Commit 649ed5a5 authored by Mathieu Hemery's avatar Mathieu Hemery
Browse files

First version of wellformedness test

parent c19157ed
......@@ -35,6 +35,7 @@ Coder: T. Martinez
set_model_name/1,
inherits/1,
parametrize/0,
check_model/0,
% Public API
get_model_name/1,
get_model_name/2,
......@@ -73,8 +74,8 @@ Coder: T. Martinez
load_all/2,
parametrize_initial_concentration/0,
parametrize_reaction/0,
is_wellformed/0,
is_strict/0
is_wellformed/1,
is_strict/1
]
).
......@@ -300,6 +301,20 @@ parametrize :-
parametrize_initial_concentration,
parametrize_reaction.
check_model :-
biocham_command,
doc('Check is the current model is well formed and strict, (see TCS15_FGS)'),
single_model(Id),
(
is_wellformed(Id)
->
format("The model is wellformed.~n", [])
;
format("The model is NOT wellformed.~n", [])
),
format("The test for strictness is not implemented yet.~n").
:- devdoc('\\section{Public API}').
......@@ -1274,18 +1289,31 @@ is_wellformed(ModelId) :-
identifier_kind(ModelId, Molecule, object),
List_Molecule
),
writeln(List_Molecule),
maplist(check_reactant, List_Molecule),
maplist(check_inhibitor, List_Molecule).
check_reactant(Molecule) :-
writeln(Molecule),
reactions_with_reactant([Molecule], List_Reaction),
forall(member(Expr for Reaction, List_Reaction),
forall(member(Expr for _Reaction, List_Reaction),
(
formal_derivation:derivative(Expr, Molecule, Derivative),
writeln(Expr),
formal_derivation:derivate(Expr, Molecule, Derivative),
writeln(Derivative),
\+(arithmetic_rules:always_negative(Derivative))
)
).
check_inhibitor(Molecule) :-
reactions_with_inhibitor([Molecule], List_Reaction),
forall(member(Expr for _Reaction, List_Reaction),
(
formal_derivation:derivate(Expr, Molecule, Derivative),
\+(arithmetic_rules:always_positive(Derivative))
)
).
%! is_strict(+model)
%
% Check if the model is strict (see TCS15_FGS)
Supports Markdown
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