-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix time indices for representative temporal blocks #1015
base: master
Are you sure you want to change the base?
Changes from 10 commits
1c31c02
3268ac6
2fd099f
c5e910f
b5ecb87
fe68654
d2be4f2
fc4d346
1b17125
65f3806
2cefffa
ca43ceb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,9 @@ function add_variable!( | |
res_internal_fix_value = _resolve(internal_fix_value, m, ind, other_ind_and_factor...; reducer=_check_unique) | ||
_finalize_variable!(vars[ind], res_bin, res_int, res_lb, res_ub, res_fix_value, res_internal_fix_value) | ||
end | ||
merge!(vars, Dict(ind => coeff * vars[ref_ind] for (ind, (ref_ind, coeff)) in ind_map)) | ||
# A ref_ind may not be covered by keys(vars) unless | ||
# the ind_map is carefully designed in specific variable adding functions. | ||
merge!(vars, Dict(ind => coeff * vars[ref_ind] for (ind, (ref_ind, coeff)) in ind_map if haskey(vars, ref_ind))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This haskey introduce an extra lookup for every iteration of the comprehension and might also damage performance. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! The haskey check now goes outside the iteration (commit 2cefffa). |
||
# Apply initial value, but make sure it updates itself by using a TimeSeries Call | ||
if initial_value !== nothing | ||
last_history_t = last(history_time_slice(m)) | ||
|
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.
This will damage performance.
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.
Same concern. I've created issue #1018 to explain the problem. This change attempts for option 1. The latest commit ca43ceb attempts for option 2 and should be more efficient, but it couldn't pass all tests.