An Optimisation Language Tailored for Energy System Modelling
GEMS is a graph-based algebraic modelling language for building, managing, and solving optimization problems that describe energy systems.
This language differs from traditional optimization languages in several ways by natively accounting for the specific needs of energy system modelling. Its underlying motivation is to provide essential features for advanced energy modelling: a readable and user-friendly syntax, strong flexibility, and a tool-agnostic design.
Defining Models and Systems as YAML Configurations
Library
A YAML file defining abstract objects called models, which describe the mathematical formulation of a category of energy system element.For more details, see the Library page of the user guide.
library:
id: example_library
description: "Example model library"
models:
- id: bus
description: "A simple balance node model"
ports:
- id: balance_port
type: flow_port
binding-constraints:
- id: balance
expression: sum_connections(flow_port.flow) = 0
- id: generator
parameters:
- id: p_min
- id: p_max
- id: generation_cost
- id: co2_emission_factor
variables:
- id: generation
lower-bound: p_min
upper-bound: p_max
variable-type: continuous
ports:
- id: balance_port
type: flow
- id: energy_port
type: energy
- id: emission_port
type: emission
port-field-definitions:
- port: balance_port
field: flow
definition: generation
- port: energy_port
field: cumulative_energy
definition: sum(generation)
- port: emission_port
field: co2
definition: sum(generation * co2_emission_factor)
objective-contributions:
- id: objective
expression: sum(generation_cost * generation)
System
A YAML file describing the concrete energy system to be simulated. It instantiates components from models provided by the libraries, assigns parameter values, and defines the connections between components.For more details, see the System page of the user guide.
system:
id: my_system
description: "An example system with one load, one node, one thermal generator"
model-libraries: example_library
components:
- id: load_1
model: example_library.load
scenario-group: load_group
parameters:
- id: load
time-dependent: true
value: demand_profile
- id: bus_1
model: example_library.bus
parameters:
- id: spillage_cost
value: 1000
- id: unsupplied_energy_cost
value: 10000
- id: generator_1
model: example_library.generator
parameters:
- id: p_min
value: 70
- id: p_max
value: 100
- id: generation_cost
value: 35
- id: co2_emission_factor
value: 10
Key Design Principles and Capabilities
Separating Model Definition from Solver Execution
GEMS as a modelling language adopts an approach that clearly distinguishes model definition from numerical computations. This allows users to focus on the structure and behavior of energy systems without being immediately concerned with optimization details. Mathematical equations ruling energy system components are not hard-coded in a software code, they are dynamically interpreted: they remain independent from the simulation tool and from the underlying optimization solver (independence from the optimisation solver is admittedly more standard). This separation facilitates reuse, experimentation, and maintenance of models , while making it easy to test different solvers or resolution settings as needed.
Model Energy Systems as Connected Objects (Hypergraphs)
Unlike traditional algebraic modelling languages such as AMPL or GAMS, GEMS adopts an object-oriented and graph-oriented approach. Abstract models of components are defined in Libraries and can then be instantiated, assembled, and interconnected to form concrete Systems. Systems are graphs of components, that can be translated into an optimization problem.
Integrated Time and Uncertainty Dimensions
GEMS natively incorporates time and scenario dimensions into its modelling framework. Temporal and scenarios indices are natively available in the language, either in an implicit or explicit form. This allows users to easly define dynamic behaviours, inter-temporal constraints, and scenario-based analyses in a clear and structured way, while ensuring consistency and scalability of the resulting optimisation problems.
Supported Optimisation Problem Classes
GEMS supports a wide range of optimisation formulations commonly used in energy system studies. It is designed to handle:
- Mixed Integer Linear Programming (MILP) problems, enabling the representation of discrete operational or investment decisions alongside continuous operational variables.
- Two-stage stochastic optimisation problems, where first-stage (here-and-now) decisions are coupled with second-stage (recourse) decisions, providing a robust framework for decision-making under uncertainty.
YAML-Based, User-Friendly Model Definition
GEMS relies on YAML configuration files to provide a user-friendly and transparent modelling interface. YAML enables readable, structured, and easily editable model definitions, lowering the barrier for new users while remaining expressive enough for advanced use cases. This approach facilitates model versioning, collaboration, and integration with external tools , while clearly separating model structure, data, and assumptions from the underlying optimisation engine.