Skip to main content

Constraint not working as intended

Answered

Comments

2 comments

  • Official comment
    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?.
  • Matthias Miltenberger
    • Gurobi Staff

    Hi Penelope,

    I am not sure what \(x\) and \(a\) represent in your model but apparently, every single sum \(\sum_{N_{ij}} x_{ij}\) is \(\geq 1\). You are also trying to maximize a sum that contains \(a\), so it shouldn't be surprising that all are set to 1.

    On a different note: You should define your variables like this:

    x = m.addVars(range(32), vtype=GRB.BINARY)
    a = m.addVars(range(32), vtype=GRB.BINARY)

    I hope this helps.

    Cheers,
    Matthias

    0

Post is closed for comments.