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
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 68/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
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.
- Langage dominant
- Python
- Étoiles
- 25
- Forks
- 25
- Merge moyen
- 4 h 5 min
- PR mergées (30 j)
- 10
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de lanl/PyBNF
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
bug minor
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
bug tech debt
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
bug minor
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 1 jour
-
bug silent-incorrectness
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de lanl/PyBNF
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
software-mansion-labs/Diplomat#20 ·
Les mainteneurs répondent en général sous 1 jour
-
[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client areaPeut-être pris @lijy91 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
libnativeapi/nativeapi#53 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
View Counts discarded due to field name mismatchPeut-être pris @rsiva0400 l’a pris aujourd’hui. Ouvertesite-bug triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Model version publishes the new UK firm entity as a personPeut-être pris @vahid-ahmadi l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
PolicyEngine/policyengine.py#764 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
spcl/HPCAgent-Bench#264 ·
Les mainteneurs répondent en général sous 1 jour