# gtopt-community/gtopt architecture

> Architecture diagram of the GitHub repository gtopt-community/gtopt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gtopt-community/gtopt
- Repository: https://github.com/gtopt-community/gtopt

## Overview

GTOpt is a power-system planning and operations optimizer: users supply a case, the engine formulates and solves a multi-stage LP/MIP, and results feed analysis tools and browser interfaces. The documented workflow includes monolithic, SDDP, and cascade methods, network reduction, and solver plugins. The diagram also preserves case-conversion, visualization, and results-analysis capabilities. Edges are limited to README-documented relationships or shown service calls; most engine internals were not sampled, so their connections are documented rather than inferred from module names.

Main entry points: [`include/gtopt/sddp_method.hpp`](https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/sddp_method.hpp) (SDDP scheduling), [`guiservice`](https://github.com/gtopt-community/gtopt/tree/master/guiservice) (Case editor), [`standalone/source/main.cpp`](https://github.com/gtopt-community/gtopt/blob/master/standalone/source/main.cpp) (GTOpt CLI), [`include/gtopt/solution_csv.hpp`](https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/solution_csv.hpp) (Dispatch and prices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Case inputs"]
  node_converters["Case converters"]
end

subgraph group_engine["Optimization engine"]
  node_runner["GTOpt CLI<br/>[main.cpp]"]
  node_planning_model["System model"]
  node_lp_formulation["LP/MIP formulation"]
  node_monolithic["Monolithic solve"]
  node_sddp["SDDP scheduling<br/>[sddp_method.hpp]"]
  node_cascade["Cascade decomposition<br/>[cascade_method.hpp]"]
  node_investment["Investment master"]
end

subgraph group_solver["Solver backends"]
  node_solver_plugins["Solver plugins"]
  node_highs_backend["HiGHS backend"]
end

subgraph group_analysis["Results and tools"]
  node_network_reduce["Network reduction"]
  node_result_files["Dispatch and prices<br/>[solution_csv.hpp]"]
  node_result_summary["Results summary<br/>[summary.py]"]
  node_timeseries_export["Workbook export<br/>[exporter.py]"]
  node_marginal_units["Storage emissions<br/>[storage_impact.py]"]
  node_diagram_tool["Network diagrams<br/>[gtopt_diagram.py]"]
end

subgraph group_interfaces["User interfaces"]
  node_case_gui["Case editor"]
  node_case_schema["Case schemas<br/>[_schemas.py]"]
  node_case_archive["Case ZIP handling<br/>[_zip_helpers.py]"]
  node_gui_service["Browser GUI service<br/>[app.py]"]
  node_web_service["Job web service<br/>[gtopt_websrv.js]"]
  node_gui_frontend["Case and results UI"]
end

node_analyst(("Power-system analyst"))

node_analyst -->|"prepares case"| node_converters
node_analyst -->|"edits case"| node_case_gui
node_converters -->|"provides inputs"| node_runner
node_case_gui -->|"uses fields"| node_case_schema
node_case_gui -->|"builds archive"| node_case_archive
node_case_gui -->|"submits job"| node_web_service
node_runner -.->|"loads case"| node_planning_model
node_planning_model -->|"forms model"| node_lp_formulation
node_lp_formulation -->|"solves with"| node_monolithic
node_lp_formulation -->|"solves with"| node_sddp
node_sddp -->|"refines model"| node_cascade
node_sddp -->|"uses master"| node_investment
node_network_reduce -->|"reduces case"| node_runner
node_monolithic -->|"dispatches solve"| node_solver_plugins
node_sddp -->|"dispatches solve"| node_solver_plugins
node_solver_plugins -.->|"includes backend"| node_highs_backend
node_monolithic -->|"writes results"| node_result_files
node_sddp -->|"writes results"| node_result_files
node_result_files -->|"summarizes"| node_result_summary
node_result_summary -->|"feeds overview"| node_timeseries_export
node_result_files -->|"analyzes dispatch"| node_marginal_units
node_runner -.->|"visualizes case"| node_diagram_tool
node_web_service -.->|"serves jobs"| node_gui_service
node_gui_service -.->|"serves interface"| node_gui_frontend
node_analyst -->|"views results"| node_gui_frontend

click node_converters "https://github.com/gtopt-community/gtopt/tree/master/scripts"
click node_case_gui "https://github.com/gtopt-community/gtopt/tree/master/guiservice"
click node_case_schema "https://github.com/gtopt-community/gtopt/blob/master/guiservice/_schemas.py"
click node_case_archive "https://github.com/gtopt-community/gtopt/blob/master/guiservice/_zip_helpers.py"
click node_runner "https://github.com/gtopt-community/gtopt/blob/master/standalone/source/main.cpp"
click node_planning_model "https://github.com/gtopt-community/gtopt/tree/master/include/gtopt"
click node_lp_formulation "https://github.com/gtopt-community/gtopt/tree/master/include/gtopt"
click node_monolithic "https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/monolithic_method.hpp"
click node_sddp "https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/sddp_method.hpp"
click node_cascade "https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/cascade_method.hpp"
click node_investment "https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/sddp_investment_master.hpp"
click node_network_reduce "https://github.com/gtopt-community/gtopt/tree/master/scripts/gtopt_reduce_network"
click node_solver_plugins "https://github.com/gtopt-community/gtopt/tree/master/plugins"
click node_highs_backend "https://github.com/gtopt-community/gtopt/blob/master/plugins/highs/highs_solver_backend.cpp"
click node_result_files "https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/solution_csv.hpp"
click node_result_summary "https://github.com/gtopt-community/gtopt/blob/master/scripts/gtopt_results_summary/summary.py"
click node_timeseries_export "https://github.com/gtopt-community/gtopt/blob/master/scripts/gtopt_timeseries_export/exporter.py"
click node_marginal_units "https://github.com/gtopt-community/gtopt/blob/master/scripts/gtopt_marginal_units/storage_impact.py"
click node_diagram_tool "https://github.com/gtopt-community/gtopt/blob/master/scripts/gtopt_diagram/gtopt_diagram.py"
click node_gui_service "https://github.com/gtopt-community/gtopt/blob/master/guiservice/app.py"
click node_web_service "https://github.com/gtopt-community/gtopt/blob/master/webservice/gtopt_websrv.js"
click node_gui_frontend "https://github.com/gtopt-community/gtopt/tree/master/guiservice-plus/src/app"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_converters toneBlue
class node_runner,node_planning_model,node_lp_formulation,node_monolithic,node_sddp,node_cascade,node_investment toneAmber
class node_solver_plugins,node_highs_backend toneMint
class node_network_reduce,node_result_files,node_result_summary,node_timeseries_export,node_marginal_units,node_diagram_tool toneRose
class node_case_gui,node_case_schema,node_case_archive,node_gui_service,node_web_service,node_gui_frontend,node_analyst toneIndigo
```

## Components

### Case inputs

- [Case converters](https://github.com/gtopt-community/gtopt/tree/master/scripts): `scripts`

### Optimization engine

- [GTOpt CLI](https://github.com/gtopt-community/gtopt/blob/master/standalone/source/main.cpp): `standalone/source/main.cpp`
- [System model](https://github.com/gtopt-community/gtopt/tree/master/include/gtopt): `include/gtopt`
- [LP/MIP formulation](https://github.com/gtopt-community/gtopt/tree/master/include/gtopt): `include/gtopt`
- [Monolithic solve](https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/monolithic_method.hpp): `include/gtopt/monolithic_method.hpp`
- [SDDP scheduling](https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/sddp_method.hpp): `include/gtopt/sddp_method.hpp`
- [Cascade decomposition](https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/cascade_method.hpp): `include/gtopt/cascade_method.hpp`
- [Investment master](https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/sddp_investment_master.hpp): `include/gtopt/sddp_investment_master.hpp`

### Solver backends

- [Solver plugins](https://github.com/gtopt-community/gtopt/tree/master/plugins): `plugins`
- [HiGHS backend](https://github.com/gtopt-community/gtopt/blob/master/plugins/highs/highs_solver_backend.cpp): `plugins/highs/highs_solver_backend.cpp`

### Results and tools

- [Network reduction](https://github.com/gtopt-community/gtopt/tree/master/scripts/gtopt_reduce_network): `scripts/gtopt_reduce_network`
- [Dispatch and prices](https://github.com/gtopt-community/gtopt/blob/master/include/gtopt/solution_csv.hpp): `include/gtopt/solution_csv.hpp`
- [Results summary](https://github.com/gtopt-community/gtopt/blob/master/scripts/gtopt_results_summary/summary.py): `scripts/gtopt_results_summary/summary.py`
- [Workbook export](https://github.com/gtopt-community/gtopt/blob/master/scripts/gtopt_timeseries_export/exporter.py): `scripts/gtopt_timeseries_export/exporter.py`
- [Storage emissions](https://github.com/gtopt-community/gtopt/blob/master/scripts/gtopt_marginal_units/storage_impact.py): `scripts/gtopt_marginal_units/storage_impact.py`
- [Network diagrams](https://github.com/gtopt-community/gtopt/blob/master/scripts/gtopt_diagram/gtopt_diagram.py): `scripts/gtopt_diagram/gtopt_diagram.py`

### User interfaces

- [Case editor](https://github.com/gtopt-community/gtopt/tree/master/guiservice): `guiservice`
- [Case schemas](https://github.com/gtopt-community/gtopt/blob/master/guiservice/_schemas.py): `guiservice/_schemas.py`
- [Case ZIP handling](https://github.com/gtopt-community/gtopt/blob/master/guiservice/_zip_helpers.py): `guiservice/_zip_helpers.py`
- [Browser GUI service](https://github.com/gtopt-community/gtopt/blob/master/guiservice/app.py): `guiservice/app.py`
- [Job web service](https://github.com/gtopt-community/gtopt/blob/master/webservice/gtopt_websrv.js): `webservice/gtopt_websrv.js`
- [Case and results UI](https://github.com/gtopt-community/gtopt/tree/master/guiservice-plus/src/app): `guiservice-plus/src/app`

### Other components

- **Power-system analyst**

## Connections

- Power-system analyst → Case converters: prepares case (evidence: `README.md`)
- Power-system analyst → Case editor: edits case (evidence: `guiservice/app.py`)
- Case converters → GTOpt CLI: provides inputs (evidence: `README.md`)
- Case editor → Case schemas: uses fields (evidence: `guiservice/app.py`)
- Case editor → Case ZIP handling: builds archive (evidence: `guiservice/_zip_helpers.py`)
- Case editor → Job web service: submits job (evidence: `guiservice/app.py`)
- GTOpt CLI → System model: loads case
- System model → LP/MIP formulation: forms model (evidence: `README.md`)
- LP/MIP formulation → Monolithic solve: solves with (evidence: `README.md`)
- LP/MIP formulation → SDDP scheduling: solves with (evidence: `README.md`)
- SDDP scheduling → Cascade decomposition: refines model (evidence: `README.md`)
- SDDP scheduling → Investment master: uses master (evidence: `README.md`)
- Network reduction → GTOpt CLI: reduces case (evidence: `README.md`)
- Monolithic solve → Solver plugins: dispatches solve (evidence: `README.md`)
- SDDP scheduling → Solver plugins: dispatches solve (evidence: `README.md`)
- Solver plugins → HiGHS backend: includes backend
- Monolithic solve → Dispatch and prices: writes results (evidence: `README.md`)
- SDDP scheduling → Dispatch and prices: writes results (evidence: `README.md`)
- Dispatch and prices → Results summary: summarizes (evidence: `scripts/gtopt_results_summary/summary.py`)
- Results summary → Workbook export: feeds overview (evidence: `scripts/gtopt_timeseries_export/exporter.py`)
- Dispatch and prices → Storage emissions: analyzes dispatch (evidence: `scripts/gtopt_marginal_units/storage_impact.py`)
- GTOpt CLI → Network diagrams: visualizes case (evidence: `README.md`)
- Job web service → Browser GUI service: serves jobs
- Browser GUI service → Case and results UI: serves interface
- Power-system analyst → Case and results UI: views results (evidence: `README.md`)
