A BNGL simulate() or parameter_scan() with no method runs as an ODE on the bngsim backend, but BNG2.pl refuses it, so the default backend fits a model that bngl_backend = bionetgen cannot run, and neither refuses it at load

Đang mở
#1,008 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/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

Hướng nghiên cứu

Start with bng2pl_network_free_refusals in pybnf/bngsim_model/grid.py (around line 274), then find the get('method', 'ode') defaults in classification.py, grid.py, net_model.py and segment.py. Add a load-time refusal for simulate, parameter_scan and bifurcate that name no method and no poplevel, quoting BNG2.pl's message. Done when the nomethod.bngl reproduction is refused on the default backend, and a model that loads also runs on bngl_backend = bionetgen.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

BNG2.pl requires method on simulate. With no method it stops with ABORT: simulate() requires 'method' parameter (ode, ssa, pla, psa, nf). (BioNetGen 2.9.3, Perl2/BNGAction.pm:256-257). A parameter_scan calls simulate at each point, so it stops too: Error in parameter_scan (step 1): simulate() requires 'method' parameter.

The bngsim bridge reads a missing method as ode everywhere:

  • the classifier, which decides that bngl_backend = auto takes the .net bridge (pybnf/bngsim_model/classification.py:300, :307, :314 for simulate, parameter_scan, bifurcate);
  • the load-time grid check (pybnf/bngsim_model/grid.py:342 and :184);
  • the run itself (_prepare_simulate_run, pybnf/bngsim_model/net_model.py:1607-1610, and _resolve_scan_settings, net_model.py:2064-2067);
  • the multiple-shooting segment integrator (pybnf/bngsim_model/segment.py:110).

bng2pl_network_free_refusals (grid.py:274) looks only at network-free methods, so an empty method passes it too. The model is therefore accepted at load on every backend. On the bridge it fits as an ODE model. On bngl_backend = bionetgen every simulation aborts, and the fit ends with Fitting complete, objective inf, and exit status 0. That is a configuration error turned into failed simulations.

The bridge is supplying a default for an input whose absence BNG2.pl treats as a mistake. The method decides whether the model is deterministic at all (ode against ssa, psa, nf). So the default backend and bngl_backend = bionetgen disagree about whether the model is valid. Usually the user meant ode, so the impact is low, but the backends should agree.

Failure scenario

A hand-written edition-1 action leaves out method, for example simulate({t_end=>5,n_steps=>5,suffix=>"tc"}). Under the default backend the fit runs and reports a best fit as an ODE model. The same configuration with bngl_backend = bionetgen, or the saved Results/<model>_<best>.bngl run with BNG2.pl, aborts. If the author meant a stochastic method, the default backend has fitted a deterministic model without saying so.

Reproduction

PyBNF v1.8.1 on main at dd4c6a3a, bngsim 0.16.0, BioNetGen 2.9.3.

nomethod.bngl:

begin model
begin parameters
  A0 1000
  kdeg kdeg__FREE
end parameters
begin molecule types
  A()
end molecule types
begin seed species
  A() A0
end seed species
begin observables
  Molecules Atot A()
end observables
begin reaction rules
  A() -> 0 kdeg
end reaction rules
end model
begin actions
generate_network({overwrite=>1})
simulate({t_end=>5,n_steps=>5,suffix=>"tc"})
end actions

tc.exp holds 1000·exp(−0.1 t) at t = 0…5. bngsim.conf (edition 1, so the job type defaults to de):

model = nomethod.bngl : tc.exp
bngl_backend = bngsim
objfunc = sos
uniform_var = kdeg__FREE 0.0999 0.1001
population_size = 3
max_iterations = 1
random_seed = 1
parallel_count = 1
output_dir = out_bngsim
delete_old_files = 0
backend result
bngsim Fitting complete, objective 0.0224; the best-fit tc rows are the ODE solution (1000, 904.81, 818.68, …)
auto the same as bngsim (objective 0.0224)
bionetgen Job gen0ind0/1/2 failed, objective inf, exit 0; ABORT: simulate() requires 'method' parameter (ode, ssa, pla, psa, nf). in each simulation log

perl $BNGPATH/BNG2.pl nomethod.bngl (with kdeg 0.1) exits 1 with the same ABORT. With the action replaced by parameter_scan({parameter=>"kdeg",par_min=>0.1,par_max=>0.4,n_scan_pts=>4,t_end=>5,suffix=>"scan"}), BNG2.pl exits 1 with Error in parameter_scan (step 1): simulate() requires 'method' parameter. The .net bridge runs it as an ODE scan (606.53, 367.88, 223.13, 135.34).

Possible fix

Refuse, at load, a simulate, parameter_scan or bifurcate that names no method (and no poplevel, which BNG2.pl reads as psa). The refusal should name the action and quote BNG2.pl's message, on every backend, so that a model that loads also runs on BNG2.pl. Once that refusal is in place, the get('method', 'ode') defaults listed above are unreachable for hand-written actions. Edition-2 experiments write the method explicitly (pybnf/config.py:1750 defaults the experiment: field to ode, which is documented), so they are unaffected.

#1005

#1005 (fix/872-sample-times-grid, 44ef34e9) does not change this. Rerunning both actions against 44ef34e9 on the .net bridge gives the same ODE rows.

Related: #920 (method spellings that are not recognised as stochastic), #999 (network-free actions BNG2.pl refuses, now refused at load).

Ngôn ngữ chính
Python
Star
25
Fork
25
Merge trung bình
4 giờ 5 phút
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của lanl/PyBNF

Tất cả issue của lanl/PyBNF

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.