Module pacai.core.search.heuristic

A heuristic function estimates the cost from the current state to the nearest goal in the provided SearchProblem.

Functions

def euclidean(position, problem)
Expand source code
def euclidean(position, problem):
    """
    This heuristic is the euclidean distance to the goal.
    """

    position1 = position
    position2 = problem.goal

    return distance.euclidean(position1, position2)

This heuristic is the euclidean distance to the goal.

def manhattan(position, problem)
Expand source code
def manhattan(position, problem):
    """
    This heuristic is the manhattan distance to the goal.
    """

    position1 = position
    position2 = problem.goal

    return distance.manhattan(position1, position2)

This heuristic is the manhattan distance to the goal.

def null(state, problem=None)
Expand source code
def null(state, problem = None):
    """
    This heuristic is trivial.
    """

    return 0

This heuristic is trivial.

def numFood(state, problem)
Expand source code
def numFood(state, problem):
    """
    This heuristic is the amount of food left to on the board.
    """

    return state[1].count()

This heuristic is the amount of food left to on the board.