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 ?

有帮助吗?

解决方案

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).

其他提示

More flexible control over the search process is provided by Search Combinators, which are described in the publication below.

Schrijvers, Tom, et al. "Search combinators." Principles and Practice of Constraint Programming–CP 2011. Springer Berlin Heidelberg, 2011. 774-788. Online at http://arxiv.org/pdf/1203.1095.pdf

Some implementation exists for Gecode, see the bottom of Gecode's FlatZinc page

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top