Skip to main content

set new constraint but got NotImplementedError

Answered

Comments

5 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff 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?.
  • Jaromił Najman
    • Gurobi Staff Gurobi Staff

    Hi,

    Mathematical solvers like Gurobi do not support strict inequality constraints. A workaround would be to introduce a small tolerance, i.e., set the constraint to something like \(\text{term} \geq 1 + 10^{-4}\).

    Best regards,
    Jaromił

    1
  • Matthias Miltenberger
    • Gurobi Staff Gurobi Staff

    Hi,

    Please see this article about why Gurobi does not allow strict inequality constraints. This is why you are seeing this error message.

    To verify whether your model actually corresponds to the mathematical formulation, we recommend writing out the LP file. You can do this via model.write("mymodel.lp").

    I hope that helps.

    Cheers,
    Matthias

    0
  • chaung yun chi
    • Gurobi-versary
    • Curious
    • Conversationalist

    I tried 

    m.write("project_412.lp")

    it only showed 

    Warning: Q constraint 0 doesn't have a name
    Warning: linear constraint 1 and linear constraint 2 have the same name "onlyone"

    what is Q constraint?

    All of my constraints has different names, what does the second warning try to tell me? 

    0
  • Jaromił Najman
    • Gurobi Staff Gurobi Staff

    The term Q constraint refers to a quadratic constraint. The second warning states that two linear constraints have the same name. It seems like you are using non-ascii charactesr to name your constraints. This may cause trouble. Please try using standard ascii characters without whitespaces when naming your variables and constraints.

    0

Post is closed for comments.