@@ -66,7 +66,7 @@ def __repr__(self):
66
66
67
67
68
68
def asp_of_AEONReg (dom , boenc , n , acting_n = None , regs = None , ns = "" ):
69
- regs = dom .rg . regulators (n ) if regs is None else regs
69
+ regs = dom .am . predecessors (n ) if regs is None else regs
70
70
acting_n = n if acting_n is None else acting_n
71
71
d = len (regs )
72
72
boenc .load_template_domain (ns = ns , allow_externals = ns )
@@ -76,24 +76,27 @@ def asp_of_AEONReg(dom, boenc, n, acting_n=None, regs=None, ns=""):
76
76
nbc = dom .get_maxclause (d )
77
77
rules .append (clingo .Function (f"{ ns } maxC" , symbols (n , nbc )))
78
78
for m in regs :
79
- reg = dom .rg .find_regulation (m , acting_n )
80
- m = dom .rg .get_variable_name (m )
79
+ reg = dom .am .find_regulation (m , acting_n )
80
+ m = dom .am .get_variable_name (m )
81
81
args = symbols (m , n )
82
- monotonicity = reg .get ("monotonicity " )
83
- if monotonicity == "activation" :
82
+ monotonicity = reg .get ("sign " )
83
+ if monotonicity in [ True , "positive" , "+" ] :
84
84
sign = 1
85
- elif monotonicity == "inhibition" :
85
+ elif monotonicity in [ False , "negative" , "-" ] :
86
86
sign = - 1
87
87
else :
88
88
sign = "(-1;1)"
89
89
rules .append ("{}in({},{},{})" .format (ns , * args , sign ))
90
- if reg [ "observable" ] :
90
+ if reg . get ( "essential" ) :
91
91
boenc .load_template_edge (ns = ns )
92
92
rules .append (":- not {}edge({},{},_)" .format (ns , * args ))
93
93
return rules
94
94
95
95
def asp_of_AEONFunction (dom , n , func ):
96
96
rules = []
97
+ if isinstance (func .struct , bool ):
98
+ rules .append (clingo .Function ("constant" , symbols (n , s2v (func .struct ))))
99
+ return rules
97
100
for cid , c in enumerate (func .struct ):
98
101
if isinstance (c , bool ):
99
102
rules .append (clingo .Function ("constant" , symbols (n , s2v (c ))))
@@ -167,7 +170,6 @@ class AEONDomain(BonesisDomain, dict):
167
170
def __init__ (self , aeon_model , maxclause = None , canonic = True ):
168
171
super ().__init__ ()
169
172
self .am = aeon_model
170
- self .rg = self .am .graph ()
171
173
self .ba = boolean .BooleanAlgebra (NOT_class = NOT )
172
174
self .maxclause = maxclause
173
175
self .canonic = canonic # canonicty is ensured only for parameters and free functions
@@ -176,7 +178,7 @@ def __init__(self, aeon_model, maxclause=None, canonic=True):
176
178
self ._f = bonesis .BooleanNetwork ({})
177
179
178
180
for i in self .am .variables ():
179
- name = self .rg .get_variable_name (i )
181
+ name = self .am .get_variable_name (i )
180
182
func = self .am .get_update_function (i )
181
183
self [name ] = func
182
184
@@ -201,7 +203,7 @@ def register_parameter(g):
201
203
else :
202
204
assert self .params [name ] == args
203
205
return name
204
- func = func . to_string ( self . am ) if not isinstance (func , str ) else func
206
+ func = str ( func ) if not isinstance (func , str ) else func
205
207
f = self .ba .parse (RE_PARAMETER .sub (register_parameter , func ))
206
208
self ._f [node ] = f
207
209
f = self ._f [node ]
0 commit comments