Conversation
patrickbrown4
left a comment
There was a problem hiding this comment.
Looks great! The only critical comment is in d_mga.gms; all the rest are minor cleanups. Approving now but should still confirm zero change before merging.
| if int(dfcases[c].MCS_runs) > 0: | ||
| mcs_sampler.general_mcs_dist_validation(reeds.io.reeds_path, mcs_dist_path, sw) | ||
| numruns = int(dfcases[c].MCS_runs) | ||
| run_type = 'MC' | ||
| else: | ||
| numruns = int(dfcases[c].GSw_MGA_RV_runs) | ||
| run_type = 'R' |
There was a problem hiding this comment.
MCS and RV are mutually incompatible, right (at least in the current implementation, which is totally ok)? If so, should probably add a check to runreeds.check_compatibility() that raises an exception if MCS_runs and GSw_MGA_RV_runs are both nonzero.
There was a problem hiding this comment.
Yea that's right. We talked about eventually enabling both, but that might warrant a different approach to the run labeling that I didn't tackle. I'll add a compability check.
| By default the MGA min/max is applied to the sum of the variable across all regions being modeled. | ||
| The MGA approach also supports an option to randomly sample of a vector of weights to apply to the regional values of the variable being optimized. | ||
| This method can be useful to characterizing the uncertainty in the regional distribution of the results. | ||
| Weights are sampled as discrete values from a support of {-1,1} to allow for simultaneous minimization and maximization. |
There was a problem hiding this comment.
Just to check, is "support" the right word here? (I'm unfamiliar with this usage but also don't know much stats)
There was a problem hiding this comment.
Can we just say "weights are sampled as discrete values between {-1,1}"? Also we still have the option to sample linearly also right?
There was a problem hiding this comment.
Support just means where the distribution has non-zero density. It's probably not that useful to include here so I'll put something simpler to avoid the jargon (An, I think your suggestion works).
On the linear weights, the python function supports it but there's no switch to control this so it isn't exposed to the user. It's not that much additional code so I figured we could leave it in and if we change our minds about using it in the future we could either add a switch or just toggle the function argument default for a specific set of runs.
There was a problem hiding this comment.
Would you move these employment factors to copy_files.py as we discussed in my PR? I'm happy to help do this here as well if needed.
There was a problem hiding this comment.
ah I forgot I said I was going to do that in this one--thanks for the reminder!
| By default the MGA min/max is applied to the sum of the variable across all regions being modeled. | ||
| The MGA approach also supports an option to randomly sample of a vector of weights to apply to the regional values of the variable being optimized. | ||
| This method can be useful to characterizing the uncertainty in the regional distribution of the results. | ||
| Weights are sampled as discrete values from a support of {-1,1} to allow for simultaneous minimization and maximization. |
There was a problem hiding this comment.
Can we just say "weights are sampled as discrete values between {-1,1}"? Also we still have the option to sample linearly also right?
Co-authored-by: Patrick Brown <25125211+patrickbrown4@users.noreply.github.com>
Summary
This PR adds a new capability to the existing MGA method to support random vector sampling across subcategories of the variables being explored.
Technical details
The current MGA method applies the minimization (or maximization) to the sum of a variable across all modeled regions (e.g., total U.S. solar capacity or fossil generation). The random vector method assigns randomly-sampled weights to the regional quantities applied before the summation. This technique allows for exploring the regional distribution of capacity and generation results in the near-optimal space.
As an illustration, the plot below shows the range of natural gas capacity by region (using the 54-zones) from 100 runs with the MGA random vector method with a 1% cost threshold. The MGA max/min squares indicate the results from the previous, nationwide-method; the original min/max approach is better suited for getting a wider range of total capacity, whereas the new method is better geared toward understanding uncertainty at a regional level.
Implementation notes
main_mga_rvfunction inmcs_sampler.py, with the number of samples (runs) controlled byGSw_MGA_RV_runs.mcs_sampler.pycan support linear sampling from [-1,1] using a uniform distribution. Initial tests suggested this didn't yield as much of a signal so we haven't implemented a switch to control this.GSw_MGA_RV_regionand can be any level in the hierarchy file.GSw_MGA_Objective = (capacity or generation), with weights generated by region and technology group (i_subtech).GSw_MGA_SubObjectiveis an aggregated tech category (e.g.,gentech), unique weights will be sampled for the differenti_subtechgroups within the larger category.b_inputs.gmsand applied to the MGA objective function ind_mga.gms.Additional changes
Added a run using the random vector method to
cases_test.csv.Switches added/removed/changed
GSw_MGA_RV_runs: number of random weight vectors to draw; corresponds to the number of ReEDS runs.Relevant sources or documentation
The random vector method has been used in previous MGA studies (examples here and here
Validation, testing, and comparison report(s)
Will run reference case tests once the HPC is back in service. Will also link a slide deck with some results using this method.
Checklist for author
Details to double-check
d_objective.gms, they are included inobjective_function_params.yamlfor completeness checkinghourlize/resource.pywas rerun to regenerate the existing/prescribed VRE capacity dataGeneral information to guide review
Did you use LLM tools (chatbot or copilot) in the preparation of this PR? If so, describe how
Tag points of contact here if you would like additional review of the relevant parts of the model