Make changes of the new model effecting the old one

Let’s say I have built a model called mymodel and I want to make some extension, meaning to add some new variables and constraints, but I want to do it to my new model. So I mymodelnew = mymodel.

Then the problem is, whenever I add some variables or constriants to mymodelnew, mymodel is always updated with these same variables or constraints as well. I want to compare solutions from mymodel and mymodelnew. Can anyone help me?

Of course I can optimize!(mymodel) and then update it and solve again. I just wonder if I can have both old model and the new one.

Maybe mymodel = copy(model)
(untested).

Great! That solved my problem. Thanks so much.

1 Like