gReason is toolset for modeling temporally and decision-theoretically extended goal models and transforming them into Decision Theoretic Golog (DT-Golog) specifications. The latter can be used for reasoning within DT-Golog or for various other querying and simulaton tasks.
In its current stage gReason consists of:
- A draw.io shape library for preparing diagrams.
- A java-based translation program that converts draw.io diagram files into a DT-Golog formal specification.
A video presentation of the tool can be found here.
To run the tool you will need SWI Prolog (tested under ver. 8.4.2), Java runtime (tested in Java(TM) SE Runtime Environment (build 1.8.0_181)) and DT-Golog (see below).
-
Install Prolog and Java runtime.
-
Clone or download as is this repository to a local directory [RepoDir]
-
Open a command line within
[RepoDir]\gReason
and ensurejava
andswipl
(the Prolog exectuable) are in your PATH. -
Download DT-Golog. DT-Golog is available under a separate license at Mikhail Soutchanski web page as an appendix to his PhD thesis which also contains much more information about the tool.
-
Place the
DT-Golog.pl
file under[RepoDir]\gReason\resources
-
For DT-Golog to run properly under SWI-Prolog it needs to be updated. Specifically add/update as follows (make a back-up copy first for line number referencing):
- Add on top of the file:
:- style_check(-discontiguous). :- style_check(-singleton). :- discontiguous(bestDo/6). :- op(900, fy, [not]).
- Later on after the
op
clauses:
(not X) := (\+ X). cputime(5).
- Rule staring from line 61 of the original file (the main bp call), replace with:
bp(E,H,Pol,Util,Prob,_) :- integer(H), H >= 0, bestDo(E : nil,s0,H,Pol,Val,Prob), Util is float(Val), write(Pol).
- Rule starting from line 134 of the original file, replace:
( RestPol = nil, Pol = A ; not RestPol=nil, Pol = (A : RestPol) )
with
( RestPol = nil, map(A,G), Pol = G ; not RestPol=nil, map(A,G), Pol = (G : RestPol) )
- Rule starting from line 146 of the original file, replace:
Pol=(A : senseEffect(A) : (RestPol)).
with
map(A,G), Pol=(G : senseEffect(G) : (RestPol)).
- Add the following (maybe before the rule of line 208) :
greatereq(V1,Prob1,V2,Prob2) :- Pr1 is float(Prob1), (Pr1 = 0.0) , Pr2 is float(Prob2), ( (Pr2 \= 0.0) ; (Pr2 = 0.0) , V2 =< V1 ).
- Go to Draw.io
- Click Start
- Create a new Blank Diagram
- File -> Open Library From Device -> Select
iStar-A.xml
from[RepoDir]\gReason\lib
- File -> Import -> From Device -> Select
[RepoDir]\gReason\files\OrganizeTravel.xml
- Update the diagram accordingly (or create your own) and save in device as
[RepoDir]\gReason\files\[Diagram Name].xml
- Export your diagram under
[RepoDir]\gReason\files\[Diagram Name].xml
- ensure the "compressed" option remains unchecked. - Open a Windows command prompt inside the
[RepoDir]\gReason
directory. - A precompiled JAR is under
.\dist\
, use at own risk as follows (compilation examples below): - Run
java -jar .\dist\gReason.jar -c .\config\config.txt -f .\files\[Diagram Name].xml
- Observe that a
[Diagram Name].pl
file has been created in.\files
- Run
swipl .\files\[Diagram Name].pl
- Inside the prolog environment enter
run.
(don't forget the dot!) - Observe optimal policy; press
.
. To exit SWI Prolog, Ctr^C ande
.
javac -sourcepath ./src/ -d ./bin/ ./src/cmg/gReason/g2dt
- Can then run
java cmg.gReason.g2dt -c .\config\config.txt -f .\files\[Diagram Name].xml
as above and continue to step (5) above.