Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ jobs:
- name: Run tests
run: |
if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then
# Draft PR: skip examples, slow, and deprecated_api
pytest -v --numprocesses=auto -m "not examples and not slow and not deprecated_api"
# Draft PR: skip examples and slow tests
pytest -v --numprocesses=auto -m "not examples and not slow"
else
# Ready PR & main push: examples excluded via addopts
pytest -v --numprocesses=auto
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ temp-plot.html
site/
*.egg-info
uv.lock

# test artifacts written to cwd
fs.json
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,57 @@ For more details regarding the individual PRs and contributors, please refer to

!!! tip

If upgrading from v7.x, see the [Migration Guide v8](https://flixopt.github.io/flixopt/latest/user-guide/migration-guide-v8/).
If upgrading from v5.x, see the [Migration Guide v6](https://flixopt.github.io/flixopt/latest/user-guide/migration-guide-v6/).
If upgrading from v2.x, see the [v3.0.0 release notes](https://github.com/flixOpt/flixOpt/releases/tag/v3.0.0) and [Migration Guide v3](https://flixopt.github.io/flixopt/latest/user-guide/migration-guide-v3/).

---

## [Unreleased]

**Summary**: v8 removes all v4-era deprecated APIs and rewrites model building with batched/vectorized operations — up to **67x faster** for large systems. Code that runs warning-free on v7.x runs unchanged apart from the removals below. See the [Migration Guide v8](https://flixopt.github.io/flixopt/latest/user-guide/migration-guide-v8/).


### 💥 Removed

- **`Optimization` / `SegmentedOptimization` / `Results`** — use `flow_system.optimize(solver)` and read results via `flow_system.solution` / `flow_system.stats`
- **`FlowSystem.sel()` / `isel()` / `resample()` / `coords`** — use `flow_system.transform.sel/isel/resample()` and `flow_system.indexes`
- **`FlowSystem.plot_network()` / `network_infos()` / `start_network_app()` / `stop_network_app()`** and the PyVis-based `topology.plot_legacy()` — use `flow_system.topology.plot()` / `infos()` / `start_app()` / `stop_app()`; **pyvis is no longer a dependency**
- **`FlowSystem.from_old_results()`** — re-run old optimizations with the current API (`from_old_dataset()` still loads pre-v5 configuration files and no longer warns)
- **`Bus(excess_penalty_per_flow_hour=...)`** — now raises `TypeError`; use `imbalance_penalty_per_flow_hour`
- **`normalize_weights` parameter** on `create_model` / `build_model` / `optimize()` — weights are always normalized

### 🚀 Performance


#### Batched Model Building (#588)

Complete rewrite of the model building pipeline using batched operations instead of per-element loops:

| System Size | Build Speedup | Write LP Speedup |
|-------------|---------------|------------------|
| XL (2000h, 300 converters) | **67x** (113s → 1.7s) | **5x** (45s → 9s) |
| Complex (72h, piecewise) | **2.6x** (1s → 383ms) | **4x** (417ms → 100ms) |

**Architecture Changes**:

- **Type-level batched models**: New `FlowsModel`, `StoragesModel`, `BusesModel` classes process all elements of a type in single vectorized operations
- **Pre-computed element data**: All `*Data` classes (`FlowsData`, `StoragesData`, `EffectsData`, `BusesData`, `ComponentsData`, `ConvertersData`, `TransmissionsData`) cache element parameters as xarray DataArrays with element dimensions
- **Mask-based variables**: Use linopy's `mask=` parameter for heterogeneous elements (e.g., only some flows have status variables)
- **Fast NumPy helpers**: `fast_notnull()` / `fast_isnull()` are ~55x faster than xarray equivalents

**Model Size Reduction** (fewer, larger variables/constraints):

| System | Variables (old → new) | Constraints (old → new) |
|--------|----------------------|------------------------|
| XL (2000h, 300 conv) | 4,917 → 21 | 5,715 → 30 |
| Medium (720h) | 370 → 21 | 428 → 30 |

### 🐛 Fixed

- **Status duration constraints**: Fixed `min_downtime` and `min_uptime` constraints not being enforced in batched mode due to mask broadcasting issues
- **Investment effects**: Fixed investment-related effects (`effects_of_investment`, `effects_of_retirement`, `effects_per_size`) not being registered when using batched operations

## [7.2.1](https://github.com/flixOpt/flixopt/compare/v7.2.0...v7.2.1) (2026-07-21)


Expand Down
Loading
Loading