set_input for one period leaves the variable's cached sum or twelfth over an overlapping period in place
Maintainer thường phản hồi trong vòng 2 ngà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
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
Start by tracing Holder.set_input and Holder._set, then follow Simulation.calculate_add, calculate_divide, and _calculate to understand how overlapping periods and branches are cached. Reproduce the four calculation sequences in the issue; done means setting an input for its own period no longer leaves stale sums or twelfths while existing cache behavior remains intact.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
set_input for one of a variable's own periods (one month of a monthly variable, one year of a yearly one) replaces the value stored for that period, but leaves in place what the simulation had calculated from it for the same variable at periods of another size: the sum calculate caches for a monthly flow over a year, and the twelfth it caches for a yearly flow at a month. A later calculate returns the cached value, so the result depends on whether the longer (or shorter) period was read before the input was set.
Executed on master b78b0ba9 (two people, formula-less float variables, auto_carry_over_input_variables off):
| Steps | Result |
|---|---|
calculate("flow_m", "2013"); set_input("flow_m", "2013-05", [50, 0]); calculate("flow_m", "2013") |
[0, 0] |
set_input("flow_m", "2013-05", [50, 0]); calculate("flow_m", "2013") |
[50, 0] |
calculate("flow_y", "2013-05"); set_input("flow_y", "2013", [1200, 0]); calculate("flow_y", "2013-05") |
[0, 0] |
set_input("flow_y", "2013", [1200, 0]); calculate("flow_y", "2013-05") |
[100, 0] |
flow_m is a monthly float variable and flow_y a yearly one, both with no formula.
Where it comes from: Simulation.calculate_add stores the sum at the requested period and calculate_divide stores the twelfth at the month (holder.put_in_cache(result, period, self.branch_name)), and _calculate returns a stored value for the requested period before anything else. Holder.set_input with a period of the variable's own unit calls Holder._set for that period only.
The inputs set over a longer period through set_input_divide_by_period and set_input_dispatch_by_period have the same problem and more; the PR for those helpers drops the variable's calculated sums and twelfths that overlap the input period. This issue is the remaining path: an input for the variable's own period. The same rule would fix it (an input drops the values calculated for that variable at overlapping periods of another size, on the branch it is stored under and the branches read through it), applied in Holder.set_input.
Not covered by #571 (which keeps the cache for a flow read over a period of another unit), #566/#576 (the fast cache, not holder storage) or #560 (other variables calculated from the input, on branches).
- Ngôn ngữ chính
- Python
- Star
- 22
- Fork
- 30
- Merge trung bình
- 2 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 25
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 PolicyEngine/policyengine-core
-
Country smoke CI fails: the pinned policyengine-us 1.824.1 is no longer on PyPICó thể đã có người làm @anth-volk đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PolicyEngine/policyengine-core#619 ·
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 76/100
PolicyEngine/policyengine-core#605 · 1 bình luận ·
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 78/100
PolicyEngine/policyengine-core#549 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
`restore_simulation` silently drops memberless group entitiesCó thể đã có người làm @Adelagric đã nhận 34 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
PolicyEngine/policyengine-core#547 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
PolicyEngine/policyengine-core#618 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của PolicyEngine/policyengine-core
Issue tương tự
-
`LazyFrameRemote` and `ExecuteRemote` sinks do not accept `Path`, like `LazyFrame` sinks do.Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ 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 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
WingedGuardian/GENesis-AGI#3375 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
curriculum documentation quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
githubnext/gh-aw-workshop#4601 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
approved Good First Issue scope: docs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
hiero-ledger/hiero-sdk-python#2730 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày