Jump to content

MiniZinc

From Wikipedia, the free encyclopedia
MiniZinc
ParadigmConstraint programming / Logic Programming
DeveloperMonash University
First appearedMay 2, 2009; 15 years ago (2009-05-02)
Stable release
2.8.5 / June 3, 2024; 59 days ago (2024-06-03)
Implementation languageC++
OSLinux, MacOS, and Windows
LicenseMPLv2
Filename extensions.mzn, .dzn, .fzn
Websitewww.minizinc.org
Influenced by
Zinc

MiniZinc[1] is a constraint modelling language (or algebraic modeling language) to describe and solve high-complexity problems using a variety of well-known solving paradigms for combinatorial problems including constraint programming, integer programming, lazy clause generation, SAT, and SMT.

Following the constraint programming paradigm, in MiniZinc a problem is specified in terms of known values (parameters), unknown values (decision variables), and the relationship (constraints) between these values. MiniZinc promotes the use of global constraints to model well-known structures in problems. These global constraints improve the clarity of the model and allow solvers to use the most effective method to exploit the structure. A MiniZinc problem instance is translated (or flattened) to a level at which it only supports constraints that are supported by the target solver and then given to the solver using its preferred format. Currently MiniZinc can communicate with solver using its own format FlatZinc or .nl files.

A big advantage of MiniZinc is the possibility to use different solvers, and even different solvers, from the same MiniZinc instance. MiniZinc supports many solvers, both open source and commercial software, including CBC,[2] Choco,[3] Chuffed,[4] CPLEX, FICO Xpress, Gecode,[5] Gurobi, IPOPT, and OR-Tools.

MiniZinc is interoperable with other languages such as R. [6]

Language

[edit]

The following MiniZinc model can be used to solve the famous n-queens puzzle:

include "all_different.mzn"; % Include all_different global

int: n = 8; % The number of queens. (parameter)

array [1..n] of var 1..n: q; % The height of the queens on the board. (decision variable)

% No queen can be in a position where it can capture another queen. (constraints)
constraint all_different(q);
constraint all_different(i in 1..n)(q[i] + i);
constraint all_different(i in 1..n)(q[i] - i);

References

[edit]
  1. ^ Nethercote, Nicholas; Stuckey, Peter J.; Becket, Ralph; Brand, Sebastian; Duck, Gregory J.; Tack, Guido (2007). Bessière, Christian (ed.). "MiniZinc: Towards a Standard CP Modelling Language". Principles and Practice of Constraint Programming – CP 2007. Lecture Notes in Computer Science. Berlin, Heidelberg: Springer: 529–543. doi:10.1007/978-3-540-74970-7_38. ISBN 978-3-540-74970-7.
  2. ^ "COIN-OR Branch-and-Cut MIP Solver". projects.coin-or.org. Retrieved 2020-09-14.
  3. ^ "Choco-solver". Choco-solver. Retrieved 2020-09-14.
  4. ^ chuffed/chuffed, Chuffed, 2020-09-11, retrieved 2020-09-14
  5. ^ "GECODE - An open, free, efficient constraint solving toolkit". www.gecode.org. Retrieved 2020-09-14.
  6. ^ https://cran.r-project.org/web/packages/rminizinc/vignettes/R_MiniZinc.html
[edit]