Commit 4adab375 authored by FAGES Francois's avatar FAGES Francois
Browse files

Addition of tutorials in notebook tests, robustness_samples:30 (before default...

Addition of tutorials in notebook tests, robustness_samples:30 (before default was 100) doc for method:rsbk default but not active yet
parent 7b339ccc
......@@ -53,7 +53,7 @@ KERNEL_DIR=$(JUPYTER_DIR)/kernel/biocham_kernel
WORKFLOWS_DIR=$(JUPYTER_DIR)/guinbextension/src/config/workflows
# NOTEBOOKS=$(shell find . -type f -name '*.ipynb' -print)
NOTEBOOKS=library/examples/C2-19-Biochemical-Programming/TD1_lotka_volterra.ipynb library/examples/C2-19-Biochemical-Programming/TD2_enzyme_kinetics.ipynb library/examples/C2-19-Biochemical-Programming/TD4_genetic_switch.ipynb library/examples/C2-19-Biochemical-Programming/TD5_protein_switch.ipynb library/examples/C2-19-Biochemical-Programming/TD6_oscillators.ipynb library/examples/C2-19-Biochemical-Programming/TD7_switches.ipynb library/examples/C2-19-Biochemical-Programming/TD7_rate_independence.ipynb library/examples/C2-19-Biochemical-Programming/TD8_mapk_signalling.ipynb
NOTEBOOKS=library/examples/tutorial/tutorialShort.ipynb library/examples/tutorial/tutorialLongHistory.ipynb library/examples/C2-19-Biochemical-Programming/TD1_lotka_volterra.ipynb library/examples/C2-19-Biochemical-Programming/TD2_enzyme_kinetics.ipynb library/examples/C2-19-Biochemical-Programming/TD4_genetic_switch.ipynb library/examples/C2-19-Biochemical-Programming/TD5_protein_switch.ipynb library/examples/C2-19-Biochemical-Programming/TD6_oscillators.ipynb library/examples/C2-19-Biochemical-Programming/TD7_switches.ipynb library/examples/C2-19-Biochemical-Programming/TD7_rate_independence.ipynb library/examples/C2-19-Biochemical-Programming/TD8_mapk_signalling.ipynb
REFDIR=nbrefs
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -234,56 +234,63 @@ markov_run(State, Conditions, Actions, Until, PropensitiesType, TimeType,
Threshold) :-
maplist(eval_in_state(State), Conditions, Propensities),
(
PropensitiesType = 'boolean'
PropensitiesType = 'boolean'
->
maplist(sign, Propensities, TypedPropensities)
maplist(sign, Propensities, TypedPropensities)
;
TypedPropensities = Propensities
TypedPropensities = Propensities
),
sum_list(TypedPropensities, Alpha),
(
Alpha =:= 0
Alpha =:= 0
->
NewTime = Until,
NewState = State
NewTime = Until,
NewState = State
;
(
TimeType = 'discrete'
->
DeltaT = 1
;
DeltaT is log(1/random_float)/Alpha
),
eval_in_state(State, 'Time', Time),
NewTime is Time + DeltaT,
Bound is Alpha*random_float,
% write(select_action(Bound, Actions, Propensities)),nl,
select_action(Bound, Actions, TypedPropensities, Action),
set_state(Action, State, NewState)
(
TimeType = 'discrete'
->
DeltaT = 1
;
DeltaT is log(1/random_float)/Alpha
),
eval_in_state(State, 'Time', Time),
NewTime is Time + DeltaT,
Bound is Alpha*random_float,
% write(select_action(Bound, Actions, Propensities)),nl,
select_action(Bound, Actions, TypedPropensities, Action),
catch(
set_state(Action, State, NewState),
stochastic_bound(Molecule),
true)
),
set_state(['Time'-NewTime], NewState, NextState),
handle_events(NextState),
retract(last_time(LastTime)),
(
% FIXME this is a very rough sampling
(nonvar(Molecule)
->
format("Stochastic bound overflow on molecular species: ~a~n",[Molecule])
;
set_state(['Time'-NewTime], NewState, NextState),
handle_events(NextState),
retract(last_time(LastTime)),
(
% FIXME this is a very rough sampling
(
(NewTime >= Until)
(NewTime >= Until)
;
(NewTime - LastTime >= min(1, Until/float(Threshold)))
(NewTime - LastTime >= min(1, Until/float(Threshold)))
)
->
->
write_state(NextState),
assertz(last_time(NewTime))
;
;
assertz(last_time(LastTime))
),
(
),
(
NewTime >= Until
->
->
true
;
markov_run(NextState, Conditions, Actions, Until, PropensitiesType,
TimeType, Threshold)
;
markov_run(NextState, Conditions, Actions, Until, PropensitiesType, TimeType, Threshold)
)
).
......@@ -429,8 +436,14 @@ set_state([], State, State).
set_state([Key-Value | Actions], State, NewState) :-
eval_in_state(State, Value, Eval),
put_assoc(Key, State, Eval, NextState),
set_state(Actions, NextState, NewState).
get_option(stochastic_bound,B),
(Eval>B % that test should be limited to numbers of molecules that are reactants only (not functions nor non-reactants)
->
throw(stochastic_bound(Key))
;
put_assoc(Key, State, Eval, NextState),
set_state(Actions, NextState, NewState)
).
:- dynamic(state/1).
......
......@@ -27,7 +27,7 @@
:- doc('
Biocham v5 uses its own implementation of the Rosenbrock implicit method \\texttt{rsbk} for numerical simulations.
Biocham v5 uses its own implementation of Rosenbrock implicit method \\texttt{rsbk} for numerical simulations.
This method is well suited to stiff systems and is the default one.
Biocham v5 is also interfaced to the GNU Scientific Library (GSL \\url{http://www.gnu.org/software/gsl/}) to perform numerical simulations.
The page
......@@ -38,7 +38,9 @@
:- doc(' The ODE simulation of a Biocham model proceeds by creating an ODE system if there is none, and deleting it after the simulation.
It is worth noting that if there is an ODE system already present (e.g. created by import_ode), it is the current ODE system that is simulated, not the Biocham model.').
:- doc('The stochastic simulation of a Biocham model is specific to reaction and influence models, and does not apply to ODE systems.').
:- doc('The stochastic simulation of a Biocham model is specific to reaction and influence models.
It cannot be directly used on an ODE system, but on an equivalent reaction system (e.g. automatically inferred with command \\command{load_reactions_from_ode/1}).').
:- grammar(method).
......@@ -131,6 +133,7 @@ filter(only_extrema).
:- initial(option(time: 20)).
:- initial(option(stochastic_conversion: 100)).
:- initial(option(stochastic_bound: 1e6)).
:- initial(option(stochastic_thresholding: 1000)).
:- initial(option(filter: no_filter)).
:- initial(option(stats: no)).
......@@ -170,12 +173,16 @@ numerical_simulation :-
),
option(
stochastic_conversion, number, _,
'Conversion factor used to scale 1 mole to the given number of molecules.'
'Conversion factor used to scale 1 mole to the given number of molecules (default 100).'
),
option(
stochastic_bound, number, _,
'Maximum number of molecules of one molecular species allowed in stochastic simulations (default 1e6).'
),
option(
stochastic_thresholding, number, _,
'Do not write (but still compute) stochastic steps below one fraction of
the total time'
the total time (default 1000)'
),
option(
filter, filter, _Filter,
......
......@@ -24,7 +24,7 @@ search_condition((Formula, Event, Objective)) :-
:- doc('The continuous satisfaction degree of an FO-LTL(Rlin) in a given trace with respect to the objective values for the free variables can be used in multiple ways to compute parameter sensitivity indices and robustness measures with respect to parameter perturbation according to normal distributions, and to search parameter values for satisfying an FO-LTL(Rlin) formula \\cite{RBFS11tcs} or even maximizing the margins and the robustness \\cite{FS18cmsb}.').
:- initial('option(robustness_samples: 100)').
:- initial('option(robustness_samples: 30)').
:- initial('option(openmpi_procs: 0)').
:- initial('option(robustness_coeff_var: 0.1)').
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment