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

# Quality Attributes

These are solution quality attributes. They are associated with the overall model. You should use one of the various `get` routines to retrieve the value of an attribute. These are described at the beginning of this section. For the object-oriented interfaces, quality attributes are retrieved by invoking the `get` method on the model, on a variable object or on a constraint object.

The solution pool quality attributes (e.g., PoolNMaxVio) can only be queried for MIP models. To access a solution pool quality attribute of a certain solution in the solution pool, you have to set the SolutionNumber parameter to the corresponding value before querying the attribute value.

Attempting to query an attribute that is not available will produce an error. In C, the attribute query routine will return a DATA_NOT_AVAILABLE error code. The object-oriented interfaces will throw an exception.

## MaxVio

- Type: `double`

- Modifiable: `No`

Maximum of all (unscaled) violations that apply to model type.

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

## BoundVio

- Type: `double`

- Modifiable: `No`

Maximum (unscaled) bound violation.

Available for all model types.

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

## BoundSVio

- Type: `double`

- Modifiable: `No`

Maximum (scaled) bound violation.

Only available for continuous models.

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

## BoundVioIndex

- Type: `int`

- Modifiable: `No`

Index of variable with the largest (unscaled) bound violation.

Available for all model types.

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

## BoundSVioIndex

- Type: `int`

- Modifiable: `No`

Index of variable with the largest (scaled) bound violation.

Only available for continuous models.

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

## BoundVioSum

- Type: `double`

- Modifiable: `No`

Sum of (unscaled) bound violations.

Available for all model types.

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

## BoundSVioSum

- Type: `double`

- Modifiable: `No`

Sum of (scaled) bound violations.

Only available for continuous models.

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

## ConstrVio

- Type: `double`

- Modifiable: `No`

Reporting constraint violations for the simplex solver is actually more complex than it may appear, due to the treatment of slacks on linear inequality constraints. The simplex solver introduces explicit non-negative slack variables inside the algorithm. Thus, for example, \(a^Tx \le b\) becomes \(a^Tx + s = b\). In this formulation, constraint errors can show up in two places: (i) as bound violations on the computed slack variable values, and (ii) as differences between \(a^Tx + s\) and \(b\). We report the former as `ConstrVio` and the latter as ConstrResidual.

For MIP models, the maximum violation of the constraints, including linear, quadratic, SOS and general constraints, is reported in `ConstrVio`.

Available for all model types.

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

## ConstrSVio

- Type: `double`

- Modifiable: `No`

Maximum (scaled) slack bound violation.

Only available for continuous models.

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

## ConstrVioIndex

- Type: `int`

- Modifiable: `No`

Index of linear constraint with the largest (unscaled) slack bound violation for continuous linear models solved by simplex.

For MIP or other situations, it is for all the constraints. The constraint order is linear, quadratic, SOS and general. Assume there are \(l\) linear, \(q\) quadratic, \(s\) SOS and \(g\) general constraints and the index \(i\) is between \(l+q+s\) and \(l+q+s+g\). Then, the general constraint with index \(i-l-q-s\) has the biggest violation.

Available for all model types.

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

## ConstrSVioIndex

- Type: `int`

- Modifiable: `No`

Index of linear constraint with the largest (scaled) slack bound violation.

Only available for continuous models.

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

## ConstrVioSum

- Type: `double`

- Modifiable: `No`

Sum of (unscaled) slack bound violations.

Available for all model types.

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

## ConstrSVioSum

- Type: `double`

- Modifiable: `No`

Sum of (scaled) slack bound violations.

Only available for continuous models.

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

## ConstrResidual

- Type: `double`

- Modifiable: `No`

Reporting constraint violations for the simplex solver is actually more complex than it may appear, due to the treatment of slacks on linear inequality constraints. The simplex solver introduces explicit non-negative slack variables inside the algorithm. Thus, for example, \(a^Tx \le b\) becomes \(a^Tx + s = b\). In this formulation, constraint errors can show up in two places: (i) as bound violations on the computed slack variable values, and (ii) as differences between \(a^Tx + s\) and \(b\). We report the former as ConstrVio and the latter as `ConstrResidual`.

Only available for continuous models. For MIP models, constraint violations are reported in ConstrVio.

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

## ConstrSResidual

- Type: `double`

- Modifiable: `No`

Maximum (scaled) primal constraint error.

