Paulo Sousa
unread,Jan 13, 2011, 12:36:16 PM1/13/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Gurobi Optimization
Hi,
In connection to the Gurobi 4 C++ API, I am using a LP model, whose
objective function I set as follows:
for (unsigned i = 0; i < n; i++)
{
double coef = 1.0;
exprObj.addTerms(&coef, &a1[i], 1);
exprObj.addTerms(&coef, &a2[i], 1);
}
model->setObjective(exprObj);
Suppose now that after setting up the model, I want to change the
coefficient of, e.g., a1[6] in the objective function; how can one
accomplish that without setting the whole objective function?
I considered to use
- GRBModel::chgCoeff()
- GRBModel::chgCoeffs()
but they seem to apply only to constraints.
In short, I am looking for a computationally *efficient* way of
changing objective function coefficients.
Thanks!
Regards,
Paulo