logarithmic constraints in gurobi
Clash Royale CLAN TAG#URR8PPP
logarithmic constraints in gurobi
I am trying to solve a model with gurobi optimizer in python. Part of one constraint is logarithmic:
import numpy as np
k = beta * np.log(f_var)
model.addConstr(t_var == t0 * (1 + alpha * k))
t0, alpha and beta are given, but f_var and t_var are model variables. Gurobi doesn't accept numpy function and return this error:
AttributeError: 'gurobipy.Var' object has no attribute 'log'
can anyone help me?
1 Answer
1
Gurobi can only handle linear, quadratic and piece-wise linear functions as constraints. To solve your model, you need a nonlinear programming solver like Ipopt.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.