Commit d6cd76d5 authored by Sylvain Soliman's avatar Sylvain Soliman

add upper limit to the number of deleted rules

parent 8627c400
......@@ -345,8 +345,9 @@ rules_from_states(["FALSE" | S1], ["FALSE" | S2], [_ | Molecules], I, D, P, R) :
delete_rules :-
findall(Item, item([kind: reaction, item: Item]), Reactions),
sublist(ToBeDeleted, Reactions),
ToBeDeleted \= [],
% FIXME make the upper bound parameterizable, currently using 6 Chabrier
% style
extract_sublist(Reactions, ToBeDeleted, 1, 6),
maplist(del_reaction_backtracking, ToBeDeleted).
......
......@@ -29,7 +29,7 @@
clean/1,
check_cleaned/1,
join_op/3,
sublist/2,
extract_sublist/4,
alphabetic_char/1,
alphanumeric_char/1,
numeric_char/1,
......@@ -428,13 +428,18 @@ join_op(Op, [I1, I2 | Items], Term) :-
join_op(Op, [I2 | Items], T).
sublist([], []).
extract_sublist([H | T], [H | TT], Min, Max) :-
Max > 0,
MMin is Min - 1,
MMax is Max - 1,
extract_sublist(T, TT, MMin, MMax).
sublist([H | T], [H | TT]) :-
sublist(T, TT).
extract_sublist([_ | T], TT, Min, Max) :-
extract_sublist(T, TT, Min, Max).
sublist(T, [_ | TT]) :-
sublist(T, TT).
extract_sublist([], [], Min, Max) :-
Min =< 0,
Max >= 0.
uppercase_char(Char) :-
......
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