Hello. I have the following simple problem case:
- 50 IntVars, each with a domain from 0 to 49.
- A FloatVar.
- A 50*50 array given as input, associating each variable-value assignment with a cost of type double.
I would like the FloatVar to hold the total cost representing a solution. That is, the sum of all the respective costs of each variable-value assignment. To do this, I create a boolean array to map whether a specific variable is assigned to a specific value or not. Then I channel this boolean array to a float array, so I can finally use it in a linear constraint, with FRT_EQ.
Running this example, it takes 8 seconds to find the first solution. But if I make a version of the problem where the costs are integers (and also remove the channel constraint, since linear can support a mix of int and boolean arrays, but not float and boolean), then I get the response instantly.
Why is this happening? Is there a better way to model, something that I am missing, or is it inevitable because of the nature of floating types?
I can provide minimal working example code if needed.
Thank you!