This framework implements temporal constraints expressed in an extension of Answer Set Programming (ASP) with language constructs from dynamic logic. It transforms dynamic constraints into an automaton expressed in terms of a logic program that enforces the satisfaction of the original constraint.
- Install dependencies using conda with the environment.yml file
conda env create -f environment.yml-
Install manually
MONAfrom this instructions -
Update git-submodules.
git submodule update --init --recursive- Check the installation by running the tests
make tests -B
More information on how to run benchmarks
All domain specific knowledge can be found in the directory ./dom. Each sub-directory has the name of the domain $DOM
Each these folders has the following elements:
instances\folder with all instancestemporal_constraints\folder with all temporal constraintsglue.lpFile mapping all predicates used in the constraint to predicatetrace/2. Used in automata approaches and must be handcrafted.telingo_choices.lpAdds a choice for every predicate used in the constraint. Used by the telingo approach.
To integrate the a new domain with the make file add parameter RUN_DOM_FILES_$DOM with the paths to the encodings of the problem. We recommend storing those encodings inside the domain folder.
The accepted dynamic constraints have the form:
:- not &del{<formula here>}, <additional predicates>.
Example dom/test/temporal_constraints/example.lp
The syntax for the LDLf formulas is defined in encodings/translations/grammar.lp
make translate DOM=$DOM APP=$APP CONSTRAINT=$CNAME INSTANCE=$INSTANCEPATH HORIZON=$H
$DOMName of the domain (folder inside./dom)$APPApproach nameawfTranslates to an alternating automata using meta-programmingdfa-msoTranslates to a deterministic automata using MONA and the mso translation from ldlfdfa-stmTranslates to a deterministic automata using MONA and the stm translation from ldlfnfaTranslates to a non-deterministic by first computing the afw and then calling pythonnfa-awfTranslates to a non-deterministic by first computing the afw and then using an asp encodingtelingoTranslates to a logic program using adaptation of telingoncThe constraint is not considered
$CNAMEConstraint name./dom/$DOM/temporal_constraints/$CNAME.lp$INSTANCEPATHPath to the instance$HHorizon (Number of time steps) only needed fortelingoapproach$HHorizon (Number of time steps) only needed fortelingoapproach
All output files can be found in the outputs directory
make translate DOM=test APP=afw CONSTRAINT=delex INSTANCE=dom/test/instances/delex_sat.lp
Translating APP=afw DOM=test CONSTRAINT=delex INSTANCE=delex_sat
Reifying constraint...
gringo encodings/translations/grammar.lp dom/test/temporal_constraints/delex.lp dom/test/instances/delex_sat.lp --output=reify > ./outputs/test/afw/delex/delex_sat/reified.lp
Reification successfull
Translating....
clingo ./outputs/test/afw/delex/delex_sat/reified.lp ./encodings/translations/ldlf2afw.lp -n 0 --outf=0 -V0 --out-atomf=%s. --warn=none | head -n1 | tr ". " ".\n" > ./outputs/test/afw/delex/delex_sat/afw_automata.lp
Translation to afw successfull.
Output saved in ./outputs/test/afw/delex/delex_sat/afw_automata.lp
A translation has to be performed before using this command. By running the command make translate-run instead, the translation will be made before only if the isn't one already saved.
make run DOM=$DOM APP=$APP CONSTRAINT=$CNAME INSTANCE=$INSTANCEPATH HORIZON=$H MODELS=$M RUN_FILES=$RUN_FILES
$HHorizon (Number of time steps)$MNumber of models (0for all,1for the first model)$RUN_FILESAny additional files or parameters that will be passed to clingo as a string
make run APP=afw CONSTRAINT=delex DOM=test INSTANCE=dom/test/instances/delex_sat.lp HORIZON=3 RUN_FILES="--warn=none"
Running APP=afw DOM=test CONSTRAINT=delexINSTANCE=delex_sat HORIZON=3
clingo ./outputs/test/afw/delex/delex_sat/afw_automata.lp dom/test/instances/delex_sat.lp encodings/automata_run/run.lp dom/test/glue.lp --warn=none -c horizon=3 -n 1 | tee ./outputs/test/afw/delex/delex_sat/plan_h-3_n-1.txt
clingo version 5.4.0
Reading from ...st/afw/delex/delex_sat/afw_automata.lp ...
Solving...
Answer: 1
a(1) b(0) b(1) b(2) b(3)
SATISFIABLE
Models : 1
Calls : 1
Time : 0.005s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time : 0.005s
make run APP=afw CONSTRAINT=delex DOM=test INSTANCE=dom/test/instances/delex_unsat.lp HORIZON=3 RUN_FILES="--warn=none"
Running APP=afw DOM=test CONSTRAINT=delexINSTANCE=delex_unsat HORIZON=3
clingo ./outputs/test/afw/delex/delex_unsat/afw_automata.lp dom/test/instances/delex_unsat.lp encodings/automata_run/run.lp dom/test/glue.lp --warn=none -c horizon=3 -n 1 | tee ./outputs/test/afw/delex/delex_unsat/plan_h-3_n-1.txt
clingo version 5.4.0
Reading from .../afw/delex/delex_unsat/afw_automata.lp ...
Solving...
UNSATISFIABLE
Models : 0
Calls : 1
Time : 0.004s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time : 0.004s
To compute all possible traces for an automata-based approach it is enough to include file trace_generator.lp.
make run APP=dfa-mso CONSTRAINT=delex DOM=test INSTANCE=dom/test/instances/delex_unsat.lp HORIZON=3 RUN_FILES="--warn=none ./encodings/automata_run/trace_generator.lp" MODELS=0
Running APP=dfa-mso DOM=test CONSTRAINT=delexINSTANCE=delex_unsat HORIZON=3
clingo ./outputs/test/dfa-mso/delex/delex_unsat/dfa-mso_automata.lp dom/test/instances/delex_unsat.lp encodings/automata_run/run.lp --warn=none ./encodings/automata_run/trace_generator.lp -c horizon=3 -n 0 | tee ./outputs/test/dfa-mso/delex/delex_unsat/plan_h-3_n-0.txt
clingo version 5.4.0
Reading from .../delex/delex_unsat/dfa-mso_automata.lp ...
Solving...
Answer: 1
a(1) b(0) b(2) b(3)
Answer: 2
a(1) b(0) b(2) b(3)
Answer: 3
a(1) b(0) b(2) b(3)
Answer: 4
a(1) b(0) b(2) b(3)
Answer: 5
a(1) b(0) b(2) b(3)
Answer: 6
a(1) b(0) b(2) b(3)
Answer: 7
a(1) b(0) b(2) b(3)
Answer: 8
a(1) b(0) b(2) b(3)
SATISFIABLE
Models : 8
Calls : 1
Time : 0.003s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time : 0.003s
Visualize an automata
APP=afw CONSTRAINT=delex DOM=test INSTANCE=dom/test/instances/delex_unsat.lp
make viz-png APP=afw CONSTRAINT=delex DOM=test INSTANCE=dom/test/instances/delex_sat.lp
make viz-tex APP=dfa-mso CONSTRAINT=delex DOM=test INSTANCE=dom/test/instances/delex_sat.lp


