# evol.problems.routing package¶

## evol.problems.routing.magicsanta module¶

class evol.problems.routing.magicsanta.MagicSanta(city_coordinates, home_coordinate, gift_weight=None, sleigh_weight=1)[source]
check_solution(solution: List[List[int]])[source]

Check if the solution for the problem is valid. :param solution: List of lists containing integers representing visited cities. :return: None, unless errors are raised.

static distance(coord_a, coord_b)[source]
eval_function(solution: List[List[int]]) → Union[float, int][source]

Calculates the cost of the current solution for the TSP problem. :param solution: List of integers which refer to cities. :return:

## evol.problems.routing.tsp module¶

class evol.problems.routing.tsp.TSPProblem(distance_matrix)[source]
check_solution(solution: List[int])[source]

Check if the solution for the TSP problem is valid. :param solution: List of integers which refer to cities. :return: None, unless errors are raised.

eval_function(solution: List[int]) → Union[float, int][source]

Calculates the cost of the current solution for the TSP problem. :param solution: List of integers which refer to cities. :return:

classmethod from_coordinates(coordinates: List[Union[tuple, list]]) → evol.problems.routing.tsp.TSPProblem[source]

Creates a distance matrix from a list of city coordinates. :param coordinates: An iterable that contains tuples or lists representing a x,y coordinate. :return: A list of lists containing the distances between cities.

## Module contents¶

The evol.problems.routing part of the library contains simple problem instances that do with routing problems. These are meant to be used for education and training purposes and these problems are typically good starting points if you want to play with the library.