Concepts
Features
Reference
This section covers functions in thegurobipy.nlfunc module. Eachfunction can be called with any modeling object and returns anNLExpr orMNLExpr representing the resultingnonlinear expression. The resulting expression can be used to addnonlinear constraints to the model. For example:
importgurobipyasgpfromgurobipyimportGRB,nlfuncwithgp.Env()asenv,gp.Model(env=env)asmodel:x=model.addVar(lb=-GRB.INFINITY,name="x")y=model.addVar(lb=-GRB.INFINITY,name="y")z=model.addVar(lb=-GRB.INFINITY,name="z")# Create a constraint specifying z = sin(x + y)model.addConstr(z==nlfunc.sin(x+y))
Return an expression representing the square root of the argument.
expr – A modeling object or numeric value
If the argument is a term-based modeling object or numericvalue, returns anNLExpr. If the argument is amatrix-friendly modeling object, returns anMNLExpr.
Also note the additional information on how Gurobi handles thesquare root function internally.
Return an expression representing the sine of the argument.
Return an expression representing the cosine of the argument.
Return an expression representing the tangent function of theargument.
Return an expression representing the exponential function of theargument.
Return an expression representing the natural logarithm of theargument.
expr – A modeling object or numeric value
If the argument is a term-based modeling object or numericvalue, returns anNLExpr. If the argument is amatrix-friendly modeling object, returns anMNLExpr.
Also note the additional information on how Gurobi handles thelogarithm functions internally.
Return an expression representing the base 2 logarithm of theargument.
expr – A modeling object or numeric value
If the argument is a term-based modeling object or numericvalue, returns anNLExpr. If the argument is amatrix-friendly modeling object, returns anMNLExpr.
Also note the additional information on how Gurobi handles thelogarithm functions internally.
Return an expression representing the base 10 logarithm of theargument.
expr – A modeling object or numeric value
If the argument is a term-based modeling object or numericvalue, returns anNLExpr. If the argument is amatrix-friendly modeling object, returns anMNLExpr.
Also note the additional information on how Gurobi handles thelogarithm functions internally.
Return an expression representing the logistic function of theargument.
Return an expression representing the hyperbolic tangent function of theargument.
Return an expression representing the signed power function of theargument.
Return an expression representing the square of the argument.
Help and Feedback