0

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?

sali
  • 33
  • 11

1 Answers1

0

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.

joni
  • 6,840
  • 2
  • 13
  • 20