Choco3 is an open-source Java library for Constraint Programming.
Choco3 is not the continuation of Choco2, but a completly rewritten version and there is no backward compatibility.
Choco3 comes with:
- various type of variables (integer, boolean, set, graph and real),
- various state-of-the-art constraints (alldifferent, count, nvalues, etc.),
- various search strategies, from basic ones (first_fail, smallest, etc.) to most complex (impact-based and activity-based search),
- explanation-based engine, that enables conflict-based back jumping, dynamic backtracking and path repair,
But also, a FlatZinc parser, facilities to interact with the search loop, factories to help modelling, many samples, Choco-Ibex interface, etc.
An overview of the features of Choco3 can be found in the presentation made in the "CP Solvers: Modeling, Applications, Integration, and Standardization" workshop of CP2013.
Choco3 is distrubuted under BSD licence (Copyright (c) 1999-2014, Ecole des Mines de Nantes).
A support mailing list is available: firstname.lastname@example.org.
The maven artifact is available through a private repository so you have first to edit your
pom.xml to declare it:
<repositories> <repository> <id>choco.repos</id> <url>http://www.emn.fr/z-info/choco-repo/mvn/repository/</url> </repository> </repositories>
Next, just declare the dependency:
<dependency> <groupId>choco</groupId> <artifactId>choco-solver</artifactId> <version>3.1.0</version> </dependency>
Visit the download page.
- JDK 7+
- maven 3+
The source of the released versions are directly available in the
Tag section. You can also download them using github features. Once downloaded, move to the source directory then execute the following command to make the jar:
$ mvn clean install -DskipTests
If the build succeeded, the resulting jar will be automatically installed in your local maven repository and available in the
The documentation related to Choco3 is under redaction.
However, together with the one-sheet and the DIY-Propagator documentation, the following steps should be enough to start using Choco3.
Basically, required objects are: a Solver, some variables and constraints to linked them together.
To facilitate the modeling, Choco3 provides factories for almost every required component of CSP and its resolution:
VariableFactory: to create any kind of variables and views (integer, boolean, set, graph and real),
GraphConstraintFactory: to declare constraints over variables,
GraphStrategyFactory: to define a specific search strategy, which can be combined together with a
SearchMonitorFactory: to enable logging resolution, setting limits and restart policies.
Here is a short example which illustrates the main steps of a CSP modeling and resolution with Choco3:
// 1. Create a Solver
Solver solver = new Solver("my first problem");
// 2. Create variables through the variable factory
IntVar x = VariableFactory.bounded("X", 0, 5, solver);
IntVar y = VariableFactory.bounded("Y", 0, 5, solver);
// 3. Create and post constraints by using constraint factories
solver.post(IntConstraintFactory.arithm(x, "+", y, "<", 5));
// 4. Define the search strategy
// 5. Launch the resolution process
One may notice that there is no more distinction between Model objects and Solver objects, unlike in Choco2. This choice makes it easier for beginners to model and solve problems (reduction of concepts and terms to know) and for developpers to implement their own constraints and strategies (short cutting process).
The Choco3 dev team.