0

I'm using Pyomo 5.6.4 to create Instance_1. At some point, I want to have a duplicate instance which I call Instance_2 from Instance_1. From there, some of the Instance_2 attributes like its objective functions formulation change but I don't want these changes to impact Instance_1. Python copy module (Instance_2 = copy.copy(Instance_1)) didn't work, nor did saving and reading the original Instance_1 as per this post (How to save (pickle) a model instance in pyomo)

How can this be done?

1 Answers1

3

The recommended way to clone a model instance is with newmodel = model.clone().

Qi Chen
  • 1,648
  • 1
  • 10
  • 19
  • Where is the documentation on the `clone` method? I can't seem to find it even after searching `site: https://pyomo.readthedocs.io "clone"` – makansij Dec 06 '22 at 17:16