Skip to main content

Getting Binding Constraints

Answered

Comments

6 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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.
  • Eli Towle
    • Gurobi Staff

    After optimizing, you can check if each (linear) constraint's Slack attribute is sufficiently close to \(0\). For example, in Python:

    binding = [c for c in model.getConstrs() if abs(c.Slack) < 1e-6]
    1
  • MEHMET RIFAT KAMBER
    • Gurobi-versary
    • First Comment
    • First Question

    Thank you Mr Towle

    0
  • Muhammad Dzulqarnain Firdausi
    • Gurobi-versary
    • First Comment
    • First Question

    Dear Mr. Towle, when I executed the code, It thrown me an error

    AttributeError: 'ConcreteModel' object has no attribute 'getConstrs'
    0
  • Muhammad Dzulqarnain Firdausi
    • Gurobi-versary
    • First Comment
    • First Question

    any help for the error.

     

    0
  • Riley Clement
    • Gurobi Staff

    Hi Muhammed,

    It sounds like you are mixing Pyomo code with gurobipy code (we don't have a ConcreteModel object in gurobipy) which will not work.

    - Riley

    0

Post is closed for comments.