On the bngsim network-free path, a bifurcate() action is skipped without any message, so the simulations after it start from the seed species instead of the state the bifurcate left
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 68/100
Research direction
Start with pybnf/bngsim_model/classification.py:308-313 and pybnf/bngsim_model/nf_model.py:291-360, then compare the bifurcate handling in pybnf/bngsim_model/net_model.py:1002-1011. Reproduce the supplied bifm.bngl and bngsim.conf cases with both backends and inspect existing tests around action classification and bridge execution. Done means unsupported accepted actions are reported or rejected consistently, with coverage for bifurcate and the related catch-all behavior.
Written by the indexing model from the issue text.
Description
A network-free BNGL model (method=>"nf") whose actions block runs bifurcate(...) and then a scored simulate(...) is sent to bngsim's network-free simulator under the default bngl_backend = auto, and also under bngl_backend = bngsim. That simulator has no code for bifurcate. It skips the action without printing anything or writing to the log, and runs the rest of the block as if the action were not there. BNG2.pl runs the bifurcate, and the next simulate continues from the state it left. PyBNF should either run the bifurcate or refuse the model when the configuration loads. In the example below, the scored time course starts at 0 molecules instead of about 180, and the objective at the same parameter values is 61358 instead of 1811.
Example
bifm.bngl (birth p, death k, steady state p/k = 200; the bifurcate ends at k = 0.5, its starting value, so it changes only the state):
begin model
begin parameters
k 0.5
p p__FREE
end parameters
begin molecule types
A()
end molecule types
begin seed species
A() 0
end seed species
begin observables
Molecules A_tot A()
end observables
begin reaction rules
0 -> A() p
A() -> 0 k
end reaction rules
end model
begin actions
bifurcate({parameter=>"k",par_min=>0.5,par_max=>2,n_scan_pts=>4,method=>"nf",t_end=>20,n_steps=>2,suffix=>"bif"})
simulate({method=>"nf",t_end=>5,n_steps=>5,suffix=>"tc"})
end actions
tc.exp:
# time A_tot
0 200
1 200
2 200
3 200
4 200
5 200
bngsim.conf (the box on p is narrow only so that every evaluation uses p = 100):
model = bifm.bngl : tc.exp
bngl_backend = bngsim
objfunc = sos
fit_type = de
uniform_var = p__FREE 99.999 100.001
population_size = 4
max_iterations = 1
random_seed = 1
output_dir = out_bngsim
delete_old_files = 0
Run pybnf -c bngsim.conf, then the same conf with bngl_backend = bionetgen (BNG2.pl with NFsim, BioNetGen 2.9.3). For evaluation gen0ind0 (p = 100.001), Simulations/gen0ind0/bifm_gen0ind0_tc.gdat holds:
| t | 0 | 1 | 2 | 3 | 4 | 5 | sos |
|---|---|---|---|---|---|---|---|
bngsim (auto or bngsim) |
0 | 75 | 148 | 166 | 172 | 167 | 61358 |
| BNG2.pl | 177 | 194 | 205 | 174 | 183 | 184 | 1811 |
The best objectives are 58203 (bngsim) and 991 (BNG2.pl). With bngl_backend = auto the run is identical to the bngsim run (objective 58203). On BNG2.pl the bifurcate's last scan point ends at 178 molecules (its _bifurcation_A_tot.scan), close to the steady state p/k = 200, and tc starts from there. On bngsim, tc starts from the seed amount, 0. Neither the console nor the bnf_*.log file mentions the skipped action.
Why
The configuration-time check classifies bifurcate with a network-free method as a network-free simulation action (pybnf/bngsim_model/classification.py:308-313), so the model is accepted for the network-free bridge (pybnf/algorithms/base.py:705). BngsimNfModel.execute (pybnf/bngsim_model/nf_model.py:291-360) handles parameter_scan, simulate, setParameter, setConcentration, addConcentration, saveParameters and resetParameters. Every other line falls through to logger.debug("BngsimNfModel: skipping unsupported action: %s", line) (nf_model.py:359-360) and the loop continues. The .net bridge's loop does handle bifurcate (pybnf/bngsim_model/net_model.py:1002-1011). BNG2.pl runs a bifurcate as a forward and a backward parameter scan with reset_conc forced to 0 (BioNetGen 2.9.3, Perl2/BNGAction.pm:1520-1553), so the model keeps the state of the last scan point, and the next simulate starts from it.
The same catch-all is also reached by a setConcentration whose quoted value contains a space (#877). Any line that reaches it is one the configuration check accepted and the bridge cannot run, so the skip is never correct.
Possible fix
Make the catch-all at nf_model.py:359-360 raise a PybnfError that names the action. Make the classifier treat bifurcate with a network-free method as unsupported by the bridge: auto then falls back to BNG2.pl, and bngsim refuses at load. (The .net bridge has the same debug-level catch-all at net_model.py:1013-1014. As far as I can tell nothing the classifier accepts reaches it today, but raising there too would stop the two from drifting apart.)
Related: #877 (the other action that reaches this skip), #941 and #880 (other places where bngsim and BNG2.pl disagree after a scan)
Found while fixing the PEtab issues #892–#908 (2026-09-25); reproduced on main at 5ecb1f69.
- Dominant language
- Python
- Stars
- 25
- Forks
- 25
- Avg merge
- 4h 5m
- Merged PRs (30d)
- 10
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lanl/PyBNF
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug minor
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug tech debt
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug minor
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug silent-incorrectness
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
software-mansion-labs/Diplomat#20 ·
Maintainers usually reply within 1 day
-
[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client areaPossibly taken @lijy91 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
libnativeapi/nativeapi#53 · 1 reaction ·
Maintainers usually reply within 1 day
-
View Counts discarded due to field name mismatchPossibly taken @rsiva0400 claimed this today. Opensite-bug triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Model version publishes the new UK firm entity as a personPossibly taken @vahid-ahmadi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PolicyEngine/policyengine.py#764 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
spcl/HPCAgent-Bench#264 ·
Maintainers usually reply within 1 day