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

What is the difference between quadratic expression and quadratic constraint for gurobi?

回答済み

コメント

3件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Mario Ruthmair
    • Gurobi Staff

    Hi Hussein,

    A quadratic constraint consists of quadratic expressions, i.e., a quadratic expression is only a term involving products of variables, not a complete constraint.

    In your first case, where you add a quadratic constraint, the resulting model will be non-convex since quadratic equality constraints are always non-convex (except for a few special cases).

    In your second case, you do NOT add any quadratic constraints to the model, you just overwrite the Gurobi variable P[i,t] with some quadratic expression, which is not added to the model.

    To check what is actually included in your model, you could export it to a file with m.write("model.lp") and open the resulting plain text file.

    Best regards,
    Mario

    1
  • Hussein Sharadga
    • Gurobi-versary
    • Investigator
    • Conversationalist

    Thank you so much! Mario Ruthmair

    You are right. In my second case, the constraint was not added to the model. 

     

    Best,

    Hussein

    0

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