Commit 0c73e3d2 authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain
Browse files

deleting rules, but without using the trace

parent a7a8c5f5
...@@ -194,10 +194,37 @@ add_reaction_backtracking(R) :- ...@@ -194,10 +194,37 @@ add_reaction_backtracking(R) :-
find_and_delete_rules :- find_and_delete_rules :-
listing(nusmv:trace/1), (
nusmv:trace(_)
->
delete_rules_from_trace
;
delete_rules
).
delete_rules_from_trace :-
fail. fail.
delete_rules :-
findall(Item, item([kind: reaction, item: Item]), Reactions),
sublist(ToBeDeleted, Reactions),
ToBeDeleted \= [],
maplist(del_reaction_backtracking, ToBeDeleted).
del_reaction_backtracking(R) :-
(
delete_item([kind: reaction, item: R]),
print_message(informational, removed(R))
;
add_item([kind: reaction, item: R]),
print_message(informational, added(R)),
fail
).
prolog:message(step(Step)) --> prolog:message(step(Step)) -->
['Entering step ~w'-[Step]]. ['Entering step ~w'-[Step]].
......
...@@ -20,6 +20,7 @@ test( ...@@ -20,6 +20,7 @@ test(
test( test(
'revise_model rule addition for ECTL', 'revise_model rule addition for ECTL',
[ [
setup(clear_model),
all(Reactions = [['_' => b], ['_' =[a]=> b], [a => b]]) all(Reactions = [['_' => b], ['_' =[a]=> b], [a => b]])
% condition(flag(slow_test, true, true)), % condition(flag(slow_test, true, true)),
] ]
...@@ -33,6 +34,7 @@ test( ...@@ -33,6 +34,7 @@ test(
test( test(
'revise_model rule addition for UCTL', 'revise_model rule addition for UCTL',
[ [
setup(clear_model),
all(Reactions = [[a => b]]) all(Reactions = [[a => b]])
% condition(flag(slow_test, true, true)), % condition(flag(slow_test, true, true)),
] ]
...@@ -46,13 +48,15 @@ test( ...@@ -46,13 +48,15 @@ test(
test( test(
'revise_model rule deletion for ACTL', 'revise_model rule deletion for ACTL',
[ [
all(Reactions = [[]]) setup(clear_model),
all(Reactions = [[], [b => c]])
% condition(flag(slow_test, true, true)), % condition(flag(slow_test, true, true)),
] ]
) :- ) :-
command(present(a)), command(present(a)),
command(absent(b)), command(absent(b)),
biocham(add_reaction(a => b)), command(add_reaction(a => b)),
command(add_reaction(b => c)),
revise_model('AG'(a)), revise_model('AG'(a)),
findall(Item, item([kind: reaction, item: Item]), Reactions). findall(Item, item([kind: reaction, item: Item]), Reactions).
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
with_clean/2, with_clean/2,
clean/1, clean/1,
check_cleaned/1, check_cleaned/1,
join_op/3 join_op/3,
sublist/2
]). ]).
name_variables(L) :- name_variables(L) :-
...@@ -421,3 +422,12 @@ join_op(_Op, [Item], Item). ...@@ -421,3 +422,12 @@ join_op(_Op, [Item], Item).
join_op(Op, [I1, I2 | Items], Term) :- join_op(Op, [I1, I2 | Items], Term) :-
Term =..[Op, I1, T], Term =..[Op, I1, T],
join_op(Op, [I2 | Items], T). join_op(Op, [I2 | Items], T).
sublist([], []).
sublist([H | T], [H | TT]) :-
sublist(T, TT).
sublist(T, [_ | TT]) :-
sublist(T, TT).
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