EZCSP Home Page
EZCSP is an inference engine that allows computing extended
answer sets of ASP programs, as defined in [bal09a,bal09b].
Intuitively, EZCSP allows a lightweight integration of ASP and
constraint programming (CP).
An extended answer set of an ASP program P is a pair consisting of an
answer set of P, and of a solution to the constraint satisfaction problem
(CSP) defined by such answer set of P.
The current version of EZCSP uses lparse+smodels as ASP solver and
SICStus Prolog (version 3.x) as constraint solver. Future versions will support
multiple solvers.
The latest release is 1.6.10.
You can see a history of the major changes
here.
The latest major improvements are:
-
Added partial support for Sicstus 4.x. Global constraint
cumulative/4 is not available under Sicstus 4.x.
-
New relation label_order(<CSP variable>,<integer>)
allows
to specify the order of the CSP variables in the SICStus
labeling statement (automatically generated by ezcsp).
Multiple variables can have the same index associated,
in which case the ordering among them will be arbitrary.
Variables without an associated index will occur last in
the list passed to the labeling statement.
Proper specification of label_order has been shown to increase
performance substantially in medium and large programs.
-
Switched to gringo and clasp as default grounder and ASP solver.
See options --grounder and --solver to use other programs.
-
Added support for reified constraints. Negation is represented
in ezcsp as #! (it is #\ in Sicstus).
-
Added ability to compute extended answer sets of CR-Prolog.
WARNING: recently crmodels has undergone major changes,
including an almost complete rewrite, and has been renamed crmodels2.
The latest version of ezcsp
only works with crmodels2. crmodels2 will be available online soon.
-
Reduced the amount of unnecessary parentheses generated when
pre-processing the program to map the CP-style connectives (#>, etc.)
into legal ASP function symbols. LParse sometimes gives errors
when the program contains unnecessary parentheses.
Installation and Usage
To install EZCSP
- Download, compile, and install dlv_rsig.
- Uncompress the archive and change directory to the newly created directory.
- Run ./configure
- Run make
- Run make install (usually as administrator)
- Download, compile, and install EZCSP.
- Uncompress the archive and change directory to the newly created directory.
- Run ./configure
- Run make
- Run make install (usually as administrator)
Note: if dlv_rsig is installed in a non-default location, when configuring ezcsp
you will need to set environment variables CFLAGS, CXXFLAGS and LDFLAGS so that
the include files and libraries installed with dlv_rsig can be found.
Please consult with your system administrator if in doubt.
To run EZCSP
Usage: ezcsp [-n <nmodels>] [--mkatoms] [-a] [--grounder <path>] [--solver <path>] [[<input file 1>] [<input file 2>...]]
- -n: maximum number of extended answer sets to be computed (0 for all).
- --mkatoms: format the output using the same format used by mkatoms.
- -a: format the output so that it is compatible with the syntax of most ASP solvers and Prolog interpreters.
- --grounder: use the specified grounding program instead of gringo.
- --solver: use the specified grounding program instead of clasp.
E.g.: ezcsp -n 0 instance1 main_program
Finds all the extended answer sets of the program consisting of files instance1 and main_program.
Example of use
Let ex1.ez be the program:
cspdomain(fd).
d(1..2).
cspvar(v(X),10,20) :- d(X).
required(v(1) >= v(2)).
required(sum([v/1],>=,39)).
cspvar(s,20,40).
required(sum([v/1],==,s)).
Executing ezcsp -n 0 p.ez will produce:
Answer: 1
Stable Model: cspdomain(fd) d(1) d(2) required(ezcsp__geq(v(1),v(2))) required(ezcsp__sum(list(v,1),ezcsp__geq,39)) cspvar(s,20,40) required(ezcsp__sum(list(v,1),ezcsp__eq,s)) cspvar(v(1),10,20) cspvar(v(2),10,20) s=39 v(1)=20 v(2)=19
Answer: 2
Stable Model: cspdomain(fd) d(1) d(2) required(ezcsp__geq(v(1),v(2))) required(ezcsp__sum(list(v,1),ezcsp__geq,39)) cspvar(s,20,40) required(ezcsp__sum(list(v,1),ezcsp__eq,s)) cspvar(v(1),10,20) cspvar(v(2),10,20) s=40 v(1)=20 v(2)=20
False
Supported Global Constraints
Currently, ezcsp supports the following global constraints
(refer to the Sicstus 3.x manual for their meaning):
sum/3
scalar_product/4
serialized/2
cumulative/4
all_different/1
all_distinct/1
count/4
element/3
assignment/2
circuit/1
circuit/2
Licensing
EZCSP and dlv_rsig are copyright (c) Eastman Kodak Company 2009.
EZCSP and dlv_rsig are free for non-commercial use.
Please refer to the license for more details.
Downloads
Before downloading, please read carefully the software's license.
Note: EZCSP requires
The latest version of mkatoms and
gringo+clasp to
be installed in a directory that occurs in your PATH variable.
EZCSP should run
without problems under most Unix variants and C/C++ compilers. It was tested under
*BSD and Linux, and gcc 4.0.3 and 4.3.2.
Questions, Bugs, etc.
Send emails to marcello.balduccini@gmail.com.
Authors
EZCSP was written by Marcello Balduccini.
References
[bal09a] Marcello Balduccini,
"Representing Constraint Satisfaction Problems in Answer Set Programming",
ICLP09 workshop on Answer Set Programming and Other Computing Paradigms (ASPOCP09) 2009.
[bal09b] Marcello Balduccini,
"CR-Prolog as a Specification Language for Constraint Satisfaction Problems",
LPNMR 2009.
Back to my home page
Author: Marcello Balduccini (marcello.balduccini@gmail.com)
Last Update: 11/04/2009