问题
The zinc spec says this:
If no output item is present, the implementation should print all the global variables and their values in a readable format.
However this does not appear to work with minizinc version 1.6.0:
G12 MiniZinc evaluation driver, version 1.6.0
I've tried the default command (minizinc) and mzn-gecode.
I'd really like to avoid repeating all the variable names in the output expression. What I really want is to have all decision variables output in some structured format (e.g. YAML), but I'd settle for some way to avoid this repetition.
To clarify: my model doesn't match the typical examples of CSP, e.g. there's no big array or matrix. It's just a fairly big (in relative terms) set of individual decision variables.
EDIT: bug created.
EDIT2: bug is now fixed in the minizinc 2.0 git repository so it conforms to the spec.
回答1:
What I know, all FlatZinc solver just show a "----------" for every solution when there is no defined output item in the model. So it seems that the spec is wrong/obsolete on this part.
There have been some (more or less radical) changes regarding the output item during the years. In some early MiniZinc version it worked the way the spec described, and it was quite handy when modelling a problem (though it was very hard to get nice output). It was a real nuisance when the behaviour was changed so an output item was required for showing the result.
Interestingly, Zinc (the "big brother" of MiniZinc, http://www.minizinc.org/g12_www/zinc/ ) works as described i.e. shows all global variables when there is no output item. Perhaps the spec writers just forget to mention that MiniZinc differs.
来源:https://stackoverflow.com/questions/25339376/easy-way-to-print-full-solution-all-decision-variables-in-minizinc