GTOpt

Image Image Image

Image

Documentation · Publications · Who uses GTOpt · Contributing · Support

GTOpt — Generation, Transmission and storage Optimization — is an open-source solver for planning and operating power systems. It builds sparse LP/MIP models of multi-stage systems and minimizes the expected discounted cost of investment and operation (CAPEX + OPEX):

  • Expansion planning of generation, transmission, storage and demand (GTEP).
  • Hydrothermal scheduling with SDDP and cascade decomposition.
  • Unit commitment and economic dispatch, single-bus or DC OPF with losses.

One consistent model, from minutes to decades. The same element definitions and the same formulation of the energy system — electricity, water (reservoirs, cascades, irrigation rights), fuels and LNG, hydrogen, ammonia and heat — are used at every time scale:

ScaleHorizonResolutionTypical use
Operationhours to days15-minute to hourly blocksunit commitment, daily and weekly dispatch
Medium termmonths to yearshourly or load-curve blockshydrothermal scheduling with SDDP
Planningup to decades (30+ years)representative blocks per stageexpansion of generation, transmission, storage and demand

Only the time structure (Stage → Block, any block duration) and the method change. The scales are coupled through SDDP cuts:

  • Optimality cuts carry the water values and storage opportunity costs: the future-cost function of a longer study becomes the end-of-horizon valuation of a shorter one (boundary_cuts, FutureCost, SDDP hot start), and the cascade method refines a coarse model into a detailed one, inheriting its cuts.
  • Feasibility cuts, from the elastic filter, enforce the hard limits — reservoir levels, irrigation and water rights — at each scale, so the policy handed from one scale to the next is also feasible.

The operation, medium-term and planning results are therefore consistent and converge across scales, instead of coming from separate models with different assumptions.

GTOpt is pronounced G-top (/ˈdʒiː tɒp/). The command-line binary is gtopt.

Image

