I noticed that adding constraints to an IloModel one by one can be prohibitively slow. (I am referring to the construction of the model, not the optimization.)

Suppose I have many constraints with the same number of variables, can I add the constraint matrix in one function call?

Are there other ways to speed up the construction of the model?


I came across this issue recently, and discovered that if you first add the constraints to an IloRangeArray, and then add that object to the model, you'll see a significant speed-up. Removing constraints is also faster if they are contained in a container object like an IloRangeArray.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.