Commit 0104137f authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain
Browse files

add option for a single solution for tropicalization

parent 543ec9c2
This diff is collapsed.
This diff is collapsed.
......@@ -444,6 +444,7 @@ ignore_partial([Eq | E], [Eq | Equils], [_ | Vars], Ignored) :-
:- initial(option(tropical_max_degree: 3)).
:- initial(option(tropical_ignore: {})).
:- initial(option(tropical_denominator: 0)).
:- initial(option(tropical_single_solution: no)).
:- biocham_silent(clear_model).
......@@ -485,6 +486,12 @@ tropicalize :-
Denominator,
'Look for solutions that are integers/(tropical_denominator+1)'
),
option(
tropical_single_solution,
yesno,
Single,
'Stop after finding one solution'
),
nb_setval(ovidiu_denominator, Denominator),
set_degrees(Eps),
retractall(is_zero(_)),
......@@ -504,7 +511,11 @@ tropicalize :-
length(Ai, VL),
(
(
nb_current(ovidiu_file, _)
(
nb_current(ovidiu_file, _)
;
Single = yes
)
->
MaxD is 2^Max
;
......@@ -534,8 +545,13 @@ tropicalize :-
equilibrate_rec(Equils),
MinD is -MaxD,
Ai ins MinD..MaxD,
labeling([bisect], Ai), % ffc makes biomodel 407 slow...
% bisect slightly better
(
Single = yes
->
once(labeling([bisect], Ai)) % ffc makes biomodel 407 slow...
;
labeling([bisect], Ai) % bisect slightly better
),
(
nb_current(ovidiu_file, _)
->
......
:- use_module(library(plunit)).
get_number_of_solutions(Output, N) :-
findall(
Pos,
(
sub_atom(Output, Pos, _, _, 'found a complete equilibration'),
once(sub_atom(Output, _, _, _, 'ε'))
),
Positions
),
length(Positions, N).
:- begin_tests(tropical).
......@@ -18,15 +30,30 @@ test(
tropicalize
)
),
findall(
Pos,
(
sub_atom(Output, Pos, _, _, 'found a complete equilibration'),
once(sub_atom(Output, _, _, _, 'ε'))
),
Positions
get_number_of_solutions(Output, N).
test(
'tropical_single_solution',
[
condition(flag(slow_test, true, true)),
setup(load('library/biomodels/BIOMD0000000103.xml')),
cleanup(clear_model),
true(N == 1)
]
) :-
with_output_to(
atom(Output),
with_option(
[
tropical_max_degree: 2,
tropical_epsilon: 0.2,
tropical_single_solution: yes
],
tropicalize
)
),
length(Positions, N).
get_number_of_solutions(Output, N).
:- end_tests(tropical).
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