General Constraint Attributes#
These are general constraint attributes, meaning that they are associated with specific general constraints in the model. If the attribute name contains string “GenConstr”, then it is for all types of general constraints. If it starts with string “Func”, then it is only for function constraints.
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,
general constraint attributes are retrieved by invoking the get
method on a constraint object. For attributes that can be modified
directly by the user, you can use one of the various set
methods.
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.
FuncPieceError#
Type:
double
Modifiable:
Yes
If the FuncPieces attribute is set to value \(-1\) or \(-2\), this attribute provides the maximum allowed error (absolute for \(-1\), relative for \(-2\)) in the piecewise-linear approximation.
For examples of how to query or modify attributes, refer to our Attribute Examples.
FuncPieceLength#
Type:
double
Modifiable:
Yes
If the FuncPieces attribute is set to value \(1\), this attribute provides the length of each piece of the piecewise-linear approximation.
For examples of how to query or modify attributes, refer to our Attribute Examples.
FuncPieceRatio#
Type:
double
Modifiable:
Yes
This attribute controls whether the piecewise-linear approximation of a function constraint is an underestimate of the function, an overestimate, or somewhere in between. A value of \(0.0\) will always underestimate, while a value of \(1.0\) will always overestimate. A value in between will interpolate between the underestimate and the overestimate. A special value of -1 chooses points that are on the original function.
See the discussion of function constraints for more information.
For examples of how to query or modify attributes, refer to our Attribute Examples.
FuncPieces#
Type:
int
Modifiable:
Yes
This attribute sets the strategy used for performing a piecewise-linear approximation of a function constraint. There are a few options:
FuncPieces = 0: Ignore the attribute settings for this function constraint and use the parameter settings (FuncPieces, etc.) instead.
FuncPieces >= 2: Sets the number of pieces; pieces are equal width.
FuncPieces = 1: Uses a fixed width for each piece; the actual width is provided in the FuncPieceLength attribute.
FuncPieces = -1: Bounds the absolute error of the approximation; the error bound is provided in the FuncPieceError attribute.
FuncPieces = -2: Bounds the relative error of the approximation; the error bound is provided in the FuncPieceError attribute.
See the discussion of function constraints for more information.
For examples of how to query or modify attributes, refer to our Attribute Examples.
GenConstrType#
Type:
int
Modifiable:
No
General constraint type.
The language APIs contain enums that allows you to map the integer
constraint type to a more meaningful name. In C, you’ll find
GRB_GENCONSTR_MAX
, GRB_GENCONSTR_MIN
, etc. In the OO interfaces,
you’ll find GRB.GENCONSTR_MAX
, GRB.GENCONSTR_MIN
, etc.
For examples of how to query or modify attributes, refer to our Attribute Examples.
GenConstrName#
Type:
string
Modifiable:
Yes
General constraint name.
For examples of how to query or modify attributes, refer to our Attribute Examples.
IISGenConstr#
Type:
int
Modifiable:
No
For an infeasible model, indicates whether the general constraint participates in the computed Irreducible Inconsistent Subsystem (IIS). Only available after you have computed an IIS.
For examples of how to query or modify attributes, refer to our Attribute Examples.
IISGenConstrForce#
Type:
int
Modifiable:
Yes
When computing an Irreducible Inconsistent Subsystem (IIS) for an infeasible model, indicates whether the general constraint should be included or excluded from the IIS.
The default value of -1 lets the IIS algorithm decide.
If the attribute is set to 0, the constraint is not eligible for inclusion in the IIS.
If the attribute is set to 1, the constraint is included in the IIS and the IIS algorithm never considers the possibility of removing it.
Note that setting this attribute to 0 may make the resulting subsystem feasible (or consistent), which would then make it impossible to construct an IIS. Trying anyway will result in a IIS_NOT_INFEASIBLE error. Similarly, setting this attribute to 1 may result in an IIS that is not irreducible. More precisely, the system would only be irreducible with respect to the model elements that have force values of -1 or 0.
See the Model.computeIIS
documentation for more details.
For examples of how to query or modify attributes, refer to our Attribute Examples.