Exemple #1
0
__license__ = "GPLv3"
__maintainer__ = "Mario Cobos Maestre"
__status__ = "Development"
__version__ = "0.0.1"

import path_planning as pp
import math


def manhattan(point, point2):
    return abs(point2.grid_point[0] -
               point.grid_point[0]) + abs(point2.grid_point[1] -
                                          point.grid_point[1])


pp.register_heuristic('manhattan', manhattan)


def naive(point, point2):
    """
        Function that performs a naive heuristic.
    """
    return 1


pp.register_heuristic('naive', naive)


def euclidean(point, point2):
    return math.sqrt(
        pow(point2.grid_point[0] - point.grid_point[0], 2) +
Exemple #2
0
__deprecated__ = False
__email__ = "*****@*****.**"
__license__ = "GPLv3"
__maintainer__ = "Mario Cobos Maestre"
__status__ = "Development"
__version__ = "0.0.1"

import path_planning as pp
import math


def naive(point1, point2, scale=1):
    return scale


pp.register_heuristic('naive', naive)


def dijkstra(point1, point2, scale=1):
    return 0 * scale


pp.register_heuristic('dijkstra', dijkstra)


def manhattan(point1, point2, scale=1):
    return scale * (abs(point1.point[0] - point2.point[0]) +
                    abs(point1.point[1] - point2.point[1]))


pp.register_heuristic('manhattan', manhattan)