Only available for continuous models.

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

## ConstrResidualIndex

- Type: `int`

- Modifiable: `No`

Index of linear constraint with the largest (unscaled) constraint error.

Only available for continuous models.

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

## ConstrSResidualIndex

- Type: `int`

- Modifiable: `No`

Index of linear constraint with the largest (scaled) constraint error.

Only available for continuous models.

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

## ConstrResidualSum

- Type: `double`

- Modifiable: `No`

Sum of (unscaled) linear constraint violations.

Only available for continuous models.

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

## ConstrSResidualSum

- Type: `double`

- Modifiable: `No`

Sum of (scaled) linear constraint violations.

Only available for continuous models.

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

## DualVio

- Type: `double`

- Modifiable: `No`

Reporting dual constraint violations for the simplex solver is actually more complex than it may appear, due to the treatment of reduced costs for bounded variables. The simplex solver introduces explicit non-negative reduced-cost variables inside the algorithm. Thus, \(a^Ty \ge c\) becomes \(a^Ty - z = c\) (where \(y\) is the dual vector and \(z\) is the reduced cost). In this formulation, errors can show up in two places: (i) as bound violations on the computed reduced-cost variable values, and (ii) as differences between \(a^Ty - z\) and \(c\). We report the former as `DualVio` and the latter as DualResidual.

`DualVio` reports the maximum (unscaled) reduced-cost bound violation.

Only available for continuous models.

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

## DualSVio

- Type: `double`

- Modifiable: `No`

Maximum (scaled) reduced cost violation.

Only available for continuous models.

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

## DualVioIndex

- Type: `int`

- Modifiable: `No`

Index of variable with the largest (unscaled) reduced cost violation. Note that the result may be larger than the number of variables in the model, which indicates that a constraint slack is the variable with the largest violation. Subtract the variable count from the result to get the index of the corresponding constraint.

Only available for continuous models.

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

## DualSVioIndex

- Type: `int`

- Modifiable: `No`

Index of variable with the largest (scaled) reduced cost violation. Note that the result may be larger than the number of variables in the model, which indicates that a constraint slack is the variable with the largest violation. Subtract the variable count from the result to get the index of the corresponding constraint.

Only available for continuous models.

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

## DualVioSum

- Type: `double`

- Modifiable: `No`

Sum of (unscaled) reduced cost violations.

Only available for continuous models.

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

## DualSVioSum

- Type: `double`

- Modifiable: `No`

Sum of (scaled) reduced cost violations.

Only available for continuous models.

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

## DualResidual

- Type: `double`

- Modifiable: `No`

Reporting dual constraint violations for the simplex solver is actually more complex than it may appear, due to the treatment of reduced costs for bounded variables. The simplex solver introduces explicit non-negative reduced-cost variables inside the algorithm. Thus, \(a^Ty \ge c\) becomes \(a^Ty - z = c\) (where \(y\) is the dual vector and \(z\) is the reduced cost). In this formulation, errors can show up in two places: (i) as bound violations on the computed reduced-cost variable values, and (ii) as differences between \(a^Ty - z\) and \(c\). We report the former as DualVio and the latter as `DualResidual`.

`DualResidual` reports the maximum (unscaled) dual constraint error.

Only available for continuous models.

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

## DualSResidual

- Type: `double`

- Modifiable: `No`

Maximum (scaled) dual constraint error.

Only available for continuous models.

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

## DualResidualIndex

- Type: `int`

- Modifiable: `No`

Index of variable with the largest (unscaled) dual constraint error.

Only available for continuous models.

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

## DualSResidualIndex

- Type: `int`

- Modifiable: `No`

Index of variable with the largest (scaled) dual constraint error.

Only available for continuous models.

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

## DualResidualSum

- Type: `double`

- Modifiable: `No`

Sum of (unscaled) dual constraint errors.

Only available for continuous models.

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

## DualSResidualSum

- Type: `double`

- Modifiable: `No`

Sum of (scaled) dual constraint errors.

Only available for continuous models.

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

## ComplVio

- Type: `double`

- Modifiable: `No`

Maximum complementarity violation. In an optimal solution, the product of the value of a variable and its reduced cost must be zero. This isn’t always strictly true for interior point solutions. This attribute returns the maximum complementarity violation for any variable.

Only available for continuous models.

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

## ComplVioIndex

- Type: `int`

- Modifiable: `No`

