Unit-Based Model#
The unit-based model represents the market at the level of individual generating units and demand blocks. It combines operational constraints, network constraints, and pricing algorithms to study how market design choices affect dispatch, prices, welfare, and redispatch outcomes.
This page is the API entry point for apem.unit_based_model.
What This Module Covers#
Data: scenario loading/parsing and model-ready data structures.
Allocation: market-clearing formulations (nodal and zonal), including redispatch extensions.
Pricing: post-allocation pricing algorithms (for example
ELMP,IP,Join,Markup,Min-MWP).Evaluation: post-run analysis of prices, welfare, redispatch, and lost opportunity costs.
Solver Configuration: shared optimizer settings used by allocation and pricing routines.
Typical Execution Flow#
Parse or load a dataset into a
Scenario.Choose allocation settings (power-flow model, redispatch, solver config).
Solve allocation/dispatch.
Run a pricing algorithm on the solved allocation.
Evaluate outputs across runs and configurations.
See Also#
Main APEM framework overview and conceptual description of this workflow: APEM: Allocation and Pricing in Electricity Markets
Direct section reference: Two Main Modeling Workflows -> Unit-Based Model
Support APIs#
Solver Configuration#
API path: apem.unit_based_model.solver_configuration
Solver configuration shared by the unit-based allocation and pricing layers.
- class SolverConfiguration(
- MIP_gap,
- optimality_tol,
- time_limit,
- work_limit,
- threads,
- presparsify,
- strict_supply_demand_eq,
- relaxation,
- output_flag,
- verbosity,
- slack_penalty=1000000000000000.0,
Bases:
objectCollects the optimizer parameters applied to unit-based solves.
The same object is passed to allocation, redispatch, and pricing routines so they use consistent solver settings across a run.
Initialize solver settings used for Gurobi-backed unit-based runs.
- Parameters:
MIP_gap – relative MIP gap target for mixed-integer solves
optimality_tol – optimality tolerance passed to Gurobi
time_limit – wall-clock time limit in seconds
work_limit – Gurobi work limit
threads – number of solver threads;
0lets Gurobi decidepresparsify – value for the Gurobi
Presparsifyparameterstrict_supply_demand_eq – whether supply-demand balance should be enforced strictly
relaxation – whether the optimization model should be solved as a relaxation
output_flag – Gurobi output flag controlling solver log output
verbosity – whether APEM should print progress information around solves
slack_penalty – penalty coefficient used where slack variables are introduced
Enums#
API path: apem.unit_based_model.enums
Utilities#
API path: apem.unit_based_model.utils
Error#
API path: apem.unit_based_model.error