Clingcon Help
Clingcon is a hybrid solver combining the monolithic answer set solver Clingo and the CSP solver Gecode.

News - Clingcon 2.0.0-RC1

For the newest version of clingcon we fixed a lot of bugs and did major refactoring.

Input Language - Extension

Wherever you can place a normal atom in the head or the body of a rule you can now place a constraint. You can do this using first order variables and the corresponding features of gringo. The first thing that you need is the domain statement.


A constraint consists of a relation, preceded by a $ (for example $>, $<, $==, $<=, $>=, $!=). The left and the right hand of the relation are arithmetic expressions. Each arithmetic operator has also to be preceeded by $.

To give a short example, consider the following program:

  x(N) $== N$+5 :- a, num(N).

x(1), .. ,x(i), .. x(5) are constraint variables which are constrained to i+5, if "a" is true.
The same can be done with conditions in the body.

  p(N) :- $abs(x $- y(N)$*N) $> x$*N, num(N).

p(2) is true, if | x - y(2)*2 | is greater then x*2.
Optimize Statements over constraint variables can be used:

  $maximize{c(X) : num(N)}.

Command Line - Heuristics and More

Help about the command line can requested calling

  $clingcon --help

The most important of all new command line options is the option


If this option is not set (default) only weak answer sets will be computed.
A full boolean assignment is printed with partially constrained constraint variables. The program

  x $< 5.

will generate the following weak answer set:

  a. b. x=[0..4]

It is ensured that at least one answer set exists in the domain of the csp variables.

If you write --csp-num-as=3 then you will get at most 3 answer sets per boolean assignment. So only 3 assignments of csp variables are enumerated for the same assignment of boolean variables.
If you write --csp-num-as=0 then all assignments of csp variables are enumerated for a boolean assignment.
Remark: You can set the total number of answer sets that shall be computed in the command line by

  $clingcon [number]
  $clingcon 1

No more then [number] answer sets are printed.
Further important options are


For further examples see here. Logo Valid XHTML 1.0 Strict Valid CSS!