Different approach for using "reduced costs"#891
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## precompute_coefficients #891 +/- ##
===========================================================
+ Coverage 85.41% 85.69% +0.27%
===========================================================
Files 50 50
Lines 5335 5186 -149
Branches 5335 5186 -149
===========================================================
- Hits 4557 4444 -113
+ Misses 559 529 -30
+ Partials 219 213 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
No idea why the results are different with mac os... very strange |
alexdewar
left a comment
There was a problem hiding this comment.
This makes sense to me and looks a lot cleaner than what we had before. Good work!
The different results on macOS ARM are pretty disturbing though... and I don't think we can merge this until we've figured out why it's happening 😞. Are you happy looking into this or would you like me to take a look?
Thanks!
I wouldn't really know where to start to be honest, so if you have any ideas then go ahead! |
I'm not sure I have many good ones 😆, but I'll take a look. |
|
Check with Adrian if you need things checked on an ARM macOS at a deeper level that what you can do here. |
…-comparison-approx Use `approx_eq!` for comparing appraisal metrics
|
...good to go, other than the merge conflict, obvs. |
Description
This follows on from #888, so look at that one first
We were previously calculating a quantity that we called "reduced costs" from the output of the dispatch optimisation, and passing this the investment algorithm to use during appraisal.
From a linear programming perspective "reduced cost" is "the amount by which an objective function coefficient would have to improve (so increase for maximization problem, decrease for minimization problem) before it would be possible for a corresponding variable to assume a positive value in the optimal solution" (from wikipedia).
Essentially, and as you can see here, we were using this to represent the cost per unit of activity of an asset. This is important for considering potential investments as, depending on the objective, this can be weighed up against potential revenues to assess the profitability of each potential investment.
We were previously calculating "reduced costs" in two different ways for commissioned vs candidate assets:
After initially trying this approach, it was discovered that, for our purposes, the first approach doesn't work (or, at least, doesn't give us what we need for investment appraisal). Therefore, we've decided to try using the second approach for all assets. Following on from this, a few extra considerations stood out:
I've tried to address all of these points in this PR. I think this gives the code much clearer flow and greater separation of concerns. "Reduced costs" are no longer calculated, and instead we're passing prices to
select_best_assets. What we're now calculating withcalculate_activity_coefficient_for_lcoxandcalculate_activity_coefficient_for_npvis equivalent to what we were previously passing around as "reduced costs" (at least for existing assets, but now we're using the same method for candidate assets as well).I've tried to brush up the documentation so it's up to date with the current approach. There are still a few small inconsistencies like #383, but I'm not aiming for perfection right now.
I need to think about this more, but there may still be issues with double counting levies for some commodities (#877).
Fixes #879
Fixes #876
Type of change
Key checklist
$ cargo test$ cargo docFurther checks