I have the following model.
array[int] of float: weight; set of int: nodes = index_set(weight); int: n = max(nodes); array[nodes] of var 1..n: segment_start; array[nodes] of var 0..0: segment_length; function var float: segment_weight(int: s) = sum (i in segment_start[s]..(segment_start[s] + segment_length[s] - 1) where i <= n) (weight[i]); var float: mass = sum (s in nodes) (segment_weight(s)); solve satisfy;
The model is unsatisfiable according to MiniZinc, however, when I get rid of the variable
mass, a solution is found. How can an existence of a variable (i.e. not a constraint) influence whether a model is solvable? Does it have sometime to do with optional types? And how do I fix this?