Concepts
Features
Reference
The Gurobi C++ interface overloads several arithmetic and comparisonoperators. Overloaded arithmetic operators (+,-,*,/) are used tocreate linear and quadratic expressions. Overloaded comparison operators(<=,>=,and==) are used to build linear and quadratic constraints.
Note that the results of overloaded comparison operators are generallynever stored in user variables. They are immediately passed toGRBModel::addConstr orGRBModel::addQConstr.
Create an equality constraint
lhsExpr – Left-hand side of equality constraint.
rhsExpr – Right-hand side of equality constraint.
A constraint of typeGRBTempConstr. The result istypically immediately passed toGRBModel::addConstr.
Create an inequality constraint
lhsExpr – Left-hand side of inequality constraint.
rhsExpr – Right-hand side of inequality constraint.
A constraint of typeGRBTempConstr. The result istypically immediately passed toGRBModel::addConstr orGRBModel::addQConstr.
Create an inequality constraint
lhsExpr – Left-hand side of inequality constraint.
rhsExpr – Right-hand side of inequality constraint.
A constraint of typeGRBTempConstr. The result istypically immediately passed toGRBModel::addConstr orGRBModel::addQConstr.
Overloaded operator on expression objects.
Add a pair of expressions.
expr1 – First expression to be added.
expr2 – Second expression to be added.
Sum expression.
Overloaded operator on expression objects.
Allow plus sign to be used before an expression.
expr – Expression.
Result expression.
Overloaded operator on expression objects.
Add a pair of variables.
x – First variable to be added.
y – Second variable to be added.
Sum expression.
Overloaded operator on expression objects.
Add a pair of expressions.
expr1 – First expression to be added.
expr2 – Second expression to be added.
Sum expression.
Overloaded operator on expression objects.
Allow plus sign to be used before an expression.
expr – Expression.
Result expression.
Overloaded operator on expression objects.
Subtract one expression from another.
expr1 – Start expression.
expr2 – Expression to be subtracted.
Difference expression.
Overloaded operator on expression objects.
Negate an expression.
expr – Expression.
Negation of expression.
Overloaded operator on expression objects.
Subtract one expression from another.
expr1 – Start expression.
expr2 – Expression to be subtracted.
Difference expression.
Overloaded operator on expression objects.
Negate an expression.
expr – Expression.
Negation of expression.
Overloaded operator on expression objects.
Multiply a variable and a constant.
x – Variable.
a – Constant multiplier.
Expression that represents the result of multiplying thevariable by a constant.
Overloaded operator on expression objects.
Multiply a variable and a constant.
a – Constant multiplier.
x – Variable.
Expression that represents the result of multiplying thevariable by a constant.
Overloaded operator on expression objects.
Multiply an expression and a constant.
expr – Expression.
a – Constant multiplier.
Expression that represents the result of multiplying theexpression by a constant.
Overloaded operator on expression objects.
Multiply an expression and a constant.
a – Constant multiplier.
expr – Expression.
Expression that represents the result of multiplying theexpression by a constant.
Overloaded operator on expression objects.
Multiply an expression and a constant.
expr – Expression.
a – Constant multiplier.
Expression that represents the result of multiplying theexpression by a constant.
Overloaded operator on expression objects.
Multiply an expression and a constant.
a – Constant multiplier.
expr – Expression.
Expression that represents the result of multiplying theexpression by a constant.
Overloaded operator on expression objects.
Multiply a pair of variables.
x – First variable.
y – Second variable.
Expression that represents the result of multiplying theargument variables.
Overloaded operator on expression objects.
Multiply an expression and a variable.
var – Variable.
expr – Expression.
Expression that represents the result of multiplying theexpression by a variable.
Overloaded operator on expression objects.
Multiply an expression and a variable.
var – Variable.
expr – Expression.
Expression that represents the result of multiplying theexpression by a variable.
Overloaded operator on expression objects.
Multiply a pair of expressions.
expr1 – First expression.
expr2 – Second expression.
Expression that represents the result of multiplying theargument expressions.
Overloaded operator to divide a variable or expression by a constant.
x – Variable.
a – Constant divisor.
Expression that represents the result of dividing the variableby a constant.
Overloaded operator to divide a variable or expression by a constant.
expr – Expression.
a – Constant divisor.
Expression that represents the result of dividing the expressionby a constant.
Overloaded operator to divide a variable or expression by a constant.
expr – Expression.
a – Constant divisor.
Expression that represents the result of dividing the expressionby a constant.
Help and Feedback