model write contains duplicate constraints and variables
AnsweredHello guys, I have a model and when I do model.write() the created file contains the binary variables plenty of times and a constraint 2 times. I do not create the variables or the constraint 2 times. Is this a typical behavior or is something going wrong?
Kind regards
Iason
-
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,
Simran0 -
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 -
Great to know this is resolved!
0
Please sign in to leave a comment.
Comments
3 comments