set_input for one period leaves the variable's cached sum or twelfth over an overlapping period in place
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- backend, performance
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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).
- 主要言語
- Python
- スター
- 22
- フォーク
- 30
- 平均マージ
- 2日 19時間
- マージ済み PR(30日)
- 25
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PolicyEngine/policyengine-core のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
PolicyEngine/policyengine-core#605 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
PolicyEngine/policyengine-core#549 ·
メンテナーはふだん 2 日以内に返信
-
`restore_simulation` silently drops memberless group entities対応中かも @Adelagric が 33 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
PolicyEngine/policyengine-core#547 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 57/100
PolicyEngine/policyengine-core#614 ·
メンテナーはふだん 2 日以内に返信
-
A reform simulation's baseline reads the reform's default for people the situation gives no value対応中かも @MaxGhenis が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
PolicyEngine/policyengine-core#612 ·
メンテナーはふだん 2 日以内に返信
PolicyEngine/policyengine-core の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
topoteretes/cognee#5773 ·
メンテナーはふだん 1 日以内に返信
-
MiKTeX: a failed build reports no errors because texify --quiet switches the log to file:line: styleオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
SublimeText/LaTeXTools#1718 ·