add_piecewise_formulation: incremental method with a fractional `active` gate only reaches the first segment
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
Hướng nghiên cứu
Start by locating add_piecewise_formulation and _add_incremental in Linopy, then inspect the incremental constraints and the existing tests for piecewise formulations. Reproduce the fractional active=0.5 case with the supplied HiGHS example. Done means fractional gates either produce the expected scaled range and curve behavior, or are rejected with a clear error.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[!NOTE]
The following content was generated by AI.
Version Checks (indicate both or one)
- I have confirmed this bug exists on the lastest release of Linopy.
- I have confirmed this bug exists on the current
masterbranch of Linopy.
Issue Description
add_piecewise_formulation(method="incremental", active=...) accepts a continuous active, but a fractional gate can then use only the first segment.
The incremental rows are delta_k <= active, delta_k <= z_k and z_{k+1} <= delta_k with binary z. With active = 0.5, delta_1 <= 0.5 forces z_2 = 0, so delta_2 = 0. For a binary gate the rows are correct.
Where it matters: PyPSA's linearised unit commitment passes the relaxed status (in [0, 1]) as active. A unit that is half on is then capped at half of its first breakpoint, not at half of its full range (PyPSA/PyPSA#2128 now refuses this case).
Reproducible Example
import linopy
for s_val in (1.0, 0.5):
m = linopy.Model()
x = m.add_variables(lower=0, name="x")
y = m.add_variables(lower=0, name="y")
s = m.add_variables(lower=s_val, upper=s_val, name="s")
m.add_piecewise_formulation(
(y, linopy.breakpoints([0, 50, 150])),
(x, linopy.breakpoints([0, 50, 100])),
method="incremental",
active=s,
)
m.add_objective(-x)
m.solve("highs", output_flag=False)
print(f"s={s_val}: max x = {float(x.solution)} (expected {100 * s_val})")
Output:
s=1.0: max x = 100.0 (expected 100.0)
s=0.5: max x = 25.0 (expected 50.0)
Expected Behavior
Either of the two:
- Support a fractional gate. The curve holds for the share that is on, i.e. the perspective
y = s * f(x / s). In_add_incremental, replacez_{k+1} <= delta_kwithdelta_k >= active - (1 - z_k)anddelta_{k+1} <= z_k(segmentkfills toactivebeforek+1opens). For a binary gate this is the same feasible set as today. I checked it with HiGHS on a non-convex curve:max x = 50ats = 0.5,y(x=30) = 0.5 * f(60)ats = 0.5, andy(x=60) = f(60)ats = 1. - Reject a non-binary
activewith a clear error, if (1) is out of scope.
Installed Versions
linopy 0.10.0.post1.dev112+gcc56119a7 (master), HiGHS solver, Python 3.13.
- Ngôn ngữ chính
- Python
- Star
- 264
- Fork
- 95
- Merge trung bình
- 11 giờ 33 phút
- Pull request đã merge (30 ngày)
- 86
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PyPSA/linopy
-
feature needs triage
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
PyPSA/linopy#1180 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 18/100
PyPSA/linopy#1159 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
spec: a row emptied by the data is refused even when it holdsCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Gurobi raises GurobiError when a MIP stops at a limit without an incumbentCó thể đã có người làm @Blizzeq đã nhận 15 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Rose22/openlumara#166 ·
-
documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement feature/signals self-driving team/self-driving
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
PostHog/posthog#144208 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue help wanted tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
LMPrado-DZ23/open_notas_br#14 ·
Maintainer thường phản hồi trong vòng 1 ngày