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


Python State.get_children方法代码示例

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


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

示例1: remove_recursively

# 需要导入模块: from State import State [as 别名]
# 或者: from State.State import get_children [as 别名]
    def remove_recursively(self,queue):      
        if(len(queue) == 0):
            return
        front = queue.pop(0)
        best_state = front[0]
        child = front[1]
        weight = front[2]

        old_state = self.get_from_closed_list(str(child),best_state.direction)        
        
        if(old_state.g_score > best_state.g_score + weight):
            if(best_state.direction):
                n_state = State(child,best_state.g_score + weight,best_state.value,self.goal,best_state.direction,self.scale)
            else:
                n_state = State(child,best_state.g_score + weight,best_state.value,self.start,best_state.direction,self.scale)
            
            self.put_in_closed_list(n_state)
            new_values = n_state.get_children()
            for edge in new_values:
                n_child = edge[0]
                n_weight = edge[1]
                if(self.OL.is_contained(n_child)):
                    self.OL.update(n_child,n_weight+n_state.g_score,n_state.value,n_state.direction)
                elif(str(n_child) in self.CL.keys()):
                    queue.append((n_state,n_child,n_weight))
                else:
                    print("LOGICAL ERROR OCCURED")
        
        self.remove_recursively(queue)
开发者ID:BijoySingh,项目名称:Artificial-Intelligence,代码行数:31,代码来源:AStar.py


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