Search code examples
constraint-programmingminizinc

Minizinc: variable order


A constraint model may have restrictions or provide hints to the constraint solver to solve the problem more efficiently by defining the order in which variables are solved for. Is there a mechanism to specify the order in which variables need to solved in MiniZinc or FlatZinc ?


Solution

  • int_search/4 is used for search annotation, i.e. for stating the involved variables and the variable/value strategies.

    Example:

    solve :: int_search(q, first_fail, indomain_min, complete) satisfy;
    

    See more about this in the MiniZinc tutorial (section 5.2): http://www.minizinc.org/downloads/doc-latest/minizinc-tute.pdf The FlatZinc specification has a detailed list of the different strategies: http://www.minizinc.org/downloads/doc-1.6/flatzinc-spec.pdf (section 5.6.1).