Concepts
Features
Reference
Gurobi model object. Commonly used methods includeaddVar(adds a new decision variable to the model),addConstr (addsa new constraint to the model),optimize (optimizes thecurrent model), andget (retrieves the value of anattribute).
Constructor forGRBModel that creates an empty model. You canthen calladdVar andaddConstr to populatethe model with variables and constraints.
env – Environment for new model.
New model object. Model initially contains no variables orconstraints.
Constructor forGRBModel that reads a model from a file.Note that the type of the file isencoded in the file name suffix. Valid suffixes are.mps,.rew,.lp,.rlp,.dua,.dlp,.ilp, or.opb. The files can be compressed, so additionalsuffixes of.zip,.gz,.bz2,.7z or.xz are accepted.
env – Environment for new model.
modelname – Name of the file containing the model.
New model object.
Constructor forGRBModel that creates a copy of an existing model. Notethat due to the lazy update approach in Gurobi, you have to callupdate before copying it.
model – Model to copy.
New model object. Model is a clone of the original.
Copy an existing model to a different environment. Multiple threads cannot work simultaneously within the same environment. Copies of modelsmust therefore reside in different environments for multiple threads tooperate on them simultaneously.
Note that this method itself is not thread safe, so you should eithercall it from the main thread or protect access to it with a lock.
Note that pending updates will not be applied to the model, so youshould callupdate before copying if you would likethose to be included in the copy.
For Compute Server users, note that you can copy a model from a clientto a Compute Server environment, but it is not possible to copy modelsfrom a Compute Server environment to another (client or Compute Server)environment.
model – Model to copy.
targetenv – Environment to copy model into.
New model object. Model is a clone of the original.
Add a single linear constraint to a model.
lhsExpr – Left-hand side expression for new linear constraint.
sense – Sense for new linear constraint (GRB_LESS_EQUAL,GRB_EQUAL, orGRB_GREATER_EQUAL).
rhsExpr – Right-hand side expression for new linear constraint.
name – (optional) Name for new constraint.
New constraint object.
Add a single linear constraint to a model.
lhsExpr – Left-hand side expression for new linear constraint.
sense – Sense for new linear constraint (GRB_LESS_EQUAL,GRB_EQUAL, orGRB_GREATER_EQUAL).
rhsVar – Right-hand side variable for new linear constraint.
name – (optional) Name for new constraint.
New constraint object.
Add a single linear constraint to a model.
lhsExpr – Left-hand side expression for new linear constraint.
sense – Sense for new linear constraint (GRB_LESS_EQUAL,GRB_EQUAL, orGRB_GREATER_EQUAL).
rhsVal – Right-hand side value for new linear constraint.
name – (optional) Name for new constraint.
New constraint object.
Add a single linear constraint to a model.
lhsVar – Left-hand side variable for new linear constraint.
sense – Sense for new linear constraint (GRB_LESS_EQUAL,GRB_EQUAL, orGRB_GREATER_EQUAL).
rhsVar – Right-hand side variable for new linear constraint.
name – (optional) Name for new constraint.
New constraint object.
Add a single linear constraint to a model.
lhsVar – Left-hand side variable for new linear constraint.
sense – Sense for new linear constraint (GRB_LESS_EQUAL,GRB_EQUAL, orGRB_GREATER_EQUAL).
rhsVal – Right-hand side value for new linear constraint.
name – (optional) Name for new constraint.
New constraint object.
Add a single linear constraint to a model.
tc – Temporary constraint object, created using an overloadedcomparison operator. SeeGRBTempConstr for moreinformation.
name – (optional) Name for new constraint.
New constraint object.
Addcount new linear constraints to a model.
We recommend that you build your model one constraint at a time (usingaddConstr), since it introduces no significant overhead andwe find that it produces simpler code. Feel free to use these methods ifyou disagree, though.
count – Number of constraints to add to the model. The newconstraints are all of the form0<=0.
Array of new constraint objects. Note that the result isheap-allocated, and must be returned to the heap by the user.
Addcount new linear constraints to a model.
We recommend that you build your model one constraint at a time (usingaddConstr), since it introduces no significant overhead andwe find that it produces simpler code. Feel free to use these methods ifyou disagree, though.
lhsExprs – Left-hand side expressions for the new linearconstraints.
senses – Senses for new linear constraints (GRB_LESS_EQUAL,GRB_EQUAL, orGRB_GREATER_EQUAL).
rhsVals – Right-hand side values for the new linear constraints.
names – Names for new constraints.
count – Number of constraints to add.
Array of new constraint objects. Note that the result isheap-allocated, and must be returned to the heap by the user.
Add a newgeneral constraintof typeGRB_GENCONSTR_MAX to a model.
A MAX constraint\(r = \max\{x_1,\ldots,x_n,c\}\) states that theresultant variable\(r\) should be equal to the maximum of theoperand variables\(x_1,\ldots,x_n\) and the constant\(c\).
resvar – The resultant variable of the new constraint.
vars – Array of variables that are the operands of the newconstraint.
len – Number of operands in the new constraint (length ofvarsarray).
constant – (optional) The additional constant operand of the newconstraint.
name – (optional) Name for the new general constraint.
New general constraint.
Add a newgeneral constraintof typeGRB_GENCONSTR_MIN to a model.
A MIN constraint\(r = \min\{x_1,\ldots,x_n,c\}\) states that theresultant variable\(r\) should be equal to the minimum of theoperand variables\(x_1,\ldots,x_n\) and the constant\(c\).
resvar – The resultant variable of the new constraint.
vars – Array of variables that are the operands of the newconstraint.
len – Number of operands in the new constraint (length ofvarsarray).
constant – (optional) The additional constant operand of the newconstraint.
name – (optional) Name for the new general constraint.
New general constraint.
Add a newgeneral constraintof typeGRB_GENCONSTR_ABS to a model.
An ABS constraint\(r = \mbox{abs}\{x\}\) states that the resultantvariable\(r\) should be equal to the absolute value of the argumentvariable\(x\).
resvar – The resultant variable of the new constraint.
argvar – The argument variable of the new constraint.
name – (optional) Name for the new general constraint.
New general constraint.
Add a newgeneral constraintof typeGRB_GENCONSTR_AND to a model.
An AND constraint\(r = \mbox{and}\{x_1,\ldots,x_n\}\) states thatthe binary resultant variable\(r\) should be\(1\) if and onlyif all of the operand variables\(x_1,\ldots,x_n\) are equal to\(1\). If any of the operand variables is\(0\), then theresultant should be\(0\) as well.
Note that all variables participating in such a constraint will beforced to be binary, independent of how they were created.
resvar – The resultant binary variable of the new constraint.
vars – Array of binary variables that are the operands of the newconstraint.
len – Number of operands in the new constraint (length ofvarsarray).
name – (optional) Name for the new general constraint.
New general constraint.
Add a newgeneral constraintof typeGRB_GENCONSTR_OR to a model.
An OR constraint\(r = \mbox{or}\{x_1,\ldots,x_n\}\) states that thebinary resultant variable\(r\) should be\(1\) if and only ifany of the operand variables\(x_1,\ldots,x_n\) is equal to\(1\). If all operand variables are\(0\), then the resultantshould be\(0\) as well.
Note that all variables participating in such a constraint will beforced to be binary, independent of how they were created.
resvar – The resultant binary variable of the new constraint.
vars – Array of binary variables that are the operands of the newconstraint.
len – Number of operands in the new constraint (length ofvarsarray).
name – (optional) Name for the new general constraint.
New general constraint.
Add a newgeneral constraintof typeGRB_GENCONSTR_NORM to a model.
A NORM constraint\(r = \mbox{norm}\{x_1,\ldots,x_n\}\) states thatthe resultant variable\(r\) should be equal to the vector norm ofthe argument vector\(x_1,\ldots,x_n\).
resvar – The resultant variable of the new constraint.
vars – Array of variables that are the operands of the newconstraint. Note that this array may not contain duplicates.
len – Number of operands in the new constraint (length ofvarsarray).
which – Which norm to use. Options are 0, 1, 2, and GRB_INFINITY.
name – (optional) Name for the new general constraint.
New general constraint.
Add a newgeneral constraint of typeGRB_GENCONSTR_NLto a model.
An NL constraint\(r = f(x)\) states that the resultant variable\(r\) should be equal to the function value\(f(x)\) of thegiven function\(f\), provided as an expression tree as described inNonlinear Constraints.
resvar – The index of the resultant variable\(r\) whosevalue will be equal to the function value of the given function\(f\).
nnodes – The number of nodes in the expression tree, thatis, the length of the input arraysopcode,data andparent.
opcode – An array containing theoperation codes for the nodes.
data – An array containing the auxiliary data for each node.For expression nodes of typeGRB_OPCODE_VARIABLE thevariable index of a variable must be retrieved with theGRBVar::index method.
parent – An array providing the parent index of the nodes.
name – (optional) Name for the new general constraint.
New general constraint.
Add a newgeneral constraintof typeGRB_GENCONSTR_INDICATOR to amodel.
An INDICATOR constraint\(z = f \rightarrow a^Tx \leq b\) statesthat if the binary indicator variable\(z\) is equal to\(f\),where\(f \in \{0,1\}\), then the linear constraint\(a^Tx \leq b\) should hold. On the other hand, if\(z = 1-f\),the linear constraint may be violated. The sense of the linearconstraint can also be specified to be\(=\) or\(\geq\).
Note that the indicator variable\(z\) of a constraint will beforced to be binary, independent of how it was created.
binvar – The binary indicator variable.
binval – The value for the binary indicator variable that wouldforce the linear constraint to be satisfied (\(0\) or\(1\)).
expr – Left-hand side expression for the linear constrainttriggered by the indicator.
sense – Sense for the linear constraint. Options areGRB_LESS_EQUAL,GRB_EQUAL, orGRB_GREATER_EQUAL.
rhs – Right-hand side value for the linear constraint.
name – (optional) Name for the new general constraint.
New general constraint.
Add a newgeneral constraintof typeGRB_GENCONSTR_INDICATOR to amodel.
An INDICATOR constraint\(z = f \rightarrow a^Tx \leq b\) statesthat if the binary indicator variable\(z\) is equal to\(f\),where\(f \in \{0,1\}\), then the linear constraint\(a^Tx \leq b\) should hold. On the other hand, if\(z = 1-f\),the linear constraint may be violated. The sense of the linearconstraint can also be specified to be\(=\) or\(\geq\).
Note that the indicator variable\(z\) of a constraint will beforced to be binary, independent of how it was created.
binvar – The binary indicator variable.
binval – The value for the binary indicator variable that wouldforce the linear constraint to be satisfied (\(0\) or\(1\)).
constr – Temporary constraint object defining the linear constraintthat is triggered by the indicator. The temporary constraint object iscreated using an overloaded comparison operator. SeeGRBTempConstr for more information.
name – (optional) Name for the new general constraint.
New general constraint.
Add a newgeneral constraintof typeGRB_GENCONSTR_PWL to a model.
A piecewise-linear (PWL) constraint states that the relationship\(y =f(x)\) must hold between variables\(x\) and\(y\), where\(f\) is a piecewise-linear function. The breakpoints for\(f\)are provided as arguments. Refer to the description ofpiecewise-linear objectives fordetails of how piecewise-linear functions are defined.
xvar – The\(x\) variable.
yvar – The\(y\) variable.
npts – The number of points that define the piecewise-linearfunction.
xpts – The\(x\) values for the points that define thepiecewise-linear function. Must be in non-decreasing order.
ypts – The\(y\) values for the points that define thepiecewise-linear function.
name – (optional) Name for the new general constraint.
New general constraint.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Add a newgeneral constraintof typeGRB_GENCONSTR_POLY to a model.
A polynomial function constraint states that the relationship\(y = p_0 x^d + p_1 x^{d-1} + ... + p_{d-1} x + p_{d}\) should holdbetween variables\(x\) and\(y\).
A piecewise-linear approximation of the functionis added to the model. The details of the approximation are controlledusing the following four attributes (or using the parameters with thesame names):FuncPieces,FuncPieceError,FuncPieceLength, andFuncPieceRatio.Alternatively, the function can be treated as a nonlinear constraint bysetting the attributeFuncNonlinear. For details, consult theGeneral Constraintdiscussion.
xvar – The\(x\) variable.
yvar – The\(y\) variable.
plen – The length of coefficient arrayp. If\(x^d\) is thehighest power term, thenplen should be\(d+1\).
p – The coefficients for the polynomial function (starting with thecoefficient for the highest power).
name – (optional) Name for the new general constraint.
options – (optional) A string that can be used to set theattributes that control the piecewise-linear approximation of thisfunction constraint. To assign a value to an attribute, follow theattribute name with an equal sign and the desired value (with nospaces). Assignments for different attributes should be separated byspaces (e.g. “FuncPieces=-1 FuncPieceError=0.001”).
New general constraint.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Add a newgeneral constraintof typeGRB_GENCONSTR_EXP to a model.
A natural exponential function constraint states that the relationship\(y = \exp(x)\) should hold for variables\(x\) and\(y\).
A piecewise-linear approximation of the functionis added to the model. The details of the approximation are controlledusing the following four attributes (or using the parameters with thesame names):FuncPieces,FuncPieceError,FuncPieceLength, andFuncPieceRatio.Alternatively, the function can be treated as a nonlinear constraint bysetting the attributeFuncNonlinear. For details, consult theGeneral Constraintdiscussion.
xvar – The\(x\) variable.
yvar – The\(y\) variable.
name – (optional) Name for the new general constraint.
options – (optional) A string that can be used to set theattributes that control the piecewise-linear approximation of thisfunction constraint. To assign a value to an attribute, follow theattribute name with an equal sign and the desired value (with nospaces). Assignments for different attributes should be separated byspaces (e.g. “FuncPieces=-1 FuncPieceError=0.001”).
New general constraint.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Add a newgeneral constraintof typeGRB_GENCONSTR_EXPA to a model.
An exponential function constraint states that the relationship\(y = a^x\) should hold for variables\(x\) and\(y\), where\(a > 0\) is the (constant) base.
A piecewise-linear approximation of the functionis added to the model. The details of the approximation are controlledusing the following four attributes (or using the parameters with thesame names):FuncPieces,FuncPieceError,FuncPieceLength, andFuncPieceRatio.Alternatively, the function can be treated as a nonlinear constraint bysetting the attributeFuncNonlinear. For details, consult theGeneral Constraintdiscussion.
xvar – The\(x\) variable.
yvar – The\(y\) variable.
a – The base of the function,\(a > 0\).
name – (optional) Name for the new general constraint.
options – (optional) A string that can be used to set theattributes that control the piecewise-linear approximation of thisfunction constraint. To assign a value to an attribute, follow theattribute name with an equal sign and the desired value (with nospaces). Assignments for different attributes should be separated byspaces (e.g. “FuncPieces=-1 FuncPieceError=0.001”).
New general constraint.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Add a newgeneral constraintof typeGRB_GENCONSTR_LOG to a model.
A natural logarithmic function constraint states that the relationship\(y = log(x)\) should hold for variables\(x\) and\(y\).
A piecewise-linear approximation of the functionis added to the model. The details of the approximation are controlledusing the following four attributes (or using the parameters with thesame names):FuncPieces,FuncPieceError,FuncPieceLength, andFuncPieceRatio.Alternatively, the function can be treated as a nonlinear constraint bysetting the attributeFuncNonlinear. For details, consult theGeneral Constraintdiscussion.
xvar – The\(x\) variable.
yvar – The\(y\) variable.
name – (optional) Name for the new general constraint.
options – (optional) A string that can be used to set theattributes that control the piecewise-linear approximation of thisfunction constraint. To assign a value to an attribute, follow theattribute name with an equal sign and the desired value (with nospaces). Assignments for different attributes should be separated byspaces (e.g. “FuncPieces=-1 FuncPieceError=0.001”).
New general constraint.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Add a newgeneral constraintof typeGRB_GENCONSTR_LOGA to a model.
A logarithmic function constraint states that the relationship\(y = log_a(x)\) should hold for variables\(x\) and\(y\),where\(a > 0\) is the (constant) base.
A piecewise-linear approximation of the functionis added to the model. The details of the approximation are controlledusing the following four attributes (or using the parameters with thesame names):FuncPieces,FuncPieceError,FuncPieceLength, andFuncPieceRatio.Alternatively, the function can be treated as a nonlinear constraint bysetting the attributeFuncNonlinear. For details, consult theGeneral Constraintdiscussion.
xvar – The\(x\) variable.
yvar – The\(y\) variable.
a – The base of the function,\(a > 0\).
name – (optional) Name for the new general constraint.
options – (optional) A string that can be used to set theattributes that control the piecewise-linear approximation of thisfunction constraint. To assign a value to an attribute, follow theattribute name with an equal sign and the desired value (with nospaces). Assignments for different attributes should be separated byspaces (e.g. “FuncPieces=-1 FuncPieceError=0.001”).
New general constraint.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Add a newgeneral constraintof typeGRB_GENCONSTR_LOGISTIC to amodel.
A logistic function constraint states that the relationship\(y = \frac{1}{1 + e^{-x}}\) should hold for variables\(x\) and\(y\).
A piecewise-linear approximation of the functionis added to the model. The details of the approximation are controlledusing the following four attributes (or using the parameters with thesame names):FuncPieces,FuncPieceError,FuncPieceLength, andFuncPieceRatio.Alternatively, the function can be treated as a nonlinear constraint bysetting the attributeFuncNonlinear. For details, consult theGeneral Constraintdiscussion.
xvar – The\(x\) variable.
yvar – The\(y\) variable.
name – (optional) Name for the new general constraint.
options – (optional) A string that can be used to set theattributes that control the piecewise-linear approximation of thisfunction constraint. To assign a value to an attribute, follow theattribute name with an equal sign and the desired value (with nospaces). Assignments for different attributes should be separated byspaces (e.g. “FuncPieces=-1 FuncPieceError=0.001”).
New general constraint.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Add a newgeneral constraintof typeGRB_GENCONSTR_POW to a model.
A power function constraint states that the relationship\(y = x^a\)should hold for variables\(x\) and\(y\), where\(a\) isthe (constant) exponent.
If the exponent\(a\) is negative, the lower bound on\(x\) mustbe strictly positive. If the exponent isn’t an integer, the lower boundon\(x\) must be non-negative.
A piecewise-linear approximation of the functionis added to the model. The details of the approximation are controlledusing the following four attributes (or using the parameters with thesame names):FuncPieces,FuncPieceError,FuncPieceLength, andFuncPieceRatio.Alternatively, the function can be treated as a nonlinear constraint bysetting the attributeFuncNonlinear. For details, consult theGeneral Constraintdiscussion.
xvar – The\(x\) variable.
yvar – The\(y\) variable.
a – The exponent of the function.
name – (optional) Name for the new general constraint.
options – (optional) A string that can be used to set theattributes that control the piecewise-linear approximation of thisfunction constraint. To assign a value to an attribute, follow theattribute name with an equal sign and the desired value (with nospaces). Assignments for different attributes should be separated byspaces (e.g. “FuncPieces=-1 FuncPieceError=0.001”).
New general constraint.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Add a newgeneral constraintof typeGRB_GENCONSTR_SIN to a model.
A sine function constraint states that the relationship\(y = sin(x)\) should hold for variables\(x\) and\(y\).
A piecewise-linear approximation of the functionis added to the model. The details of the approximation are controlledusing the following four attributes (or using the parameters with thesame names):FuncPieces,FuncPieceError,FuncPieceLength, andFuncPieceRatio.Alternatively, the function can be treated as a nonlinear constraint bysetting the attributeFuncNonlinear. For details, consult theGeneral Constraintdiscussion.
xvar – The\(x\) variable.
yvar – The\(y\) variable.
name – (optional) Name for the new general constraint.
options – (optional) A string that can be used to set theattributes that control the piecewise-linear approximation of thisfunction constraint. To assign a value to an attribute, follow theattribute name with an equal sign and the desired value (with nospaces). Assignments for different attributes should be separated byspaces (e.g. “FuncPieces=-1 FuncPieceError=0.001”).
New general constraint.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Add a newgeneral constraintof typeGRB_GENCONSTR_COS to a model.
A cosine function constraint states that the relationship\(y = cos(x)\) should hold for variables\(x\) and\(y\).
A piecewise-linear approximation of the functionis added to the model. The details of the approximation are controlledusing the following four attributes (or using the parameters with thesame names):FuncPieces,FuncPieceError,FuncPieceLength, andFuncPieceRatio.Alternatively, the function can be treated as a nonlinear constraint bysetting the attributeFuncNonlinear. For details, consult theGeneral Constraintdiscussion.
xvar – The\(x\) variable.
yvar – The\(y\) variable.
name – (optional) Name for the new general constraint.
options – (optional) A string that can be used to set theattributes that control the piecewise-linear approximation of thisfunction constraint. To assign a value to an attribute, follow theattribute name with an equal sign and the desired value (with nospaces). Assignments for different attributes should be separated byspaces (e.g. “FuncPieces=-1 FuncPieceError=0.001”).
New general constraint.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Add a newgeneral constraintof typeGRB_GENCONSTR_TAN to a model.
A tangent function constraint states that the relationship\(y = tan(x)\) should hold for variables\(x\) and\(y\).
A piecewise-linear approximation of the functionis added to the model. The details of the approximation are controlledusing the following four attributes (or using the parameters with thesame names):FuncPieces,FuncPieceError,FuncPieceLength, andFuncPieceRatio.Alternatively, the function can be treated as a nonlinear constraint bysetting the attributeFuncNonlinear. For details, consult theGeneral Constraintdiscussion.
xvar – The\(x\) variable.
yvar – The\(y\) variable.
name – (optional) Name for the new general constraint.
options – (optional) A string that can be used to set theattributes that control the piecewise-linear approximation of thisfunction constraint. To assign a value to an attribute, follow theattribute name with an equal sign and the desired value (with nospaces). Assignments for different attributes should be separated byspaces (e.g. “FuncPieces=-1 FuncPieceError=0.001”).
New general constraint.
Add a quadratic constraint to a model.
Important
Gurobi can handle both convex and non-convex quadraticconstraints. The differences between them can be both important andsubtle. Refer tothis discussion foradditional information.
lhsExpr – Left-hand side expression for new quadratic constraint.
sense – Sense for new quadratic constraint (GRB_LESS_EQUAL,GRB_EQUAL, orGRB_GREATER_EQUAL).
rhsExpr – Right-hand side expression for new quadratic constraint.
name – (optional) Name for new constraint.
New quadratic constraint object.
Add a quadratic constraint to a model.
Important
Gurobi can handle both convex and non-convex quadraticconstraints. The differences between them can be both important andsubtle. Refer tothis discussion foradditional information.
lhsExpr – Left-hand side expression for new quadratic constraint.
sense – Sense for new quadratic constraint (GRB_LESS_EQUAL,GRB_EQUAL, orGRB_GREATER_EQUAL).
rhsVar – Right-hand side variable for new quadratic constraint.
name – (optional) Name for new constraint.
New quadratic constraint object.
Add a quadratic constraint to a model.
Important
Gurobi can handle both convex and non-convex quadraticconstraints. The differences between them can be both important andsubtle. Refer tothis discussion foradditional information.
tc – Temporary constraint object, created using an overloadedcomparison operator. SeeGRBTempConstr for moreinformation.
name – (optional) Name for new constraint.
New quadratic constraint object.
Add a single range constraint to a model. A range constraint states thatthe value of the input expression must be between the specifiedlower andupper bounds in any solution.
Note that range constraints are stored internally as equalityconstraints. We add an extra variable to the model to capture the rangeinformation. Thus, theSense attribute on a range constraintwill always beGRB_EQUAL. In particular introducing a rangeconstraint
is equivalent to adding a slack variable\(s\) and the followingconstraints
expr – Linear expression for new range constraint.
lower – Lower bound for linear expression.
upper – Upper bound for linear expression.
name – (optional) Name for new constraint.
New constraint object.
Add new range constraints to a model. A range constraint states that thevalue of the input expression must be between the specifiedlowerandupper bounds in any solution.
exprs – Linear expressions for the new range constraints.
lower – Lower bounds for linear expressions.
upper – Upper bounds for linear expressions.
name – Names for new range constraints.
count – Number of range constraints to add.
Array of new constraint objects. Note that the result isheap-allocated, and must be returned to the heap by the user.
Add an SOS constraint to the model. Please refer tothis section for details on SOSconstraints.
vars – Array of variables that participate in the SOS constraint.
weights – Weights for the variables in the SOS constraint.
len – Number of members in the new SOS set (length ofvars andweights arrays).
type – SOS type (can beGRB_SOS_TYPE1 orGRB_SOS_TYPE2).
New SOS constraint.
Add a single decision variable to a model; non-zero entries will be added later.
lb – Lower bound for new variable.
ub – Upper bound for new variable.
obj – Objective coefficient for new variable.
type – Variable type for new variable (GRB_CONTINUOUS,GRB_BINARY,GRB_INTEGER,GRB_SEMICONT, orGRB_SEMIINT).
name – (optional) Name for new variable.
New variable object.
Add a single decision variable and the associated non-zero coefficients to a model.
lb – Lower bound for new variable.
ub – Upper bound for new variable.
obj – Objective coefficient for new variable.
type – Variable type for new variable (GRB_CONTINUOUS,GRB_BINARY,GRB_INTEGER,GRB_SEMICONT, orGRB_SEMIINT).
numnz – Number of constraints in which this new variableparticipates.
constrs – Array of constraints in which the variable participates.
coeffs – Array of coefficients for each constraint in which thevariable participates.
name – (optional) Name for new variable.
New variable object.
Add a single decision variable and the associated non-zero coefficients to a model.
lb – Lower bound for new variable.
ub – Upper bound for new variable.
obj – Objective coefficient for new variable.
type – Variable type for new variable (GRB_CONTINUOUS,GRB_BINARY,GRB_INTEGER,GRB_SEMICONT, orGRB_SEMIINT).
col – GRBColumn object for specifying a set of constraints to whichnew variable belongs.
name – (optional) Name for new variable.
New variable object.
Addcount new decision variables to a model. All associatedattributes take their default values, except the variabletype,which is specified as an argument.
count – Number of variables to add.
type – (optional) Variable type for new variables(GRB_CONTINUOUS,GRB_BINARY,GRB_INTEGER,GRB_SEMICONT,orGRB_SEMIINT).
Array of new variable objects. Note that the result isheap-allocated, and must be returned to the heap by the user.
Addcount new decision variables to a model. This signature allowsyou to use arrays to hold the various variable attributes (lower bound,upper bound, etc.).
lb – Lower bounds for new variables. Can beNULL, in which casethe variables get lower bounds of 0.0.
ub – Upper bounds for new variables. Can beNULL, in which casethe variables get infinite upper bounds.
obj – Objective coefficients for new variables. Can beNULL, inwhich case the variables get objective coefficients of 0.0.
type – Variable types for new variables (GRB_CONTINUOUS,GRB_BINARY,GRB_INTEGER,GRB_SEMICONT, orGRB_SEMIINT).Can beNULL, in which case the variables are assumed to becontinuous.
names – Names for new variables. Can beNULL, in which case allvariables are given default names.
count – The number of variables to add.
Array of new variable objects. Note that the result isheap-allocated, and must be returned to the heap by the user.
Addcount new decision variables to a model. This signature allows you tospecify the set of constraints to which each new variable belongs usingan array ofGRBColumn objects.
lb – Lower bounds for new variables. Can beNULL, in which casethe variables get lower bounds of 0.0.
ub – Upper bounds for new variables. Can beNULL, in which casethe variables get infinite upper bounds.
obj – Objective coefficients for new variables. Can beNULL, inwhich case the variables get objective coefficients of 0.0.
type – Variable types for new variables (GRB_CONTINUOUS,GRB_BINARY,GRB_INTEGER,GRB_SEMICONT, orGRB_SEMIINT).Can beNULL, in which case the variables are assumed to becontinuous.
names – Names for new variables. Can beNULL, in which case allvariables are given default names.
cols – GRBColumn objects for specifying a set of constraints towhich each new column belongs.
count – The number of variables to add.
Array of new variable objects. Note that the result isheap-allocated, and must be returned to the heap by the user.
Change one coefficient in the model. The desired change is capturedusing aGRBVar object, aGRBConstr object, and a desiredcoefficient for the specified variable in the specified constraint. Ifyou make multiple changes to the same coefficient, the last one will beapplied.
Note that, due to our lazy update approach, thechange won’t actually take effect until you update the model (usingGRBModel::update), optimize the model (usingGRBModel::optimize), or write the model to disk (usingGRBModel::write).
constr – Constraint for coefficient to be changed.
var – Variable for coefficient to be changed.
newvalue – Desired new value for coefficient.
Change a list of coefficients in the model. Each desired change iscaptured using aGRBVar object, aGRBConstr object, and adesired coefficient for the specified variable in the specifiedconstraint. The entries in the input arrays each correspond to a singledesired coefficient change. If you make multiple changes to the samecoefficient, the last one will be applied.
Note that, due to our lazy update approach, thechange won’t actually take effect until you update the model (usingGRBModel::update), optimize the model (usingGRBModel::optimize), or write the model to disk (usingGRBModel::write).
constrs – Constraints for coefficients to be changed.
vars – Variables for coefficients to be changed.
vals – Desired new values for coefficients.
len – Number of coefficients to change (length ofvars,constrs, andvals arrays).
Compute an Irreducible Inconsistent Subsystem (IIS).
An IIS is a subset of the constraints and variable bounds with thefollowing properties:
It is still infeasible, and
If a single constraint or bound is removed, the subsystem becomesfeasible.
Note that an infeasible model may have multiple IISs. The one returnedby Gurobi is not necessarily the smallest one; there may exist otherswith fewer constraints or bounds.
IIS results are returned in a number of attributes:IISConstr,IISLB,IISUB,IISSOS,IISQConstr, andIISGenConstr.Each indicates whether the corresponding model element is a member ofthe computed IIS.
Note that for models with general function constraints, piecewise-linearapproximation of the constraints may cause unreliable IIS results.
TheIIS log provides information about theprogress of the algorithm, including a guess at the eventual IIS size.
Termination parameters such asTimeLimit,WorkLimit,MemLimit, andSoftMemLimit are considered when computing an IIS. If an IIScomputation is interrupted before completion or stops due to a terminationparameter, Gurobi will return the smallest infeasible subsystem found to thatpoint. The model attributeIISMinimal can be used to check whetherthe computed IIS is minimal.
TheIISConstrForce,IISLBForce,IISUBForce,IISSOSForce,IISQConstrForce, andIISGenConstrForce attributesallow you mark model elements to either include or exclude from thecomputed IIS. Setting the attribute to 1 forces the correspondingelement into the IIS, setting it to 0 forces it out of the IIS, andsetting it to -1 allows the algorithm to decide.
To give an example of when these attributes might be useful, considerthe case where an initial model is known to be feasible, but it becomesinfeasible after adding constraints or tightening bounds. If you areonly interested in knowing which of the changes caused theinfeasibility, you can force the unmodified bounds and constraints intothe IIS. That allows the IIS algorithm to focus exclusively on the newconstraints, which will often be substantially faster.
Note that setting any of theForce attributes to 0 may make theresulting subsystem feasible, which would then make it impossible toconstruct an IIS. Trying anyway will result in aIIS_NOT_INFEASIBLE error. Similarly, settingthis attribute to 1 may result in an IIS that is not irreducible. Moreprecisely, the system would only be irreducible with respect to themodel elements that have force values of -1 or 0.
This method populates theIISConstr,IISQConstr,andIISGenConstr constraint attributes, theIISSOS, SOS attribute, and theIISLB andIISUB variable attributes. You can also obtain informationabout the results of the IIS computation by writing a.ilp formatfile (seeGRBModel::write). This file contains onlythe IIS from the original model.
Use theIISMethod parameter to adjust the behavior ofthe IIS algorithm.
Note that this method can be used to compute IISs for both continuousand MIP models.
Turn the MIP model into a continuousone, in place.A solution (e.g. obtained through a call to theoptimize method) or a MIP start must beavailable in the MIP model. If no solution is available, the MIP startspecified withStartNumber is used.
In the model, each integer variable is fixed to the value that variable takesin the MIP solution or MIP start. In addition, continuous variables may befixed to satisfy SOS or general constraints. The result is that the model hasneither integrality constraints, SOS constraints, nor general constraints anymore.
Note
While the fixed problem is always a continuous model, it may contain anon-convex quadratic objective or non-convex quadratic constraints. As aresult, it may still be solved using the MIP algorithm.
Note
An error is raised if the converted model contains more than oneobjective or scenario, or if the model contains concurrent environmentsor tune environments.
Discard concurrent environments for a model.
The concurrent environments created bygetConcurrentEnv willbe used by every subsequent call to the concurrent optimizer until theconcurrent environments are discarded.
Discard all multi-objective environments associated with the model, thusrestoring multi objective optimization to its default behavior.
Please refer to the discussion ofMultiple Objectives for information onhow to specify multiple objective functions and control the trade-offbetween them.
UsegetMultiobjEnv to create a multi-objective environment.
Modifies theGRBModel object to create a feasibility relaxation.Note that you need to calloptimize on the result to computethe actual relaxed solution.
The feasibility relaxation is a model that, when solved, minimizes theamount by which the solution violates the bounds and linear constraintsof the original model. This method provides a number of options forspecifying the relaxation.
If you specifyrelaxobjtype=0, the objective of the feasibilityrelaxation is to minimize the sum of the weighted magnitudes of thebound and constraint violations. Thelbpen,ubpen, andrhspen arguments specify the cost per unit violation in the lowerbounds, upper bounds, and linear constraints, respectively.
If you specifyrelaxobjtype=1, the objective of the feasibilityrelaxation is to minimize the weighted sum of the squares of the boundand constraint violations. Thelbpen,ubpen, andrhspenarguments specify the coefficients on the squares of the lower bound,upper bound, and linear constraint violations, respectively.
If you specifyrelaxobjtype=2, the objective of the feasibilityrelaxation is to minimize the weighted count of bound and constraintviolations. Thelbpen,ubpen, andrhspen arguments specifythe cost of violating a lower bound, upper bound, and linear constraint,respectively.
To give an example, if a constraint withrhspen valuep isviolated by 2.0, it would contribute2*p to the feasibilityrelaxation objective forrelaxobjtype=0, it would contribute2*2*p forrelaxobjtype=1, and it would contributep forrelaxobjtype=2.
Theminrelax argument is a boolean that controls the type offeasibility relaxation that is created. Ifminrelax=false,optimizing the returned model gives a solution that minimizes the costof the violation. Ifminrelax=true, optimizing the returned modelfinds a solution that minimizes the original objective, but only fromamong those solutions that minimize the cost of the violation. Note thatfeasRelax must solve an optimization problem to find the minimumpossible relaxation whenminrelax=true, which can be quiteexpensive.
There are two signatures for this method. The more complex one takes alist of variables and constraints, as well as penalties associated withrelaxing the corresponding lower bounds, upper bounds, and constraints.If a variable or constraint is not included in one of these lists, theassociated bounds or constraints may not be violated. The simplersignature takes a pair of boolean arguments,vrelax andcrelax,that indicate whether variable bounds and/or constraints can beviolated. Ifvrelax/crelax istrue, then everybound/constraint is allowed to be violated, respectively, and theassociated cost is 1.0.
For an example of how this routine transforms a model, and more detailsabout the variables and constraints created, please seethis section.
Note that this is a destructive method: it modifies the model on whichit is invoked. If you don’t want to modify your original model, use theGRBModelconstructor to create a copy beforeinvoking this method.
Create a feasibility relaxation model.
relaxobjtype – The cost function used when finding the minimum costrelaxation.
minrelax – The type of feasibility relaxation to perform.
vlen – The length of the list of variables whose bounds are allowedto be violated.
vars – Variables whose bounds are allowed to be violated.
lbpen – Penalty for violating a variable lower bound. One entry foreach variable in argumentvars.
ubpen – Penalty for violating a variable upper bound. One entry foreach variable in argumentvars.
clen – The length of the list of linear constraints that areallowed to be violated.
constrs – Linear constraints that are allowed to be violated.
rhspen – Penalty for violating a linear constraint. One entry foreach constraint in argumentconstrs.
Zero ifminrelax is false. Ifminrelax is true, thereturn value is the objective value for the relaxation performed. If thevalue is less than 0, it indicates that the method failed to create thefeasibility relaxation.
Modifies theGRBModel object to create a feasibility relaxation.Note that you need to calloptimize on the result to computethe actual relaxed solution.
The feasibility relaxation is a model that, when solved, minimizes theamount by which the solution violates the bounds and linear constraintsof the original model. This method provides a number of options forspecifying the relaxation.
If you specifyrelaxobjtype=0, the objective of the feasibilityrelaxation is to minimize the sum of the weighted magnitudes of thebound and constraint violations. Thelbpen,ubpen, andrhspen arguments specify the cost per unit violation in the lowerbounds, upper bounds, and linear constraints, respectively.
If you specifyrelaxobjtype=1, the objective of the feasibilityrelaxation is to minimize the weighted sum of the squares of the boundand constraint violations. Thelbpen,ubpen, andrhspenarguments specify the coefficients on the squares of the lower bound,upper bound, and linear constraint violations, respectively.
If you specifyrelaxobjtype=2, the objective of the feasibilityrelaxation is to minimize the weighted count of bound and constraintviolations. Thelbpen,ubpen, andrhspen arguments specifythe cost of violating a lower bound, upper bound, and linear constraint,respectively.
To give an example, if a constraint withrhspen valuep isviolated by 2.0, it would contribute2*p to the feasibilityrelaxation objective forrelaxobjtype=0, it would contribute2*2*p forrelaxobjtype=1, and it would contributep forrelaxobjtype=2.
Theminrelax argument is a boolean that controls the type offeasibility relaxation that is created. Ifminrelax=false,optimizing the returned model gives a solution that minimizes the costof the violation. Ifminrelax=true, optimizing the returned modelfinds a solution that minimizes the original objective, but only fromamong those solutions that minimize the cost of the violation. Note thatfeasRelax must solve an optimization problem to find the minimumpossible relaxation whenminrelax=true, which can be quiteexpensive.
There are two signatures for this method. The more complex one takes alist of variables and constraints, as well as penalties associated withrelaxing the corresponding lower bounds, upper bounds, and constraints.If a variable or constraint is not included in one of these lists, theassociated bounds or constraints may not be violated. The simplersignature takes a pair of boolean arguments,vrelax andcrelax,that indicate whether variable bounds and/or constraints can beviolated. Ifvrelax/crelax istrue, then everybound/constraint is allowed to be violated, respectively, and theassociated cost is 1.0.
For an example of how this routine transforms a model, and more detailsabout the variables and constraints created, please seethis section.
Note that this is a destructive method: it modifies the model on whichit is invoked. If you don’t want to modify your original model, use theGRBModelconstructor to create a copy beforeinvoking this method.
Simplified method for creating a feasibility relaxation model.
relaxobjtype – The cost function used when finding the minimum costrelaxation.
minrelax – The type of feasibility relaxation to perform.
vrelax – Indicates whether variable bounds can be relaxed (with acost of 1.0 for any violations.
crelax – Indicates whether linear constraints can be relaxed (witha cost of 1.0 for any violations.
Zero ifminrelax is false. Ifminrelax is true, thereturn value is the objective value for the relaxation performed. If thevalue is less than 0, it indicates that the method failed to create thefeasibility relaxation.
Create the fixed model associated witha MIP model.A solution (e.g. obtained through a call to theoptimize method) or a MIP start must beavailable in the MIP model. If no solution is available, the MIP startspecified withStartNumber is used.
In the model, each integer variable is fixed to the value that variable takesin the MIP solution or MIP start. In addition, continuous variables may befixed to satisfy SOS or general constraints. The result is that the model hasneither integrality constraints, SOS constraints, nor general constraints anymore.
Note
While the fixed problem is always a continuous model, it may contain anon-convex quadratic objective or non-convex quadratic constraints. As aresult, it may still be solved using the MIP algorithm.
Note
On a multi-objective model, all but the first objectives are ignored. Allscenarios are ignored as well, if any.
Fixed model associated with calling object.
Query the value of a parameter.
param – The parameter being queried.
The current value of the requested parameter.
Query the value of a double, int, or string-valued model attribute.
attr – The attribute being queried.
The current value of the requested attribute.
Query an attribute for an array of modeling objects.
attr – The attribute being queried.
objs – An array of modeling objects, i.e., variables or constraints,whose attribute values are being queried.
count – The number of attributes to retrieve.
The current values of the requested attribute for each inputobject. Note that the result is heap-allocated, and must be returnedto the heap by the user.
Query the coefficient of variablevar in linear constraintconstr (note that the result can be zero).
constr – The requested constraint.
var – The requested variable.
The current value of the requested coefficient.
Retrieve the list of constraints in which a variable participates, andthe associated coefficients. The result is returned as aGRBColumn object.
var – The variable of interest.
AGRBColumn object that captures the set ofconstraints in which the variable participates.
Create/retrieve a concurrent environment for a model.
This method provides fine-grained control over the concurrent optimizer.By creating your own concurrent environments and setting appropriateparameters on these environments (e.g., theMethodparameter), you can control exactly which strategies the concurrentoptimizer employs. For example, if you create two concurrentenvironments, and setMethod to primal simplex for one and dualsimplex for the other, subsequent concurrent optimizer runs will use thetwo simplex algorithms rather than the default choices.
Note that you must create contiguously numbered concurrent environments,starting withnum=0. For example, if you want three concurrentenvironments, they must be numbered 0, 1, and 2.
Once you create concurrent environments, they will be used for everysubsequent concurrent optimization on that model. UsediscardConcurrentEnvs to revert back to default concurrentoptimizer behavior.
num – The concurrent environment number.
The concurrent environment for the model.
Retrieve a linear constraint from its name. If multiple linearconstraints have the same name, this method chooses one arbitrarily.
name – The name of the desired linear constraint.
The requested linear constraint.
Note
Retrieving constraint objects by name is not recommended in general. Whenadding constraints to a model, you should keep track of the returned objectsin your own data structures in order to retrieve them efficiently formodel building and extracting attribute values.
Retrieve an array of all linear constraints in the model.
An array of all linear constraints in the model. Note that thisarray is heap-allocated, and must be returned to the heap by the user.
Retrieve the data associated with a general constraint of type MAX.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
Typical usage is to call this routine twice. In the first call, youspecify the requested general constraint, with aNULL value for thevars argument. The routine returns the total number of operandvariables in the specified general constraint inlenP. That allowsyou to make certain that thevars array is of sufficient size tohold the result of the second call.
See alsoaddGenConstrMax for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
resvarP – Pointer to store the resultant variable of theconstraint.
vars – Array to store the operand variables of the constraint.
lenP – Pointer to store the number of operand variables of theconstraint.
constantP – Pointer to store the additional constant operand of theconstraint.
Retrieve the data associated with a general constraint of type MIN.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
Typical usage is to call this routine twice. In the first call, youspecify the requested general constraint, with aNULL value for thevars argument. The routine returns the total number of operandvariables in the specified general constraint inlenP. That allowsyou to make certain that thevars array is of sufficient size tohold the result of the second call.
See alsoaddGenConstrMin for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
resvarP – Pointer to store the resultant variable of theconstraint.
vars – Array to store the operand variables of the constraint.
lenP – Pointer to store the number of operand variables of theconstraint.
constantP – Pointer to store the additional constant operand of theconstraint.
Retrieve the data associated with a general constraint of type NL.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
Typical usage is to call this routine twice. In the first call, you specifythe requested general constraint, with aNULL value for theopcode,data andparent arguments. The routine returns the total number ofnodes that form the expression tree for the specified general constraint innnodesP. That allows you to make certain that theopcode,data andparent arrays are of sufficient size to hold the result of the second call.
See alsoNonlinear Constraints andaddGenConstrNL fora description of the semantics of this general constraint type.
genc – The general constraint to retrieve.
Note that any of the following arguments can beNULL.
resvarP – The variable of the resultant variable of the constraint.
nnodesP – The number of nodes in the expression tree for this constraint.
opcode – An array to store the nodes’ operation codes.
data – An array to store the nodes’ auxiliary data items.
parent – An array to store the nodes’ parent indices.
Retrieve the data associated with a general constraint of type ABS.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
See alsoaddGenConstrAbs for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
resvarP – Pointer to store the resultant variable of theconstraint.
argvarP – Pointer to store the argument variable of the constraint.
Retrieve the data associated with a general constraint of type AND.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
Typical usage is to call this routine twice. In the first call, youspecify the requested general constraint, with aNULL value for thevars argument. The routine returns the total number of operandvariables in the specified general constraint inlenP. That allowsyou to make certain that thevars array is of sufficient size tohold the result of the second call.
See alsoaddGenConstrAnd for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
resvarP – Pointer to store the resultant variable of theconstraint.
vars – Array to store the operand variables of the constraint.
lenP – Pointer to store the number of operand variables of theconstraint.
Retrieve the data associated with a general constraint of type OR.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
Typical usage is to call this routine twice. In the first call, youspecify the requested general constraint, with aNULL value for thevars argument. The routine returns the total number of operandvariables in the specified general constraint inlenP. That allowsyou to make certain that thevars array is of sufficient size tohold the result of the second call.
See alsoaddGenConstrOr for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
resvarP – Pointer to store the resultant variable of theconstraint.
vars – Array to store the operand variables of the constraint.
lenP – Pointer to store the number of operand variables of theconstraint.
Retrieve the data associated with a general constraint of type NORM.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
Typical usage is to call this routine twice. In the first call, youspecify the requested general constraint, with aNULL value for thevars argument. The routine returns the total number of operandvariables in the specified general constraint inlenP. That allowsyou to make certain that thevars array is of sufficient size tohold the result of the second call.
See alsoaddGenConstrNorm for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
resvarP – Pointer to store the resultant variable of theconstraint.
vars – Array to store the operand variables of the constraint.
lenP – Pointer to store the number of operand variables of theconstraint.
whichP – Pointer to store the norm type (possible values are 0, 1,2, or GRB_INFINITY).
Retrieve the data associated with a general constraint of type INDICATOR.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
See alsoaddGenConstrIndicator for a description of thesemantics of this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
binvarP – Pointer to store the binary indicator variable of theconstraint.
binvalP – Pointer to store the value that the indicator variablehas to take in order to trigger the linear constraint.
exprP – Pointer to aGRBLinExpr object to store theleft-hand side expression of the linear constraint that is triggered bythe indicator.
senseP – Pointer to store the sense for the linear constraint.Options areGRB_LESS_EQUAL,GRB_EQUAL, orGRB_GREATER_EQUAL.
rhsP – Pointer to store the right-hand side value for the linearconstraint.
Retrieve the data associated with a general constraint of type PWL.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
Typical usage is to call this routine twice. In the first call, youspecify the requested general constraint, with aNULL value for thexpts andypts arguments. The routine returns the length for thexpts andypts arrays innptsP. That allows you to makecertain that thexpts andypts arrays are of sufficient size tohold the result of the second call.
See alsoaddGenConstrPWL for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
xvarP – Pointer to store the\(x\) variable.
yvarP – Pointer to store the\(y\) variable.
nptsP – Pointer to store the number of points that define thepiecewise-linear function.
xpts – The\(x\) values for the points that define thepiecewise-linear function.
ypts – The\(y\) values for the points that define thepiecewise-linear function.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Retrieve the data associated with a general constraint of type POLY.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
Typical usage is to call this routine twice. In the first call, youspecify the requested general constraint, with aNULL value for thep argument. The routine returns the length of thep array inplenP. That allows you to make certain that thep array is ofsufficient size to hold the result of the second call.
See alsoaddGenConstrPoly for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
xvarP – Pointer to store the\(x\) variable.
yvarP – Pointer to store the\(y\) variable.
plenP – Pointer to store the array length for p. If\(x^d\) isthe highest power term, then\(d+1\) will be returned.
p – The coefficients for polynomial function.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Retrieve the data associated with a general constraint of type EXP.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
See alsoaddGenConstrExp for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
xvarP – Pointer to store the\(x\) variable.
yvarP – Pointer to store the\(y\) variable.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Retrieve the data associated with a general constraint of type EXPA.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
See alsoaddGenConstrExpA for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
xvarP – Pointer to store the\(x\) variable.
yvarP – Pointer to store the\(y\) variable.
aP – Pointer to store the base of the function.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Retrieve the data associated with a general constraint of type LOG.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
See alsoaddGenConstrLog for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
xvarP – Pointer to store the\(x\) variable.
yvarP – Pointer to store the\(y\) variable.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Retrieve the data associated with a general constraint of type LOGA.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
See alsoaddGenConstrLogA for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
xvarP – Pointer to store the\(x\) variable.
yvarP – Pointer to store the\(y\) variable.
aP – Pointer to store the base of the function.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Retrieve the data associated with a general constraint of type LOGISTIC.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
See alsoaddGenConstrLogistic for a description of thesemantics of this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
xvarP – Pointer to store the\(x\) variable.
yvarP – Pointer to store the\(y\) variable.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Retrieve the data associated with a general constraint of type POW.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
See alsoaddGenConstrPow for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
xvarP – Pointer to store the\(x\) variable.
yvarP – Pointer to store the\(y\) variable.
aP – Pointer to store the exponent of the function.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Retrieve the data associated with a general constraint of type SIN.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
See alsoaddGenConstrSin for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
xvarP – Pointer to store the\(x\) variable.
yvarP – Pointer to store the\(y\) variable.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Retrieve the data associated with a general constraint of type COS.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
See alsoaddGenConstrCos for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
xvarP – Pointer to store the\(x\) variable.
yvarP – Pointer to store the\(y\) variable.
Deprecated since version 13.0:Usingfunction constraints is deprecated since version 13.0.Please usenonlinear constraints instead.
Retrieve the data associated with a general constraint of type TAN.Calling this method for a general constraint of a different type leadsto an exception. You can query theGenConstrType attribute to determine the typeof the general constraint.
See alsoaddGenConstrTan for a description of the semanticsof this general constraint type.
Any of the following arguments can beNULL.
genc – The general constraint object.
xvarP – Pointer to store the\(x\) variable.
yvarP – Pointer to store the\(y\) variable.
Retrieve an array of all general constraints in the model.
An array of all general constraints in the model. Note that thisarray is heap-allocated, and must be returned to the heap by the user.
After a call tooptimize, this method returns the resulting solution andrelated model attributes as a JSON string. Please refer to theJSON solution format section for details.
A JSON string.
Create/retrieve a multi-objective environment for the optimization passwith the given index. This environment enables fine-grained control overthe multi-objective optimization process. Specifically, by changingparameters on this environment, you modify the behavior of theoptimization that occurs during the corresponding pass of themulti-objective optimization.
Each multi-objective environment starts with a copy of the current modelenvironment.
Please refer to the discussion ofMultiple Objectives for information onhow to specify multiple objective functions and control the trade-offbetween them.
Please refer to the discussion onCombining Blended and Hierarchical Objectivesfor information on the optimization passes to solve multi-objectivemodels.
UsediscardMultiobjEnvs to discard multi-objectiveenvironments and return to standard behavior.
index – The optimization pass index, starting from 0.
The multi-objective environment for that optimization pass whensolving the model.
Retrieve the optimization objective.
Note that the constant and linear portions of the objective can also beretrieved using theObjCon andObj attributes.
The model objective.
Retrieve an alternative optimization objective. Alternative objectiveswill always be linear. You can also use this routine to retrieve theprimary objective (usingindex = 0), but you will get an exceptionif the primary objective contains quadratic terms.
Please refer to the discussion ofMultiple Objectives for more informationon the use of alternative objectives.
Note that alternative objectives can also be retrieved using theObjNCon andObjN attributes.
index – The index for the requested alternative objective.
The requested alternate objective.
Retrieve the piecewise-linear objective function for a variable. Thereturn value gives the number of points that define the function, andthe\(x\) and\(y\) arguments give the coordinates of thepoints, respectively. The\(x\) and\(y\) arguments must belarge enough to hold the result. Call this method withNULL valuesfor\(x\) and\(y\) if you just want the number of points.
Refer tothis discussion foradditional information on what the values in\(x\) and\(y\)mean.
var – The variable whose objective function is being retrieved.
x – The\(x\) values for the points that define thepiecewise-linear function. These will always be in non-decreasing order.
y – The\(y\) values for the points that define thepiecewise-linear function.
The number of points that define the piecewise-linear objectivefunction.
Retrieve the left-hand side expression from a quadratic constraint. Theresult is returned as aGRBQuadExpr object.
qconstr – The quadratic constraint of interest.
AGRBQuadExpr object that captures the left-handside of the quadratic constraint.
Retrieve an array of all quadratic constraints in the model.
An array of all quadratic constraints in the model. Note thatthis array is heap-allocated, and must be returned to the heap by theuser.
Retrieve a list of variables that participate in a constraint, and theassociated coefficients. The result is returned as aGRBLinExpr object.
constr – The constraint of interest. AGRBConstrobject, typically obtained fromaddConstr orgetConstrs.
AGRBLinExpr object that captures the set ofvariables that participate in the constraint.
Retrieve the list of variables that participate in an SOS constraint,and the associated coefficients. The return value is the length of thislist. If you would like to allocate space for the result beforeretrieving the result, call the method first withNULL arrayarguments to determine the appropriate array lengths.
sos – The SOS set of interest.
vars – A list of variables that participate insos.
weights – The SOS weights for each participating variable.
typeP – The type of the SOS set (eitherGRB_SOS_TYPE1 orGRB_SOS_TYPE2).
The length of the result arrays.
Retrieve an array of all SOS constraints in the model.
An array of all SOS constraints in the model. Note that thisarray is heap-allocated, and must be returned to the heap by the user.
Use this method to retrieve the results of a previoustunecall. Calling this method with argumentn causes tuned parameter setn to be copied into the model. Parameter sets are stored in order ofdecreasing quality, with parameter set 0 being the best. The number ofavailable sets is stored in attributeTuneResultCount.
Once you have retrieved a tuning result, you can calloptimize to use these parameter settings to optimize themodel, orwrite to write the changed parameters to a.prm file.
Please refer to theparameter tuning section fordetails on the tuning tool.
n – The index of the tuning result to retrieve. The best result isavailable as index 0. The number of stored results is available inattributeTuneResultCount.
Retrieve a variable from its name. If multiple variables have the samename, this method chooses one arbitrarily.
name – The name of the desired variable.
The requested variable.
Note
Retrieving variable objects by name is not recommended in general. Whenadding variables to a model, you should keep track of the returned objectsin your own data structures in order to retrieve them efficiently formodel building and extracting attribute values.
Retrieve an array of all variables in the model.
An array of all variables in the model. Note that this array isheap-allocated, and must be returned to the heap by the user.
Optimize a model. The algorithm used for theoptimization depends on the model type (simplex or barrier for acontinuous model; branch-and-cut for a MIP model). Upon successfulcompletion, this method will populate the solution related attributesof the model. See theAttributes section formore information on attributes. The algorithm will terminate early if itreaches any of the limits set bytermination parameters.
Please consultthis section for adiscussion of some of the practical issues associated with solving aprecisely defined mathematical model using finite-precisionfloating-point arithmetic.
Note that this method will process all pending model modifications.
Optimize a model asynchronously. This method returns immediately. Yourprogram can perform other computations while optimization proceeds inthe background. To check the state of the asynchronous optimization,query theStatus attribute for the model. A value ofGRB_INPROGRESS indicates that the optimization has not yet completed.When you are done with your foreground tasks, you must callsync to sync your foreground program with the asynchronousoptimization task.
Note that the set of Gurobi calls that you are allowed to make whileoptimization is running in the background is severely limited.Specifically, you can only perform attribute queries, and only for afew attributes (listed below). Any other calls on the running model,or on any other models that were built within the same Gurobienvironment, will raise an exception with error codeGRB_ERROR_OPTIMIZATION_IN_PROGRESS.
Note that there are no such restrictions on models built in otherenvironments. Thus, for example, you could create multiple environments,and then have a single foreground program launch multiple simultaneousasynchronous optimizations, each in its own environment.
As already noted, you are allowed to query the value of theStatus attribute while an asynchronous optimization is inprogress. The other attributes that can be queried are:ObjVal,ObjBound,IterCount,NodeCount,BarIterCount,NLBarIterCount, andNLBarIterCount. In each case, the returned value reflectsprogress in the optimization to that point. Any attempt to query the valueof an attribute not on this list will raise an exception with error codeGRB_ERROR_OPTIMIZATION_IN_PROGRESS.
Submit a new batch request to the Cluster Manager. Returns the BatchID(a string), which uniquely identifies the job in the Cluster Manager andcan be used to query the status of this request (from this program orfrom any other). Once the request has completed, theBatchID canalso be used to retrieve the associated solution. To submit a batchrequest, you must tag at least one element of the model by setting oneof theVTag,CTag orQCTag attributes.For more details on batch optimization, please refer to theBatch Optimization section.
Note that this routine will process all pending model modifications.
// submit batch requestbatchID=model->optimizeBatch();
Perform presolve on a model.
Please note that the presolved modelcomputed by this function may be different from the presolved modelcomputed when optimizing the model.
Presolved version of original model.
This method is the general entry point for importing data from a fileinto a model. It can be used to read basis files for continuous models,start vectors for MIP models, variable hints for MIP models, branchingpriorities for MIP models, or parameter settings.The type of dataread is determined by the file suffix. File formats are described in theFile Format section.
Note that reading a file doesnot process all pending modelmodifications. These modifications can be processed by callingGRBModel::update.
Note also that this isnot the method to use if you want to read anew model from a file. For that, use theGRBModelconstructor. One variant of theconstructor takes the name of the file that contains the new model asits argument.
filename – Name of the file to read. The suffix on the file must beeither.bas (for an LP basis),.mst or.sol (for a MIPstart),.hnt (for MIP hints),.ord (for a priority order),.attr (for a collection of attribute settings), or.prm (for a parameter file). The suffix may optionally be followedby.zip,.gz,.bz2,.7z or.xz.
Remove a modeling object, i.e., a variable or constraint, from the model.Note that, due to our lazy update approach, thechange won’t actually take effect until you update the model (usingGRBModel::update), optimize the model (usingGRBModel::optimize), or write the model to disk (usingGRBModel::write).
obj – The object to remove.
Reset the model to an unsolved state, discarding any previously computedsolution information. Note that, due to our lazy update approach, thechange won’t actually take effect until you update the model (usingGRBModel::update), optimize the model (usingGRBModel::optimize), or write the model to disk (usingGRBModel::write).
clearall – (optional) A value of 1 discards additional informationthat affects the solution process but not the actual model (currentlyMIP starts, variable hints, branching priorities, lazy flags, andpartition information). The default value of 0 just discards thesolution.
Set the callback object for a model. This function additionally allows forspecifying for whichwhere flags the callback should be invoked.Thecallback() method on this object will be called periodically fromthe Gurobi solver. You will have the opportunity to obtain more detailedinformation about the state of the optimization from this callback.See the documentation forGRBCallback for additional information.
Note that a model can only have a single callback method, so this callwill replace an existing callback.
cb – New callback object. To disable a previously set callback,call this method with aNULL argument.
wheres – (optional) A bit vector defining for whichwhere flags thecallback should be invoked. It should contain value 1 in the n-thposition if you want the callback to be invoked for thewhere flagof value n. See the possible values atCallback Codes, andthe example below. If not specified, the default value would be all bits enabled.
Note
Even if thePOLLING bit is not setin thewheres bit vector, the callback may still be invoked withwhere set to that value.
classmycallback:publicGRBCallback{public:intnumcalls;mycallback(){numcalls=0;}protected:voidcallback(){// count number of callback callsnumcalls++;}};mycallbackcb=mycallback();// only invoked in presolve or when simplex is runmodel.setCallback(&cb,(1<<GRB_CB_PRESOLVE)|(1<<GRB_CB_SIMPLEX));
Reset all parameters to their default values.
Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
model.resetParams()
Set the value of a double, int, or string-valued parameter.
The difference between setting a parameter on a model and setting it onan environment (i.e., throughGRBEnv::set) is that theformer modifies the parameter for a single model, while the lattermodifies the parameter for every model that is subsequently built usingthat environment (and leaves the parameter unchanged for models thatwere previously built using that environment).
param – The parameter being modified.
newvalue – The desired new value for the parameter.
Set the value of a double, int, or string-valued model attribute.
attr – The attribute being modified.
newvalue – The desired new value for the attribute.
Set an attribute for an array of modeling objects.
attr – The attribute being modified.
objs – An array of modeling objects, i.e., variables orconstraints, whose attribute values are being modified.
newvalues – The desired new values for the attribute for each inputobject.
count – The number of attributes to set.
Set the model objective equal to a linear expression (formulti-objective optimization, seesetObjectiveN).
Note that you can also modify the linear portion of a model objectiveusing theObj variable attribute. If you wish to mix andmatch these two approaches, please note that this method replaces theentire existing objective, while theObj attribute can beused to modify individual linear terms.
linexpr – New linear model objective.
sense – (optional) Optimization sense (GRB_MINIMIZE forminimization,GRB_MAXIMIZE for maximization). Omit this argument touse theModelSense attribute value to determine the sense.
Set the model objective equal to a quadratic expression. Note thatthis method replaces the entire existing objective, including thelinear terms, even if the given quadratic expression has no linearterms.
quadexpr – New quadratic model objective.
sense – (optional) Optimization sense (GRB_MINIMIZE forminimization,GRB_MAXIMIZE for maximization). Omit this argument touse theModelSense attribute value.
Set an alternative optimization objective equal to a linear expression.
Please refer to the discussion ofMultiple Objectives for more informationon the use of alternative objectives.
Note that you can also modify an alternative objective using theObjN variable attribute. If you wish to mix and match thesetwo approaches, please note that this method replaces the entireexisting objective, while theObjN attribute can be used tomodify individual terms.
expr – New alternative objective.
index – Index for new objective. If you use an index of 0, thisroutine will change the primary optimization objective.
priority – Priority for the alternative objective. Thisinitializes theObjNPriority attribute for this objective.
weight – Weight for the alternative objective. This initializestheObjNWeight attribute for this objective.
abstol – Absolute tolerance for the alternative objective. Thisinitializes theObjNAbsTol attribute for this objective.
reltol – Relative tolerance for the alternative objective. Thisinitializes theObjNRelTol attribute for this objective.
name – Name of the alternative objective. This initializes theObjNName attribute for this objective.
Set a piecewise-linear objective function for a variable.
The arguments to this method specify a list of points that define apiecewise-linear objective function for a single variable. Specifically,the\(x\) and\(y\) arguments give coordinates for the verticesof the function.
For additional details on piecewise-linear objective functions, refer tothis discussion.
var – The variable whose objective function is being set.
npoints – Number of points that define the piecewise-linearfunction.
x – The\(x\) values for the points that define thepiecewise-linear function. Must be in non-decreasing order.
y – The\(y\) values for the points that define thepiecewise-linear function.
Capture a single scenario from a multi-scenario model. Use theScenarioNumber parameter to indicate which scenario tocapture.
The model on which this method is invoked must be a multi-scenariomodel, and the result will be a single-scenario model.
Model for a single scenario.
Wait for a previous asynchronous optimization call to complete.
Callingoptimizeasync returns control to the calling routineimmediately. The caller can perform other computations whileoptimization proceeds, and can check on the progress of the optimizationby querying various model attributes. Thesync call forces thecalling program to wait until the asynchronous optimization callcompletes. Youmust callsync before the corresponding modelobject is deleted.
Thesync call throws an exception if the optimization itself raninto any problems. In other words, exceptions thrown by this method arethose thatoptimize itself would have thrown, had the originalmethod not been asynchronous.
Note that you need to callsync even if you know that theasynchronous optimization has already completed.
Generate a request to terminate the current optimization. This methodcan be called at any time during an optimization (from a callback, fromanother thread, from an interrupt handler, etc.). Note that, in general,the request won’t be acted upon immediately.
When the optimization stops, theStatus attribute will beequal toGRB_INTERRUPTED.
Perform an automated search for parameter settings that improveperformance. Upon completion, this method stores the best parameter setsit found. The number of stored parameter sets can be determined byquerying the value of theTuneResultCount attribute. Theactual settings can be retrieved usinggetTuneResult.
Please refer to theparameter tuning section fordetails on the tuning tool.
Process any pending model modifications.
This method is the general entry point for writing optimization data toa file. It can be used to write optimization models, solution vectors,basis vectors, start vectors, or parameter settings. The type of datawritten is determined by the file suffix. File formats are described intheFile Format section.
Note that writing a model to a file will process all pending modelmodifications. This is also true when writing other model informationsuch as solutions, bases, etc.
Note also that when you write a Gurobi parameter file (PRM), bothinteger or double parameters not at their default value will be saved,but no string parameter will be saved into the file.
Finally, note that whenIgnoreNames=1, the namesof variables and constraints are replaced with default names whenwriting a file.
filename – The name of the file to be written. The file typeis encoded in the file name suffix. Valid suffixes are.mps,.rew,.lp, or.rlp for writing the model itself,.dua or.dlp for writing the dualized model (only pureLP),.ilp for writing just the IIS associated with aninfeasible model (seeGRBModel::computeIIS forfurther information),.sol for writing the solution selectedby theSolutionNumber parameter,.mst forwriting a start vector,.hnt for writing a hint file,.bas for writing an LP basis,.prm for writing modifiedparameter settings,.attr for writing model attributes, or.json for writing solution information in JSON format. Ifyour system has compression utilities installed (e.g.,7z orzip for Windows, andgzip,bzip2, orunzip forLinux or macOS), then the files can be compressed, so additionalsuffixes of.zip,.gz,.bz2,.7z or.xz are accepted.
Help and Feedback
GRBModelGRBModel::GRBModelGRBModel::GRBModelGRBModel::GRBModelGRBModel::GRBModelGRBModel::addConstrGRBModel::addConstrGRBModel::addConstrGRBModel::addConstrGRBModel::addConstrGRBModel::addConstrGRBModel::addConstrsGRBModel::addConstrsGRBModel::addGenConstrMaxGRBModel::addGenConstrMinGRBModel::addGenConstrAbsGRBModel::addGenConstrAndGRBModel::addGenConstrOrGRBModel::addGenConstrNormGRBModel::addGenConstrNLGRBModel::addGenConstrIndicatorGRBModel::addGenConstrIndicatorGRBModel::addGenConstrPWLGRBModel::addGenConstrPolyGRBModel::addGenConstrExpGRBModel::addGenConstrExpAGRBModel::addGenConstrLogGRBModel::addGenConstrLogAGRBModel::addGenConstrLogisticGRBModel::addGenConstrPowGRBModel::addGenConstrSinGRBModel::addGenConstrCosGRBModel::addGenConstrTanGRBModel::addQConstrGRBModel::addQConstrGRBModel::addQConstrGRBModel::addRangeGRBModel::addRangesGRBModel::addSOSGRBModel::addVarGRBModel::addVarGRBModel::addVarGRBModel::addVarsGRBModel::addVarsGRBModel::addVarsGRBModel::chgCoeffGRBModel::chgCoeffsGRBModel::computeIISGRBModel::convertToFixedGRBModel::discardConcurrentEnvsGRBModel::discardMultiobjEnvsGRBModel::feasRelaxGRBModel::feasRelaxGRBModel::fixedModelGRBModel::get[Param]GRBModel::get[Attr]GRBModel::get[Attr,1D]GRBModel::getCoeffGRBModel::getColGRBModel::getConcurrentEnvGRBModel::getConstrByNameGRBModel::getConstrsGRBModel::getGenConstrMaxGRBModel::getGenConstrMinGRBModel::getGenConstrNLGRBModel::getGenConstrAbsGRBModel::getGenConstrAndGRBModel::getGenConstrOrGRBModel::getGenConstrNormGRBModel::getGenConstrIndicatorGRBModel::getGenConstrPWLGRBModel::getGenConstrPolyGRBModel::getGenConstrExpGRBModel::getGenConstrExpAGRBModel::getGenConstrLogGRBModel::getGenConstrLogAGRBModel::getGenConstrLogisticGRBModel::getGenConstrPowGRBModel::getGenConstrSinGRBModel::getGenConstrCosGRBModel::getGenConstrTanGRBModel::getGenConstrsGRBModel::getJSONSolutionGRBModel::getMultiobjEnvGRBModel::getObjectiveGRBModel::getObjectiveGRBModel::getPWLObjGRBModel::getQCRowGRBModel::getQConstrsGRBModel::getRowGRBModel::getSOSGRBModel::getSOSsGRBModel::getTuneResultGRBModel::getVarByNameGRBModel::getVarsGRBModel::optimizeGRBModel::optimizeasyncGRBModel::optimizeBatchGRBModel::presolveGRBModel::readGRBModel::removeGRBModel::resetGRBModel::setCallbackGRBModel::resetParamsGRBModel::set[Param]GRBModel::set[Attr]GRBModel::set[Attr,1D]GRBModel::setObjectiveGRBModel::setObjectiveGRBModel::setObjectiveNGRBModel::setPWLObjGRBModel::singleScenarioModelGRBModel::syncGRBModel::terminateGRBModel::tuneGRBModel::updateGRBModel::write