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 gringo+clasp by default
(lparse+smodels or other solvers can be specified) as ASP solver and
BProlog as constraint solver. To specify other solvers, run "ezcsp h".
The latest release is 2.0.0.
You can see a history of the major changes
here.
EZCSP now supports CP solvers compatible with the minizinc input language!
Starting with version 2.0.0, EZCSP can be interfaced to any CP solver compatible with the
minizinc input language via commandline option minizinc.
EZCSP now supports nonlinear constraints on real numbers!
Starting with version 1.7.x, EZCSP includes support for the GAMS system
via option gams[:name of GAMS solver]. Through GAMS, EZCSP can solve nonlinear constraints on real numbers (use cspdomain(nlp)).
Support for GAMS is still in beta and involves certain limitations.
Please contact us if you have any questions
Installation
To compile and install EZCSP

Download, compile (if needed), and install an ASP grounder and solver, such as gringo+clasp.

Gringo and clasp are used by EZCSP by default.

Note: all external programs should be installed in a directory that occurs in your PATH variable.
 Download, compile (if needed), and install mkatoms.
 If you are building EZCSP from sources, 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 was installed in a nondefault 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.

Download, compile (if needed), and install any of the supported CP solvers.

EZCSP currently supports SICStus, BProlog, SWIProlog, and GAMS.

Note: due to backwardsincompatible changes occurred in BProlog latest versions, we recommend using BProlog 7.5.
For your convenience, here are links to the versions for Windows,
Linux 32bit,
Linux 64bit, and
MacOS X.
The files are hosted on the Picat (former BProlog) web site.
Usage
To run EZCSP
Usage: ezcsp [<options>] [[[purefile] <EZ file1>] [[purefile] <EZ file2>...]]
Useful options:
 h: display an explanation of the commandline options.
 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 ex1.ez produces:
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
Let ex2.ez be the program (courtesy of Sandeep Chintabathina):
cspdomain(r).
cspvar(t,0,1).
cspvar(s,0,1).
required(s==0).
required(t==s+1).
Executing ezcsp sicstus3 n 0 ex2.ez produces:
Answer: 1
Stable Model: cspdomain(r) cspvar(t,0,1) cspvar(s,0,1)
required(ezcsp__eq(s,0)) required(ezcsp__eq(t,ezcsp__pl(s,1)))
s=0.0 t=1.0
False
Let ex3.ez be the program:
cspdomain(r).
cspvar(t,0,1).
cspvar(s,0,1).
required(s==0).
required(t==s+1).
cspvar(z,0,2).
required(z > t).
Executing ezcsp relaxedlabeling sicstus3 n 0 ex3.ez produces:
Answer: 1
Stable Model: cspdomain(r) cspvar(t,0,1) cspvar(s,0,1)
required(ezcsp__eq(s,0)) required(ezcsp__eq(t,ezcsp__pl(s,1)))
cspvar(z,0,2) required(ezcsp__gt(z,t)) s=0.0 t=1.0 z>1.0 z=<2.0
False
Note the use of option relaxedlabeling. Normally, EZCSP attempts to find solutions that assign exact values to the CP variables.
In the above example, the underlying CP is unable to find an exact solution, causing EZCSP to return no model.
The use of relaxedlabeling instructs EZCSP to accept solutions returned by the CP solver that include inequalities.
Option relaxedlabeling is only supported in conjunction with the r and q domains and with CLP solvers, such as Sicstus and SWIProlog.
Integration Schemas
Recent versions of EZCSP support multiple integration schemas (blackbox, greybox, and clearbox), as
described in [bl11]. The blackbox integration schema is used by default. The other integration
schemas require that CMODELS be compiled within EZCSP (see subdirectory CMODELS in EZCSP's main directory).
Once that is done, they can be enabled by the following commandline options:
 cmodelsincremental: selects the greybox integration schema.
 cmodelsfeedback: selects the clearbox integration schema.
In both cases, CMODELS is automatically selected as the ASP solver.
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
Note that, unfortunately, support for global constraints by the underlying constraint
solvers varies substantially from solver to solver and from version to version.
Feel free to contact EZCSP's authors for help.
Licensing
EZCSP and dlv_rsig are copyright (c) Marcello Balduccini 20092016.
Downloads
Note: EZCSP requires
the latest version of mkatoms and
gringo+clasp to
be installed in a directory that occurs in your PATH variable.
For most uses, you will also need to install SICStus or BProlog.
Benchmarks and Experimental Results
Questions, Bugs, Feedback
Send emails to marcello.balduccini@gmail.com
or Yuliya Lierler (ylierler@unomaha.edu).
Authors
Marcello Balduccini (marcello.balduccini@gmail.com)
Yuliya Lierler (ylierler@unomaha.edu)
Selected 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,
"CRProlog as a Specification Language for Constraint Satisfaction Problems",
LPNMR 2009.
[bl11] Marcello Balduccini, Yulia Lierler,
"ASPBased Problem Solving with CuttingEdge Tools",
ICLP11 workshop on Answer Set Programming and Other Computing Paradigms (ASPOCP11) 2011.
[bal11] Marcello Balduccini,
"IndustrialSize Scheduling with ASP+CP",
11th International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR11) 2011.
[bl13a] Marcello Balduccini and Yuliya Lierler.
"Integration Schemas for Constraint Answer Set Programming: a Case Study",
Theory and Practice of Logic Programming (TPLP), Online Supplement, Aug 2013.
[bl13b] Marcello Balduccini and Yuliya Lierler.
"Hybrid Automated Reasoning Tools: from Blackbox to Clearbox Integration",
In Michael Fink and Yuliya Lierler, editors, ICLP13 Workshop on Answer Set Programming and Other Computing Paradigms (ASPOCP13), Aug 2013.
[bls13] Marcello Balduccini, Yuliya Lierler, and Peter Schuller.
"Prolog and ASP Inference Under One Roof",
In Pedro Cabalar and Tran Cao Son, editors, 12th International Conference on Logic Programming and Nonmonotonic Reasoning, Sep 2013.
Author: Marcello Balduccini (marcello.balduccini@gmail.com)
Last Update: 05/05/2017