当前位置: 首页>>代码示例>>Python>>正文


Python Node.update方法代码示例

本文整理汇总了Python中node.Node.update方法的典型用法代码示例。如果您正苦于以下问题:Python Node.update方法的具体用法?Python Node.update怎么用?Python Node.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在node.Node的用法示例。


在下文中一共展示了Node.update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update

# 需要导入模块: from node import Node [as 别名]
# 或者: from node.Node import update [as 别名]
 def update(self):
     Node.update(self)
     if self.initiation:
         if self.aware:
             self.system_awaken()
         else:
             self.init()
     if not self.initiate:
         return
     integrity = self.system_integrity()
     if not integrity:
         self.system_failure()
开发者ID:jggatc,项目名称:nexus,代码行数:14,代码来源:core.py

示例2: test_tree_policy

# 需要导入模块: from node import Node [as 别名]
# 或者: from node.Node import update [as 别名]
 def test_tree_policy(self):
     data = [(31.16,105),(52.89,153),(113.05,285),
             (6.87,44),(100.89,259),(16.5,70),(22.05,84)]
     v0 = Node(7)
     v0.update= 1000
     for i in range(7):
         child = Node(7)
         child.val, child.update = data[i]
         child.parent = v0
         v0.children[i] = child
     v0.unvisited = 0
     v_l = self.M.tree_policy(v0, self.G)
     eq_(v0.children[1], v_l.parent)    # best child is children[1]
开发者ID:ishikota,项目名称:pymcts,代码行数:15,代码来源:test_mcts.py

示例3: test_calc_node_score

# 需要导入模块: from node import Node [as 别名]
# 或者: from node.Node import update [as 别名]
 def test_calc_node_score(self):
     data = [(31.16,105),(52.89,153),(113.05,285),
             (6.87,44),(100.89,259),(16.5,70),(22.05,84)]
     v0 = Node(7)
     v0.update= 1000
     ans = [0.55325390369,0.558168573334,0.552351405228\
             ,0.552361600287,0.552848864639,0.549851545954,0.549266772644]
     for i in range(7):
         child = Node(7)
         child.val, child.update = data[i]
         child.parent = v0
         v0.children[i] = child
         ok_(abs(ans[i] - self.M.calc_node_score(child, 1.0/math.sqrt(2))) < 0.000001)
开发者ID:ishikota,项目名称:pymcts,代码行数:15,代码来源:test_mcts.py

示例4: test_calc_node_score

# 需要导入模块: from node import Node [as 别名]
# 或者: from node.Node import update [as 别名]
    def test_calc_node_score(self):
        root = Node(7)
        root.val = 50
        root.update = 1350
        
        v0 = Node(7)
        v0.val = 80+90+100/3
        v0.update = 1380
        v0.parent = root

        # child num < 2 case
        child = Node(7)
        child.val, child.update = 50,100
        v0.children[0] = child

        # mean operator case
        eq_(1.0*v0.val/v0.update, self.M.calc_node_score(v0,0))

        data =[ (80,450), (90,400), (100, 500)]
        for i in range(3):
            child = Node(7)
            child.val, child.update = data[i]
            child.parent = v0
            v0.children[i] = child
        
        # max operator case
        eq_(100/500.0, self.M.calc_node_score(v0,0))


        data =[ (80,450), (90,400), (100, 400)]
        for i in range(3):
            child = Node(7)
            child.val, child.update = data[i]
            child.parent = v0
            v0.children[i] = child

        # mean operator case
        eq_(1.0*v0.val/v0.update, self.M.calc_node_score(v0,0))
开发者ID:ishikota,项目名称:pymcts,代码行数:40,代码来源:test_mixoperator.py

示例5: test_best_child

# 需要导入模块: from node import Node [as 别名]
# 或者: from node.Node import update [as 别名]
    def test_best_child(self):
        data = [(31.16,105),(52.89,153),(113.05,285),
                (6.87,44),(100.89,259),(16.5,70),(22.05,84)]
        v0 = Node(7)
        v0.update= 1000
        for i in range(7):
            child = Node(7)
            child.val, child.update = data[i]
            child.parent = v0
            v0.children[i] = child
        eq_(2,self.M.best_child(v0, 0))
        eq_(1,self.M.best_child(v0, 1.0/math.sqrt(2)))

        data = [(20.57,83),(33.24,113),(112.03,285),
                (1025.74,2029),(139.79,343),(22.06,86),(11.96,61)]
        v0 = Node(7)
        v0.update= 3000
        for i in range(7):
            child = Node(7)
            child.val, child.update = data[i]
            child.parent = v0
            v0.children[i] = child
        eq_(3,self.M.best_child(v0, 0))
        eq_(3,self.M.best_child(v0, 1.0/math.sqrt(2)))
开发者ID:ishikota,项目名称:pymcts,代码行数:26,代码来源:test_mcts.py


注:本文中的node.Node.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。