Model Formulation#

Core Euphemia formulation helpers for the master problem.

This module contains the functions that populate the mathematical structure of the order-book-based optimization model after variable creation. In practice, these helpers define:

  • the surplus-maximizing objective

  • the market-clearing and order-linking constraints

  • the network constraints for ATC and FBMC

Model Formulation#

API path: apem.order_book_based_model.euphemia.model.setup_model

add_market_constraints(self)[source]#

Add market-clearing and order-linking constraints to the master problem.

This routine builds the core allocation structure of the Euphemia master problem. It enforces:

  • market balance for the active network representation

  • block-order acceptance logic including MAR, exclusive, linked, and flexible blocks

  • linkage between parent complex/scalable-complex orders and their step rows

  • load-gradient and MAP restrictions for complex-order variants

Balance is formulated differently depending on the current network mode:

  • no network constraints: one global balance equation per period

  • ATC: zonal injection balanced with directed interconnector flows

  • FBMC: zonal net-position definitions plus global balance

Parameters:

self (MasterProblem) – Active Euphemia master-problem instance whose Gurobi model is being populated.

Returns:

None.

Return type:

None

add_network_constraints(self)[source]#

Add network feasibility constraints for the selected network model.

The function is a no-op when network_constraints_enabled is False. Otherwise it complements add_market_constraints() with the physical transmission limits implied by the configured network representation:

  • ATC: capacity bounds on directed interconnectors plus optional ramp-up and ramp-down limits between consecutive periods

  • FBMC: PTDF-based upper RAM limits and optional lower-bound limits on zonal net positions

Parameters:

self (MasterProblem) – Active Euphemia master-problem instance whose Gurobi model is being populated.

Returns:

None.

Return type:

None

add_objective(self)[source]#

Define the surplus-maximizing objective of the master problem.

The objective aggregates the contribution of every supported order family: step orders, block orders, complex-order step rows, scalable-complex step rows, and piecewise-linear orders. The final model objective is posted as a maximization of total economic surplus using the sign conventions already encoded in the parsed bid tables.

Parameters:

self (MasterProblem) – Active Euphemia master-problem instance whose Gurobi model is being populated.

Returns:

None.

Return type:

None