Switching data between being a math parameter, decision variable, or global expression #788
brynpickering
started this conversation in
General
Replies: 1 comment
-
|
@brynpickering fits our proposals, yeah. As discussed, let's go with option 1 (#783). The main problem is that we kind of let go of easy 'switching', but the code simplifications are worth it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm moving this discussion from #771 to here so that it isn't lost in a sea of closed PRs when it's merged.
The content of this post was originally written by @irm-codebase with minor edits by me.
This discussion pertains to switching a referenced math component between being a parameter, decision variable, or global expression.
Example
This is useful when switching between a capacity expansion model (
flow_capis a decision variable) and a dispatch model (flow_capis a parameter).Most constraints don't need to change when this switch is made -
flow_outis still limited byflow_capwhether that's a variable or fixed value - so we can keep the reference toflow_capin them and separately handle whether that math component is a parameter or a decision variable.1. Switching through a new
ModelinstantiationSuggested by @brynpickering with a PoC in #783
In this approach, parameters and variables are two distinct entities and users must actively 'swap' between them in code by initialising another model. All model inputs / schemas and so on are re-validated against parameter / dimension definitions.
It could also allow us to clean up the math so that it is all dealt with at model instantiation, including e.g. defining the model "mode".
Embedding parameter / variable 'switching' within the YAML math
suggested by @irm-codebase
In this approach, we combine
VariableandParameterintoNumeric, and specify the direction (input/parameter or result/variable) in arolefield. The math files then define their expected role for each numeric value.Will likely benefit from keeping everything in
model.data.Beta Was this translation helpful? Give feedback.
All reactions