Conversation
b4851b3 to
8d35e65
Compare
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the MCA equilibrium loop so that endogenously calculated prices are also applied in the base year (when running in equilibrium mode), instead of leaving base-year prices at the projections/zero defaults, and refreshes the regression “golden” outputs accordingly. It also clarifies projections-file behavior in the docs and fixes a working-directory handling issue in the example-output runner.
Changes:
- Update equilibrium price-updating logic so base-year prices can be endogenously updated (first iteration) and carried into stored results.
- Update documentation describing how/when projections are used (and what happens when they’re omitted).
- Refresh example/tutorial regression outputs and fix
run_models.pyto run in stable per-example directories and restore CWD.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/muse/mca.py |
Updates equilibrium/run logic so base-year prices are updated (first iteration) and price updates apply to the intended year set. |
docs/inputs/projections.rst |
Clarifies when price projections are optional/required and how missing projections are interpreted. |
tests/example_outputs/run_models.py |
Runs examples in directories relative to the script and restores the previous working directory. |
tests/example_outputs/trade/Results/MCAPrices.csv |
Updates expected base-year prices in regression output. |
tests/example_outputs/multiple_agents/Results/MCAPrices.csv |
Updates expected base-year prices in regression output. |
tests/example_outputs/minimum_service/Results/MCAPrices.csv |
Updates expected base-year prices in regression output. |
tests/example_outputs/medium/Results/MCAPrices.csv |
Updates expected base-year prices in regression output. |
tests/example_outputs/default_timeslice/Results/Power_Supply.csv |
Reorders/updates expected output rows due to regenerated results. |
tests/example_outputs/default_timeslice/Results/MCAPrices.csv |
Updates expected base-year prices in regression output. |
tests/example_outputs/default_retro/Results/MCAPrices.csv |
Updates expected base-year prices in regression output. |
tests/example_outputs/default_correlation/Results/MCAPrices.csv |
Updates expected base-year prices in regression output. |
tests/example_outputs/default_adhoc/Results/MCAPrices.csv |
Updates expected base-year prices in regression output. |
tests/example_outputs/default/Results/MCAPrices.csv |
Updates expected base-year prices in regression output. |
docs/tutorial-code/new-decision-metric/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/modify-timing-data/2-modify-time-framework/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/modify-timing-data/1-modify-timeslices/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/min-max-timeslice-constraints/2-max-constraint/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/min-max-timeslice-constraints/1-min-constraint/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/carbon-budget/1-carbon-budget/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/add-service-demand/1-exogenous-demand/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/add-service-demand-subsectors/2-agents/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/add-service-demand-subsectors/1-residential-subsectors/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/add-region/1-new-region/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/add-new-technology/2-scenario/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/add-new-technology/1-introduction/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/add-correlation-demand/1-correlation/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/add-agent/2-multiple-objective/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
docs/tutorial-code/add-agent/1-single-objective/Results/MCAPrices.csv |
Updates expected base-year prices in tutorial output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <copilot@github.com>
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.
Prices were previously not being updated in the base year, sticking to the values provided in the projections file (or zero if not provided), whereas all subsequent years return endogenously calculated prices (if available).
However, there's no particularly good reason why we can't return endogenous prices for the base year, so in the interests of consistency I've changed this.
I've also tried to clarify the documentation to make it clearer how the projections file is used and the consequences for omitting certain price projections.
You can see the implications of this in the results files for the example models. Apart from changing prices in the first year, this doesn't have any impact, because prices are (with certain exceptions) only used to make investment decisions, and there are no investments in the base year. Still nice to see these numbers, and this will also prevent potentially sharp price changes from the first year to the second year.
With this change there's really no need to provide price projections for commodities that can be produced in the model, except that if they don't have a projection they'll end up with a price of zero until the first time they're actually produced.