Esempio n. 1
0
def heuristic(state, problem):
    # It would take a while for Flat Earther's to get accustomed to this paradigm
    # but hang in there.
    return util.points2distance(
        ((problem.G.node[state]['x'], 0, 0),
         (problem.G.node[state]['y'], 0, 0)),
        ((problem.G.node[problem.end_node]['x'], 0, 0),
         (problem.G.node[problem.end_node]['y'], 0, 0)))
Esempio n. 2
0
def heuristic(state, problem):
    # It would take a while for Flat Earther's to get accustomed to this paradigm
    # but hang in there.

    """
        Takes the state and the problem as input and returns the heuristic for the state
        Returns a real number(Float)
    """
    return util.points2distance(((problem.G.node[state]['x'],0,0), (problem.G.node[state]['y'],0,0)),
                                ((problem.G.node[problem.end_node]['x'],0,0), (problem.G.node[problem.end_node]['y'],0,0)))
Esempio n. 3
0
def heuristic(state, problem):
    # It would take a while for Flat Earther's to get accustomed to this paradigm
    # but hang in there.

    """
        Takes the state and the problem as input and returns the heuristic for the state
        Returns a real number(Float)
    """

    current_node_attr, end_node_attr = problem.G.node[state], problem.G.node[problem.end_node]
    current_node_coordinates = ((current_node_attr['x'], 0, 0), (current_node_attr['y'], 0, 0))
    end_node_coordinates = ((end_node_attr['x'], 0, 0), (end_node_attr['y'], 0, 0))
    return util.points2distance(current_node_coordinates, end_node_coordinates)
Esempio n. 4
0
def heuristic(state, problem):
    # It would take a while for Flat Earther's to get accustomed to this paradigm
    # but hang in there.
    """
        Takes the state and the problem as input and returns the heuristic for the state
        Returns a real number(Float)
    """
    goalState = problem.end_node
    goalState = problem.G.node[goalState]
    stateState = problem.G.node[state]
    goalP = ((goalState['x'], 0, 0), (goalState['y'], 0, 0))
    stateP = ((stateState['x'], 0, 0), (stateState['y'], 0, 0))
    return util.points2distance(goalP, stateP)
    util.raiseNotDefined()
Esempio n. 5
0
def heuristic(state, problem):
    # It would take a while for Flat Earther's to get accustomed to this paradigm
    # but hang in there.

    """
        Takes the state and the problem as input and returns the heuristic for the state
        Returns a real number(Float)
    """
    # util.raiseNotDefined()
    p_state = problem.G.node[state]
    p_end = problem.G.node[problem.end_node]
    p1 = ((p_state['x'],0,0),(p_state['y'],0,0))
    p2 = ((p_end['x'],0,0),(p_end['y'],0,0))
    # print(p_state,p_end)
    return util.points2distance(p1,p2)
Esempio n. 6
0
def heuristic(state, problem):
    point1 = ((problem.G.node[problem.end_node]['x'], 0, 0),
              (problem.G.node[problem.end_node]['y'], 0, 0))
    point2 = ((problem.G.node[state]['x'], 0, 0), (problem.G.node[state]['y'],
                                                   0, 0))
    return util.points2distance(point1, point2)