add epsilon term to npv activity coefficients#994
Conversation
update objective fxn
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #994 +/- ##
==========================================
+ Coverage 83.94% 84.12% +0.17%
==========================================
Files 52 52
Lines 5794 5844 +50
Branches 5794 5844 +50
==========================================
+ Hits 4864 4916 +52
+ Misses 695 689 -6
- Partials 235 239 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| let capacity_coefficient = -annual_fixed_cost(asset); | ||
|
|
||
| // Small epsilon to ensure break-even assets are dispatched | ||
| let epsilon = MoneyPerActivity(1e-14); |
There was a problem hiding this comment.
I would define this as a const at the top of the function. E.g. see
Line 182 in 29a9a30
There was a problem hiding this comment.
We can also use f64::EPSILON, so it is not an arbitrary small number. See https://doc.rust-lang.org/std/f64/constant.EPSILON.html
There was a problem hiding this comment.
that's interesting didn't know about that. I changed it to f64::EPSILON * 100.0 because we need it to big enough to force out precision errors. Multiplying by 100.0 is still a bit arbitrary but seems more elegant this way
Co-authored-by: Tom Bland <t.bland@imperial.ac.uk>
Description
Add a small epsilon value to all activity coefficients in the NPV appraisal optimisation to help prevent spurious investment failures.
Fixes #991
see #998 for a results comparison with simple model
Type of change
Key checklist
$ cargo test$ cargo docFurther checks