Commit 466bf0db authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain
Browse files

more gentle syntax in tropical equilibrations, stats option

parent ddf0184b
......@@ -229,7 +229,16 @@ subst_deg_and_vars(V, Vars, Ai, A) :-
!,
nth0(N, Ai, A).
% TODO use get_degree for numbers
% Only accept division by constants
subst_deg_and_vars(A/N, Vars, Ai, AA - D) :-
const_degree(N, D),
!,
subst_deg_and_vars(A, Vars, Ai, AA).
% Only accept division by constants
subst_deg_and_vars(N + M, _Vars, _Ai, D) :-
const_degree(N+M, D),
!.
subst_deg_and_vars(E, _, _, _) :-
throw(error(unknown_kinetic_term(E))).
......@@ -239,6 +248,27 @@ prolog:message(error(unknown_kinetic_term(E))) -->
['We do not understand the kinetic term ~p~n'-[E]].
const_degree(A, D) :-
const_eval(A, V),
get_degree(V, D).
const_eval(K, V) :-
parameter_value(K, V),
!.
const_eval(N, N) :-
number(N),
!.
const_eval(Term, D) :-
Term =.. [Op, A, B],
member(Op, ['+', '*', '-', '/']),
const_eval(A, AA),
const_eval(B, BB),
TTerm =.. [Op, AA, BB],
D is TTerm.
% split_pos_neg_and_subst(+O, +Vars, ?Ai, ?Pos, ?Neg)
%
% split expression O in positive and negative terms of the ODE
......@@ -492,6 +522,7 @@ tropicalize :-
Single,
'Stop after finding one solution'
),
option(stats, yesno, Stats, 'display computation time'),
nb_setval(ovidiu_denominator, Denominator),
set_degrees(Eps),
retractall(is_zero(_)),
......@@ -505,7 +536,13 @@ tropicalize :-
find_pinvar(4)
),
debug(tropical, "invar done", []),
statistics(cputime, Time0),
(
Stats == yes
->
statistics(cputime, Time0)
;
true
),
molecules_vars(Vars),
length(Vars, VL),
length(Ai, VL),
......@@ -569,11 +606,11 @@ tropicalize :-
close(ovidiu_file),
nb_delete(ovidiu_file)
;
debugging(tropical)
Stats == yes
->
statistics(cputime, Time1),
Time is Time1 - Time0,
debug(tropical, "Time: ~f~n~w variables~n", [Time, VL])
format("Time: ~f~n~w variables~n", [Time, VL])
;
true
)
......
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