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

Deal with quadratic constraints

進行中

コメント

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.
  • Riley Clement
    • Gurobi Staff

    Hi Lorenz,

    You can retrieve quadratic constraints with gurobipy using the Model.getQConstrs() method.  You can then query relevant attributes listed here: Quadratic Constraint Attributes

    You can control the linearization of quadratic constraints (by Gurobi) using PreQLinearize.  Is there a motivation for wanting to do the linearization yourself?

    - Riley

    0
  • Lorenz Wagner
    • Gurobi-versary
    • Investigator
    • Conversationalist

    Hi Riley Clement thanks a lot. My guess would be something like this.

    for i in I:
        for t in range(2, len(T) + 1):
            m.addConstr(n[i, t] == n_h[i, t] - e[i, t] + b[i, t])
            m.addConstr(n_h[i, t] <= n[i, t-1] + sc[i, t])
            m.addConstr(n_h[i, t] >= (n[i, t-1] + sc[i, t])-M*r[i, t])
            m.addConstr(n_h[i, t] <= M*(1 - r[i, t]))

    Sadly i cant test it right now. Would that work?

    0

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