Commit 298e93a4 authored by Sylvain Soliman's avatar Sylvain Soliman

and now with self loops

parent 7e171c2b
......@@ -165,7 +165,10 @@ export_transitions(Stream, Molecules, Reactions) :-
assertz(allmolecules(Molecules)),
write(Stream, 'TRANS '),
maplist(reaction_to_trans, Reactions, Trans),
atomic_list_concat(Trans, ' | ', TransOred),
maplist(reaction_to_nofire, Reactions, Loops),
all_nochange(NoChange),
atomic_list_concat([NoChange | Loops], ' & ', Loop),
atomic_list_concat([Loop | Trans], ' | ', TransOred),
write(Stream, TransOred),
nl(Stream).
......@@ -251,6 +254,47 @@ reaction_to_trans((PositiveInputs, NegativeInputs, Products, Degraded), Trans) :
).
reaction_to_nofire((PosInputs, NegInputs, _, _), ParenLoop) :-
(
PosInputs == []
->
NusmvPos = 'FALSE'
;
maplist(reactant_to_name, PosInputs, PosNames),
apply_and_join(
[make_nusmv_name, prepend_not],
PosNames,
' | ',
NusmvPos
)
),
(
NegInputs == []
->
NusmvNeg = 'FALSE'
;
maplist(reactant_to_name, NegInputs, NegNames),
apply_and_join(
[make_nusmv_name],
NegNames,
' | ',
NusmvNeg
)
),
atomic_list_concat([NusmvPos, NusmvNeg], ' | ', Loop),
format(atom(ParenLoop), '(~a)', [Loop]).
all_nochange(Result) :-
allmolecules(Molecules),
apply_and_join(
[make_nusmv_name, equiv_next],
Molecules,
' & ',
Result
).
apply_and_join([], List, Join, Result) :-
atomic_list_concat(List, Join, Result).
......
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