Skip to content

Python visualization of the Traveling Salesman Problem (TSP) with extra rules and constraints for a more dynamic solution

Notifications You must be signed in to change notification settings

jefftobi2004/TSP_path_optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Traveling Salesman Problem (TSP) – Visual Representation with Extended Rules

Overview

The Traveling Salesman Problem (TSP) is a classical problem in combinatorial optimization and graph theory.

It can be stated as follows:

“A person must visit a given number of cities (n), exactly once each, and return to the starting city.
The goal is to find the optimal route (the one with the minimum total cost) that satisfies these conditions.”


Extended Rules

To make the problem more interesting and realistic, I introduced additional constraints that influence how the salesman can choose the next destination at each step:

  1. Roads with Speed Limits
    Each road between two cities is defined not only by its distance but also by a speed limit (in km/h).
    This affects the time required for the salesman to travel between cities.

  2. City Accessibility Intervals
    Each city can only be visited within a specific time window.
    Outside this interval, traveling to that city is not possible.
    As a result, the algorithm must consider both distance and timing when deciding the next move.

Assumptions:

To simplify and optimize the problem-solving process, we assume that the traveler’s speed on each road is equal to the speed limit associated with that road.


Algorithms Used

The problem is solved using three classical algorithmic approaches:

  • Branch & Bound
  • Greedy Algorithm
  • Backtracking

Each algorithm offers a different perspective on how to approach and optimize the solution under the defined constraints.


Implementation

This project is implemented in Python and includes a visual representation of the TSP routes generated by the algorithms.
It aims to provide both a theoretical understanding of the problem and a practical demonstration of how additional rules affect the possible solutions.


Conclusion

By introducing extra rules such as time windows and speed limits, the Traveling Salesman Problem becomes more realistic and challenging.
This version of the TSP better reflects real-world route planning scenarios and serves as an excellent framework for exploring algorithmic optimization techniques.


About

Python visualization of the Traveling Salesman Problem (TSP) with extra rules and constraints for a more dynamic solution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages