Skip to content

Spores solve mode math

Pre-defined additional math to apply SPORES solve mode math on top of the base mathematical formulation. This math is only applied if referenced in the config.init.add_math list as spores.

A guide to math documentation

If a math component's initial conditions are met (the first if statement), it will be applied to a model. For each objective, constraint and global expression, a number of sub-conditions then apply (the subsequent, indented if statements) to decide on the specific expression to apply at a given iteration of the component dimensions.

In the expressions, terms in bold font are decision variables and terms in italic font are parameters. The decision variables and parameters are listed at the end of the page; they also refer back to the global expressions / constraints in which they are used. Those parameters which are defined over time (timesteps) in the expressions can be defined by a user as a single, time invariant value, or as a timeseries that is loaded from file or dataframe.

Note

For every math component in the documentation, we include the YAML snippet that was used to generate the math in a separate tab.

Download the spores solve mode math formulation as a YAML file

Objective

min_spores (inactive)

NEW SPORES score minimisation objective, activated for all iterations after the baseline optimisation. The SPORES scores are applied to flow capacity for each technology at each node.

Uses
\[ \begin{array}{l} \min{}\!\!:\\[2em] \quad \text{if } (\text{config.ensure\_feasibility}\mathord{=}\text{true})\!\!:\\ \qquad \sum\limits_{\text{[nodes,techs,carriers]} \in \text{[nodes,techs,carriers]}} (\textbf{flow\_cap}_\text{node,tech,carrier} \times \textit{spores\_score}) + \sum\limits_{\text{timestep} \in \text{timesteps}} (\sum\limits_{\text{[carriers,nodes]} \in \text{[carriers,nodes]}} (\textbf{unmet\_demand}_\text{node,carrier,timestep} - \textbf{unused\_supply}_\text{node,carrier,timestep}) \times \textit{timestep\_weights}_\text{timestep}) \times \textit{bigM}\\[2em] \quad \text{if } (\neg (\text{config.ensure\_feasibility}\mathord{=}\text{true}))\!\!:\\ \qquad \sum\limits_{\text{[nodes,techs,carriers]} \in \text{[nodes,techs,carriers]}} (\textbf{flow\_cap}_\text{node,tech,carrier} \times \textit{spores\_score})\\[2em] \end{array} \]
equations:
- expression: sum(flow_cap * spores_score, over=[nodes, techs, carriers]) + 
    $unmet_demand
sub_expressions:
  unmet_demand:
  - where: config.ensure_feasibility=True
    expression: "sum(\n  sum(unmet_demand - unused_supply, over=[carriers, nodes])\n\
      \  * timestep_weights,\n  over=timesteps\n) * bigM"
  - where: NOT config.ensure_feasibility=True
    expression: '0'

Subject to

total_system_cost_max

NEW Limit total system monetary cost in SPORES mode. Applies a maximum relaxation to the system cost compared to the least-cost feasible option.

Uses
\[ \begin{array}{l} \forall{} \text{ cost }\negthickspace \in \negthickspace\text{ costs } \!\!,\\ \text{if } (\text{cost} \in \text{[monetary]})\!\!:\\[2em] \quad \sum\limits_{\text{[nodes,techs]} \in \text{[nodes,techs]}} (\textbf{cost}_\text{node,tech,cost}) \leq \textit{spores\_baseline\_cost} \times (1 + \textit{spores\_slack})\\ \end{array} \]
foreach:
- costs
where: '[monetary] in costs'
equations:
- expression: sum(cost, over=[nodes, techs]) <= spores_baseline_cost * (1 + 
    spores_slack)

Where

spores_score_cumulative

NEW Track SPORES score to include in the model results

Uses
\[ \begin{array}{l} \forall{} \text{ node }\negthickspace \in \negthickspace\text{ nodes, } \text{ tech }\negthickspace \in \negthickspace\text{ techs, } \text{ carrier }\negthickspace \in \negthickspace\text{ carriers } \!\!:\\[2em] \quad \textit{spores\_score}\\ \end{array} \]
foreach:
- nodes
- techs
- carriers
equations:
- expression: spores_score

Parameters

bigM

BigM is a large value used to define certain optimisation problems. See https://en.wikipedia.org/wiki/Big_M_method for more information. This value should be larger than the largest values that any decision variables can take, but should not be too large (i.e., do not set it greater than 3 orders of magnitude above the numeric range of the model). If too large, numerical problems may arise in the optimisation.

Used in

Default: 1000000000.0

Type: float

spores_baseline_cost

The baseline optimal cost of the system used to set the maximum cost constraint when undertaking SPORES analysis. This usually only applies to monetary cost, but could be applied to other non-SPORES costs as necessary.

Used in

Default: inf

Type: float

spores_score

The per-tech & per-node SPORES score used to penalise technologies at nodes that have appeared in previous SPORES iterations.

Used in

Default: 0

Type: float

spores_slack

The amount of slack in the maximum cost constraint applied in SPORES mode. This is a fraction that is applied to the baseline cost, e.g., 0.1 would be used to set a maximum cost constraint of spores_baseline_cost * 1.1

Used in

Default: 0

Type: float

timestep_weights

Used in