ChocoZN is a converter from MiniZinc to FlatZinc that uses the global constraint library of Choco Solver. This enables you to use the global constraints of Choco Solver to solve your MiniZinc problem. The extension of the output file is .czn to emphasis that it is specialised for Choco Solver and it won't be recognised by other solvers.

Use this online tool to generate a .czn file from your MiniZinc model, i.e. a FlatZinc model optimised for Choco Solver. Then, parse and solve this file as if it was a classical .fzn file using the following code in your Java project:

FZN/CZN Parsing and Solving:

` ````
try {
ChocoFZN.main(new String[]{"C:\\Dev\\mario_easy_2.czn"});
} catch (Exception e) {
e.printStackTrace();
}
```

Note that ChocoFZN.java is a class of the open source choco-parser project, which should be included in your project as a dependency.

SBT import:

` ````
"org.choco-solver" % "choco-solver" % "3.3.3",
"org.choco-solver" % "choco-parsers" % "3.3.3",
```

Standard FlatZinc files do not allow taking the best from Choco Solver. Without the constraint library of Choco Solver, global constraints are reformulated into heavy decompositions, leading to strong performance loss. ChocoZN enables you to use the power of global constraints that are probably the main advantage of Choco Solver.

We have evaluated the impact of ChocoZN on mario on data mario_easy_2.fzn. As you can see on the table below, global constraints make quite a difference!

mario.fzn | mario.czn | |
---|---|---|

Time (s) | 29.5 | 0.3 |

# Nodes | 882,051 | 1,351 |