Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# Multi-objective Attributes

These are the attributes for setting and querying multiple objectives (refer to this section for additional information on multi-objective optimization).

## NumObj

- Type: `int`

- Modifiable: `Yes`

Number of objectives in the model. If you modify this attribute, it will change the number of objectives in the model. Decreasing it will discard existing objectives. Increasing it will create new objectives (initialized to 0). Setting it to 0 will create a model with no objective (i.e., a feasibility model). If you want to switch from a multi-objective model to a single-objective model you also need to set `NumObj` to 0 and call model update before installing a new single objective.

You can use the ObjNumber parameter, in conjunction with multi-objective attributes (ObjN, ObjNName, etc.), to query or modify attributes for different objectives. The value of ObjNumber should always be less than `NumObj`.

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

For examples of how to query or modify attributes, refer to our Attribute Examples.

## NumObjPasses

- Type: `int`

- Modifiable: `No`

When the model has multiple objectives, each objective is blended into an optimization pass with all other objectives of the same priority. This attribute is used to query the number of passes that were conducted in the last run.

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

For examples of how to query or modify attributes, refer to our Attribute Examples.

## ObjN

- Type: `double`

- Modifiable: `Yes`

When the model has multiple objectives, this attribute is used to query or modify objective coefficients for objective \(n\). You set \(n\) using the ObjNumber parameter. Note that when ObjNumber is equal to 0, `ObjN` is equivalent to Obj.

The number of objectives in the model can be queried (or modified) using the NumObj attribute.

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

For examples of how to query or modify attributes, refer to our Attribute Examples.

## ObjNAbsTol

- Type: `double`

- Modifiable: `Yes`

This attribute is used to set the allowable degradation for objective \(n\) when doing hierarchical multi-objective optimization. You set \(n\) using the ObjNumber parameter.

Hierarchical multi-objective MIP optimization will optimize for the different objectives in the model one at a time, in priority order. If it achieves objective value \(z\) when it optimizes for this objective, then subsequent steps are allowed to degrade this value by at most `ObjNAbsTol`.

Objective degradations are handled differently for multi-objective LP models. For LP models, solution quality for higher-priority objectives is maintained by fixing some variables to their values in previous optimal solutions. These fixings are decided using variable reduced costs. The value of the `ObjNAbsTol` parameter indicates the amount by which a fixed variable’s reduced cost is allowed to violate dual feasibility. Relaxing this tolerance has a similar effect on the value of the objective to relaxing OptimalityTol, so we recommend against values larger than 1e-2. The value of the related ObjNRelTol attribute is ignored.

The default absolute tolerance for an objective is `1e-6`.

The number of objectives in the model can be queried (or modified) using the NumObj attribute.

Please refer to the discussion of Allowing Multiple-Objective Degradation for more information.

For examples of how to query or modify attributes, refer to our Attribute Examples.

## ObjNCon

- Type: `double`

- Modifiable: `Yes`

When the model has multiple objectives, this attribute is used to query or modify the constant term for objective \(n\). You set \(n\) using the ObjNumber parameter. Note that when ObjNumber is equal to 0, `ObjNCon` is equivalent to ObjCon.

The number of objectives in the model can be queried (or modified) using the NumObj attribute.

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

For examples of how to query or modify attributes, refer to our Attribute Examples.

## ObjNName

- Type: `string`

- Modifiable: `Yes`

When the model has multiple objectives, this attribute is used to query or modify the name for objective \(n\). You set \(n\) using the ObjNumber parameter.

The number of objectives in the model can be queried (or modified) using the NumObj attribute.

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

For examples of how to query or modify attributes, refer to our Attribute Examples.

## ObjNPriority

- Type: `int`

- Modifiable: `Yes`

This attribute is used to query or modify the priority of objective \(n\) when doing hierarchical multi-objective optimization. You set \(n\) using the ObjNumber parameter.

The default priority for an objective is 0.

The number of objectives in the model can be queried (or modified) using the NumObj attribute.

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

For examples of how to query or modify attributes, refer to our Attribute Examples.

## ObjNRelTol

- Type: `double`

- Modifiable: `Yes`

This attribute is used to set the allowable degradation for objective \(n\) when doing hierarchical multi-objective optimization for MIP models. You set \(n\) using the ObjNumber parameter.

Hierarchical multi-objective MIP optimization will optimize for the different objectives in the model one at a time, in priority order. If it achieves objective value \(z\) when it optimizes for this objective, then subsequent steps are allowed to degrade this value by at most `ObjNRelTol`*\(|z|\).

Objective degradations are handled differently for multi-objective LP models. The allowable degradation is controlled by the ObjNAbsTol parameter and `ObjNRelTol` is ignored.

The default relative tolerance for an objective is 0.

The number of objectives in the model can be queried (or modified) using the NumObj attribute.

Please refer to the discussion of Allowing Multiple-Objective Degradation for more information.

For examples of how to query or modify attributes, refer to our Attribute Examples.

## ObjNVal

- Type: `double`

- Modifiable: `No`

This attribute is used to query the objective value obtained for objective \(n\) by the \(k\)-th solution stored in the pool of feasible solutions found so far for the problem. You set \(n\) using the ObjNumber parameter, while you set \(k\) using the SolutionNumber parameter.

The number of objectives in the model can be queried (or modified) using the NumObj attribute; while the number of stored solutions can be queried using the SolCount attribute.

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

For examples of how to query or modify attributes, refer to our Attribute Examples.

## ObjNWeight

- Type: `double`

