Try our new documentation site (beta).


GRBModel.SetObjectiveN()

void SetObjectiveN ( GRBLinExpr expr,
    int index,
    int priority,
    double weight,
    double abstol,
    double reltol,
    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.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search

Gurobi Optimization