MiniZinc tools¶
|
Implements the workflow for solving a CSP problem encoded with MiniZinc. |
|
Flatten a MiniZinc model into a FlatZinc one. |
|
Wraps the |
Status of the solution stream. |
|
|
Solution stream returned by the |
|
Generic error raised by the PyMzn functions. |
PyMzn provides an interface to the minizinc
executable to compile a MiniZinc
model into a FlatZinc one, solve a given problem and get back the resulting
solutions directly as Python objects.
The main function that PyMzn provides is the pymzn.minizinc
function, which
executes the entire workflow for solving a constranint program encoded in
MiniZinc, just like using the minizinc
executable from command line. As
added benefit, the pymzn.minizinc
function takes care of adding
solver-dependent parameters and converts the solutions into Python dictionaries
by default. Solving a MiniZinc problem with PyMzn is as simple as:
import pymzn
pymzn.minizinc('test.mzn')
The pymzn.minizinc
function is probably the way to go for most of the
problems, but the pymzn.mzn2fzn
and pymzn.solns2out
functions are also
included in the library to allow for maximum flexibility. The latter two
functions are wrappers of the two homonym MiniZinc tools for, respectively,
converting a MiniZinc model into a FlatZinc one and getting custom output from
the solution stream of a solver.