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.1.1. You can see a history of the major changes here.


EZCSP now supports gurobi via the Python gurobi package

Starting with version 2.1.0, EZCSP can be used with gurobi via command-line option --gurobi.

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 command-line option --minizinc.

EZCSP now supports non-linear 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 non-linear 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
  1. Download, compile (if needed), and install an ASP grounder and solver, such as gringo+clasp.
  2. Download, compile (if needed), and install mkatoms.
  3. If you are building EZCSP from sources, download, compile, and install dlv_rsig.
  4. Download, compile, and install EZCSP.
  5. Download, compile (if needed), and install any of the supported CP solvers.

Usage

To run EZCSP
  Usage: ezcsp [<options>] [[[--pure-file] <EZ file1>] [[--pure-file] <EZ file2>...]]

  Useful options:
  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 --relaxed-labeling --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 --relaxed-labeling. 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 --relaxed-labeling instructs EZCSP to accept solutions returned by the CP solver that include inequalities.
Option --relaxed-labeling is only supported in conjunction with the r and q domains and with CLP solvers, such as Sicstus and SWI-Prolog.

Integration Schemas

Recent versions of EZCSP support multiple integration schemas (black-box, grey-box, and clear-box), as described in [bl11]. The black-box 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 command-line options: 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 2009-2016.


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 B-Prolog.


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, "CR-Prolog as a Specification Language for Constraint Satisfaction Problems", LPNMR 2009.

[bl11] Marcello Balduccini, Yulia Lierler, "ASP-Based Problem Solving with Cutting-Edge Tools", ICLP11 workshop on Answer Set Programming and Other Computing Paradigms (ASPOCP11) 2011.

[bal11] Marcello Balduccini, "Industrial-Size 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), On-line Supplement, Aug 2013.

[bl13b] Marcello Balduccini and Yuliya Lierler. "Hybrid Automated Reasoning Tools: from Black-box to Clear-box 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: 04/27/2021