pymzn.mzn2fzn

pymzn.mzn2fzn(mzn_file, *dzn_files, data=None, keep_data=False, globals_dir=None, include=None, output_mode='item', 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.
  • globals_dir (str) – The path to the directory for global included files.
  • include (str or list) – One or more additional paths to search for included mzn files when running mzn2fzn.
  • output_mode ('dzn', 'json', 'item') – The desired output format. The default is ‘item’ which outputs a stream of strings as returned by the solns2out tool, formatted according to the output statement of the MiniZinc model. The ‘dzn’ and ‘json’ formats output a stream of strings formatted in dzn of json respectively.
  • 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)