|
flow_balance += m.data['actor'].loc[a, 'sink-source'] |
As I had to learn the hard way in the larger model tum-ens/urbs#140, accessing single values using pandas .loc[...] in a loop is wasteful. Instead convert each parameter to a dictionary with fast access. It won't be noticeable here, but with millions of accesses, accessing DataFrames for single parameter values should be avoided.
pyomo-example/bacon.py
Line 94 in 6c29c4c
As I had to learn the hard way in the larger model tum-ens/urbs#140, accessing single values using pandas
.loc[...]in a loop is wasteful. Instead convert each parameter to a dictionary with fast access. It won't be noticeable here, but with millions of accesses, accessing DataFrames for single parameter values should be avoided.