Does the cvxpy replace the max function, which is convex, by MIP formulation under the hood when shows up in the constraints (for example, $\max(x,y)\le z$) or in the objective function? In gurobipy, we need to introduce a new variable and new constraint: $L=\max(x,y)$ and $L\le z$
Then gurobipy converts it to MIP.
for example:
import gurobipy as gp
m=gp.Model()
x=m.addvar(vtype='C')
y=m.addvar(vtype='C')
z=m.addvar(vtype='C')
L=m.addvar(vtype='C') # new variable
m.addConstr(L=gp.max_(x,y)) # new constraint
m.addaddConstr(L<=z)
L=gp.max_(x,y)
is nonconvex, and gurobipy converts it to MIP convex under the hood.
$\max(x,y)\le z$ can b formulated in cvxpy as follows:
import cvxpy as cp
Cons=[cp.max(x,y)<=z]
Does cvxpy do something similar to gurobipy?
Thanks, @xd y! My problem was the following: $$g+z\ge\max(x,y)+L$$ Does that mean it can be rewritten as $g+z\ge x+L$, $g+z\ge y+L$?