EnergySystemsModellingLab / EnergySystemsModellingLab/MUSE2

Add tests for dispatch optimisation

Open
#448 1 comment 0 reactions 0 assignees View on GitHub
question test
Dominant language
Rust
Stars
8
Forks
5
Avg merge
1d 2m
Merged PRs (30d)
37

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.