PyMzn can be configured with custom executable paths and other variables. Configuration is done via the pymzn.config object. For instance:

import pymzn
pymzn.config.set('minizinc', 'path/to/minizinc')

The configurable properties used by PyMzn are the following:

  • minizinc: Path to the minizinc executable;

  • solver: Solver instance to use when calling pymzn.minizinc;

  • solver_args: Arguments to pass to the solver when calling pymzn.minizinc;

  • args: Additional arguments to pass to the template engine;

  • include: List of search paths to include in all minizinc calls;

  • keep: Overrides the keep flag of all minizinc calls;

  • dzn_width: The horizontal character limit for dzn files; This property is used to wrap long dzn statements when writing dzn files. This property is also used in the minizinc function as a limit to decide whether to write the inline data into a file.

One can also set custom properties to be used for custom solvers.

The configuration of PyMzn can be made permanent by using the dump function of the config object:


This operation, as well as loading the saved configuration file, requires the appdirs and pyyaml libraries to be installed on your system.


PyMzn can also be set to print debugging messages on standard output via:


This function is meant to be used in interactive sessions or in applications that do not configure the logging library. If you configure the logging library in your application, then PyMzn will print logging messages as well. To disable debugging messages you can then call: