I'm performing clustering on Minizinc on huge dataset but my computational time is huge and I'm trying to reduce it. To do so, I would like to specify the order in which the possible values are tried for a variable.
For example, a variable v
as a domain 1..5
, but I know that 4 is more likely than 3, 3 is more likely than 2, ect.
In this case, is there a way for me to say that I want 4 to be tried first, then 3, then 2, etc.?
Although there is a way of setting a preselected order in which we search over variables (the input_order
variable choice heuristic), there is currently no value choice heuristic that does the same for the order in which values are tried.
There are, however, many other value choice heuristics in MiniZinc: https://www.minizinc.org/doc-2.5.5/en/lib-stdlib.html#value-choice-annotations. If you are looking for a portable value choice heuristic, then you will probably find one that approximates the distribution in the problem that you are looking for.
As a side note, it might be good to consider what will actually perform best in a CP solver. Although choose the most likely candidate can lead to good results, sometimes the best search strategy is actually to fail quickly. If you know that at least some variables have to take an unlikely value and it is easier to prove failure than find a solution, then it is often better to first try the choices that would lead to failures. These failures will quickly further the search, where to find out that a good guess is not a solution might take a lot of search. In the end, the best thing is to try many search heuristics. It might often surprise you what works best.
Some other things to consider:
chuffed.mzn
and gecode.mzn
). These include some search heuristics.