本文整理汇总了Python中Action.Action.get_properties方法的典型用法代码示例。如果您正苦于以下问题:Python Action.get_properties方法的具体用法?Python Action.get_properties怎么用?Python Action.get_properties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action.Action
的用法示例。
在下文中一共展示了Action.get_properties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Schema
# 需要导入模块: from Action import Action [as 别名]
# 或者: from Action.Action import get_properties [as 别名]
#.........这里部分代码省略.........
builder += s.associated_observations.to_xml()
builder += "</associated_observations>\n"
builder += "<disappeared_observations>\n"
builder += s.disappeared_observations.to_xml()
builder += "</disappeared_observations>\n"
builder += "</schema>\n"""""
#print "Added failed schema"
return builder
def set_vars_from_state(self, concrete):
"""Set variables of generalised schema from given concrete state"""
#print "\nInstiating Instantiate:::",inspect.stack()[1][3]
concrete_ws = concrete.copy()
self.mem.remove_ignored_preconditions(concrete_ws)
redundant = WorldState(); variables = {}
#print "@set_var_state for generalised schema:", self.id, self.generalised
#print "@Set_var_called:",self.generalised, len(concrete_ws.state)> 0,inspect.stack()[1][3]
if (not self.generalised) or len(concrete_ws.state)== 0:
return
observations_types = {}
for o in concrete_ws.state:
if not observations_types.has_key(o.name):
observations_types[o.name] = [o]
else:
observations_types[o.name].append(o)
most_reliable = WorldState()
for k in observations_types.keys():
if len(observations_types[k])>1:
probability = -1.0; reliable = None
"""for o in observations_types[k]:
if float(o.get_probability())/(1+self.mem.observation_id_occurrences(o)) > probability:
probability = float(o.get_probability())/self.mem.observation_id_occurrences(o)
reliable = o.copy()
elif len(o.get_properties().keys()) > len(reliable.get_properties().keys()) or len(o.coords.get_coords().keys()) > len(reliable.coords.get_coords().keys()):
reliable = o.copy()
probability = float(o.get_probability())/self.mem.observation_id_occurrences(o)"""
for o in observations_types[k]:
if self.mem.observation_id_occurrences(o) > 0:
tau1 = self.mem.observation_occurred_in_schemas(o.id).second/self.mem.observation_id_occurrences(o.id)
else:
tau1 = 0.0
nov = 1 - 4*(tau1*(1.55-1.2*tau1))**2
if 0 > tau1 or tau1 >1.0:
print "Tau value execeed the [email protected]_var_state:", o.id, tau1, self.mem.observation_occurred_in_schemas(o.id).second,self.mem.observation_id_occurrences(o), self.mem.observation_occurred_in_schemas(o.id).first
input("Enter to continue")
#observation habituation
l =[]; l1 = []; l2 = []
l = [i for i in self.mem.observation_occurred_in_schemas(o.id).first]
for i in l: l1 += self.mem.schemas[i].execution_ID; l2.append(self.mem.schemas[i].added_ID)
if len(l1) > 0:
tau2 = float(max(l1))/float(self.mem.total_executions)
su = 0.0
for i in l1:
su += i/float(self.mem.total_executions)
tau2 =su/len(l1)
else:
tau2 = 0.0
hab = 1 - math.e**(-5*tau2)
#hab = 4*(tau2*(1.55-1.2*tau2))**2
#hab = 1 - math.e**(-3*tau2)
if 0 > tau2 or tau2 >1.0:
print "Tau value execeed the [email protected]_var_state:", o.id,tau2, nov, hab, self.mem.observation_occurred_in_schemas(o.id).first, self.mem.observation_occurred_in_schemas(o.id).second
input("Enter to continue")
sim3 = (nov - hab)
print "Observation at Set_var:", o.id, nov, hab,sim3, l1