• Gurobi Staff

m.addConstr(x[t] == max_(y[t], z[t]))

m.addGenConstrMax(x[t], [y[t], z[t]])

Thank you very much. The first syntax does not work for me but the second one does.

• Gurobi Staff

Glad to hear it works. There was a ")" missing in the first one. I updated it accordingly. It should work too.

I get the same error with the first syntax, i.e. "name 'max_ ' not defined'

Could it be a limitation of the editor I am using?

• Gurobi Staff

The $$\texttt{max_}$$ function is part of the $$\texttt{gurobipy}$$ module. Thus, in your case, you have to access it via

gurobipy.max_(y[t], z[t])