Skip to main content

Is it possible to have constraints such as z^1.5 <= v in the model

Answered

Comments

2 comments

  • Maliheh Aramon
    Gurobi Staff Gurobi Staff

    Hi Ebru, 

    Have you tried using the GRBModel.addGenConstrPow() method?  To model \( z^{1.5} \leq v\), you can have:

    z = model.addVar(name="z")
    y = model.addVar(name="y")
    v = model.addVar(name="v")

    model.addGenConstrPow(z, y, 1.5, name="map_power") # y = z^1.5
    model.addConstr(y <= v, name="inequality_constr")

    Gurobi versions 9.0 and later support bilinear constraints. To model \( z^{1.5} \leq vx\), you can have:

    x = model.addVar(vtype=GRB.BINARY, name="x")
    model.addConstr( y <= v * x, name="bilinear_constr")

    Best regrads,

    Maliheh

    1
  • Ebru Angun
    Gurobi-versary
    Conversationalist
    Curious

    Thank you Maliheh.

    0

Please sign in to leave a comment.