-
Notifications
You must be signed in to change notification settings - Fork 1
add epsilon term to npv activity coefficients #994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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:
|
tsmbland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would define this as a const at the top of the function. E.g. see
Line 182 in 29a9a30
| const MAX_DISPLAY: usize = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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