Features

  • Expansion planning: co-optimized investment in generation, transmission lines, storage (battery energy and power separately) and demand, in modules with annualized costs, multi-stage and with capacity limits and derating. Expandable demand models loads that grow where and when the observed prices make them worthwhile (e.g. electrolysers, data centres, desalination, electrified industry): a demand module is added when the value of serving it exceeds its cost. Large problems use the OptGen-style investment master over SDDP operation (Investment Master).
  • Network: single bus or DC power flow, with angle-based or loop-flow (cycle-basis) Kirchhoff formulations, line losses with several piecewise formulations, transmission expansion and optional optimal transmission switching.
  • Reduce, solve, project back: networks can be reduced automatically for long-term studies (gtopt-net), with dispatch and investment decisions mapped back onto the full network.
  • Storage and hydro: optimal management of reservoirs, hydro cascades, pumped hydro and batteries, with water values and the opportunity cost of stored energy per block, future-cost functions for the end of the horizon, and irrigation rights (Storage and water values).
  • Numerically curated: per-element variable scaling, objective scaling and matrix equilibration (row-max, Ruiz), with the condition number reported for every solve, so one model can hold kWh-scale batteries next to TWh-scale reservoirs (Lake Laja stores about 5,600 hm³, roughly 10 TWh through the El Toro–Antuco cascade) and still give stable dispatch, water values and opportunity costs in multi-node, multi-reservoir systems. Hard volume bounds and water-right limits are kept feasible in SDDP with an elastic filter and feasibility cuts (SDDP §2.4).
  • Unit commitment: tight three-bin MIP formulation, start-up tiers, ramps, minimum up/down times, piecewise heat rates.
  • Reserves and inertia: zonal up/down reserve requirements and minimum-inertia constraints co-optimized with energy, with shortage prices.
  • Plant-level detail: combined-cycle configurations, pumps, reservoir seepage, head-dependent production factors and discharge limits, and free decision variables for custom rules.
  • Beyond electricity: hydrogen and ammonia chains (electrolysers, fuel cells, storage), thermal storage and LNG terminals, in the same LP as the power system.
  • Emissions: CO₂ and other greenhouse gases (CO₂-eq) and local pollutants (NOₓ, SO₂, particulate matter) per unit or fuel, with prices and caps by system-wide or regional zone (the cap's dual is the endogenous price), cap-and-trade allowance banking, carbon capture (CCS) per unit, and marginal emission factors per bus and hour, including the CO₂ impact of storage operation (Emissions).
  • Constraints on demand, without code: PAMPL, an AMPL-like language, adds user constraints, parameters, sums over elements, scenario/stage/ block domains and cross-phase state terms to the LP from a text file. Complex operating rules are modelled this way — e.g. the Chilean irrigation agreements (Maule, Laja), built from water-right elements plus PAMPL constraints (User Constraints, Irrigation Agreements).
  • Methods: monolithic LP/MIP, SDDP and multi-level cascade SDDP, with an OptGen-style investment master.
  • Uncertainty: SDDP handles the stochasticity of hydro inflows, solar and wind (and demand) through scenarios and backward-pass apertures that vary inflows and renewable capacity factors, with multi-cut and (experimental) Markov-chain variants and AR(1) inflow models; the resulting cuts give the expected-cost water values and storage policies under that uncertainty (SDDP).
  • Solvers as plugins: HiGHS, CPLEX, Gurobi, MindOpt, SCIP, CBC/CLP and cuOpt, loaded at run time.
  • National scale: built for real power systems — the full Chilean national system (SEN), with its transmission network, hydro cascades, storage and multi-year horizons, is solved routinely; SDDP and cascade decomposition, parallel per-scenario LPs and network reduction (gtopt_reduce_network) keep large cases tractable.
  • From laptop to server and GPU: the same binary runs on a laptop or a many-core server; scenes, phases and apertures are solved in parallel by an adaptive work pool, and NVIDIA cuOpt adds GPU solving.
  • Careful memory use: LPs are kept compressed (lz4) between solves in low-memory mode, cuts can be capped and shared, and the work pool throttles dispatch on free memory, so large cases fit on modest machines.
  • Policies you keep: SDDP cuts are saved as plain CSV after every iteration, so runs can be stopped, resumed (hot start), extended or reused as end-of-horizon future-cost functions, including cuts imported from PLP; gtopt_monitor follows a run live.
  • Warm starts that survive a solver change: simplex bases and MIP starts are stored in solver-neutral form and reused across runs and backends.
  • Open, inspectable models: every LP/MIP can be written to a standard LP file with readable names (--lp-file, --lp-only) and solved or checked with any solver; infeasible runs dump the LP, and gtopt_check_lp finds the conflicting constraints (IIS).
  • Auditable formulation: the complete LP/MIP formulation, the SDDP cut-validity conditions and the inflow models are published with the source (Formulation), and an LP fingerprint records the structure of the model actually solved, so auditors and CI can check that a run uses the intended formulation (LP fingerprint).
  • Schema-first input: gtopt --json-schema prints the JSON Schema of the input model, generated from the C++ code, for editor completion and validation before a run.
  • Open data end to end: JSON cases and Apache Parquet/CSV inputs and results, readable by pandas, DuckDB, Spark or Power BI (gtopt2pbi), with no proprietary database or viewer. Converters from PLP, PLEXOS, PSR SDDP, PSS/E, pandapower, NREL Sienna, RTS-GMLC, NREL-118 and Excel, and export back to pandapower.
  • Interfaces: command line, Python tools, a browser GUI and a REST web service.
  • Engineering: unit, integration and Python test suites, static analysis (CodeQL, clang-tidy) and coverage run on every change.

The browser GUI (interfaces) builds and edits a case, shows its network and runs it on the web service. Here, the IEEE 9-bus case with its buses, line ratings, generators, a solar profile and the demands:

Image

From the terminal, run_gtopt runs a case and follows it live. Here, an SDDP run solved with HiGHS: lower and upper bounds and gap per iteration, cut counts, resource use and the solver log:

Image

Install

On Ubuntu 24.04+ or Debian 13+:

curl -fsSL https://raw.githubusercontent.com/gtopt-community/gtopt/master/install.sh | bash

The script installs the system packages and the open-source solvers HiGHS and CBC/CLP, builds GTOpt from source and installs it in /usr/local (it asks for sudo). Useful options:

# Install in your home directory, plus the Python tools (plp2gtopt, plexos2gtopt, ...)
curl -fsSL https://raw.githubusercontent.com/gtopt-community/gtopt/master/install.sh \
  | bash -s -- --prefix "$HOME/.local" --python

Choose the solver plugins with --solvers (open-source ones are installed if missing; commercial ones must already be installed):

curl -fsSL https://raw.githubusercontent.com/gtopt-community/gtopt/master/install.sh \
  | bash -s -- --solvers highs,cbc,scip      # or: --solvers all

By default the installer also builds every commercial solver it finds installed (CPLEX, Gurobi, MindOpt; newest version) and, with an NVIDIA GPU, installs and builds cuOpt. Run install.sh --help for all options. For other platforms, manual builds and build options, see the Building Guide.

Solvers

GTOpt needs at least one LP/MIP solver. Solvers are plugins (libgtopt_solver_*.so) built for every solver found when GTOpt is compiled, and chosen at run time with --solver; gtopt --solvers lists the ones available.

SolverLicenceHow to get itNotes
HiGHSMIT, freeInstalled by install.sh (apt libhighs-dev on Ubuntu 25.04+, otherwise built from source)Recommended open-source choice
CBC / CLPEPL, freeInstalled by install.sh (apt coinor-libcbc-dev)Always available
SCIPApache-2.0, freescipopt.org; set SCIP_ROOT_DIROpt-in: --solver scip
CPLEXCommercial (free academic)IBM ILOG CPLEX Optimization Studio; set CPLEX_ROOT_DIRPreferred when present
GurobiCommercial (free academic)gurobi.com; set GUROBI_HOMEOpt-in: --solver gurobi
MindOptCommercialAlibaba Cloud; set MINDOPT_HOME
cuOptApache-2.0, freeInstalled by install.sh when an NVIDIA GPU is present (libcuopt-cu12/-cu13 >=26.8; from 26.10 the libcuopt_mathopt wheel it pulls in), or set CUOPT_HOMEOpt-in: --solver cuopt

Without --solver, GTOpt picks the first available of CPLEX, HiGHS, MindOpt, CBC and CLP.

See Supported Solvers for each solver's test status and limitations (CLP is LP-only; for MIP prefer HiGHS or a commercial solver; cuOpt is for the monolithic method only; Gurobi is untested), why results can legitimately differ between solvers, and how to add a new one.

The installer finds CPLEX, Gurobi and MindOpt in their usual locations (/opt, ~/opt, ~, or on PATH). Elsewhere, pass the location to the installer (to bash, not to curl):

curl -fsSL https://raw.githubusercontent.com/gtopt-community/gtopt/master/install.sh \
  | CPLEX_ROOT_DIR=/opt/ibm/ILOG/CPLEX_Studio2211/cplex bash
curl -fsSL https://raw.githubusercontent.com/gtopt-community/gtopt/master/install.sh \
  | GUROBI_HOME=/opt/gurobi1203/linux64 bash

Running the installer again rebuilds GTOpt with the solvers it now finds. Solver details and manual builds: Building Guide.

Quick start

git clone https://github.com/gtopt-community/gtopt.git
cd gtopt/cases/c0
gtopt system_c0.json --set output_directory=/tmp/c0-out

cases/c0 is a single-bus system with one generator and one demand and capacity expansion over 5 stages. Results are written to /tmp/c0-out (without --set, to the case's output/, which holds the reference results used by the tests), one file per component; status 0 in solution.csv means the optimum was found.

Common options:

gtopt case.json --set output_directory=results/   # where to write results
gtopt case.json --set use_single_bus=true         # ignore the network
gtopt case.json --solver highs                    # pick a solver backend

A battery example: cases/bat_4b_24 is a 4-bus network with solar, a 60 MW / 200 MWh battery and 24 hourly blocks. In the variant built by tools/figures/make_battery_demo_case.py (more solar, a smaller baseload unit and a 90 $/MWh peaker) the price swings over the day. The battery charges on the midday solar surplus, when the marginal cost is zero, and discharges into the evening peak, so the peaker is never needed. Its opportunity cost of stored energy (the dual of its energy balance) explains the dispatch: it charges while the marginal cost is below that value and discharges when it is above.

Image

Next steps: the first-solve walkthrough and the Usage Guide.

How GTOpt compares

GTOpt works alongside the models used in the region and reads their inputs. A qualitative overview:

GTOptPLPPLEXOSPSR SDDP
Maintained byGTOpt CommunityCENEnergy ExemplarPSR
LicenceAGPL-3.0 or commercialsee CENcommercialcommercial
Formulation documentationfull LP/MIP formulation published with the codeCEN documentationvendor documentationvendor documentation and papers
LP solveryour choice: HiGHS, CBC/CLP, SCIP, cuOpt, CPLEX, Gurobi, MindOptCLP (via OSI)see vendorsee vendor
Data formatsJSON + Parquet/CSVtext .dat filesvendor database/XMLvendor formats
Read by GTOpt—plp2gtoptplexos2gtopt (published inputs)sddp2gtopt

Details, element by element, in Comparison with other tools.

Roadmap: bid-based markets

GTOpt is being extended toward offer-based electricity markets, in line with the transition of the Chilean power system from audited-cost dispatch to a market with bids:

  • a single, consistent dispatch chain — from medium-term water values to day-ahead and intraday scheduling — clearing offers instead of audited costs;
  • co-optimization of energy and ancillary services, with nodal prices;
  • market layers for capacity/sufficiency, long-term energy (reservoirs, LNG take-or-pay) and financial transmission rights;
  • a market simulator to test designs and bidding behaviour on the full system before they are applied.

This work is in development; feedback and collaboration are welcome in Discussions.

Validation

GTOpt is validated at three levels. The Chilean national electric system (SEN): full-scale long-term hydrothermal planning cases built from PLP data with plp2gtopt and solved with SDDP and cascade SDDP, with the generated LPs compared element by element against PLP's (PLP vs GTOpt), and daily/weekly operation cases built with plexos2gtopt from the PLEXOS input bundles that the system operator (CEN) publishes for its daily programming, with the GTOpt dispatch, prices and losses compared against the PLEXOS solutions the CEN publishes alongside them (we do not run PLEXOS; only the published inputs and outputs are used; the comparison is in scripts/plexos2gtopt/compare_with_plexos.py). The same cases, and others from Australia, Guatemala, Ireland, Peru and Poland, together with standard benchmark systems and published case studies, are published in gtopt-cases. External reference systems and models: IEEE 4/9/14/30/57/118-bus and RTS-24 networks, MATPOWER case3375wp, DC OPF results from pandapower, the SDDP.jl hydro-valley and hydro-thermal examples and published SDDP benchmarks (literature benchmarks), PSR SDDP sample cases via sddp2gtopt, UnitCommitment.jl and NREL Sienna unit-commitment cases, the NREL-118 and RTS-GMLC systems, and ports of GenX and PyPSA emission models. Continuous integration: more than 4,600 C++ unit and integration tests and several thousand Python tests, with reference results for the cases in cases/ checked on every change. See also Comparison with othertools.

Cases and benchmarks: gtopt-cases

The public companion repository gtopt-cases holds cases ready to run with GTOpt 1.1.0 or later (1.2.0 for the Australian expansion case), built with its converters (inputs only, provided AS IS). It has two parts.

Real systems, from data published by system operators and regulators:

CountrySystem · publisherCases
Image

Australia

NEM · AEMO4 weekly dispatches, one per season of 2027 (2026 ISP PLEXOS model)
Image

Chile

SEN · CEN14 daily operation programmes (one week each, PLEXOS); SDDP of 2, 5 and 23 years (PLP); PET 2027 transmission planning bases (PLP)
Image

Guatemala

SNI · AMM, EORNCP daily/weekly dispatch; 6 PSS®E snapshots; 6 annual SDDP programmes
Image

Ireland

SEM · SEM Committee4 weekly unit commitments, one per season of 2025 (PLEXOS), downloaded and converted on demand
Image

Peru

SEIN · COES4 annual SDDP cases (2026-2029)
Image

Poland

MATPOWER case3375wp3,374-bus DC OPF

Benchmarks: standard test systems, example systems of other tools and published case studies, to compare GTOpt with other models (benchmarks/). Where the source has an open licence the files are kept with the case; otherwise a recipe downloads (pinned, sha256-checked) and converts it on your machine.

FamilyCasesSource
IEEE9 single-hour DC OPF, 5 to 300 buses (PJM 5, IEEE 14, 30, 57, 118, 300, RTS-79, RTS-96, New England 39)PGLib-OPF
UnitCommitment.jl3 unit-commitment MIPs (IEEE 14 and 118 buses)UnitCommitment.jl
NRELNREL-118, one week hourlySienna PowerSystemsTestData
Sienna7 PowerSimulations.jl test systems (PJM 5-bus)Sienna PowerSystemsTestData
PapersClustered unit commitment, Morales-España and Tejada-Arango (2019): IEEE 39 and 118 busesCUC-data

Each case README gives the exact gtopt command. From a GTOpt checkout, eval "$(bash tools/get_cases.sh)" fetches the revision pinned in tools/cases.lock and sets GTOPT_CASES_DIR for the tests that use these cases.

Tools and interfaces

What it isDocs
Python toolsConverters (plp2gtopt, plexos2gtopt, psse2gtopt, sddp2gtopt, pp2gtopt, igtopt), diagrams, marginal units and emissions (gtopt-marginal-units), run_gtopt and checkersScripts Guide
GUIBrowser interface to build, solve and inspect cases (gtopt_gui)GUI and web service
Web serviceREST API to submit cases and fetch results (gtopt_websrv)GUI and web service
C++ libraryThe solver as a library, plus the Apache-2.0 Extension SDK for solver pluginsAPI reference

Documentation

All documentation is indexed in docs/README.md. The main entry points:

  • What's New: the recent capabilities, with links to their documentation.
  • Understanding GTOpt: architecture, data flow and repository layout.
  • Planning Guide: time structure, system elements, JSON format and worked examples.
  • Mathematical Formulation: the full LP/MIP model.
  • SDDP and Cascade methods.
  • Gas Network Guide: natural-gas network elements (Weymouth pipes, compressors, line pack, gas-fired units) and benchmark cases with their sources and licences.
  • Distribution Expansion: LinDistFlow feeders, distribution expansion practice and an OpenDSS AC check.
  • Comparison with other tools: PLP, pandapower, PyPSA and GenX.
  • White paper (LaTeX source): the reference paper, covering the formulation, solution methods, multi-scale coupling, architecture, validation and the comparison with the Chilean daily schedule.

Citing GTOpt

If you use GTOpt in your work, please cite:

M. Matus, M. del P. Buitrago, C. García, E. Sierra, C. López, M. Falcone and G. Bustos, "GTOpt: Open-Source Energy-System Optimization, Consistent from Minutes to Decades," engrXiv preprint, 2026. DOI: 10.31224/8872

CITATION.cff has the same reference (the "Cite this repository" button on GitHub). BibTeX, the papers behind each method, applications, presentations and the third-party references are in PUBLICATIONS.md.

Who uses GTOpt

Companies, system operators, universities and researchers using GTOpt are listed in USERS.md. Using GTOpt? Fill in the “Register as a GTOpt user” form and we add you.

Contributing

Contributions are welcome: see CONTRIBUTING.md. Pull requests need a one-time Contributor License Agreement, which the CLA bot requests on your first PR. Questions and ideas go to Discussions; security issues to SECURITY.md.

The people and organizations who helped build GTOpt are in FRIENDS.md, and the companies offering maintenance and development of GTOpt, and energy studies and consulting, in PROVIDERS.md.

Acknowledgements

GTOpt is built on the work of many open-source projects, and we are very grateful to their authors and communities, in particular:

All of them are used under their own licences, which are compatible with GTOpt's; the full list, with versions and the compatibility analysis, is in THIRD_PARTY_NOTICES.md.

License

The GTOpt core is dual-licensed: AGPL-3.0-or-later with the solver plugin exception, or a commercial license. The Extension SDK (the solver-plugin interface headers) is Apache-2.0, so plugins and apps may use any licence. See LICENSING.md and TRADEMARKS.md. Third-party components, data and documents keep their own licences; see THIRD_PARTY_NOTICES.md.

Copyright (c) 2024-2026 Marcelo Matus and [contributors](AUTHORS).

Support and services

Maintenance and development of GTOpt (support contracts, custom features, training, PLP / PLEXOS → GTOpt migration), and energy studies and consulting, are available from Black Bear Engineering SpA (contacto@blackbeareng.cl). See PROVIDERS.md.