MiniZinc version 1.3 released
MiniZinc version 1.3 is released. Download here (snapshots can be downloaded here)
From the NEWS:
* Many of my MiniZinc models does not contain a explicit
From the NEWS:
G12 MiniZinc Distribution 1.3
------------------------------
* New evaluation and output framework
We have implemented a new evaluation and output framework for MiniZinc that simplifies evaluating a model and producing output formatted according to the model's output item.
The new framework is based around two new tools. The first, solns2out, takes a model output specification produced by mzn2fzn, and reads the solution stream from a FlatZinc implementation. It then formats and prints each solution according to the output specification. An example, of its use is as follows:
$ mzn2fzn model.mzn
$ flatzinc model.fzn | solns2out model.ozn
Model output specifications are contained in files with the ".ozn" extension. Such files are now generated by default by mzn2fzn.
The second new tool, named minizinc, is an evaluation driver that automates the process of evaluating a MiniZinc model. For example, the following command:
$ minizinc model.mzn
will flatten, evaluate, and generate formatted output for the specified model. The FlatZinc interpreter used by minizinc is pluggable, so any FlatZinc implementation that can be invoked from the command line can in principle be used with it. (The manual page for minizinc contains a complete description of how it interacts with the FlatZinc implementation.)
The minizinc program replaces the mzn script; since it also has support for CP-Viz, it also replaces the minizinc-viz script as well. Unlike the scripts, the minizinc program works directly from the Windows command prompt, i.e. neither Cygwin or MSYS are required to use it.
We have added some wrapper scripts (on Windows, batch files) around the minizinc program for invoking each of the G12 FlatZinc interpreter's backends with the appropriate global constraint definitions.
These new wrapper scripts are:
mzn-g12fd (Evaluate MiniZinc using G12/FD.)
mzn-g12lazy (Evaluate MiniZinc using G12/Lazy.)
mzn-g12mip (Evaluate MiniZinc using G12 and a MIP solver.)
mzn-g12sat (Evaluate MiniZinc using G12 and a SAT solver.)
For example, the following evaluates a MiniZinc model using the G12 Lazy Clause Generation solver:
$ mzn-g12lazy model.mzn
Changes to the MiniZinc language:
* The built-in operation show_cond/3 is no longer supported.
* The built-in annotation is_output/0 is deprecated. Support for it will be removed in a later release.
* The following operations, which were deprecated in MiniZinc 1.1, are no longer supported:
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)
Changes to the G12 MiniZinc-to-FlatZinc converter:
* The --no-output-pred-decls option is no longer supported.
* The --target-flatzinc-version is no longer supported.
Bugs fixed in this release:
* A bug in mzn2fzn that caused it to infer incorrect bounds on absolute value expressions has been fixed.
* A bug in mzn2fzn's optimisation pass that caused it to delete equality constraints between output variables has been fixed.
* The FlatZinc interpreter now rejects output_var/0 annotations on array declarations and output_array/1 annotations on scalar variable declarations.
Some notes
* One thing to note with the newminizinc
program is that it can be used as a wrapper for all FlatZinc solvers and it shows the nice output from the output
section . Here is how to run Gecode/fz (the program name is fz
) on a Rogo model (rogo2.mzn):
$ minizinc rogo2.mzn rogo_mike_trick.dzn -f "fz -mode stat -solutions 0" .... x : [2, 2, 2, 2, 3, 4, 5, 5, 5, 4, 4, 3] y : [2, 3, 4, 5, 5, 5, 5, 4, 3, 3, 2, 2] points: [3, 0, 0, 1, 0, 0, 2, 0, 0, 2, 0, 0] sum_points: 8 (2, 2): 3 points (2, 3): 0 points (2, 4): 0 points (2, 5): 1 point (3, 5): 0 points (4, 5): 0 points (5, 5): 2 points (5, 4): 0 points (5, 3): 0 points (4, 3): 2 points (4, 2): 0 points (3, 2): 0 points ---------- ========== %% runtime: 1.216 (1216.804000 ms) %% solvetime: 1.213 (1213.208000 ms) %% solutions: 3 %% variables: 230 %% propagators: 284 %% propagations: 9641152 %% nodes: 78247 %% failures: 39121 %% peak depth: 30 %% peak memory: 712 KBThe
output
statement for this model is:
output [
"x : " ++ show(x) ++ "\n" ++
"y : " ++ show(y) ++ "\n" ++
"points: " ++ show(points) ++ "\n" ++
"sum_points: " ++ show(sum_points) ++ "\n"
] ++ ["\n"]
++
[
"(" ++ show(x[i]) ++ ", " ++ show(y[i]) ++ "): " ++
show(points[i]) ++ if fix(points[i]) == 1 then " point"
else " points" endif ++ "\n"
| i in 1..max_steps
] ++ ["\n"];
* Many of my MiniZinc models does not contain a explicit
output
statement yet, and I will fix that.