MiniZinc

Last updated

MiniZinc
MiniZinc logo.svg
Paradigm
Developer Monash University
First appeared2 May 2009;16 years ago (2009-05-02)
Stable release
2.9.2 / 6 March 2025;8 months ago (2025-03-06)
Typing discipline Strong
Implementation language C++
OS Linux, macOS, and Windows
License Mozilla Public License 2.0
Filename extensions .mzn, .dzn, .fzn
Website www.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, SAT, and SMT.

Contents

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 solvers using its own format "FlatZinc" or .nl files.

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

MiniZinc is interoperable with other languages such as R [4] and Python. [5]

Language

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

include "all_different.mzn"; % Include all_different globalint: 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

  1. Nethercote, Nicholas; Stuckey, Peter J.; Becket, Ralph; Brand, Sebastian; Duck, Gregory J.; Tack, Guido (2007). "MiniZinc: Towards a Standard CP Modelling Language". In Bessière, Christian (ed.). Principles and Practice of Constraint Programming – CP 2007. Lecture Notes in Computer Science. Berlin, Heidelberg: Springer. pp. 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 14 September 2020.
  3. "Choco-solver". Choco-solver. Retrieved 14 September 2020.
  4. "Introduction".
  5. "Minizinc Python".