Skip to main content

model write contains duplicate constraints and variables

Answered

Comments

4 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.
  • Simranjit Kaur
    • Gurobi Staff

    Hi Iason,

    Please check if the variables or constraints that appear duplicated have the same name in your code. In Gurobi, if different variables or constraints are given the same name, they may appear as duplicates in the output file generated by model.write(), despite being distinct objects. Always assign unique names to each variable and constraint to prevent this issue.

    Best regards,
    Simran

    0
  • Iason Liagkas
    • Gurobi-versary
    • Detective
    • Thought Leader

    Thanks Kaur. This was the case as I was using the code:

    for i in ["I","E"]:
      for r,s in drs.keys():
        MPmodel.addGenConstrPWL(Rirs[i,r,s], lRirs[i,r,s], horizPoints, verticalPoints, "log_approximation")
    0
  • Simranjit Kaur
    • Gurobi Staff

    Great to know this is resolved!

    0

Post is closed for comments.