Releases: chocoteam/choco-solver
4.0.7
JAR file names have changed:
- the suffix 'with-dependencies' disappears,
- the suffix '-no-dep' (for no dependencies) appears.
This should intends to clarify the selection for new comers.
Add a PayPal button for donations.
Move to Ibex-2.6.5.
Major features:
- Revamp
Settings
: no default method anymore, add setters. A concrete classDefaultSettings
provides
the default behavior. IViewFactory.intScaleView
now manages negative constants,IViewFactory.intAffineView
is now available- add new constraint for mixed linear equation (over real/int variables and double/int coefficients)
- Dow/WDeg now manages variables in a bipartite set (instantiated variables are swaped)
- Assert that a propagator that is passive is not allowed to filter anymore
- An exception is thrown when a sum (or scalar) constraint is candidate for integer over/underflow (an alternative should be provided later)
BoolVar
now handles modifications in different way (may impact performances)- Propagation engine has changed: no alternative to seven-queue one anymore + simplification of code (may impact performances)
- add new relation expression
ift(e1,e2)
Deprecated API (to be removed in next release):
Model.set(Settings)
is deprecated. Now settings are declared in theModel
constructor.Settings.debugPropagation()
is deprecated. There is no alternative.
Closed issues and pull requests:
4.0.6
Move to Ibex-2.6.3.
Major features:
- Ibex instance is no longer static, that offers better stability and reduce
memory consumption when adding/removing functions. Reification no longer managed by Choco but
delegated to Ibex. Search.realVarSearch(...)
offers possibility to define minimal range size, known asepsilon
Search.ibexSolving(model)
let Ibex iterates over solutions once all integer variables are instantiated- add detection of min/max sub-cases
- add simple dashboard in Swing to show resolution statistics, see
solver.showDashboard()
Deprecated API (to be removed in next release):
IntEqRealConstraint
will be removed in next release, Ibex managed this concept (int to real)Model.getIbex()
should not be used. AIbexHandler
manages Ibex instances (one per model).
Closed issues and pull requests:
4.0.5
The current release was submitted to MiniZinc Challenge 2017
and at XCSP3 Competition 2017 and won medals.
choco-parsers provides utility to export a Model
to JSON format
and or import JSON data into a Model
.
Major features:
- Compact-Table now deals with short tuples (#531)
- Checking if a created constraint is free (neither posted or reified) is now possible with
Settings.checkDeclaredConstraints()
- Improvements on BoolVarImpl and BoolNotView.
- Remove code deprecated in last release.
- Fix error in Views.
- Add scalar detection in
BiReExpression
- fix errors in Impact-based Search
- update Search.intVarSearch() + Search.defaultSearch(Model)
- update ParallelPortfolio default strategies
Deprecated API (to be removed in next release):
Closed issues and pull requests:
- fix bug in
PropNogoods
when dealing with negative values (impactsolver..setNoGoodRecordingFromRestarts()
andsolver..setNoGoodRecordingFromSolutions(...)
) - fix bug in
model.sum(...)
andmodel.scalar(...)
when dealing with arity greater than 100 and all operators except=
- fix bug in
model.table(...)
with binary scope and universal value - fix bug related to Ibex and GC.
4.0.4
Major features:
- add logical operator to expression (#520). Now it is possible, f-ex., to declare expression like:
x.eq(y.add(1)).or(x.eq(y).and(x.eq(1)))
- add new API to
Solver
to print features in a single line - enable ignoring passivate propagators when iterating over propagators of a modified variable (false by default; see Settings)
Deprecated API (to be removed in next release):
IPropagationEngine.fails(c,v,m)
is replaced bySolver.throwsException(c,v,m)
(#524)IPropagationEngine.getContradictionException()
is replaced bySolver.getContradictionException()
(#524)MathUtils.bounds(values)
is replaced by a call toMathUtils.min(values)
andMathUtils.max(values)
Remove dead code:
- SparseSet
- IFeatures, Features, IAttribute and Attribute
Closed issues and pull requests:
4.0.3
4.0.2
4.0.2 - 20 Jan 2017
Major features:
- restrict calls to
Solver.setEngine(...)
when propagation started. See javadoc for details. - remove global constructive disjunction, only local constructive disjunction is allowed.
- add
Solution.restore()
to restore a solution (#354). - deep reset of
Solver
(#490, #491)
Deprecated API:
Solver.getState()
(#485)Measures.IN_SEC
(related to #486)Settings.outputWithANSIColors
,IOutputFactory.ANSI_*
IMoveFactory.setLubyRestart(int, int, ICounter, int)
Closed issues and pull requests:
#468, #479, #480, #481, #484, #487, #488, #489, #492, #493, #494, #495, #496, #497, #499.
4.0.1
4.0.0
This release is mainly dedicated to API migration. In the following, the major modifications are reported in order to ease code migration.
See also closed issues.
Even though we first wanted to provide an automatic script to help migration, we finally preferred to list the code modifications needed to move from 3 to 4.
The documentation is up-to-date and may be a good starting point.
Note that most IDEs now provide helpful tools to help code migration.
At a glance
In order to distinguish resolution steps, Solver
and SearchLoop
now move to respectively Model
and Solver
.
Model
aims at declaring a problem on the basis of variables and constraints, and replaces the dedicated factories.Solver
mainly focuses on the resolution of the declared problem, using less factories .
In details
Model
v3.3.3 | v4.0.0 |
---|---|
Solver solver = new Solver("my problem"); |
Model model = new Model("my problem"); |
BoolVar
Any BoolVar
is now created thanks to model.boolVar(...)
APIs.
v3.3.3 | v4.0.0 |
---|---|
BoolVar x = VF.bool("X", solver); |
BoolVar x = model.boolVar("X"); |
BoolVar x = model.boolVar(); |
|
BoolVar[] xs = VF.boolArray("XS", 4, solver); |
BoolVar[] xs = model.boolVar Array("XS", 4); |
BoolVar[] xs = VF.boolMatrix("XS", 3, 4, solver); |
BoolVar[] xs = model.boolVar Matrix("XS", 3, 4); |
IntVar
Any IntVar
is now created thanks to model.intVar(...)
APIs.
integer
v3.3.3 | v4.0.0 |
---|---|
IntVar x = VF.integer("X", 0, 10, solver); |
IntVar x = model.intVar("X", 0, 10); |
IntVar x = model.intVar(0, 10); |
|
IntVar[] xs = VF.integerArray("XS", 4, 0, 10, solver); |
IntVar[] xs = model.intVarArray("XS", 4, 0, 10); |
IntVar[] xs = VF.integerMatrix("XS", 3, 4, 0, 10, solver); |
IntVar[] xs = model.intVarMatrix("XS", 3, 4, 0, 10); |
When one wants to chose between bounded or enumerated, he/she has to set the bounded domain boolean.
bounded
v3.3.3 | v4.0.0 |
---|---|
IntVar x = VF.bounded("X", 0, 10, solver); |
IntVar x = model.intVar("X", 0, 10, true); |
IntVar x = model.intVar(0, 10, true); |
|
IntVar[] xs = VF.boundedArray("XS", 4, 0, 10, solver); |
IntVar[] xs = model.intVarArray("XS", 4, 0, 10, true); |
IntVar[] xs = VF.boundedMatrix("XS", 3, 4, 0, 10, solver); |
IntVar[] xs = model.intVarMatrix("XS", 3, 4, 0, 10, true); |
enumerated
v3.3.3 | v4.0.0 |
---|---|
IntVar x = VF.enumerated("X", 0, 10, solver); |
IntVar x = model.intVar("X", 0, 10, false'); |
IntVar x = model.intVar(0, 10, false'); |
|
IntVar x = VF.enumerated("X", new int[]{0,2,4}, solver); |
IntVar x = model.intVar("X", new int[]{0,2,4}); |
IntVar x = model.intVar(new int[]{0,2,4}); |
|
IntVar xs = VF.enumeratedArray("XS", 4, 0, 10, solver); |
IntVar x = model.intVarArray("XS", 0, 10, false'); |
IntVar xs = VF.enumeratedArray("XS", 4, new int[]{0,2,4}, solver); |
IntVar x = model.intVarArray("XS", new int[]{0,2,4}); |
IntVar xs = VF.enumeratedMatrix("XS", 3, 4, 0, 10, solver); |
IntVar x = model.intVarMatrix("X", 3, 4, 0, 10, false'); |
IntVar xs = VF.enumeratedMatrix("XS", 3, 4, new int[]{0,2,4}, solver); |
IntVar x = model.intVarMatrix("X", 3, 4, new int[]{0,2,4}); |
fixed
The way constants are declared does not depend on the type (fixed or variable) but on the kind (integer, set, ...).
v3.3.3 | v4.0.0 |
---|---|
IntVar zero = VariableFactory.fixed(0, solver); |
IntVar zero = model.intVar(0); |
IntVar zero = VariableFactory.fixed("0", 0, solver); |
IntVar zero = model.intVar("0", 0); |
SetVar
and RealVar
Similar modifications were applied to SetVar
and RealVar
declaration, e.g.:
v3.3.3 | v4.0.0 |
---|---|
SetVar s = VariableFactory.set("S", new int[]{0,3}, new int[]{0, 1, 2, 3}, solver); |
SetVar s = model.setVar("S", new int[]{0,3}, new int[]{0, 1, 2, 3}); |
RealVar r = VariableFactory.real("R", 0.1d, 2.2d, solver); |
RealVar r = model.realVar("R", 0.1d, 2.2d); |
Task
A TaskVar
now have to be created calling new Task(IntVar start, IntVar duration, IntVar end)
.
Views
Ways to create views evolved too, the signature are now :
model.intAbsView(IntVar)
,model.intMinusView(IntVar)
,model.intOffsetView(IntVar)
,model.intScaleView(IntVar)
,model.boolNotView(IntVar)
,model.realIntView(IntVar)
Constraints
Constraints can be created thanks to a model.
For example,
solver.post(IntConstraintFactory.alldifferent(xs));
now becomes:
model.post(model.allDifferent(xs));
or, in a more convenient way:
model.allDifferent(xs).post();
Most of the names and signatures remain the same between the two versions (but not all, see for instance alldifferent
is now allDifferent
).
Reifying
Nothing really change here, expect the way constraints are created:
BoolVar b = model.allDifferent(xs).reify();
Note that Model
provides APIs like model.ifThenElse(Constraint, Constraint, Constraint)
.
Clauses
Model offers possibilities to directly add clauses to the clause-store, like model.addClauses***(...)
where ***
indicates the expression to turn into clauses.
Solver
SearchLoop
now becomes Solver
.
Solver solver = model.getSolver();
This class provides APIs to configure the search and the resolution process.
v3.3.3 APIs to solve problem, like solver.findSolution()
.
However, the returning value has changed, from boolean
to Solution
.
Solver
now provides another API to solve a problem, named solve()
which looks for a feasible solution.
It can be called as long as it returns true
. In that case, the resolution process stops on a solution state, which means that variables are instantiated and their domain can be read.
Printing solutions or resolution statistics is not done thanks to a factory anymore, but directly with the solver, e.g.:
solver.showDecisions();
The same goes with measures, directly reachable from the solver, e.g:
solver.getBackTrackCount();
Solver hasReachedLimit()
moved to isStopCriterionMet()
(since limit were renamed criterion so far, both method act similarly).
Moreover, Solver.getState()
which returns one of those states:
NEW
: when the problem is established but the resolution has not been triggered yet ;RUNNING
: when the solver is searching for a solution ;TERMINATED
: the search ends normally, a solution is found or the entire search tree was explored without finding any solution ;STOPPED
: the search was stopped by a limit ;KILLED
: the resolution was killed from the outside (eg, thread interruption, JVM killed)
Solver
's setters signatures have changed to be more accurate, e.g.:
solver.set(mySearchStrategy)
becomes solver.setSearch(mySearchStrategy)
IntSearchStrategy
and similar were merged into Search
, which provides widely used search strategies.
Making dedicated combination of variable selector and value selector may imply to create object calling new
instruction.
Closed issues
4.0.0.a
3.3.3
3.3.3 - 22 Dec 2015
All:
- remove deprecated interfaces, classes and methods.
Solver:
- add new APIs with an argument named
restoreLastSolution
which allow to indicate
whether or not the last solution found, if any, should be restored on exit;
Previous APIs (without the argument) restore the last solution by default (#354) - update javadoc (in particular: #347)
- add default name to Solver + setter, modify measures printing to include the name.
SetVar
toString implementation has changed
Explanations
- refactor
PropNogoods
to deal with generalized no-goods
Bug fixes:
#346, #348, #349, #350, #351, #352, #353, #354, #355, #356, #357, #358, #359