PowerGridModel / power-grid-model

Python/C++ library for distribution power system analysis
Mozilla Public License 2.0
143 stars 29 forks source link

[FEATURE] More efficient iterations over components #411

Open mgovers opened 11 months ago

mgovers commented 11 months ago

Describe the feature request

The enumerated_zip_sequence function iterates over all groups/buses, regardless of whether the input was a DenseGroupedIdxVector or a SparseGroupedIdxVector.

Especially for DenseGroupedIdxVector, for which it is expected to have few groups/buses, the iteration is over a lot of empty groups (potentially orders of magnitude larger than the amount of actually occupied non-empty groups). This results in a lot of useless calculations.

Proposed solution

mgovers commented 7 months ago

Most of this was resolved in #426 . Only determining a better decision criterion is left:

https://github.com/PowerGridModel/power-grid-model/blame/main/power_grid_model_c/power_grid_model/include/power_grid_model/index_mapping.hpp#L134C23-L134C53