Skip to content

Commit 38c6c4d

Browse files
committed
Update CHANGELOG.md
1 parent 4d42bbc commit 38c6c4d

1 file changed

Lines changed: 75 additions & 112 deletions

File tree

CHANGELOG.md

Lines changed: 75 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -51,146 +51,109 @@ If upgrading from v2.x, see the [v3.0.0 release notes](https://github.com/flixOp
5151
5252
## [Unreleased] - ????-??-??
5353
54-
**Summary**: Renaming parameters in Linear Transformers for readability (old parameters still work but emit warnings), new bounds for weighted sums over all periods for effects and flow hours, and refactored weights handling to fix `.sel()` issues with periods.
54+
**Summary**:
5555
5656
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](https://flixopt.github.io/flixopt/latest/user-guide/migration-guide-v3/).
5757
5858
### ✨ Added
59-
- **Internal period weight computation**: `FlowSystem` now automatically computes `period_weights` from the period index (similar to `hours_per_timestep` for time dimension), ensuring weights are always consistent with the actual periods
6059
61-
- **New constraint parameters for sum across all periods**:
62-
- `Effect`: Added `minimum_over_periods` and `maximum_over_periods` for weighted sum constraints across all periods (complements existing per-period `minimum_total`/`maximum_total`)
63-
- `Flow`: Added `flow_hours_max_over_periods` and `flow_hours_min_over_periods` for weighted sum constraints across all periods
60+
### 💥 Breaking Changes
61+
62+
### ♻️ Changed
63+
64+
### 🗑️ Deprecated
65+
66+
### 🔥 Removed
67+
68+
### 🐛 Fixed
69+
70+
### 🔒 Security
71+
72+
### 📦 Dependencies
73+
74+
### 📝 Docs
75+
76+
### 👷 Development
77+
78+
### 🚧 Known Issues
79+
80+
---
81+
82+
Until here -->
6483

65-
**Important**:
66-
- Constraints with the `_over_periods` suffix compute weighted sums across all periods using the **raw** weights from period durations (or user-specified weights). These constraints always use unnormalized weights.
67-
- The `normalize_weights` parameter (in `Calculation` or `FlowSystem.create_model()`) only affects the objective function, not the `_over_periods` constraints.
68-
- Per-period constraints (without the suffix) apply separately to each individual period.
84+
## [4.0.0] - 2025-11-19
6985

70-
**Example**:
71-
```python
72-
# Per-period constraint: limits apply to EACH period individually
73-
# With periods=[2020, 2030, 2040], this creates 3 separate constraints
74-
effect = fx.Effect('costs', maximum_total=1000) # ≤1000 in 2020 AND ≤1000 in 2030 AND ≤1000 in 2040
86+
**Summary**: This release introduces clearer parameter naming for linear converters and constraints, enhanced period handling with automatic weight computation, and new sum-over-all-periods constraints for multi-period optimization. All deprecated parameter names continue to work with warnings.
7587

76-
# Over-periods constraint: limits apply to WEIGHTED SUM across ALL periods
77-
# With periods=[2020, 2030, 2040] (auto-derived weights: [10, 10, 10] from 10-year intervals)
78-
effect = fx.Effect('costs', maximum_over_periods=1000) # 10×costs₂₀₂₀ + 10×costs₂₀₃₀ + 10×costs₂₀₄₀ ≤ 1000
88+
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](https://flixopt.github.io/flixopt/latest/user-guide/migration-guide-v3/).
89+
90+
### ✨ Key Features
7991

80-
# Note: If normalize_weights=True, the objective uses normalized weights [0.33, 0.33, 0.33],
81-
# but the constraint above still uses raw weights [10, 10, 10]
82-
```
92+
**Sum-over-all-periods constraints:**
93+
New constraint parameters enable limiting weighted totals across all periods:
94+
- `Effect`: `minimum_over_periods` and `maximum_over_periods`
95+
- `Flow`: `flow_hours_max_over_periods` and `flow_hours_min_over_periods`
8396

84-
- **Auto-modeling**: `Calculation.solve()` now automatically calls `do_modeling()` if not already done, making the explicit `do_modeling()` call optional for simpler workflows
97+
```python
98+
# Per-period: limits apply to EACH period individually
99+
effect = fx.Effect('costs', maximum_total=1000) # ≤1000 per period
100+
101+
# Over-periods: limits apply to WEIGHTED SUM across ALL periods
102+
# With periods=[2020, 2030, 2040] (weights: [10, 10, 10] from 10-year intervals)
103+
effect = fx.Effect('costs', maximum_over_periods=25000) # 10×costs₂₀₂₀ + 10×costs₂₀₃₀ + 10×costs₂₀₄₀ ≤ 25000
104+
```
105+
106+
**Improved period weight handling:**
107+
- Period weights now computed automatically from period index (like `hours_per_timestep` for time)
108+
- Weights correctly recalculate when using `.sel()` or `.isel()` on periods
109+
- Separate tracking of `period_weights`, `scenario_weights`, and combined `weights`
110+
111+
**Simplified workflow:**
112+
- `Calculation.solve()` now automatically calls `do_modeling()` if needed
85113

86114
### 💥 Breaking Changes
87-
- **FlowSystem weights parameter renamed**: The `weights` parameter in `FlowSystem.__init__()` has been renamed to `scenario_weights` to clarify that it only accepts scenario dimension weights (not period × scenario)
88-
- Period weights are now **always computed internally** from the period index (similar to `hours_per_timestep` for time)
89-
- The combined `weights` (period × scenario) are computed automatically by multiplying `period_weights × scenario_weights`
90-
- only scenario_weights are normalized in the objective function
91-
92-
**Migration**: Update your code from:
93-
```python
94-
# Old (v3.6 and earlier)
95-
fs = FlowSystem(..., weights=np.array([0.3, 0.5, 0.2])) # scenario weights
96-
```
97-
98-
To:
99-
```python
100-
# New (v3.7+)
101-
fs = FlowSystem(..., scenario_weights=np.array([0.3, 0.5, 0.2]))
102-
```
115+
116+
**FlowSystem weights parameter renamed:**
117+
```python
118+
# Old (v3.x)
119+
fs = FlowSystem(..., weights=np.array([0.3, 0.5, 0.2]))
120+
121+
# New (v4.0)
122+
fs = FlowSystem(..., scenario_weights=np.array([0.3, 0.5, 0.2]))
123+
```
124+
Period weights are now always computed from the period index.
103125

104126
**Note**: If you were previously passing period × scenario weights to `weights`, you now need to:
105127
1. Pass only scenario weights to `scenario_weights`
106128
2. Period weights will be computed automatically from your `periods` index
107129

108-
### ♻️ Changed
109-
- **Period weights now computed from period index**: FlowSystem now computes `period_weights` automatically from the period index (using period intervals/differences), making weight handling consistent with `hours_per_timestep` for time dimension
110-
- Added `_update_period_metadata()` method (analogous to `_update_time_metadata()`) to recalculate weights when periods are selected
111-
- Period weights are stored separately in `FlowSystem.period_weights` (1D array with 'period' dimension)
112-
- Scenario weights are stored in `FlowSystem.scenario_weights` (1D array with 'scenario' dimension)
113-
- Combined weights `FlowSystem.weights` (2D array with 'period' and 'scenario' dimensions) are computed via `_compute_weights()` method
114-
115-
- **Refactored FlowSystem-Element coupling**:
116-
- Introduced `_set_flow_system()` method in Interface base class to propagate FlowSystem reference to nested Interface objects
117-
- Each Interface subclass now explicitly propagates the reference to its nested interfaces (e.g., Component → OnOffParameters, Flow → InvestParameters)
118-
- Elements can now access FlowSystem via `self.flow_system` property instead of passing it through every method call
119-
- **Simplified transform_data() signature**: Removed `flow_system` parameter from `transform_data()` methods - FlowSystem reference is now accessed via `self.flow_system` property
120-
- **Two-phase modeling pattern within _do_modeling()**: Clarified the pattern where `_do_modeling()` creates nested submodels first (so their variables exist), then creates constraints that reference those variables - eliminates circular dependencies in Submodel architecture
121-
- **Improved cache invalidation**: Cache invalidation in `add_elements()` now happens once after all additions rather than per element
122-
- **Better logging**: Centralized element registration logging to show element type and full label
123-
- **Parameter renaming in `linear_converters.py`**: Renamed parameters to use lowercase, descriptive names for better consistency and clarity:
124-
- **Flow parameters** (deprecated uppercase abbreviations → descriptive names):
125-
- `Boiler`: `Q_fu` → `fuel_flow`, `Q_th` → `thermal_flow`
126-
- `Power2Heat`: `P_el` → `electrical_flow`, `Q_th` → `thermal_flow`
127-
- `HeatPump`: `COP` → `cop`, `P_el` → `electrical_flow`, `Q_th` → `thermal_flow`
128-
- `CoolingTower`: `P_el` → `electrical_flow`, `Q_th` → `thermal_flow`
129-
- `CHP`: `Q_fu` → `fuel_flow`, `P_el` → `electrical_flow`, `Q_th` → `thermal_flow`
130-
- `HeatPumpWithSource`: `COP` → `cop`, `P_el` → `electrical_flow`, `Q_ab` → `heat_source_flow`, `Q_th` → `thermal_flow`
131-
- **Efficiency parameters** (abbreviated → descriptive names):
132-
- `Boiler`: `eta` → `thermal_efficiency`
133-
- `Power2Heat`: `eta` → `thermal_efficiency`
134-
- `CHP`: `eta_th` → `thermal_efficiency`, `eta_el` → `electrical_efficiency`
135-
- `HeatPump`: `COP` → `cop`
136-
- `HeatPumpWithSource`: `COP` → `cop`
137-
- **Storage Parameters**:
138-
- `Storage`: `initial_charge_state="lastValueOfSim"` → `initial_charge_state="equals_last"`
139-
140-
- **Parameter naming consistency**: Established consistent naming pattern for constraint parameters across `Effect`, `Flow`, and `OnOffParameters`:
141-
- Per-period constraints use no suffix or clarified names (e.g., `minimum_total`, `flow_hours_max`, `on_hours_min`)
142-
- Sum-over-all-periods constraints use `_over_periods` suffix (e.g., `minimum_over_periods`, `flow_hours_max_over_periods`)
143-
144-
- **Flow parameters** (renamed for consistency):
145-
- Renamed `flow_hours_total_max` → `flow_hours_max` (per-period constraint)
146-
- Renamed `flow_hours_total_min` → `flow_hours_min` (per-period constraint)
147-
148-
- **OnOffParameters** (renamed for consistency):
149-
- Renamed `on_hours_total_max` → `on_hours_max` (per-period constraint)
150-
- Renamed `on_hours_total_min` → `on_hours_min` (per-period constraint)
151-
- Renamed `switch_on_total_max` → `switch_on_max` (per-period constraint)
152-
153-
### 🗑️ Deprecated
154-
- **Old parameter names in `linear_converters.py`**: The following parameter names are now deprecated and accessible as properties/kwargs that emit `DeprecationWarning`. They will be removed in v4.0.0:
155-
- **Flow parameters**: `Q_fu`, `Q_th`, `P_el`, `Q_ab` (use `fuel_flow`, `thermal_flow`, `electrical_flow`, `heat_source_flow` instead)
156-
- **Efficiency parameters**: `eta`, `eta_th`, `eta_el` (use `thermal_efficiency`, `electrical_efficiency` instead)
157-
- **COP parameter**: `COP` (use lowercase `cop` instead)
158-
- **Storage Parameter**: `Storage`: `initial_charge_state="lastValueOfSim"` (use `initial_charge_state="equals_last"`)
159-
130+
### 🗑️ Deprecated Parameters
160131

161-
- **Flow parameters**: `flow_hours_total_max`, `flow_hours_total_min` (use `flow_hours_max`, `flow_hours_min`)
162-
- **OnOffParameters**: `on_hours_total_max`, `on_hours_total_min`, `switch_on_total_max` (use `on_hours_max`, `on_hours_min`, `switch_on_max`)
132+
**Linear converters** (`Boiler`, `CHP`, `HeatPump`, etc.) - descriptive names replace abbreviations:
133+
- Flow: `Q_fu``fuel_flow`, `P_el``electrical_flow`, `Q_th``thermal_flow`, `Q_ab``heat_source_flow`
134+
- Efficiency: `eta``thermal_efficiency`, `eta_th``thermal_efficiency`, `eta_el``electrical_efficiency`, `COP``cop` (lowercase)
163135

164-
**Migration**: Simply rename parameters by removing `_total` from the middle:
165-
- `flow_hours_total_max` → `flow_hours_max`
166-
- `on_hours_total_min` → `on_hours_min`
167-
- `switch_on_total_max` → `switch_on_max`
136+
**Constraint parameters** - removed redundant `_total` suffix:
137+
- `Flow`: `flow_hours_total_max``flow_hours_max`, `flow_hours_total_min``flow_hours_min`
138+
- `OnOffParameters`: `on_hours_total_max``on_hours_max`, `on_hours_total_min``on_hours_min`, `switch_on_total_max``switch_on_max`
168139

169-
All deprecated parameter names continue to work with deprecation warnings for backward compatibility. **Deprecated names will be removed in version 4.0.0.** Please update your code to use the new parameter names. Additional property aliases have been added internally to handle various naming variations that may have been used.
140+
**Storage**:
141+
- `initial_charge_state="lastValueOfSim"``initial_charge_state="equals_final"`
170142

143+
All deprecated names continue working with warnings. **They will be removed in v5.0.0.**
171144

172145
### 🐛 Fixed
173-
- **Fixed weights not recalculating when using `.sel()` on periods**: `FlowSystem.sel()` and `FlowSystem.isel()` now correctly recalculate `period_weights` and `weights` when selecting a subset of periods (previously weights would be incorrectly sliced instead of recomputed from the new period index)
174-
- Added `_update_period_metadata()` call in `_dataset_sel()` and `_dataset_isel()` to ensure weights stay consistent with selected periods
175-
- This matches the existing behavior for time dimension where `hours_per_timestep` is recalculated on selection
176-
177-
- Fixed inconsistent argument passing in `_fit_effect_coords()` - standardized all calls to use named arguments (`prefix=`, `effect_values=`, `suffix=`) instead of mix of positional and named arguments
178-
- Fixed `check_bounds` function in `linear_converters.py` to normalize array inputs before comparisons, ensuring correct boundary checks with DataFrames, Series, and other array-like types
146+
- Fixed inconsistent boundary checks in linear converters with array-like inputs
179147

180148
### 👷 Development
181-
- **Eliminated circular dependencies**: Implemented two-phase modeling pattern within `_do_modeling()` where nested submodels are created first (creating their variables), then constraints are created that can safely reference those submodel variables
182-
- Added comprehensive docstrings to `_do_modeling()` methods explaining the pattern: "Create variables, constraints, and nested submodels"
183-
- Added missing type hints throughout the codebase
184-
- Improved code organization by making FlowSystem reference propagation explicit and traceable
185-
- **System validation**: Added `_validate_system_integrity()` to validate cross-element references (e.g., Flow.bus) immediately after transformation, providing clearer error messages
186-
- **Element registration validation**: Added checks to prevent elements from being assigned to multiple FlowSystems simultaneously
187-
- **Helper methods in Interface base class**: Added `_fit_coords()` and `_fit_effect_coords()` convenience wrappers for cleaner data transformation code
188-
- **FlowSystem property in Interface**: Added `flow_system` property to access the linked FlowSystem with clear error messages if not yet linked
149+
- Eliminated circular dependencies with two-phase modeling pattern
150+
- Enhanced validation for cross-element references and FlowSystem assignment
151+
- Added helper methods for cleaner data transformation code
152+
- Improved logging and cache invalidation
153+
- Improved argument consistency in internal effect coordinate fitting
189154

190155
---
191156

192-
Until here -->
193-
194157
## [3.6.1] - 2025-11-17
195158

196159
**Summary**: Documentation improvements and dependency updates.

0 commit comments

Comments
 (0)