- Modifiable: `Yes`

This attribute is used to query or modify the weight of objective \(n\) when doing blended multi-objective optimization. You set \(n\) using the ObjNumber parameter.

The default weight for an objective is 1.0.

The number of objectives in the model can be queried (or modified) using the NumObj attribute.

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

For examples of how to query or modify attributes, refer to our Attribute Examples.

## ObjNPass

- Type: `int`

- Modifiable: `No`

This attribute is used to query the index of the multiobjective optimization pass in which objective \(k\) was processed. You set \(k\) using the ObjNumber parameter.

If the objective was not processed (e.g. a time limit was reached during some prior optimization pass), querying this attribute returns -1.

## ObjPassNIterCount

- Type: `double`

- Modifiable: `No`

This attribute is used to query the number of simplex iterations spent for optimization pass \(p\) of a multi-objective solve. You set \(p\) using the ObjPassNumber parameter. If that parameter is set to -1 (its default value), the optimization pass selected is the one in which objective \(k\) was processed. You set \(k\) using the ObjNumber parameter.

Note that this attribute is only available for the objectives that were actually processed. When an objective was not processed (e.g. a time limit was reached during some prior optimization pass), an error is raised.

## ObjPassNMipGap

- Type: `double`

- Modifiable: `No`

This attribute is used to query the MIP gap for optimization pass \(p\) of a multi-objective solve. You set \(p\) using the ObjPassNumber parameter. If that parameter is set to -1 (its default value), the optimization pass selected is the one in which objective \(k\) was processed. You set \(k\) using the ObjNumber parameter.

Note that this attribute is only available for the objectives that were actually processed. When an objective was not processed (e.g. a time limit was reached during some prior optimization pass), an error is raised.

## ObjPassNNodeCount

- Type: `double`

- Modifiable: `No`

This attribute is used to query the number of explored nodes for optimization pass \(p\) of a multi-objective solve. You set \(p\) using the ObjPassNumber parameter. If that parameter is set to -1 (its default value), the optimization pass selected is the one in which objective \(k\) was processed. You set \(k\) using the ObjNumber parameter.

Note that this attribute is only available for the objectives that were actually processed. When an objective was not processed (e.g. a time limit was reached during some prior optimization pass), an error is raised.

## ObjPassNObjBound

- Type: `double`

- Modifiable: `No`

This attribute is used to query the objective bound for optimization pass \(p\) of a multi-objective solve. You set \(p\) using the ObjPassNumber parameter. If that parameter is set to -1 (its default value), the optimization pass selected is the one in which objective \(k\) was processed. You set \(k\) using the ObjNumber parameter.

Note that this attribute is only available for the objectives that were actually processed. When an objective was not processed (e.g. a time limit was reached during some prior optimization pass), an error is raised.

## ObjPassNObjVal

- Type: `double`

- Modifiable: `No`

This attribute is used to query the objective value for optimization pass \(p\) of a multi-objective solve. You set \(p\) using the ObjPassNumber parameter. If that parameter is set to -1 (its default value), the optimization pass selected is the one in which objective \(k\) was processed. You set \(k\) using the ObjNumber parameter.

Note that this attribute is only available for the objectives that were actually processed. When an objective was not processed (e.g. a time limit was reached during some prior optimization pass), an error is raised.

## ObjPassNOpenNodeCount

- Type: `double`

- Modifiable: `No`

This attribute is used to query the number of unexplored nodes for optimization pass \(p\) of a multi-objective solve. You set \(p\) using the ObjPassNumber parameter. If that parameter is set to -1 (its default value), the optimization pass selected is the one in which objective \(k\) was processed. You set \(k\) using the ObjNumber parameter.

Note that this attribute is only available for the objectives that were actually processed. When an objective was not processed (e.g. a time limit was reached during some prior optimization pass), an error is raised.

## ObjPassNRuntime

- Type: `double`

- Modifiable: `No`

This attribute is used to query the runtime (in seconds) spent for optimization pass \(p\) of a multi-objective solve. You set \(p\) using the ObjPassNumber parameter. If that parameter is set to -1 (its default value), the optimization pass selected is the one in which objective \(k\) was processed. You set \(k\) using the ObjNumber parameter.

Note that this attribute is only available for the objectives that were actually processed. When an objective was not processed (e.g. a time limit was reached during some prior optimization pass), an error is raised.

## ObjPassNStatus

- Type: `int`

- Modifiable: `No`

This attribute is used to query the status for optimization pass \(p\) of a multi-objective solve. You set \(p\) using the ObjPassNumber parameter. If that parameter is set to -1 (its default value), the optimization pass selected is the one in which objective \(k\) was processed. You set \(k\) using the ObjNumber parameter.

Note that this attribute is only available for the objectives that were actually processed. When an objective was not processed (e.g. a time limit was reached during some prior optimization pass), an error is raised.

## ObjPassNWork

- Type: `double`

- Modifiable: `No`

This attribute is used to query the work spent for optimization pass \(p\) of a multi-objective solve. You set \(p\) using the ObjPassNumber parameter. If that parameter is set to -1 (its default value), the optimization pass selected is the one in which objective \(k\) was processed. You set \(k\) using the ObjNumber parameter.

Note that this attribute is only available for the objectives that were actually processed. When an objective was not processed (e.g. a time limit was reached during some prior optimization pass), an error is raised.

Help and Feedback

Press `/` or click to search this documentation | Gurobi website | Gurobi community forum
Go to other Gurobi documentation | Gurobi download | Contact support