News

Page 1 of 3  > >>

Choco-3.2.0: released , Jun 4, 2014.

Choco-3.2.0 is now available for download. 

 

A new release, 3.1.1, is now available.

MiniZinc Challenge 2013 , Sep 26, 2013.

MiniZinc'13: Choco-3.1.0 won 2 solver medals!

 

Choco 3

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.

The current release, choco-3.2.0, is hosted on github.com.

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: choco3-support@mines-nantes.fr.  

Usage

Inside a maven project

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>

Inside a non-maven project

Visit the download page.

Building from sources

Requirements:

  • 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 target sub-folders.

 

5-minute tutorial

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),
  • IntConstraintFactory, SetConstraintFactory and GraphConstraintFactory: to declare constraints over variables,
  • IntStrategyFactory, SetStrategyFactory and GraphStrategyFactory: to define a specific search strategy, which can be combined together with a StrategiesSequencer object,
  • 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
solver.set(IntStrategyFactory.inputOrder_InDomainMin(new IntVar[])); 
// 5. Launch the resolution process
solver.findSolution();

 

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).

Many samples are available (zip file or Github repository). Don't be afraid to take a look at the sources, we thought it is a good start point.

 

The Choco3 dev team.

 

 

Previous page: Choco 3  Next page: Choco3 FAQ