cpmodel / FTT_StandAlone

Future Technology Transformation models
GNU General Public License v3.0
9 stars 1 forks source link

Replace deepcopy with np.copy #182

Open Femkemilene opened 2 weeks ago

Femkemilene commented 2 weeks ago

Throughout the code, the inefficient deepcopy is used. The goal is to ensure the new variable stays the same even when the old variable is changed.

In some cases, this is unnecessary (when used for single value assignments, when the original array is a local variable and cannot be altered). In other cases, it's simply inefficient, as numpy's internal np.copy can be 10-100x faster. I think about 95% of deepcopy's can be replaced or removed.