Skip to content

Add pipeline tests#23

Merged
paulapreuss merged 3 commits into
mainfrom
feature/pipeline-tests
May 26, 2026
Merged

Add pipeline tests#23
paulapreuss merged 3 commits into
mainfrom
feature/pipeline-tests

Conversation

@paulapreuss

Copy link
Copy Markdown
Collaborator

Add AI generated tests to check the entire optimizer pipeline, not just single units.

Covers N=1,2,3 intermediate poles and both to_from directions.
Catches the missing pole-to-pole link that left disconnected
subgraphs when breaking long distribution links.
Runs optimize() end-to-end on a 4-consumer hand-calculable grid and verifies:
- all consumers grid-connected (SHS threshold is astronomically high)
- no distribution or connection link exceeds its configured max length
- at least one long-distance intermediate pole was inserted by _break_long_link
- pole connection-link count stays within max_n_connections
- every pole reachable from power house (no disconnected subgraphs)
Runs optimize() on a 3-consumer grid where one consumer (C2, 500 m from PH)
is too expensive to connect and must be assigned SHS by the optimizer.

Fixture design notes:
- C0 and C1 are placed 40 m from PH, beyond the 30 m auto-attach threshold
  of _connect_power_house_consumer_manually, so they go through k-means and
  get a proper cluster pole that survives the SHS cut.
- max_n_connections=3 so the binary-search pole finder converges to 3 clusters
  (PH, near, far), avoiding the k_means_constrained capacity error that would
  occur with 2 clusters and 3 placeholder nodes.

Verifies:
- C0, C1 remain grid-connected with a parent pole after the far cut
- C2 is marked SHS (is_connected=False, parent=None)
- no orphaned poles remain in the pruned network
@paulapreuss paulapreuss merged commit ad65617 into main May 26, 2026
1 check failed
@paulapreuss paulapreuss deleted the feature/pipeline-tests branch May 26, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant