# Documentation

Filter Content By
Version
Languages

### GRBModel::setObjectiveN()

 void setObjectiveN ( GRBLinExpr expr, int index, int priority=0, double weight=1, double abstol=0, double reltol=0, string name="" )
Set an alternative optimization objective equal to a linear expression.

Please refer to the discussion of Multiple Objectives for more information on the use of alternative objectives.

Note that you can also modify an alternative objective using the ObjN variable attribute. If you wish to mix and match these two approaches, please note that this method replaces the entire existing objective, while the ObjN attribute can be used to modify individual terms.

Arguments:

expr: New alternative objective.

index: Index for new objective. If you use an index of 0, this routine will change the primary optimization objective.

priority: Priority for the alternative objective. This initializes the ObjNPriority attribute for this objective.

weight: Weight for the alternative objective. This initializes the ObjNWeight attribute for this objective.

abstol: Absolute tolerance for the alternative objective. This initializes the ObjNAbsTol attribute for this objective.

reltol: Relative tolerance for the alternative objective. This initializes the ObjNRelTol attribute for this objective.

name: Name of the alternative objective. This initializes the ObjNName attribute for this objective.