Skip to content

Spores mode math

Pre-defined mode math to apply SPORES mode math on top of the base mathematical formulation. This math is only applied when config.build.mode is set to "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 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 \sum\limits_{\substack{\text{node} \in \text{nodes} \\ \text{tech} \in \text{techs} \\ \text{carrier} \in \text{carriers}}} (\textbf{flow\_cap}_\text{node,tech,carrier} \times \textit{spores\_score}) + \sum\limits_{\substack{\text{timestep} \in \text{timesteps}}} (\sum\limits_{\substack{\text{carrier} \in \text{carriers} \\ \text{node} \in \text{nodes}}} (\textbf{unmet\_demand}_\text{node,carrier,timestep} - \textbf{unused\_supply}_\text{node,carrier,timestep}) \times \textit{timestep\_weights}_\text{timestep}) \times \textit{bigM}\\ \end{array} \]
description: "NEW\nSPORES 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."
equations:
- expression: sum(flow_cap * spores_score, over=[nodes, techs, carriers]) + 
    $unmet_demand
sub_expressions:
  unmet_demand:
  - expression: "sum(\n  sum(unmet_demand - unused_supply, over=[carriers, nodes])\n\
      \  * timestep_weights,\n  over=timesteps\n) * bigM"
sense: minimise

Subject to

total_system_cost_max

NEW Limit total system cost in SPORES mode. Applies a maximum relaxation to the system cost compared to the least-cost objective function value.

Uses
\[ \begin{array}{l} \quad \text{if } (\bigvee\limits_{\substack{\text{node} \in \text{nodes} \\ \text{tech} \in \text{techs} \\ \text{cost} \in \text{costs}}} (\textbf{cost}_\text{node,tech,cost}))\!\!:\\ \qquad \sum\limits_{\substack{\text{cost} \in \text{costs}}} (\sum\limits_{\substack{\text{node} \in \text{nodes} \\ \text{tech} \in \text{techs}}} (\textbf{cost}_\text{node,tech,cost}) \times \textit{objective\_cost\_weights}) + \sum\limits_{\substack{\text{timestep} \in \text{timesteps}}} (\sum\limits_{\substack{\text{carrier} \in \text{carriers} \\ \text{node} \in \text{nodes}}} (\textbf{unmet\_demand}_\text{node,carrier,timestep} - \textbf{unused\_supply}_\text{node,carrier,timestep}) \times \textit{timestep\_weights}_\text{timestep}) \times \textit{bigM} \leq \textit{spores\_baseline\_cost} \times (1 + \textit{spores\_slack})\\[2em] \quad \text{if } (\neg (\bigvee\limits_{\substack{\text{node} \in \text{nodes} \\ \text{tech} \in \text{techs} \\ \text{cost} \in \text{costs}}} (\textbf{cost}_\text{node,tech,cost})))\!\!:\\ \qquad \sum\limits_{\substack{\text{timestep} \in \text{timesteps}}} (\sum\limits_{\substack{\text{carrier} \in \text{carriers} \\ \text{node} \in \text{nodes}}} (\textbf{unmet\_demand}_\text{node,carrier,timestep} - \textbf{unused\_supply}_\text{node,carrier,timestep}) \times \textit{timestep\_weights}_\text{timestep}) \times \textit{bigM} \leq \textit{spores\_baseline\_cost} \times (1 + \textit{spores\_slack})\\[2em] \end{array} \]
description: "NEW\nLimit total system cost in SPORES mode. Applies a maximum relaxation
  to the system cost compared to the least-cost objective function value.\n"
equations:
- where: any(cost, over=[nodes, techs, costs])
  expression: "sum(\n  sum(cost, over=[nodes, techs])\n  * objective_cost_weights,\n\
    \  over=costs\n) + $unmet_demand <= spores_baseline_cost * (1 + spores_slack)"
- where: NOT any(cost, over=[nodes, techs, costs])
  expression: $unmet_demand <= spores_baseline_cost * (1 + spores_slack)
sub_expressions:
  unmet_demand:
  - expression: "sum(\n  sum(unmet_demand - unused_supply, over=[carriers, nodes])\n\
      \  * timestep_weights,\n  over=timesteps\n) * bigM"

Postprocessed Statistics

spores_baseline_cost_tracked

NEW Track SPORES baseline cost to include in the model results

Uses

Unit: cost

Default: inf

\[ \begin{array}{l} \quad \textit{spores\_baseline\_cost}\\ \end{array} \]
description: "NEW\nTrack SPORES baseline cost to include in the model results"
equations:
- expression: spores_baseline_cost
unit: cost
default: .inf

spores_score_cumulative

NEW Track SPORES score to include in the model results

Uses

Unit: unitless

Default: 0

\[ \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} \]
description: "NEW\nTrack SPORES score to include in the model results"
equations:
- expression: spores_score
foreach:
- nodes
- techs
- carriers
unit: unitless
default: 0

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

Unit: unitless

Default: 1000000.0

objective_cost_weights

Weightings for cost classes to apply in the objective function.

Used in

Unit: unitless

Default: 1

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

Unit: cost

Default: inf

spores_score

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

Used in

Unit: unitless

Default: 0

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

Unit: unitless

Default: 0

timestep_weights

Used in

Unit: unitless.

Default: 1