Readablewiki

MiniZinc

Content sourced from Wikipedia, licensed under CC BY-SA 3.0.

MiniZinc is a language for modeling and solving complex problems using constraints. It follows the constraint programming approach: you define data (parameters), unknowns (variables), and the relationships between them (constraints). MiniZinc often uses global constraints like all_different, which makes models clearer and helps solvers work faster.

How it works
- A MiniZinc model is translated into a solver-friendly form (FlatZinc or .nl) and then solved by a solver.
- You can use many different solvers from the same MiniZinc model, including CBC, Choco, Chuffed, HiGHS, Gurobi, IPOPT, and OR-Tools. Some are open source, some are commercial.

Interoperability
- MiniZinc can work with other programming languages such as R and Python, making it easy to integrate into data workflows.

Example: the eight-queens puzzle
- Set n = 8.
- Declare q[1..n] as decision variables with values 1..n.
- Add constraints:
- all_different(q) to ensure one queen per column.
- all_different(i in 1..n)(q[i] + i) and all_different(i in 1..n)(q[i] - i) to prevent diagonal attacks.

History and format
- MiniZinc was developed at Monash University and first appeared in 2009.
- It aims to be a standard, solver-agnostic constraint programming language.
- Files: .mzn (model), .dzn (data), and .fzn (FlatZinc for solvers).
- Website: minizinc.org
- License: Mozilla Public License 2.0
- Influenced by Zinc

External resources
- Official website and the MiniZinc GitHub page.


This page was last edited on 1 February 2026, at 21:05 (CET).