Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

less conservative value for the big-M value #905

Merged
merged 6 commits into from
Nov 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions flexmeasures/data/models/planning/linear_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,8 @@ def device_scheduler( # noqa C901
)

# Compute a good value for M
M = 0.1
for device_constraint in device_constraints:
M = max(
M,
device_constraint["derivative max"].max(),
-device_constraint["derivative min"].min(),
)
M = np.nanmax([np.nanmax(d.abs()) for d in device_constraints])
M = max(M, 1)

# Turn prices per commitment into prices per commitment flow
if len(commitment_downwards_deviation_price) != 0:
Expand Down