CPSC322 - Using CILog for Assignment 2 - 1999
Using CILog from the undergraduate Machines
Here is a trace of using CILog on the undergrad machines:
[pender: ugrad0/cs322] {37} % cd ~cs322/cilog
[pender: cs322/cilog] {38} % cilog
SICStus 3.7.1 (SunOS-5.5.1-sparc): Tue Oct 06 13:38:15 MET DST 1998
Licensed to cs.ubc.ca
{compiling /ugrad0/cs322/cilog/cilog_sics.pl...}
CILOG Version 0.12. Copyright 1998, David Poole.
CILOG comes with absolutely no warranty.
All inputs end with a period. Type "help." for help.
cilog: load 'plumbing.pl'.
CILOG theory plumbing.pl loaded.
cilog: ask flow(d1).
Answer: flow(d1).
Runtime since last report: 0 ms.
[ok,more,how,help]: ok.
cilog: quit.
{/ugrad0/cs322/cilog/cilog_sics.pl compiled, 1240 msec 127012 bytes}
[pender: cs322/cilog] {39} %
If you copy plumbing.pl to your own directory, you can either
call ~cs322/cilog/cilog from that directory or use a more
complicated filename between the single quotes in the load command.
Running CILog from Home
From the CILog
manual, look at "Getting and Starting CILog". This gives links to
SWI Prolog, and code for CILog that runs under SWI Prolog. SWI prolog
runs under Linux and Windows. (It may be confusing, but from the SWI
Prolog page, the leftmost box is the download box.). If you
register SWI Prolog as the owner of the ".pl" extersion, you just need
to click on the COLog code to start CILog. Again, you can use
complicated filenames between the quotes for the load command. If you have
problems, please post to the newsgroup.
Useful Debugging Tools
The how and whynot commands of CILog are useful for
debugging incorrect answers or missing answers
respectively. how is also useful for
tracing a program (without knowing how an answer is computed). Here is
such a trace:
[pender: cs322/cilog] {41} % ~cs322/cilog/cilog
SICStus 3.7.1 (SunOS-5.5.1-sparc): Tue Oct 06 13:38:15 MET DST 1998
Licensed to cs.ubc.ca
{compiling /ugrad0/cs322/cilog/cilog_sics.pl...}
CILOG Version 0.12. Copyright 1998, David Poole.
CILOG comes with absolutely no warranty.
All inputs end with a period. Type "help." for help.
cilog: load 'plumbing.pl'.
CILOG theory plumbing.pl loaded.
cilog: ask flow(d1).
Answer: flow(d1).
Runtime since last report: 0 ms.
[ok,more,how,help]: how.
flow(d1) <-
1: flow(d2)
How? [Number,up,retry,ok,prompt,help]: 1.
flow(d2) <-
1: wet(bath)
2: unplugged(bath)
How? [Number,up,retry,ok,prompt,help]: 1.
wet(bath) <-
1: flow(shower)
How? [Number,up,retry,ok,prompt,help]: 1.
flow(shower) <-
1: on(t2)
2: pressurised(p2)
How? [Number,up,retry,ok,prompt,help]: ok.
Answer: flow(d1).
Runtime since last report: 0 ms.
[ok,more,how,help]: ok.
cilog: quit.
{/ugrad0/cs322/cilog/cilog_sics.pl compiled, 1230 msec 127012 bytes}
[pender: cs322/cilog] {42} %