Commit de932e8c authored by HUANG Wei Chih's avatar HUANG Wei Chih
Browse files

take advantage of the property in switch and zero-order ultrasensitivity to simplify not operation

parent 16f33c92
......@@ -792,7 +792,8 @@ default_symbol_attr( Constant,
value: [ P, N ],
init: [ P, N ],
max: Constant,
min: Constant
min: Constant,
'not': Not
], dual ) :-
number( Constant ),
!,
......@@ -802,7 +803,8 @@ default_symbol_attr( Constant,
P is Constant, N is 0
;
P is 0, N is -Constant
).
),
constant( notNull, Not ).
default_symbol_attr( Constant,
[ const: yes,
......@@ -811,9 +813,11 @@ default_symbol_attr( Constant,
value: Constant,
init: Constant,
max: Constant,
min: Constant
min: Constant,
'not': Not
] ) :-
number( Constant ), !.
number( Constant ), !,
constant( notNull, Not ).
default_symbol_attr( Variable,
[ const: no,
......@@ -822,8 +826,10 @@ default_symbol_attr( Variable,
value: 0,
init: 0,
max: 0,
min: 0
] ).
min: 0,
'not': Not
] ) :-
!, constant( notNull, Not ).
%% get_symbol_name(-Symbol:atom) is det
%
......@@ -1073,6 +1079,20 @@ get_variable_positive( VariableName, VariableP ) :-
variable( VariableName, [ VariableP, _ ] )
).
% }}}
% get_variable_symbol{{{
%% get_variable_symbol(+VariableName:name, -VariableSymbol:name) is det
%
% Get the symbol from a variable of positive part of variable.
get_variable_symbol( VariableName, VariableSymbol ) :-
(
symbol( VariableName, _ )
->
VariableSymbol = VariableName
;
get_symbol_attr( VariableSymbol, [ name: [ VariableName, _ ] ] )
).
% }}}
% new variable{{{
%% new_variable(?Name:name) is det
......@@ -2052,7 +2072,15 @@ eval_condition( Condition, Z ) :-
*/
%% assign_to_PIVP(+OdeSystem:'ode system', +VariableXName:name, +VariableZName:name) is det
assign_to_PIVP( OdeSystem, X, Z ) :-
variable( [ Z, X ], [ ZDiff, [ XP, XN ] ], list ),
variable( [ Z, X ], [ ZDiff, XDiff ], list ),
(
XDiff = [ XP, XN ]
->
true
;
XP = XDiff,
XN = 0
),
assign_to_ODE( OdeSystem, ZDiff, XP, XN ).
......@@ -2527,7 +2555,7 @@ neg_sigmoid_to_PIVP( OdeSystem, X, Z ) :-
Threshold is True / 2,
new_variable( T ),
zero_order_ma_to_PIVP( OdeSystem, Threshold, X, T, _ ),
zero_order_ma_to_PIVP( OdeSystem, Threshold, X, T, _, true ),
multiplication_to_PIVP( OdeSystem, T, 0.01, Z ).
% }}}
/* z = pos_number_to_bool( x ):{{{
......@@ -2566,7 +2594,7 @@ pos_number_to_bool_to_PIVP( OdeSystem, X, Z, bidir ) :-
% Ideally, the theshold should be close to 0.
neg_number_to_bool_to_PIVP( OdeSystem, X, Z ) :-
new_variable( T ),
zero_order_ma_to_PIVP( OdeSystem, 0.2, X, T, _ ),
zero_order_ma_to_PIVP( OdeSystem, 0.2, X, T, _, true ),
multiplication_to_PIVP( OdeSystem, T, 0.01, Z ).
%% neg_number_to_bool_to_PIVP(+OdeSytem:'ode system', +VariableXName:name, +VariableZName:name, Bidir ) is det
......@@ -2919,7 +2947,18 @@ and_to_PIVP( OdeSystem, X, Y, Z ) :-
*/
%% not_to_PIVP(+OdeSystem:'ode system', +VariableXName:name, +VariableZName:name) is det
not_to_PIVP( OdeSystem, X, Z ) :-
neg_sigmoid_to_PIVP( OdeSystem, X, Z ).
not_to_PIVP( OdeSystem, X, Z, sim ).
%neg_sigmoid_to_PIVP( OdeSystem, X, Z ).
not_to_PIVP( OdeSystem, X, Z, sim ) :-
get_symbol_attr( X, [ 'not': Not ] ),
(
constant( notNull, Not )
->
neg_sigmoid_to_PIVP( OdeSystem, X, Z )
;
assign_to_PIVP( OdeSystem, Not, Z )
).
% }}}
% end conditional operations
% }}}
......@@ -2998,7 +3037,11 @@ switch_to_PIVP( _, SX, SY, X, Y, Options ) :- % non dual
true
;
switch_control_to_reaction( SX, Y, X, B )
).
),
get_variable_symbol( X, SymbolX ),
get_variable_symbol( Y, SymbolY ),
change_symbol_attr( SymbolX, [ 'not': SymbolY ] ),
change_symbol_attr( SymbolY, [ 'not': SymbolX ] ).
%% init_switch(+VariableXName:name, +VariableYName:name, +VariableBName:name, +Options:option_list ) is det
%
......@@ -3129,7 +3172,11 @@ zero_order_to_PIVP( OdeSystem, Threshold, SY, X, Y, InitX, InitY, Inverse ) :- %
!,
init_zero_order( OdeSystem, Threshold, X, Y, SX, KcatSX, KcatSY, KmSX, KmSY, InitX, InitY, Inverse ),
gk_to_reaction( KcatSX, KmSX, KcatSY, KmSY, SX, SY, X, Y ).
gk_to_reaction( KcatSX, KmSX, KcatSY, KmSY, SX, SY, X, Y ),
get_variable_symbol( X, SymbolX ),
get_variable_symbol( Y, SymbolY ),
change_symbol_attr( SymbolX, [ 'not': SymbolY ] ),
change_symbol_attr( SymbolY, [ 'not': SymbolX ] ).
%% init_zero_order(+OdeSystem:'ode system', +Threshold:'non-negative number', +VariableXName:name, +VariableYName:name, -VariableSXName:name, -KcatSX:'non-negative number', -KcatSY:'non-negative number', -KmSX:'non-negative number', -KmSY:'non-negative number', +InitX:bool, +InitY:bool, +Inverse:bool ) is det
init_zero_order( _, Threshold, X, Y, SX, KcatSX, KcatSY, KmSX, KmSY, InitX, InitY, Inverse ) :-
......@@ -3254,7 +3301,11 @@ zero_order_ma_to_PIVP( OdeSystem, Threshold, SY, X, Y, InitX, InitY, Inverse ) :
!,
init_zero_order_ma( OdeSystem, Threshold, X, Y, SX, KcatSX, KcatSY, KmSX, KmSY, InitX, InitY, Inverse ),
gk_to_reaction( OdeSystem, KcatSX, KmSX, KcatSY, KmSY, SX, SY, X, Y ).
gk_to_reaction( OdeSystem, KcatSX, KmSX, KcatSY, KmSY, SX, SY, X, Y ),
get_variable_symbol( X, SymbolX ),
get_variable_symbol( Y, SymbolY ),
change_symbol_attr( SymbolX, [ 'not': SymbolY ] ),
change_symbol_attr( SymbolY, [ 'not': SymbolX ] ).
%% init_zero_order_ma(+OdeSystem:'ode system', +Threshold:'non-negative number', +VariableXName:name, +VariableYName:name, -VariableSXName:name, -KcatSX:'non-negative number', -KcatSY:'non-negative number', -KmSX:'non-negative number', -KmSY:'non-negative number', +InitX:bool, +InitY:bool, +Inverse:bool ) is det
init_zero_order_ma( _, Threshold, X, Y, SX, KcatSX, KcatSY, KmSX, KmSY, InitX, InitY, Inverse ) :-
......@@ -3598,6 +3649,7 @@ constant( conNull, null ).
constant( counter, counter ).
constant( switchNull, Value ) :-
constant( false, Value ).
constant( notNull, none ).
% end constants
% }}}
% operators{{{
......
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