Help
News - Clingcon 0.1.2
The newest version of clingcon fixes several bugs.
Among them, the #hide statement can now safely by used.
The hide all feature now also hides the constraints which makes answer sets much readable.
Just use #hide. to hide all atoms and #show to select the ones you need.
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.
$domain(0..10000).
A constraint consists of a relation, preceded by a $ (for example $>, $<, $==, $<=, $>=, $!=).
The left and the right hand of the relation are arithmetic expressions.
To give a short example, consider the following program:
$domain(0..20).
num(1..5).
x(N) $== N+5 :- a, num(1..5).
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.
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
--csp-num-as=<arg>
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
$domain(0..10).
a.
b.
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]
e.g.
$clingcon 1
No more then [number] answer sets are printed.
For further examples see
here