Constraints
Arithmetic operation
All the operators are overriden to ease the usage of Choco.
let a = 0 .. 10;
let b = 0 .. 20;
let c = a + b; // Ok, will call the java a.mul (b).intVar ();
let d = a + 3;
let x = (d + c * 32) / b;
Logical operation
As for arithmetic operation all the logical operator are overriden. They return a BoolVar, or a ChocoBool (ChocLet name) that can be used in another expression are be posted as a constraint to the model.
let a = 0 .. 10;
let b = 0 .. 10;
let c = a < b;
let d = a + b == 19;
(d && c).post ();
Constraint binding
in choco {
def allDifferent -> ChocoConstraint;
}
let a = [0 .. 10 | i in 0 .. 10];
choco.allDifferent (a).post ();
// Or using standard function
import std.choco.globals;
a.allDifferent ().post ();