In this repository you will find the benchmark and instruction to reproduce the evaluation and example presented in the paper "Modelling and Reasoning in Event Calculus using Goal-Directed Constraint Answer Set Programming".
The file bec_theory.pl contains the translation of the Basic Event Calculus theory.
This example is based on the example 14 in [Mueller, 2014b] and reason about turning on and off a light.
There are four files implementing different features:
- bec_light_01_....pl is the simplest version of the problem.
- bec_light_02_....pl add the global constraint to ensure that light_red and light_green.
- bec_light_03_...pl change the trajectory of light_red generating an overlap w.r.t. light_green.
- bec_light_04_...pl similar to the previous but the overlap does not occur.
To check the behaviour of the first file with several queries execute the script:
go_bec_light_01
to check the behaviour of the rest of files execute the script:
go_bec_light_02_03_04
The scripts are located here. Note that there are the queries that success returning a valid partial model while others do not. For each of the queries there is a comment which explain the expected result.
Additionally you can execute the example invoking s(CASP) directly from the terminal. As an example let us execute s(CASP) asking for the justification tree with (note that it will execute the last uncommented query that appear in the file):
scasp -j bec_light_01.pl
This example is based on an example from [Shanahan, 1999] where a vessel is filled with water.
There are four files implementing different features:
- bec_tap_01_...pl is the simplest version of the problem.
- bec_tap_02_...pl similar to the previous but in this example the water is not spilled.
- bec_tap_03_...pl in this example we have two possible worlds/models.
- bec_tap_04_...pl the most complex example (the one described in the paper).
To check the behaviour of each file with several queries execute the scripts (located here):
go_bec_tap_01_overflow
go_bec_tap_02_no_overflow
go_bec_tap_03_two_models
go_bec_tap_04_abducible_infer_event_time
Note that there are the queries that success returning a valid partial model while others do not. For each of the queries there is a comment which explain the expected result.
Ciao
is a programming language that builds up from a logic-based simple kernel, and is designed to be extensible and modular. It is available at http://ciao-lang.org. Its supports:
- constraint logic programming (and, in particular, Prolog)
- different levels of modularity (from small to large scale):
- modules as (analysis-friendly) compilation units
- bundles as collections of modules
- packages as modules implementing language extensions (syntactic definitions, compilation options, compiler plugins)
- assertions (as an homogeneous framework that allows static and dynamic verification to work cooperatively in a unified way)
- multiparadigm constructs (meta-programming, higher-order, mutables, concurrency, functions, etc.) and interfacing with foreign code
The system implements some advanced features such as separate and incremental compilation, global program analysis and static debugging and optimization (via source to source program transformation, CiaoPP preprocessor
), a build automation system, documentation generator, debugger, and (Emacs-based) development environment.
To begin the interactive installation type the following one-liner in a sh-compatible terminal:
curl https://ciao-lang.org/boot -sSfL | sh
Do not forget to rerun the bashrc file source ~/.bashrc
. If you have any problem go here for details.
s(CASP)
is an implementation of the stable model semantics of
constraint logic programming. Unlike similar systems, it does not
employ any form of grounding. This allows s(CASP)
to execute programs
that are not finitely groundable, including those which make use of
lists and terms. It is available here.
Once you have Ciao working in your computer to install s(CASP)
type the following one-liner in a sh-compatible terminal:
ciao get gitlab.software.imdea.org/ciao-lang/sCASP
If you have any problem go here for details.
In order to compare the run time of s(CASP) versus s(ASP) in the folder aux-sasp
there are four files:
- bec_theory_discrete.pl with the Basic Event Calculus theory implemented without constraint.
- bec_light_sasp_discrete_0.5.pl the light simpler example adapted to be use using s(ASP) with a step-wise of 0.5 to discretize the time domain from 0 to 5.
- bec_light_sasp_discrete_0.25.pl the light simpler example adapted to be use using s(ASP) with a step-wise of 0.25 to discretize the time domain from 0 to 5.
- go_time_bec_light_sasp_discrete to run the benchmark using s(ASP).
s(ASP) is available here. We used the version 1.0.7.
In the scripts folder for s(CASP) (located here) there is the script to run the benchmarks in the paper computing the time for s(CAPS):
- go_time_bec_light_01 to run the benchmark using s(CASP).
In order to compare the run time of s(CASP) versus clingo in the
folder sCASP-clingo
there are several programs and scripts. We use
extension .pl
for s(CASP), the extension .clingo
for clingo 5.2.0
and .e
for the encoding using F2LP.
In the folder scripts you can find the files used to run the benchmarks: