grid-parity-exchange / Egret

Tools for building power systems optimization problems
Other
133 stars 54 forks source link

[WIP] PTDF calculation performance enhancements #172

Closed bknueven closed 4 years ago

bknueven commented 4 years ago

This PR makes several changes to PTDF calculation.

  1. Uses a back-solve to calculate PTDFs, replacing the inverse computation used currently.

    Difference in time for calculate_ptdf on my system (measured using TicTocTimer): Instance master PR
    case24464_goc 274 s 179 s
    case30000_goc 439 s 262 s
    Difference in memory for calculate_ptdf on my system (measured looking at top): Instance master PR
    case24464_goc 18 GB 14 GB
    case30000_goc 27 GB 15 GB
  2. Changes the PTDF calculation to only calculate PTDFs for lines which are "monitored", all other flows are reported at the end of the solve using a back-solve. Interface sensitivities are now also directly calculated, as opposed to summing PTDF rows.

  3. Deprecates PTDF serialization/deserialization, which with this PR is even more fraught with danger than before. This feature should be re-implemented in the future with stronger checks. With PR #155, this is no longer critical for good performance with Prescient.

bknueven commented 4 years ago

Should switch to using scipy.sparse.linalg.SuperLU everywhere, which has algorithmic implications.