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

about the constraints changed with variables

ユーザーの入力を待っています。

コメント

5件のコメント

  • 正式なコメント
    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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Jonasz Staszek
    • Community Moderator
    • Gurobi-versary
    • Thought Leader
    • First Question

    You can do it via indicator constraints. Perhaps this post will give you an idea of how to go about this.

    Additionally, I would suggest that you have a look at this entry concerning the creation of quadratic constraints, and make sure that your Python syntax is correct.

    Best regards
    Jonasz 

    0
  • Hu Zhenghao
    • Gurobi-versary
    • First Comment
    • First Question

    Thanks for your suggestion, I tried to use a binary variable and use indicator constraints, but the constraint is quadratic. So I added a new variable to define the quadratic equation, it works. I really appreciate your help!  

    0
  • Hu Zhenghao
    • Gurobi-versary
    • First Comment
    • First Question

    Actually, my objective is also changed with variables, like :

    if p[9,0]>=4:

       objective=max p[9,1]

    else:

       objective=max p[9,0]

    the expression is simplified.The objective function is segmented and nonlinear. Here the indicator constraints don't work, I also wonder how could I settle this.

    0
  • Jonasz Staszek
    • Community Moderator
    • Gurobi-versary
    • Thought Leader
    • First Question

    I am afraid you can't change the objective this way. But perhaps you can find a way to reformulate your objective in such a way that the change is not required?

    Best regards,
    Jonasz

    0

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