Skip to main content

Posts

smsk

class Graph : def __init__ ( self , graph , heuristicNodeList , startNode ): # instantiate graph object with graph topology, # heuristic values, start node self . graph = graph self . H = heuristicNodeList self . start = startNode self . parent = {} self . status = {} self . solutionGraph = {} def applyAOStar ( self ): # starts a recursive AO* algorithm self . aoStar ( self . start , False ) def getNeighbors ( self , v ): # gets the Neighbors of a given node return self . graph . get ( v , '' ) def getStatus ( self , v ): # return the status of a given node return self . status . get ( v , 0 ) def setStatus ( self , v , val ): # set the status of a given node self . status [ v ] = val def getHeuristicNodeValue ( self , n ): return self . H . get ( n , 0 ) # always return the heuristic value of a given node def setHeuris...