Writing my first non-trivial MiniZinc app, I keep running into the error "cannot determine bounds". How does one generally resolve this error?
Asked
Active
Viewed 576 times
1 Answers
1
In general “cannot determine bounds” means that the solver cannot determine the bounds (the domain) of a decision variable.
Using "var int" as the domain of a decision variable should be avoided if possible, since it will probably slow down the solving process. There are times where the solver can figure out the domain, e.g. in cases likes
% ...
var int: z = sum(x);
when "x" have declared domains. But, as a rule, try to define the domains.

hakank
- 6,629
- 1
- 17
- 27
-
I realize the "cannot determine bounds" means that the solver cannot determine the bounds. But when does that happen - perhaps a simple example would shed some light. Additionally I thought "var" signified a decision variable and that they are the whole point of CP - to specify constraints on unknown values - so why do you suggest to avoid them? I'm using G12 fd. – Jim Lewis Feb 07 '15 at 21:55
-
1Well, "var int" is a decision variable with a huge (maximal possible) domain which will make the solver try all possible values for the values in that domain. "var 0..10" is also a decision variable but with a much smaller domain of possible values. You should try to restrict the domain as small as possible since this will speed up things. What happen if you restricts the domains of the decision variables? What MiniZinc version do you use? I know that in some earlier version of MiniZinc 2 there was some issues of these errors that was fixed later. – hakank Feb 07 '15 at 22:59
-
Ah, I was using a lot of arrays like "array[1 .. n] of var int: X;" and did not realize it should be "array [1 ..n] of var 1 .. 10: X". Thanks. Using 0.9.6. But does the solver really try "all" values? I thought they were smarter than that. – Jim Lewis Feb 08 '15 at 08:44
-
Great. Alas it's not always easy to know the exact domains, but when you do it should be used in the model. The version 0.9.6 is for the MiniZinc IDE, but what MiniZinc version are you using (1.6 or 2.0)? You are right, the solver are usually much much smarter than trying all the values in the domain, but there are case when large domains makes it harder/slower depending on the constraints, the solver etc. For some combination of solver and constraints only the bounds (min and max) of the decision variables are updated during propagation (and the "holes" in the domains are ignored). – hakank Feb 08 '15 at 09:26
-
-
There was some issues regarding "cannot determine bounds" in earlier versions of version 2 but I'm not sure when it was fixed. I'm using the Git version and don't got these errors anymore. Since you don't show any model I can't test it. You can try with the latest Git version: https://github.com/MiniZinc/libminizinc – hakank Feb 08 '15 at 19:42