Skip to main content

about the constraints changed with variables

Awaiting user input

Comments

4 comments

  • Jonasz Staszek
    Community Moderator 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 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

Please sign in to leave a comment.