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?
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.