-
Notifications
You must be signed in to change notification settings - Fork 18
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
Modify investment limit to integer when necessary #582
Conversation
Benchmark Results
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #582 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 15
Lines 628 636 +8
=========================================
+ Hits 628 636 +8 ☔ View full report in Codecov by Sentry. |
It seems that the benchmark runs correctly TulipaEnergyModel, but then, processing the results, there is an error (a problem with an ![]() |
02ae1a4
to
5d2f85a
Compare
The benchmark results show that the extra conditions slightly increase the time for |
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.
Thanks for the PR, here is a short comment.
@abelsiqueira thanks for the review! Based on your review, I added a function to calculate the bounds, how does it look now? For me to learn 😄, an extra question is that, instead of using if-else, you suggest to set an default value first and then check for "outliers", is this a better way of programming in general, or is it due to performance concerns or some other reasons? |
Nothing general in this case. Here I was trying to avoid a long expression from appearing twice, so it looks easier to read. If the expression was shorter, or involved different enough terms, I would have suggested a single-line solution using the ternary operator: The change also reads fine in both situations. Originally, it was "if the investment is not integer, then its bound is A over B, otherwise, then the bound is the rounded value of A over B". Now it reads as "The bound is A over B. If the investment is integer, the round the bound". |
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.
Thanks!
Pull request details
Describe the changes made in this pull request
Add floor function to investment limit when investment is integer, otherwise it stays the same.
List of related issues or pull requests
Closes #577
Collaboration confirmation
As a contributor I confirm