using addConstr vs addConstrs

714 views
Skip to first unread message

Akhil

unread,
Apr 9, 2011, 6:21:53 PM4/9/11
to Gurobi Optimization
In my experiments I am observing that model->addConstr() becomes
increasingly very time consuming as the model size grows. Can I expect
model->addConstrs() (i.e. adding multiple constraints at one time
rather than adding constraints one by one) to be faster. Will model-
>addConstrs() be faster than addConstr()??

I know I will have to experiment and test them for their performance.
But any insight from Gurobi developers will be helpful.

Greg Glockner

unread,
Apr 9, 2011, 7:47:37 PM4/9/11
to gur...@googlegroups.com

Are you calling model->update() after each call to model->addConstr() or model->addConstrs()? You should only call model->update() when you need to reference a model element. For example, you need to call model->update() when you need to use new variables in a constraint.

The more you can consolidate the calls to model->update(), the better the performance.

Akhil

unread,
Apr 9, 2011, 11:43:45 PM4/9/11
to Gurobi Optimization
That indeed was the case! Thanks a lot!
Reply all
Reply to author
Forward
0 new messages