Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 87384601 authored by Mathieu Hemery's avatar Mathieu Hemery

Merge branch 'develop' into feature/well_formed

parents dcef3978 991d6d79
......@@ -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.
This diff is collapsed.
......@@ -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,20 +27,25 @@
:- doc('
Biocham v4 uses the GNU Scientific Library (GSL \\url{http://www.gnu.org/software/gsl/}) to perform 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
\\url{http://www.gnu.org/software/gsl/manual/html_node/Stepping-Functions.html#Stepping-Functions}
gives a detailed description of the numerical integration methods and options listed below.
The implicit method \\texttt{bsimp} for stiff systems is the default one.
').
:- 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).
method(rsbk).
:- grammar_doc('\\emphright{\\emph{Default method}. Rosenbrock method.}').
% Note: a list of GSL supported methods is given in gsl:gsl_methods/1
method(rk2).
......@@ -68,7 +73,7 @@ method(rk4imp).
:- grammar_doc('\\emphright{Implicit Gaussian 4th order Runge-Kutta. Error estimation is carried out by the step doubling method.}').
method(bsimp).
:- grammar_doc('\\emphright{\\emph{Default method}. Implicit Bulirsch-Stoer method of Bader and Deuflhard. The method is generally suitable for stiff problems.}').
:- grammar_doc('Implicit Bulirsch-Stoer method of Bader and Deuflhard. The method is generally suitable for stiff problems.}').
method(msadams).
:- grammar_doc('\\emphright{A variable-coefficient linear multistep Adams method in Nordsieck form. This stepper uses explicit Adams-Bashforth (predictor) and implicit Adams-Moulton (corrector) methods in P(EC)^m functional iteration mode. Method order varies dynamically between 1 and 12.}').
......@@ -98,8 +103,7 @@ method(bn).
:- grammar_doc('\\emphright{Random Boolean net simulation run. All transitions are
equiprobable.}').
method(rsbk).
:- grammar_doc('\\emphright{Rosenbrock method.}').
:- grammar(time).
......@@ -119,7 +123,7 @@ filter(no_filter).
filter(only_extrema).
:- grammar_doc('\\emphright{Only keeps the points that are an extremum for some variable.}').
:- initial(option(method: bsimp)).
:- initial(option(method: bsimp)). % rsbk)). % msbdf too slow
:- initial(option(error_epsilon_absolute: 1e-6)).
:- initial(option(error_epsilon_relative: 1e-6)).
:- initial(option(initial_step_size: 1e-6)).
......@@ -129,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)).
......@@ -168,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,
......
......@@ -115,7 +115,7 @@ ode_solver([
add_functions_values(TrueInitialState, InitialTime, FullState),
SecondRow =.. [row,InitialTime|FullState],
nb_setval(last_row, SecondRow),
log_current_row(InitialTime, FullState, Fields),
log_current_row(InitialTime, FullState, InitialParameters, Fields),
TrueInitialTime is InitialTime
),
rosenbrock_init(Epsilon_abs),
......@@ -133,11 +133,12 @@ initialize_functions_list :-
(
FunctionsList = []
->
nb_setval(functions_number,0)
nb_setval(functions_number,0),
nb_delete(functions_list)
;
nb_setval(functions_list,FunctionsList),
length(FunctionsList,Number),
nb_setval(functions_number,Number)
nb_setval(functions_number,Number),
nb_setval(functions_list,FunctionsList)
).
initialize_functions_list([],[]) :- !.
......@@ -202,21 +203,27 @@ initialize_names([Name:_|FTail], [NName|NTail]) :-
initialize_names_int(FTail, NTail).
%! log_current_row(+Time, +State, +Fields)
%! log_current_row(+Time, +State, +Parameters, +Fields)
log_current_row(Time, State, Fields) :-
prepare_row(Time, State, Fields, ToSave),
log_current_row(Time, State, Parameters, Fields) :-
prepare_row(Time, State, Parameters, Fields, ToSave),
assertz(saved_row(ToSave)).
prepare_row(_Time, _State, [], []) :- !.
prepare_row(_Time, _State, _Param, [], []) :- !.
prepare_row(Time, State, [_N:t|FTail], [Time|VTail]) :-
prepare_row(Time, State, Parameters, [_N:t|FTail], [Time|VTail]) :-
!,
prepare_row(Time, State, FTail, VTail).
prepare_row(Time, State, Parameters, FTail, VTail).
prepare_row(Time, State, [_N:x(N)|FTail], [Val|VTail]) :-
prepare_row(Time, State, Parameters, [_N:x(N)|FTail], [Val|VTail]) :-
!,
nth0(N, State, Val),
prepare_row(Time, State, FTail, VTail).
prepare_row(Time, State, Parameters, FTail, VTail).
prepare_row(Time, State, Parameters, [_N:expression(Expr)|FTail], [Val|VTail]) :-
!,
eval_coeff(Expr, State, Parameters, Time, Val),
prepare_row(Time, State, Parameters, FTail, VTail).
%! add_functions_values(+State, +Time, -FullState)
......@@ -434,7 +441,7 @@ rosenbrock(Equations, InitialTime, Duration, MaxStSz, MinStSz, Jacobian, Fields)
add_functions_values(Next_state, Time2, Next_state_full),
NewLine =.. [row,Time2|Next_state_full],
nb_setval(last_row, NewLine),
log_current_row(Time2, Next_state_full, Fields),
log_current_row(Time2, Next_state_full, Parameters, Fields),
% assertz(saved_row([Time2|Next_state_full])),
nb_setval(last_time,Time2),
Time2 >= FinalTime,!,
......
......@@ -68,6 +68,14 @@ test(test_ball, [setup(command(clear_model)), cleanup(command(clear_model))]) :-
check_integration_ball(D, 1e-3),
set_option(time, Time_default).
test(test_cell_cyle, [setup(command(clear_model)), cleanup(command(clear_model))]) :-
get_option(time, Time_default),
command(load("library/examples/cell_cycle/BIOMD0000000008.xml")),
command(option(time:10)),
command(numerical_simulation(method:rsbk)),
get_table_data(_D),
set_option(time, Time_default).
test(test_time_event, [setup(command(clear_model)), cleanup(command(clear_model))]) :-
command(k*a for a => b),
command(present(a,1.0)),
......
......@@ -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