Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit e2130061 authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain

Merge branch 'hotfix/ode_simplification'

parents b918c291 198c33a7
......@@ -8,7 +8,7 @@
about/0
]).
version('4.1.6').
version('4.1.7').
copyright(
'Copyright (C) 2003-2018 Inria, EPI Lifeware, Saclay-Île de France, France'
......
......@@ -1077,8 +1077,7 @@ ode_add_expression_to_molecule(NewExpression, Molecule) :-
(
retract(assoc(Molecule, Expression))
->
true
asserta(assoc(Molecule, Expression + NewExpression))
;
Expression = 0
),
asserta(assoc(Molecule, Expression + NewExpression)).
asserta(assoc(Molecule, NewExpression))
).
......@@ -471,11 +471,12 @@ factorize_solution([], []).
factorize_solution([Coefficient * Object | Tail], SimplifiedSolution) :-
collect_object(Tail, Object, TailCoefficient, Others),
simplify(Coefficient + TailCoefficient, SimplifiedCoefficient),
% simplify(Coefficient + TailCoefficient, SimplifiedCoefficient),
SimplifiedCoefficient is Coefficient + TailCoefficient,
(
SimplifiedCoefficient = 0
->
simplify_solution(Others, SimplifiedCoefficient)
simplify_solution(Others, SimplifiedSolution)
;
SimplifiedSolution = [SimplifiedCoefficient * Object | SimplifiedTail],
simplify_solution(Others, SimplifiedTail)
......@@ -598,13 +599,17 @@ make_reaction(
compute_ode_for_reactions :-
\+ (
item([kind: reaction, item: Item]),
reaction(Item, Kinetics, Reactants, Inhibitors, Products),
\+ (
forall(
(
item([kind: reaction, item: Item]),
reaction(Item, Kinetics, Reactants, Inhibitors, Products)
),
(
kinetics(Reactants, Inhibitors, Kinetics, KineticsExpression),
add_molecules(Reactants, -KineticsExpression),
add_molecules(Products, KineticsExpression)
maplist(negate_coefficient, Reactants, NegatedReactants),
append(NegatedReactants, Products, StoichiometricSolution),
simplify_solution(StoichiometricSolution, SimplifiedSolution),
add_molecules(SimplifiedSolution, KineticsExpression)
)
).
......@@ -620,3 +625,6 @@ add_molecules(Molecules, Kinetics) :-
add_molecule(Coefficient * Molecule, Kinetics) :-
ode_add_expression_to_molecule(Coefficient * Kinetics, Molecule).
negate_coefficient(C*X, (-C)*X).
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