MiniZinc version 1.1 released
MiniZinc version 1.1 has been released. See below how my existing (and maybe others') MiniZinc models are affected by the changes.
From the NEWS:
G12 MiniZinc Distribution version 1.1
-------------------------------------Changes to the MiniZinc language:
* The following built-in operations have been introduced:
int: lb_array(array[int] of var int)
float: lb_array(array[int] of var float)
set of int: lb_array(array[int] of var set of int)
int: ub_array(array[int] of var int)
float: ub_array(array[int] of var float)
set of int: ub_array(array[int] of var set of int)
set of int: dom_array(array[int] of var int)
These new operations are synonyms for the following existing built-in
MiniZinc operations:int: lb(array[$T] of var int)
float: lb(array[$T] of var float)
set of int: lb(array[$T] of var set of int)
int: ub(array[$T] of var int)
float: ub(array[$T] of var float)
set of int: ub(array[$T] of var set of int)
set of int: dom(array[$T] of var int)These latter operations are now deprecated. Support for them will
be removed in the next release. This change is being made in order
to preserve compatibility with the full Zinc language.Note: that only the versions of lb, ub and dom that take an array
as a an argument are deprecated. The MiniZinc lb, ub and dom operations
on non-array values are *not* deprecated.
Changes to the FlatZinc language:* Boolean variable expressions as constraints are no longer supported.
All constraints in FlatZinc must now be predicate applications.* String parameters are no longer supported. String literals are restricted
to appearing as the arguments of annotations.* Set of bool and set of float parameters and literals are no longer
supported.* The int_float_lin/4 objective expression is no longer supported.
* FlatZinc now has two additional evaluation outcomes: "unknown"
for when search terminates without having explored the whole search
space and "unbounded", for when the objective of an optimization
problem is unbounded.* The semantics of the int_div/3 and int_mod/3 built-ins has been changed.
See the ``Specification of FlatZinc'' for further details.
Other Changes:* The single pass MiniZinc interpreter, minizinc, has been deprecated.
It will be removed in a future release.* The MiniZinc-to-FlatZinc converter, mzn2fzn, has been rewritten.
The new implementation is smaller and more efficient.
Computation of variable bounds has also been improved.* mzn2fzn now outputs singleton sets as ranges. [Bug #94]
* A bug that caused expressions containing abs/1 to be incorrectly
flattened has been fixed. [Bug #91]* The FlatZinc interpreter's finite-domain backend now implements
global_cardinality_low_up as a built-in.* The FlatZinc interpreter's lazy clause generation solver now supports
the int_mod/3 built-in.* Two additional modes of operation have been added to the FlatZinc
solution processing tools, solns2dzn, that allow it to extract the first
or last solution from a FlatZinc output stream. Also, there is no longer
a default mode of operation for solns2dzn, it must now be specified by
the user or an error will occur.* The following new global constraints have been added to the MiniZinc
library:all_equal
decreasing
diffn
lex2
lex_greater (Synonym for lex_less with arguments swapped.)
lex_greatereq (Synonym for lex_lesseq with arguments swapped.)
sliding_sum
strict_lex2* The following synonyms for existing global constraints have been added
to the MiniZinc library (the existing name is given in parentheses):alldifferent (all_different)
atleast (at_least)
atmost (at_most)
atmost1 (at_most1)* The sequence constraint is deprecated. Models should use the new
sliding_sum constraint instead.* The 'table' constraint decompositions in the MiniZinc library have been
modified so as to fit better with the G12 MiniZinc-to-FlatZinc conversion:
now no scaling constraints are created.* The decompositions of the constraints in the 'lex' family have been
tweaked to enable a little more propagation.
Documents
Here are the three new specification documents for MiniZinc version 1.1 (and Zinc version 0.11):- Specification of Zinc version 0.11 and MiniZinc version 1.1. (PDF)
- Specification of FlatZinc, version 1.1. (PDF)
- Transition guide (PDF) to assist FlatZinc implementors in updating their implementations from version 1.0.X.
Comments
The next few days I will change my MiniZinc models so they comply to version 1.1, and I have already started this work. Update 2010-03-20: These changes has now been done, including updating the SVN repository.The following will be changed:
- lb/ub for arrays
lb(array)
andub(array)
will be changed tolb_array(array)
andub_array(array)
respectively.
- Comparing/copying arrays
One thing that should not work even in MiniZinc version 1.0.3 - but for some reason did - was copying/equality/comparison of arrays in theconstraint
section or in predicates. This don't work in MiniZinc version 1.1. E.g., the following no longer works:
int: n = 4;
array[1..n] of var 1..n: x;
constraint
x = [1,2,3,4] % no longer works
;
Instead, the arrays must now be handled element-wise. Since many of my models use the above construct, especially for testing the global constraints, the models use a new predicate familycp<n>d
(where <n> is the dimension, 1, 2, etc), e.g.cp1d
andcp2d
. Example of one version ofcp1d
:
int: n = 4;
array[1..n] of var 1..n: x;
solve satisfy;
% arrays of 1d where both arguments are var int
predicate cp1d(array[int] of var int: x, array[int] of var int: y) =
assert(index_set(x) = index_set(y),
"cp1d: x and y have different sizes",
forall(i in index_set(x)) ( x[i] = y[i] ));
constraint
cp1d(x, [1,2,3,4]) % this works
;
Some examples are collected in the model copy_arrays.mzn.I estimate that over 200 of my models have to be fixed in this way.As mentioned above, some of models are now already changed.
- Renamed models
Some of my MiniZinc models has been renamed since they clash with new built-in predicates:
After the changes are done, I will also update the G12's MiniZinc SVN repository, the hakank directory.
Two more things
- One model that I have not mentioned is spinning_disks.mzn: The spinning disks problem from Skeptic's Play
- I'm now in the AUTHORS file. :-)
Also see, my MiniZinc Page.