Commit 57c5f356 authored by FAGES Francois's avatar FAGES Francois
Browse files

encours

parent 0ab20881
......@@ -177,6 +177,7 @@ simplify(Inputs, Outputs):-
\+ simplify(Molecules).
simplify(Inputs, Outputs):-
writeln('--------- iterate ---------'), list_model,
simplify(Inputs, Outputs).
......@@ -204,24 +205,37 @@ simplify(Molecules):-
simpl(M),
!.
% Elimination of species M if no outgoing fork
% rewritten by merging reactions
% alpha_i => beta_i + M and M + gamma => delta is rewritten alpha_i + gamma => beta_i + delta
% Elimination of species M isolated in reactions alpha_i => beta_i + M and M + gamma => delta
% if forall i alpha_i\cap\gamma=\emptyset and \alpha_i \= \delta
% by merging reactions resulting in alpha_i + gamma => beta_i + delta
simpl(M):-
reactions_with_reactant([M], [Reaction1]),
reactions_with_product([M], Reactions),
subtract(Reactions, [Reaction1], Reactions2),
Reactions2\=[],
reaction(Reaction1, _, _, _, Products1),
forall(
member(Reaction2, Reactions2),
(
\+ (is_reactant(X, Reaction1), is_reactant(X, Reaction2)),
\+ reaction(Reaction2, _, Products1, _, _)
)
),
!,
delete_reaction(Reaction1),
member(Reaction2, Reactions2),
delete_reaction(Reaction2),
add_merge_reactions(M, Reaction1, Reaction2).
forall(
member(Reaction2, Reactions2),
(
delete_reaction(Reaction2),
add_merge_reactions(M, Reaction1, Reaction2)
)
).
% Todo: accept reversible reactions with syntax <=>
% Elimination of M in 2 loops alpha 1<=>3 M (4<)=>2 gamma rewritten alpha (<)=> gamma
% Elimination of M in 2 loops a 1<=>3 M (4<)=>2 b rewritten a (<)=> b
simpl(M):-
reactions_with_reactant([M], [Reaction1, Reaction2]),
reactions_with_product([M], [Reaction3 | Reactions]),
......
......@@ -5,6 +5,7 @@ x+y => z.
c+z => r.
list_model.
test_rate_independence_inputs_sinks.
prolog('writeln("ANSWER YES: max = sum-min")'). prolog('writeln("============")').
clear_model.
a => b.
......@@ -12,6 +13,7 @@ b => c.
c => b + d.
list_model.
test_rate_independence_inputs_sinks.
prolog('writeln("ANSWER YES: loop leakage")'). prolog('writeln("============")').
clear_model.
a => b.
......@@ -20,12 +22,24 @@ c => b.
c => d.
list_model.
test_rate_independence_inputs_sinks.
prolog('writeln("ANSWER YES: loop leakage")'). prolog('writeln("============")').
clear_model.
a+b=>b.
b+c=>_.
b+c=>d.
list_model.
test_rate_independence_inputs_sinks.
prolog('writeln("ANSWER YES: irrelevant fork")'). prolog('writeln("============")').
clear_model.
a => b.
b => a.
b => c.
list_model.
test_rate_independence_inputs_sinks. %
prolog('writeln("ANSWER YES: loop leakage")'). prolog('writeln("============")').
clear_model.
a+b=>c+d.
......@@ -35,14 +49,7 @@ e=>c+d.
e=>f+g.
list_model.
test_rate_independence_inputs_sinks.
clear_model.
a => b.
b => a.
b => c.
list_model.
test_rate_independence_inputs_sinks.
prolog('writeln("ANSWER YES: composite loop leakage")'). prolog('writeln("============")').
clear_model.
......@@ -51,6 +58,45 @@ a=>c.
b=>d.
c=>d.
list_model.
test_rate_independence_inputs_sinks.
test_rate_independence_inputs_sinks. % yes
prolog('writeln("ANSWER YES: closing or-fork with or-join")'). prolog('writeln("============")').
clear_model.
MA(k1) for A => B.
MA(k2) for A + B => C.
list_model.
test_rate_independence_inputs_sinks. % no
prolog('writeln("ANSWER NO: closing or-fork with and-join")'). prolog('writeln("============")').
% loop and fork
clear_model.
MA(1) for A=>B.
MA(2) for B=>C.
MA(5) for B=>D.
MA(6) for D=>B.
list_model.
test_rate_independence_inputs_sinks. % no
prolog('writeln("ANSWER NO: parasite loop and fork")'). prolog('writeln("============")').
clear_model.
MA(k1) for a => b.
MA(k2) for b => a.
MA(k3) for b => c.
MA(k4) for c => b.
list_model.
test_rate_independence({a},{c}). % no
prolog('writeln("ANSWER NO: loop equilibrium output")'). prolog('writeln("============")').
clear_model.
MA(k1) for a+b => b.
MA(k2) for b+c=>d.
list_model.
test_rate_independence({a},{c}). % no
prolog('writeln("ANSWER NO")'). prolog('writeln("============")').
......@@ -183,7 +183,7 @@ list_reactions_with_reactant(ObjectSet):-
reactions_with_reactant(ObjectSet, Reactions),
forall(member(R,Reactions), writeln(R)).
% setof with composite goals is bugged !
reactions_with_reactant(ObjectSet, Reactions):-
realsetof(Reaction, reaction_editor:reactant(ObjectSet, Reaction), Reactions).
......
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