pymzn.mzn2fzn

pymzn.mzn2fzn(mzn_file, *dzn_files, data=None, keep_data=False, include=None, no_ozn=False)

Flatten a MiniZinc model into a FlatZinc one. It executes the mzn2fzn utility from libminizinc to produce a fzn and ozn files from a mzn one.

Parameters:
  • mzn_file (str) – The path to the minizinc problem file.
  • *dzn_files – A list of paths to dzn files to attach to the mzn2fzn execution, provided as positional arguments; by default no data file is attached.
  • data (dict) – Additional data as a dictionary of variables assignments to supply to the mzn2fnz function. The dictionary is then automatically converted to dzn format by the pymzn.dict2dzn function. Notice that if the data provided is too large, a temporary dzn file will be produced.
  • keep_data (bool) – Whether to write the inline data into a dzn file and keep it. Default is False.
  • include (str or list) – One or more additional paths to search for included mzn files when running mzn2fzn.
  • no_ozn (bool) – If True, the ozn file is not produced, False otherwise.
Returns:

The paths to the generated fzn and ozn files. If no_ozn=True, the second argument is None.

Return type:

tuple (str, str)