Index of variable with the largest complementarity violation.

Only available for continuous models.

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

## ComplVioSum

- Type: `double`

- Modifiable: `No`

Sum of complementarity violation.

Only available for continuous models.

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

## IntVio

- Type: `double`

- Modifiable: `No`

A MIP solver won’t always assign strictly integral values to integer variables. This attribute returns the largest distance between the computed value of any integer variable and the nearest integer.

Only available for MIP models.

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

## IntVioIndex

- Type: `int`

- Modifiable: `No`

Index of variable with the largest integrality violation.

Only available for MIP models.

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

## IntVioSum

- Type: `double`

- Modifiable: `No`

Sum of integrality violations.

Only available for MIP models.

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

## PoolNMaxVio

- Type: `double`

- Modifiable: `No`

Maximum of all violations in a MIP solution. Use parameter SolutionNumber to indicate which alternate solution to retrieve.

Please consult the section on Solution Pools for a more detailed discussion of this topic.

Only available for MIP models.

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

## PoolNBoundVio

- Type: `double`

- Modifiable: `No`

Maximum bound violation in a sub-optimal MIP solution. Use parameter SolutionNumber to indicate which alternate solution to retrieve.

Please consult the section on Solution Pools for a more detailed discussion of this topic.

Only available for MIP models.

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

## PoolNBoundVioIndex

- Type: `int`

- Modifiable: `No`

Index of variable with the largest bound violation in a sub-optimal MIP solution. Use parameter SolutionNumber to indicate which alternate solution to retrieve.

Please consult the section on Solution Pools for a more detailed discussion of this topic.

Only available for MIP models.

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

## PoolNBoundVioSum

- Type: `double`

- Modifiable: `No`

Sum of bound violations in a sub-optimal MIP solution. Use parameter SolutionNumber to indicate which alternate solution to retrieve.

Please consult the section on Solution Pools for a more detailed discussion of this topic.

Only available for MIP models.

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

## PoolNConstrVio

- Type: `double`

- Modifiable: `No`

Maximum constraint violation, including linear, quadratic, SOS and general constraints, in a sub-optimal MIP solution. Use parameter SolutionNumber to indicate which alternate solution to retrieve.

Please consult the section on Solution Pools for a more detailed discussion of this topic.

Only available for MIP models.

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

## PoolNConstrVioIndex

- Type: `int`

- Modifiable: `No`

Index of constraint with the largest violation in a sub-optimal MIP solution. Use parameter SolutionNumber to indicate which alternate solution to retrieve.

The constraint order is linear, quadratic, SOS and general. Assume there are \(l\) linear, \(q\) quadratic, \(s\) SOS and \(g\) general constraints and the index \(i\) is between \(l+q+s\) and \(l+q+s+g\). Then, the general constraint with index \(i-l-q-s\) has the biggest violation.

Please consult the section on Solution Pools for a more detailed discussion of this topic.

Only available for MIP models.

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

## PoolNConstrVioSum

- Type: `double`

- Modifiable: `No`

Sum of constraint violations, including linear, quadratic, SOS and general constraints, in a sub-optimal MIP solution. Use parameter SolutionNumber to indicate which alternate solution to retrieve.

Please consult the section on Solution Pools for a more detailed discussion of this topic.

Only available for MIP models.

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

## PoolNIntVio

- Type: `double`

- Modifiable: `No`

A MIP solver won’t always assign strictly integral values to integer variables. This attribute returns the largest distance between the computed value of any integer variable and the nearest integer in a sub-optimal MIP solution. Use parameter SolutionNumber to indicate which alternate solution to retrieve.

Please consult the section on Solution Pools for a more detailed discussion of this topic.

Only available for MIP models.

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

## PoolNIntVioIndex

- Type: `int`

- Modifiable: `No`

Index of variable with the largest integrality violation in a sub-optimal MIP solution. Use parameter SolutionNumber to indicate which alternate solution to retrieve.

Please consult the section on Solution Pools for a more detailed discussion of this topic.

Only available for MIP models.

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

## PoolNIntVioSum

- Type: `double`

- Modifiable: `No`

Sum of integrality violations in a sub-optimal MIP solution. Use parameter SolutionNumber to indicate which alternate solution to retrieve.

Please consult the section on Solution Pools for a more detailed discussion of this topic.

Only available for MIP models.

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

Help and Feedback

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