Commit dcf08b9d authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain

properties of the positive semantics of influence systems

parent aa662f2b
:- module(
influence_properties,
[
% Commands
list_stable_states/0,
list_tscc_candidates/0
% Public API
]
).
:- reexport(library(clpb)).
:- use_module(library(assoc)).
list_stable_states :-
biocham_command,
doc('
lists stable steady states of the state transition graph corresponding
to the positive semantics of the current influence model.
'),
is_influence_model,
enumerate_objects(Objects),
create_bool_assoc(Objects, BoolState),
add_stable_constraints(BoolState),
assoc_to_values(BoolState, Bools),
forall(
labeling(Bools),
(
write_bool_state(BoolState),
nl
)
).
list_tscc_candidates :-
biocham_command,
doc('
lists possible representative states of Terminal Strongly Connected
Components (TSCC) of the state transition graph corresponding to the
positive semantics of the current influence model.
'),
is_influence_model,
enumerate_objects(Objects),
create_bool_assoc(Objects, BoolState),
add_tscc_constraints(BoolState),
assoc_to_values(BoolState, Bools),
forall(
labeling(Bools),
(
write_bool_state(BoolState),
(
has_enabled_effective('-', BoolState, _)
->
(
has_enabled_effective('-', BoolState, NewBoolState),
\+ has_enabled_effective('+', NewBoolState, BoolState)
->
write(' not terminal')
;
true
)
;
write(' stable')
),
nl
)
).
add_stable_constraints(BoolState) :-
findall(
(PositiveInputs, Sign, Output),
(
item([kind: influence, item: Item]),
influence(Item, _Force, PositiveInputs, _NegativeInputs, Sign,
Output)
),
InfluenceTriples
),
add_stable_constraint(InfluenceTriples, BoolState).
add_tscc_constraints(BoolState) :-
findall(
(PositiveInputs, Sign, Output),
(
item([kind: influence, item: Item]),
influence(Item, _Force, PositiveInputs, _NegativeInputs, Sign,
Output),
Sign = '+'
),
InfluenceTriples
),
add_stable_constraint(InfluenceTriples, BoolState).
add_stable_constraint([], _).
add_stable_constraint([(PositiveInputs, Sign, Output) | InfluenceTriples], BoolState) :-
get_assoc_list(PositiveInputs, BoolState, BoolPositiveInputs),
get_assoc(Output, BoolState, BoolOutput),
(
Sign = '+'
->
sat(~(*(BoolPositiveInputs)) + BoolOutput)
;
sat(~(*(BoolPositiveInputs)) + ~(BoolOutput))
),
add_stable_constraint(InfluenceTriples, BoolState).
get_assoc_list([], _, []).
get_assoc_list([H | T], Assoc, [V | U]) :-
get_assoc(H, Assoc, V),
get_assoc_list(T, Assoc, U).
create_bool_assoc(Objects, Assoc) :-
create_var_list(Objects, BoolList),
list_to_assoc(BoolList, Assoc).
create_var_list([], []).
create_var_list([H | T], [H-_ | U]) :-
create_var_list(T, U).
write_bool_state(BoolState) :-
assoc_to_list(BoolState, BoolList),
write(BoolList).
enumerate_objects(Objects) :-
setof(
Object,
enumerate_object(Object),
Objects
).
enumerate_object(Object) :-
item([kind: influence, item: Item]),
influence(Item, _Force, PositiveInputs, NegativeInputs, _Sign, Output),
(
member(Object, PositiveInputs)
;
member(Object, NegativeInputs)
;
Object = Output
).
has_enabled_effective(Sign, BoolState, NewBoolState) :-
item([kind: influence, item: Item]),
influence(Item, _Force, PositiveInputs, _NegativeInputs, Sign, Output),
get_assoc_list(PositiveInputs, BoolState, BoolInputs),
maplist(=(1), BoolInputs),
(
Sign = '+'
->
get_assoc(Output, BoolState, 0),
put_assoc(Output, BoolState, 1, NewBoolState)
;
get_assoc(Output, BoolState, 1),
put_assoc(Output, BoolState, 0, NewBoolState)
).
......@@ -41,6 +41,7 @@
- reaction_editor.pl
*** Influences
- influence_editor.pl
- influence_properties.pl
*** Events
- events.pl
** Listing and defining initial states, molecules and locations
......
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