Skip to main content

i dont know why my code is not taking a constraint into account

Answered

Comments

1 comment

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

    Hi Sujana,

    I would recommend you undertake the following steps:

    1) Before optimizing your model, try to write it to your drive, for example as an .lp file:

    m.write("model.lp")

    and then compare the constraints you get with the mathematical formulation you are implementing. Such a comparison will tell you exactly, which constraints are implemented incorrectly.

    Perhaps you will need to use a smaller dataset to keep the size of the .lp file manageable.

    2) Once you know which constraints are culprits, you will usually also have an idea of how to fix them.

    Hope this helps. In case you have specific questions pertaining to the implementation of your model, we will gladly help you.

    Best regards
    Jonasz

    PS From afar, it seems to me that you may need at least one constraint of the form \( \Sigma x \geq 1 \) to get the effect you are after. All of the constraints are of " \( \leq \) " or  " \(  = \) " sense for now...

     

    0

Please sign in to leave a comment.