MiniZinc / libminizinc

The MiniZinc compiler
http://www.minizinc.org
Other
516 stars 81 forks source link

Support for Generating Flatzinc-JSON Format in MiniZinc Compiler #868

Open Yuliang795 opened 3 hours ago

Yuliang795 commented 3 hours ago

Hi, According to the documentation, the MiniZinc compiler can flatten a model file into the Flatzinc format using the command minizinc -c model.mzn data.dzn. But it seems there is no direct option to output the Flatzinc-JSON format, except by modifying the inputType in the solver configuration. Would it be possible to add support for generating the Flatzinc-JSON format as an explicit output option during compilation?

Thank you.

Dekker1 commented 2 hours ago

Being able to switch between the traditional and JSON format does seem quite helpful when doing analysis or doing some manual work, so this sounds like a good suggestion to me.

However, the other side of this is that it is important to realize that individual FlatZinc files are solver-dependent and cannot be used between different solvers. In that sense, it is odd to avoid the usage of solver configuration files, and I think that switching should be made dependent on the use of the --compile flag.