CSR constraints: support `update()` instead of raising frozen errors
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
- 48/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Start with CSRConstraint and Constraint.update() in linopy/constraints.py, then trace how the CSR store represents active rows and sparsity patterns. Check the existing constraint update tests and persistent backend snapshot diff; add coverage for rhs, sign, coeffs, lhs, and pattern changes. Done means supported updates keep the constraint sparse and a changed coefficient pattern raises.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
this came up as a missing gap for making the sparse model and equivalent backend to the dense
[!NOTE]
The following content was generated by AI.
Describe the feature you'd like to see
In a sparse model every constraint is a CSRConstraint. It cannot be changed: update() and all setters raise, and the only way out is mutable(), which converts the constraint to dense. Changing the right-hand side between solves (rolling horizon, persistent re-solves, sensitivity runs) therefore costs a full densification and gives up the sparse path.
import pandas as pd
import linopy
linopy.options["semantics"] = "v1"
m = linopy.Model(sparse=True)
x = m.add_variables(lower=0, coords=[pd.RangeIndex(3, name="i")], name="x")
c = m.add_constraints(x >= 1, name="c")
c.update(rhs=2)
# AttributeError: CSRConstraint.update is not supported on a frozen constraint; call .mutable() to modify.
Expected: c.update(rhs=2) changes the right-hand side and c stays a sparse constraint.
Proposed direction
Implement CSRConstraint.update() with the same signature as Constraint.update() (linopy/constraints.py:1954), on the CSR store:
| Argument | Implementation |
|---|---|
rhs, sign |
replace the per-row arrays (aligned to the active rows) |
coeffs |
replace the data array on the existing sparsity pattern; a pattern change raises |
lhs |
rebuild the CSR from the new expression |
scaling is managed by the scaling module and stays read-only for users.
This is part of retiring freezing as a user concept (#1019, step 3): once the CSR store can be updated, freeze=, freeze() and mutable() can be deprecated in favour of the model's sparse key and to_sparse() / to_dense(). Persistent backends should pick up the change through the existing snapshot diff.
- Ngôn ngữ chính
- Python
- Star
- 262
- Fork
- 89
- Merge trung bình
- 2 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 34
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
-
bug solver interface
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
refactor sparse
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
PyPSA/linopy#1049 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
refactor sparse
Độ 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
-
refactor sparse
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
-
refactor sparse
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Python Volcengine provider returns failures instead of raising themCó thể đã có người làm @Ricardo-M-L đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
agent-infra/sandbox#248 ·
-
Textractor leaves empty temporary files when remote retrieval failsCó thể đã có người làm @HuaTNA đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
test(bm_generation): pin the learning parameters and CPU sync shortcutCó thể đã có người làm @iloveeyjafjalla đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
qboson/kaiwu-pytorch-plugin#1341 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
elder-plinius/V3R1T4S#625 ·
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 62/100
foxglove/mcap#1907 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày