Filter Content By
Version
Languages

GRBModel::setObjective()

Set the model objective equal to a linear or quadratic expression (for multi-objective optimization, see setObjectiveN).

Note that you can also modify the linear portion of a model objective using the Obj variable attribute. If you wish to mix and match these two approaches, please note that this method replaces the entire existing objective, while the Obj attribute can be used to modify individual linear terms.

 void setObjective ( GRBLinExpr linexpr, int sense=0 )
Arguments:

linexpr: New linear model objective.

sense (optional): Optimization sense (GRB_MINIMIZE for minimization, GRB_MAXIMIZE for maximization). Omit this argument to use the ModelSense attribute value to determine the sense.

Arguments: