Skip to main content

model write contains duplicate constraints and variables

Answered

Comments

3 comments

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

    Great to know this is resolved!

    0

Please sign in to leave a comment.