EnergySystemsModellingLab / EnergySystemsModellingLab/MUSE2

Add tests for dispatch optimisation

Offen
#448 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
question test
Vorherrschende Sprache
Rust
Sterne
8
Forks
5
Ø Merge
1 T. 2 Min.
Gemergte PRs (30 T.)
37

Beschreibung

When we added the code for the dispatch optimisation, we didn't add unit tests, partly because of time constraints but also because it's not obvious exactly what the best way to write tests for the optimisation code is. It would be nice, for example, to check that under condition X, constraints Y will be added. This would be dead easy in Python -- you could just mock all the functions -- but sadly this is an inherently harder problem with statically typed languages.

I see two ways we could approach this:

1. Read e.g. row values back out of the `highs::RowProblem` -- although this part of the C API is not wrapped by the Rust crate yet, so we'd probably have to add it
2. Write a mock solver, either manually or with help from a library ([`mockall`](https://docs.rs/mockall) seems to be popular, though I've not used it)

I'm leaning towards the second, because it gels nicely with #447 -- we'd need to write traits for solver code for that anyway.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by reading the dispatch optimisation code and issue #447, then inspect how the Rust crate exposes highs::RowProblem and how solver calls are structured. Compare the RowProblem-reading and mock-solver approaches, and use the chosen design to cover cases such as condition X adding constraints Y. Done means unit tests exercise the optimisation decisions and pass reliably.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
testing
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Ruhig
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.