calliope-project / calliope

A multi-scale energy systems modelling framework
https://www.callio.pe
Apache License 2.0
277 stars 90 forks source link

Compare LPs to improve testing of constraints #433

Open brynpickering opened 1 year ago

brynpickering commented 1 year ago

Problem description

The new math formulation implementation (#411) has a time penalty for very small models which slows down the tests.

To speed things up, we should reduce how much of a backend model we build on testing the validity of different constraints.

Following the approach of Oemof, we can build incomplete models and then write an LP file that we do a string comparison against. Then we don't need to solve the model each time, nor do we need (or want) to run m.build() in the tests. Instead, we should use the backend API for adding constraints/variables/expressions one at a time.

Calliope version

v0.7.0-dev

brynpickering commented 1 year ago

Method to do so added in #453, now we just need to implement all tests in this format.