Performance consideration: constraining a boolean variable vs not having it in the model at all #3147
-
Hi! I'm working on a scheduling problem. My solution is basically a big matrix of boolean variables. Some of those variables must have value 0 and I know that beforehand (e.g. some employees are not qualified to work certain shifts so they will never be assigned such a shift). I achieve that by adding a constraint ensuring their value will always be 0 ( Is there performance to be gained by not adding those variables to the solver in the first place, if I know they have to be 0 before hand? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I’ve noticed that the cpsat solver presolve step seems to eliminate redundant constraints. So I have always kept in all the constraints and variables I need for the logic to be clear, and let the solver winnow those down to a more concise set. But I’m very interested in a more definitive answer. |
Beta Was this translation helpful? Give feedback.
-
It takes memory and time, but the solving time after presolve should be the same. |
Beta Was this translation helpful? Give feedback.
It takes memory and time, but the solving time after presolve should be the same.