Add faster method for assigning actual to representative periods#105
Open
patrickbrown4 wants to merge 10 commits into
Open
Add faster method for assigning actual to representative periods#105patrickbrown4 wants to merge 10 commits into
patrickbrown4 wants to merge 10 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When using 7 or 15 weather years in
GSw_HourlyWeatherYears, the second stage of the representative period selection (mapping actual to representative periods using a MILP) is exceedingly slow. This PR adds an alternative method that runs in seconds and produces actual-to-representative period maps that look pretty much the same.The defaults are unchanged, but the new method can be used in the meantime until we decide what to do by default.
Technical details
Implementation notes
The new method, implemented in
reeds.timeseries.match_act2rep_bestfirst(), works as follows:a. Match each rep period to the single remaining actual period that is closest to it, recording its match in the actual-to-rep-period table
b. Decrement the remaining weight for each rep period. If any weights reach zero, remove them from future consideration for matches. (So the lowest-weighted rep periods will fill up and drop out of consideration first.)
c. Remove the actual periods that were matched from the table of distances
d. Return to 3.a. and repeat until there are no remaining weights in the rep-period weight table (and no remaining unmatched actual periods)
Additional changes
reeds.inputs_processing.hourly_repperiodsintoreeds.timeseriesreedsplots.plot_repdays()to include the year whenGSw_HourlyWeatherYearshas more than one weather yearnextsznfrom2_temporal_params.gmstohourly_repperiods.py, which cuts off roughly 1 hour of solve time per model year when using 7-15 weather yearsPacific_rep7test case toPacific_rep15, which uses the new methodSwitches added/removed/changed
GSw_HourlyClusterMapMethod(defaultmilp): How to map actual periods to representative periods: 'milp' minimizes sum of absolute errors but is slow; 'bestfirst' is orders of magnitude faster when using many weather years inGSw_HourlyWeatherYearsIssues resolved
Known incompatibilities
GSw_H2= 0GSw_H2_PTC= 0GSw_StartCost= 0Validation, testing, and comparison report(s)
Compare report is here: 20260522 - rep15.pptx
Checklist for author
Details to double-check
model_documentation.md)General information to guide review
Did you use LLM tools (chatbot or copilot) in the preparation of this PR? If so, describe how
No