TSP problem

Traveling Salesman Problem (TSP)

The Traveling Salesman Problem (TSP) is a classic optimization problem focused on finding the shortest possible route for a traveler to visit a set of cities and return to the origin city. The key challenge is:

  1. Unique Tour: Each city must be visited exactly once.

TSP is commonly used in logistics, manufacturing, and transportation to optimize travel routes and reduce costs.

Problem Description

Given a set of cities and the distances between each pair of them, the goal is to find a sequence of visits that minimizes the total distance traveled. This problem can be visualized as a closed circuit:

  1. Unique Route: Each city must be visited exactly once.

  2. Closed Circuit: The route must start and end in the same origin city.

  3. Distance Minimization: The sum of all distances between the visited cities must be as small as possible.

Example

Suppose we have five cities: A, B, C, D, and E. The task is to find the route that covers all the cities and returns to the initial city A, so that the sum of the distances between the cities is minimized.

Solution Methods

Some methods to solve the traveling salesman problem include:

  • Brute Force: Evaluates all possible routes and selects the one with the shortest distance. This is practical for a small number of cities due to its factorial complexity.

  • Approximate Algorithms: Such as ant colony search, genetic algorithms, or simulated annealing, which offer solutions close to optimal in reasonable time for large numbers of cities.

  • Dynamic Programming: Uses the Held-Karp algorithm, which has a time complexity of 2^n * n^2, more efficient than brute force, though still exponential.

Practical Exercise: Solving the Traveler Problem with PuLP

In this exercise, students will use the PuLP library in Python to solve the traveling salesman problem (TSP). Through this exercise, students will model and solve the problem computationally.

Instructions

  1. Introduction to the Problem:

    Imagine you are a salesperson who must visit the following cities: City1, City2, City3, City4, and City5. The goal is to determine the route that minimizes the total distance traveled when visiting all the cities and returning to the initial city.

Example Code

  1. Formulate the theoretical and algebraic linear programming model. 2. Formulate this problem as a transportation problem by constructing the appropriate parameter table. 3. Get an optimal solution for this problem. 4. Do the exercise in Colab and vary different values.

  1. Formulate the problem as a transportation model. In Colab using latex.

  2. Solve the problem with Colab and determine an optimal distribution plan for the power company.

  3. Determine the cost of additional electricity purchased by each of the three cities.

  1. Formulate the problem as a transportation model by preparing the appropriate parameter table.

  2. Draw the network representation of this problem.

  3. Get an optimal solution.

  1. Formulate the theoretical and algebraic linear programming model. 2. Formulate this problem as a transportation problem by constructing the appropriate parameter table. 3. Get an optimal solution for this problem. \

  1. Find the optimal model that minimizes system cost.

  2. Balance the system based on supply.

  3. Do this exercise in Google Colab.

Última actualización

¿Te fue útil?