@@ -36,7 +36,9 @@ function get_reqs_ongoing!(reqs, qs, state)
3636 (state. ongoing_transitions[i][:transCycleTime ] > 0 ) &&
3737 (reqs[tok. index, i] += qs[i] * tok. stoich * state. dt)
3838 if in (:rate , tok. modality) && in (tok. species, state. structured_species)
39- error (" Modality `:rate` is not supported for structured species in transition $(trans[:transName ]) ." )
39+ error (
40+ " Modality `:rate` is not supported for structured species in transition $(trans[:transName ]) ." ,
41+ )
4042 end
4143 in (:nonblock , tok. modality) && (reqs[tok. index, i] += qs[i] * tok. stoich)
4244 end
@@ -125,7 +127,6 @@ function get_init_satisfied(allocs, qs, state)
125127 return qs
126128end
127129
128-
129130"""
130131Evolve transitions, spawn new transitions.
131132"""
@@ -189,12 +190,20 @@ function evolve!(state)
189190 for (j, type) in enumerate (state. acs[:, :specName ])
190191 if type ∈ state. structured_species
191192 if ! isinteger (allocs[j, i])
192- error (" For structured species, stoichiometry coefficient must be integer in transition $i ." )
193+ error (
194+ " For structured species, stoichiometry coefficient must be integer in transition $i ." ,
195+ )
193196 end
194197
195- all_of_type = collect (values (inners (getagent (state, " structured/$(string (type)) " ))))
198+ all_of_type = collect (
199+ values (inners (getagent (state, " structured/$(string (type)) " ))),
200+ )
196201 filter! (! isblocked, all_of_type)
197- sort! (all_of_type, by= a-> priority (a, state. acs[i, :transName ]), rev= true )
202+ sort! (
203+ all_of_type;
204+ by = a -> priority (a, state. acs[i, :transName ]),
205+ rev = true ,
206+ )
198207
199208 ix = 1
200209 while allocs[j, i] > 0 && ix <= length (all_of_type)
@@ -246,12 +255,20 @@ function evolve!(state)
246255 for (j, type) in enumerate (state. acs[:, :specName ])
247256 if type ∈ state. structured_species
248257 if ! isinteger (allocs[j, i])
249- error (" For structured species, stoichiometry coefficient must be integer in transition $i ." )
258+ error (
259+ " For structured species, stoichiometry coefficient must be integer in transition $i ." ,
260+ )
250261 end
251262
252- all_of_type = collect (values (inners (getagent (state, " structured/$(string (type)) " ))))
263+ all_of_type = collect (
264+ values (inners (getagent (state, " structured/$(string (type)) " ))),
265+ )
253266 filter! (! isblocked, all_of_type)
254- sort! (all_of_type, by= a -> priority (a, state. acs[i, :transName ]), rev= true )
267+ sort! (
268+ all_of_type;
269+ by = a -> priority (a, state. acs[i, :transName ]),
270+ rev = true ,
271+ )
255272
256273 ix = 1
257274 while allocs[j, i] > 0 && ix <= length (all_of_type)
@@ -301,7 +318,7 @@ function finish!(state)
301318 ((state. t - trans_. t) < trans_. trans[:transMaxLifeTime ]) &&
302319 (trans_. state < trans_[:transCycleTime ]) &&
303320 (ix += 1 ; continue )
304-
321+
305322 q = if trans_. state >= trans_[:transCycleTime ]
306323 rand (Distributions. Binomial (Int (trans_. q), trans_[:transProbOfSuccess ]))
307324 else
@@ -320,7 +337,7 @@ function finish!(state)
320337 state. u[i] += q * stoich
321338 val_reward += state[i, :specReward ] * q * stoich
322339
323- for _ in 1 : q
340+ for _ = 1 : q
324341 a = context_eval (state, trans_, state. wrap_fun (r. species))
325342 entangle! (getagent (state, " structured/$(r. species. args[1 ]) " ), a)
326343 end
@@ -340,7 +357,7 @@ function finish!(state)
340357 tok. stoich *
341358 (in (:rate , tok. modality) ? trans_[:transCycleTime ] : 1 )
342359 if tok. species ∈ state. structured_species
343- for _ in 1 : (trans_. q * tok. stoich)
360+ for _ = 1 : (trans_. q* tok. stoich)
344361 trans_. bound_structured_agents[begin ]. bound_transition = nothing
345362 deleteat! (trans_. bound_structured_agents, 1 )
346363 end
@@ -349,12 +366,14 @@ function finish!(state)
349366
350367 if in (:nonblock , tok. modality)
351368 if in (:conserved , tok. modality)
352- error (" Modalities `:conserved` and `:nonblock` cannot be specified at the same time." )
369+ error (
370+ " Modalities `:conserved` and `:nonblock` cannot be specified at the same time." ,
371+ )
353372 end
354373
355- state. u[tok. index] += trans_. q * tok. stoich
374+ state. u[tok. index] += trans_. q * tok. stoich
356375 if tok. species ∈ state. structured_species
357- for _ in 1 : (trans_. q * tok. stoich)
376+ for _ = 1 : (trans_. q* tok. stoich)
358377 trans_. nonblock_structured_agents[begin ]. bound_transition = nothing
359378 deleteat! (trans_. nonblock_structured_agents, 1 )
360379 end
@@ -366,7 +385,7 @@ function finish!(state)
366385
367386 terminated_all[Symbol (trans_[:transHash ])] =
368387 get (terminated_all, Symbol (trans_[:transHash ]), 0 ) + trans_. q
369-
388+
370389 terminated_success[Symbol (trans_[:transHash ])] =
371390 get (terminated_success, Symbol (trans_[:transHash ]), 0 ) + q
372391
@@ -427,7 +446,8 @@ function ReactionNetworkProblem(
427446
428447 acs = remove_choose (acs)
429448
430- structured_species_names = acs[filter (i -> acs[i, :specStructured ], 1 : nparts (acs, :S )), :specName ]
449+ structured_species_names =
450+ acs[filter (i -> acs[i, :specStructured ], 1 : nparts (acs, :S )), :specName ]
431451
432452 attrs, transitions, wrap_fun = compile_attrs (acs, structured_species_names)
433453 transition_recipes = transitions
0 commit comments