evol.problems.routing package¶
Submodules¶
evol.problems.routing.coordinates module¶
evol.problems.routing.magicsanta module¶

class
evol.problems.routing.magicsanta.
MagicSanta
(city_coordinates, home_coordinate, gift_weight=None, sleigh_weight=1)[source]¶
evol.problems.routing.tsp module¶

class
evol.problems.routing.tsp.
TSPProblem
(distance_matrix)[source]¶ Bases:
evol.problems.problem.Problem

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.