Metadata-Version: 2.4
Name: cobre-python
Version: 0.3.1
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering
Summary: High-performance SDDP solver for hydrothermal dispatch — Python bindings for the Cobre ecosystem
Keywords: sddp,optimization,power-systems,energy,hydrothermal
Home-Page: https://cobre-rs.github.io/cobre-docs/
Author-email: "Rogerio J. M. Alves" <rogerio.alves@cobre.dev>
License-Expression: Apache-2.0
Requires-Python: >=3.12
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Bug Tracker, https://github.com/cobre-rs/cobre/issues
Project-URL: Documentation, https://cobre-rs.github.io/cobre-docs/
Project-URL: Homepage, https://cobre-rs.github.io/cobre-docs/
Project-URL: Repository, https://github.com/cobre-rs/cobre

# cobre

Python bindings for the [Cobre](https://github.com/cobre-rs/cobre) power systems solver.

Cobre is a high-performance SDDP (Stochastic Dual Dynamic Programming) solver for hydrothermal dispatch, written in Rust. This package provides Python access to case loading, validation, training, simulation, and result inspection.

## Installation

```bash
pip install cobre-python
```

Pre-built wheels are available for:

- Linux x86_64 and aarch64 (manylinux_2_34), musl x86_64
- macOS Apple Silicon (aarch64) and Intel (x86_64)
- Windows x86_64
- Python 3.12+

## Quick Start

```python
import cobre

# Load and validate a case
system = cobre.io.load_case("path/to/case")
print(f"System: {system.n_buses} buses, {system.n_hydros} hydros, {system.n_thermals} thermals")

# Run training + simulation
cobre.run.run("path/to/case", output_dir="output/")

# Inspect convergence and simulation results
convergence = cobre.results.load_convergence("output/")
print(f"Converged after {len(convergence)} iterations")

simulation = cobre.results.load_simulation("output/")
print(f"Stages: {simulation.n_stages}, Scenarios: {simulation.n_scenarios}")

# Read the saved policy (FlatBuffers FCF checkpoint)
policy = cobre.results.load_policy("output/policy.fcf")
print(f"Policy cuts: {policy.n_cuts}")
```

## Modules

- **`cobre.io`** — Load and validate case directories
- **`cobre.model`** — Data model classes (System, Bus, Line, Thermal, Hydro, etc.)
- **`cobre.run`** — Execute SDDP training and simulation
- **`cobre.results`** — Load and inspect output artifacts, including convergence
  history, Parquet simulation outputs, and FlatBuffers policy (FCF) checkpoints

## Requirements

- Python >= 3.12
- No runtime dependencies (the Rust solver is statically linked)

## License

Apache-2.0 — see [LICENSE](https://github.com/cobre-rs/cobre/blob/main/LICENSE).

## Links

- [Repository](https://github.com/cobre-rs/cobre)
- [Software Book](https://cobre-rs.github.io/cobre/)
- [Documentation](https://cobre-rs.github.io/cobre-docs/)
- [Bug Tracker](https://github.com/cobre-rs/cobre/issues)

