A constraint's suffix.observable reference is resolved only once simulations run: an ambiguous suffix is accepted at load, and a gradient fit names a different cause

未关闭
#1,061 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
58/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend, testing

调研方向

Start with Constraint variable lookup in pybnf/constraint.py and gradient_base.scored_suffixes, then trace when constraint references are resolved during configuration loading. Use the two-model reproduction with duplicate q outputs and a dotted reference such as q.A_tot to check the behavior. Done means loading rejects references that match zero or multiple models and names the suffix and producing models.

由索引模型根据 Issue 内容生成。

描述

bug

What you do. Fit two models that both write an output with the same suffix, say q. Attach a constraint to one of them that reads that output by name, for example a tc.prop on model m1 containing q.A_tot < 50 at q.time=2 weight 1.

What you see. The configuration loads and the fit is set up. Then it depends on the fit type:

  • job_type = de stops at its first simulation with "Suffix 'q' in your constraint file appears in multiple model files. Please change your suffix names so it isn't ambiguous".
  • job_type = gntr, where m2's q is an ssa run, is refused as it is set up. The message is that it "cannot differentiate the scored output 'q' of model 'm2': it is written by a simulate run with method 'ssa'". It does not mention the ambiguity, which is the actual problem. Both models' q count as read by the constraint, because a suffix.observable reference is matched against every model's outputs.

Both runs stop, so no wrong result is reported. But the name is resolved only against the simulated output, after the configuration has been accepted. Under refine_method = gntr or refine_method = ms, a refusal that depends on this would come after the whole search.

What should happen. When the configuration loads, each suffix.observable reference in a constraint file should resolve to exactly one model's output. If it resolves to none or to more than one, the configuration should be refused, naming the suffix and the models that produce it.

Where. Constraint's variable lookup in pybnf/constraint.py (the "appears in multiple model files" check) runs against the simulation data dictionary at evaluation time. gradient_base.scored_suffixes (from #1057) adds a dotted reference's suffix to every model that can produce it.

Reproduction. Two copies of a decay model, each with simulate({method=>...,suffix=>"q"}) and then resetConcentrations() and an ODE simulate(...suffix=>"tc"). The q run is ode in m1.bngl and ssa in m2.bngl. The job:

edition = 2
bngl_backend = bngsim
model = m1.bngl : a/tc.exp, a/tc.prop
model = m2.bngl : b/tc.exp
objective = sos
uniform_var = k_deg 0.1 10
job_type = de

a/tc.prop holds q.A_tot < 50 at q.time=2 weight 1.

Found during review of the multiple-shooting batch (fix/ms-batch). The de behaviour is the same on main.

主要语言
Python
星标
26
派生
25
平均合并
4 小时 25 分钟
30 天内合并 PR
9

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

lanl/PyBNF 的其他 Issue

查看 lanl/PyBNF 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。