メインコンテンツへスキップ

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

回答済み

コメント

3件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Maliheh Aramon
    • 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

投稿コメントは受け付けていません。