JuMPv0.21 and deepcopy

I will just chime in because this change (deepcopy throwing an error) was my contribution (first suggested by @Thuener here, then suggested by me again here, and finally implemented by me here).

The fact is: deepcopy has never ever worked, it always had basically the same behavior as copy that you say it is incompatible with your usage. There was never a code that correctly implemented deepcopy and now it was thrown out (replaced by an error), the fact deepcopy was implemented for JuMP.Model was mere accident, because deepcopy is automatically defined for all types but this does not work correctly/out-of-the-box if the type in question has a pointer to an external C object.

If your code was working correctly with old deepcopy then either: it was incorrect; or it will work with copy too. The other solutions given in this thread are far better however.

3 Likes