You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add weight_of_last_period to flowsystem
* Add weights per effect and move normalization
* Weighted Sum Constraints Over All Periods have been fully implemented for both Effects and Flows:
Effects
- Renamed parameters: minimum_total → minimum_total_per_period, maximum_total → maximum_total_per_period
- New parameters: minimum and maximum for weighted sum across ALL periods
- Effect-specific weights: Effects can override FlowSystem weights (e.g., for discounting in costs vs equal weighting for CO2)
- Backward compatibility: Deprecation wrappers ensure existing code continues to work
Flows
- Renamed parameters: flow_hours_total_min/max → flow_hours_per_period_min/max
- New parameters: total_flow_hours_min/max for weighted sum across ALL periods
- Uses FlowSystem period weights for weighting
- Backward compatibility: Deprecation wrappers for old parameter names
Test Results
- 616/616 tests passing - no regressions introduced
- All existing functionality preserved
- Weighted sums respect period weights (auto-derived from period index or user-specified)
The implementation is production-ready and maintains full backward compatibility with existing code.
* Fixed a critical bug in /Users/felix/PycharmProjects/flixopt_719231/flixopt/structure.py:218-228 where the FlowSystemModel.weights property
wasn't normalizing weights despite its docstring claiming it would. The property now correctly normalizes weights to sum to 1 when
normalize_weights=True.
* Successfully refactored 11 parameter names across the codebase using the _over_periods suffix for weighted sums across all periods:
Effects (4 parameters):
- minimum_total_per_period → minimum_total
- maximum_total_per_period → maximum_total
- minimum → minimum_over_periods
- maximum → maximum_over_periods
Flows (4 parameters):
- flow_hours_per_period_max → flow_hours_max
- flow_hours_per_period_min → flow_hours_min
- total_flow_hours_max → flow_hours_max_over_periods
- total_flow_hours_min → flow_hours_min_over_periods
OnOffParameters (3 parameters):
- on_hours_total_min → on_hours_min
- on_hours_total_max → on_hours_max
- switch_on_total_max → switch_on_max
* Cahneglog
* Fix CHANGELOG.md
* 1. Critical Bug Fix - structure.py:219-229
- Fixed weights property normalization to handle scalars/lists properly
- Added zero-sum guard to prevent division by zero
- Now always aligns weights to model coords before normalizing
2. Documentation - flow_system.py
- Added documentation for the weight_of_last_period parameter in the FlowSystem class docstring
3. Code Quality - interface.py
- Refactored deprecated kwargs handling to use instance method instead of awkward static call pattern
- Removed unnecessary import and cleaner implementation
4. Parameter Name Updates - Test Files
Updated deprecated parameter names in all test files:
- tests/test_scenarios.py
- tests/test_functional.py
- tests/conftest.py
- tests/test_flow.py
- tests/test_linear_converter.py
5. Parameter Name Updates - Documentation
Updated parameter names in:
- docs/user-guide/mathematical-notation/features/OnOffParameters.md
6. Parameter Name Updates - Examples
Updated parameter names in:
- examples/02_Complex/complex_example.py
7. Enhanced CHANGELOG.md
Added comprehensive migration guidance including:
- Clear explanation of weighting behavior for _over_periods constraints
- Concrete example showing per-period vs over-periods differences
- Removal timeline (version 4.0.0) for deprecated parameters
- Simple migration instructions
All deprecated parameters:
- on_hours_total_min → on_hours_min
- on_hours_total_max → on_hours_max
- switch_on_total_max → switch_on_max
- flow_hours_total_min → flow_hours_min
- flow_hours_total_max → flow_hours_max
The codebase is now fully updated with consistent naming, proper documentation, and backward compatibility maintained through deprecation warnings!
* 1. Critical Bug Fix - structure.py:219-229
- Fixed weights property normalization to handle scalars/lists properly
- Added zero-sum guard to prevent division by zero
- Now always aligns weights to model coords before normalizing
2. Documentation - flow_system.py
- Added documentation for the weight_of_last_period parameter in the FlowSystem class docstring
3. Code Quality - interface.py
- Refactored deprecated kwargs handling to use instance method instead of awkward static call pattern
- Removed unnecessary import and cleaner implementation
4. Parameter Name Updates - Test Files
Updated deprecated parameter names in all test files:
- tests/test_scenarios.py
- tests/test_functional.py
- tests/conftest.py
- tests/test_flow.py
- tests/test_linear_converter.py
5. Parameter Name Updates - Documentation
Updated parameter names in:
- docs/user-guide/mathematical-notation/features/OnOffParameters.md
6. Parameter Name Updates - Examples
Updated parameter names in:
- examples/02_Complex/complex_example.py
7. Enhanced CHANGELOG.md
Added comprehensive migration guidance including:
- Clear explanation of weighting behavior for _over_periods constraints
- Concrete example showing per-period vs over-periods differences
- Removal timeline (version 4.0.0) for deprecated parameters
- Simple migration instructions
All deprecated parameters:
- on_hours_total_min → on_hours_min
- on_hours_total_max → on_hours_max
- switch_on_total_max → switch_on_max
- flow_hours_total_min → flow_hours_min
- flow_hours_total_max → flow_hours_max
The codebase is now fully updated with consistent naming, proper documentation, and backward compatibility maintained through deprecation warnings!
* Added single-period validation in _create_periods_with_extra():
* Added dimension validation for flow_hours constraints
* Fixed the DataArray boolean context
* Remove intermediate parameters that need no deprecation
* Remove intermediate parameters that need no deprecation
* Update CHANGELOG.md
* Fix weighting per period in Flows
* Add type hints and fallback for weights = None
* Imrove weight computation in Effects
* Improve objectove weight handling
* Add tests
* Typos
* Add zero-sum guard to objective_weights property to prevent silent NaN/inf corruption
* Guard over‑periods constraint when no period dimension is present.
* Fit fallback weight to dims
* Improve weight handling.
* Typos and updates
* Update CHANGELOG.md
* Update tests
* Improve handling of scenario weights
* Improve docs
* Typos
* Rename in tests
* Add removal warnings to deprecated parameters
* Update CHANGELOG.md
* Add deprectation test
* Add deprectation test
* Add remaining deprectation warnings and tests
* Move DEPRECATION_REMOVAL_VERSION to core.py
* Reevrt Merge issue
* Add infos to CHANGELOG.md
0 commit comments