- Awards Season
- Big Stories
- Pop Culture
- Video Games
- Celebrities

## How Has a Year Without Tourists Impacted the Overtourism Problem?

## How Overtourism Impacts Some of the World’s Most Beautiful Destinations

Some of the other most heavily impacted destinations include:

- Santorini, Greece: Greece as a whole may be on the brink of an overtourism crisis. In 2018, the country hosted an unprecedented 32 million visitors, whereas back in 2010, that figure was closer to 15 million. The Greek National Tourism Organisation says it plans to strategically extend what is considered the summer holiday period so the influx of tourists doesn’t “[move] beyond the carrying capacity of the environment.” Of all locales, the small island of Santorini has been hit hardest, garnering a whopping 5.5 million annual visitors.
- Machu Picchu: Peru’s most well-known Inca citadel is one of those destinations everyone puts on their bucket list. Unfortunately, this wonder of the ancient world wasn’t built to sustain the more than 1.2 million tourists that trek to the archeological site annually. Since Peru can’t just close its most popular tourist spot, a new ticketing system was implemented in 2017 to promote preservation.
- Koh Tachai, Thailand: Like most Thai marine parks, Koh Tachai, an island in Similan National Park, is closed every May through October for the monsoon season. But in 2016, the park didn’t reopen. The beautiful beaches had been overrun with 14 times the number of people experts said the beaches should hold. Officials decided to close the island for rehabilitation, although many fear the damage is irreparable. In addition to problems related to general overcrowding, inexperienced divers — who were more concerned with photographs than their surroundings — damaged the island’s fragile reefs. As of 2019, Koh Tachai is closed to tourists indefinitely.
- Dubrovnik, Croatia: Although it joined UNESCO’s list of World Heritage Sites back in 1979, Dubrovnik only recently emerged as one of the Mediterranean’s top tourist destinations. Unfortunately, locals claim the Old City’s historic cathedrals, fortresses and buildings have swelled with Disneyland-level crowds — due to the popularity of HBO’s Game of Thrones and the sheer number of cruises it brings in.
- Boracay, Philippines: Boracay is known for having some of the most beautiful beaches in the world. But those beaches were closed to tourists in 2018 by the president of the Philippines. An estimated 1.7 million travelers visited the island within a 10-month period, raising major infrastructure concerns — namely in terms of sewage treatment.

## How Has a Year Without Tourists Impacted These Normally Heavily Trafficked Places?

- Data Structure & Algorithm Classes (Live)
- System Design (Live)
- DevOps(Live)
- Explore More Live Courses
- Interview Preparation Course
- Data Science (Live)
- GATE CS & IT 2024
- Data Structure & Algorithm-Self Paced(C++/JAVA)
- Data Structures & Algorithms in Python
- Explore More Self-Paced Courses
- C++ Programming - Beginner to Advanced
- Java Programming - Beginner to Advanced
- C Programming - Beginner to Advanced
- Android App Development with Kotlin(Live)
- Full Stack Development with React & Node JS(Live)
- Java Backend Development(Live)
- React JS (Basic to Advanced)
- JavaScript Foundation
- Complete Data Science Program(Live)
- Mastering Data Analytics
- CBSE Class 12 Computer Science
- School Guide
- All Courses
- Linked List
- Binary Tree
- Binary Search Tree
- Advanced Data Structure
- All Data Structures
- Asymptotic Analysis
- Worst, Average and Best Cases
- Asymptotic Notations
- Little o and little omega notations
- Lower and Upper Bound Theory
- Analysis of Loops
- Solving Recurrences
- Amortized Analysis
- What does 'Space Complexity' mean ?
- Pseudo-polynomial Algorithms
- Polynomial Time Approximation Scheme
- A Time Complexity Question
- Searching Algorithms
- Sorting Algorithms
- Graph Algorithms
- Pattern Searching
- Geometric Algorithms
- Mathematical
- Bitwise Algorithms
- Randomized Algorithms
- Greedy Algorithms
- Dynamic Programming
- Divide and Conquer
- Backtracking
- Branch and Bound
- All Algorithms
- Company Preparation
- Practice Company Questions
- Interview Experiences
- Experienced Interviews
- Internship Interviews
- Competitive Programming
- Design Patterns
- System Design Tutorial
- Multiple Choice Quizzes
- Go Language
- Tailwind CSS
- Foundation CSS
- Materialize CSS
- Semantic UI
- Angular PrimeNG
- Angular ngx Bootstrap
- jQuery Mobile
- jQuery EasyUI
- React Bootstrap
- React Rebass
- React Desktop
- React Suite
- ReactJS Evergreen
- ReactJS Reactstrap
- BlueprintJS
- TensorFlow.js
- English Grammar
- School Programming
- Number System
- Trigonometry
- Probability
- Mensuration
- Class 8 Syllabus
- Class 9 Syllabus
- Class 10 Syllabus
- Class 8 Notes
- Class 9 Notes
- Class 10 Notes
- Class 11 Notes
- Class 12 Notes
- Class 8 Maths Solution
- Class 9 Maths Solution
- Class 10 Maths Solution
- Class 11 Maths Solution
- Class 12 Maths Solution
- Class 7 Notes
- History Class 7
- History Class 8
- History Class 9
- Geo. Class 7
- Geo. Class 8
- Geo. Class 9
- Civics Class 7
- Civics Class 8
- Business Studies (Class 11th)
- Microeconomics (Class 11th)
- Statistics for Economics (Class 11th)
- Business Studies (Class 12th)
- Accountancy (Class 12th)
- Macroeconomics (Class 12th)
- Machine Learning
- Data Science
- Mathematics
- Operating System
- Computer Networks
- Computer Organization and Architecture
- Theory of Computation
- Compiler Design
- Digital Logic
- Software Engineering
- GATE 2024 Live Course
- GATE Computer Science Notes
- Last Minute Notes
- GATE CS Solved Papers
- GATE CS Original Papers and Official Keys
- GATE CS 2023 Syllabus
- Important Topics for GATE CS
- GATE 2023 Important Dates
- Software Design Patterns
- HTML Cheat Sheet
- CSS Cheat Sheet
- Bootstrap Cheat Sheet
- JS Cheat Sheet
- jQuery Cheat Sheet
- Angular Cheat Sheet
- Facebook SDE Sheet
- Amazon SDE Sheet
- Apple SDE Sheet
- Netflix SDE Sheet
- Google SDE Sheet
- Wipro Coding Sheet
- Infosys Coding Sheet
- TCS Coding Sheet
- Cognizant Coding Sheet
- HCL Coding Sheet
- FAANG Coding Sheet
- Love Babbar Sheet
- Mass Recruiter Sheet
- Product-Based Coding Sheet
- Company-Wise Preparation Sheet
- Array Sheet
- String Sheet
- Graph Sheet
- ISRO CS Original Papers and Official Keys
- ISRO CS Solved Papers
- ISRO CS Syllabus for Scientist/Engineer Exam
- UGC NET CS Notes Paper II
- UGC NET CS Notes Paper III
- UGC NET CS Solved Papers
- Campus Ambassador Program
- School Ambassador Program
- Geek of the Month
- Campus Geek of the Month
- Placement Course
- Testimonials
- Student Chapter
- Geek on the Top
- Geography Notes
- History Notes
- Science & Tech. Notes
- Ethics Notes
- Polity Notes
- Economics Notes
- UPSC Previous Year Papers
- SSC CGL Syllabus
- General Studies
- Subjectwise Practice Papers
- Previous Year Papers
- SBI Clerk Syllabus
- General Awareness
- Quantitative Aptitude
- Reasoning Ability
- SBI Clerk Practice Papers
- SBI PO Syllabus
- SBI PO Practice Papers
- IBPS PO 2022 Syllabus
- English Notes
- Reasoning Notes
- Mock Question Papers
- IBPS Clerk Syllabus
- Apply for a Job
- Apply through Jobathon
- Hire through Jobathon
- All DSA Problems
- Problem of the Day
- GFG SDE Sheet
- Top 50 Array Problems
- Top 50 String Problems
- Top 50 Tree Problems
- Top 50 Graph Problems
- Top 50 DP Problems
- Solving For India-Hackthon
- GFG Weekly Coding Contest
- Job-A-Thon: Hiring Challenge
- BiWizard School Contest
- All Contests and Events
- Saved Videos
- What's New ?
- Divide & Conquer

## Related Articles

- Write Articles
- Pick Topics to write
- Guidelines to Write
- Get Technical Writing Internship
- Write an Interview Experience
- Optimal Substructure Property in Dynamic Programming | DP-2
- Overlapping Subproblems Property in Dynamic Programming | DP-1
- How to solve a Dynamic Programming Problem ?
- Tabulation vs Memoization
- Bitmasking and Dynamic Programming | Set 1 (Count ways to assign unique cap to every person)
- Digit DP | Introduction
- Ugly Numbers
- Program for nth Catalan Number
- Bell Numbers (Number of ways to Partition a Set)
- Coin Change | DP-7
- Subset Sum Problem | DP-25
- Subset Sum Problem in O(sum) space
- Introduction and Dynamic Programming solution to compute nCr%p
- Cutting a Rod | DP-13
- Painting Fence Algorithm
- Longest Common Subsequence | DP-4
- Count all subsequences having product less than K
- Maximum sum in a 2 x n grid such that no two elements are adjacent
- Min Cost Path | DP-6
- Longest Common Substring | DP-29
- Count ways to reach the nth stair using step 1, 2 or 3
- Count Balanced Binary Trees of Height h
- Floyd Warshall Algorithm | DP-16
- 0/1 Knapsack Problem
- Egg Dropping Puzzle | DP-11
- Box Stacking Problem | DP-22
- Partition problem | DP-18

## Travelling Salesman Problem using Dynamic Programming

- Longest Palindromic Subsequence | DP-12
- Longest alternating subsequence
- Find all distinct subset (or subsequence) sums of an array
- Weighted Job Scheduling
- Number of paths with exactly k coins
- Count number of ways to jump to reach end
- Count number of ways to partition a set into k subsets
- Maximum subarray sum in O(n) using prefix sum
- Maximum number of trailing zeros in the product of the subsets of size k
- Minimum number of deletions to make a string palindrome
- Find if string is K-Palindrome or not | Set 1
- Find the longest path in a matrix with given constraints
- Find minimum sum such that one of every three consecutive elements is taken
- Dynamic Programming | Wildcard Pattern Matching | Linear Time and Constant Space
- Dynamic Programming | Building Bridges
- Palindrome Partitioning | DP-17
- Mobile Numeric Keypad Problem
- Longest Common Subsequence with at most k changes allowed
- The painter’s partition problem
- Matrix Chain Multiplication | DP-8
- Largest rectangular sub-matrix whose sum is 0
- Maximum profit by buying and selling a share at most k times
- Introduction to Dynamic Programming on Trees
- Traversal of tree with k jumps allowed between nodes of same height
- Difficulty Level : Hard
- Last Updated : 06 Feb, 2023
- Discuss(50+)

Travelling Salesman Problem (TSP):

1) Consider city 1 as the starting and ending point.

2) Generate all (n-1)! Permutations of cities.

3) Calculate the cost of every permutation and keep track of the minimum cost permutation.

4) Return the permutation with minimum cost.

10100 represents node 2 and node 4 are left in set to be processed

010010 represents node 1 and 4 are left in subset.

NOTE:- ignore the 0th bit since our graph is 1-based

Time Complexity : O(n 2 *2 n )

Auxiliary Space : O(n 2 ) , where n is number of Nodes/Cities here.

Next Article: Traveling Salesman Problem | Set 2

http://www.lsi.upc.edu/~mjserna/docencia/algofib/P07/dynprog.pdf

http://www.cs.berkeley.edu/~vazirani/algorithms/chap6.pdf

Solve DSA problems on GfG Practice.

## Please Login to comment...

Prepare for Microsoft & other Product Based Companies

## Improve your Coding Skills with Practice

Start your coding journey now.

## Travelling Salesman Problem: Python, C++ Algorithm

What is the travelling salesman problem (tsp).

The problem statement gives a list of cities along with the distances between each city.

## Example of TSP

## Different Solutions to Travelling Salesman Problem

There are multiple ways to solve the traveling salesman problem (tsp). Some popular solutions are:

## Algorithm for Traveling Salesman Problem

We will use the dynamic programming approach to solve the Travelling Salesman Problem (TSP).

Before starting the algorithm, let’s get acquainted with some terminologies:

- A graph G=(V, E), which is a set of vertices and edges.
- V is the set of vertices.
- E is the set of edges.
- Vertices are connected through edges.
- Dist(i,j) denotes the non-negative distance between two vertices, i and j.

For example, cost (1, {2, 3, 4}, 1) denotes the length of the shortest path where:

The dynamic programming algorithm would be:

- Set cost(i, , i) = 0, which means we start and end at i, and the cost is 0.
- When |S| > 1, we define cost(i, S, 1) = ∝ where i !=1 . Because initially, we do not know the exact cost to reach city i to city 1 through other cities.
- Now, we need to start at 1 and complete the tour. We need to select the next city in such a way-

cost(i, S, j)=min cost (i, S−{i}, j)+dist(i,j) where i∈S and i≠j

For the given figure, the adjacency matrix would be the following:

Let’s see how our algorithm works:

Step 3) Now, for all subsets of S, we need to find the following:

cost(i, S, j)=min cost (i, S−{i}, j)+dist(i,j), where j∈S and i≠j

Let’s find out how we could achieve that:

{{1, 2}, {1, 3}, {1, 4}, {2, 3}, {2, 4}, {3, 4}}

{{1, 2, 3}, {1, 2, 4}, {2, 3, 4}, {1, 3, 4}}

As we are starting at 1, we could discard the subsets containing city 1.

cost (2, Φ, 1) = dist(2, 1) = 10

cost (3, Φ, 1) = dist(3, 1) = 15

cost (4, Φ, 1) = dist(4, 1) = 20

cost (2, {3}, 1) = dist(2, 3) + cost (3, Φ, 1) = 35+15 = 50

cost (2, {4}, 1) = dist(2, 4) + cost (4, Φ, 1) = 25+20 = 45

cost (3, {2}, 1) = dist(3, 2) + cost (2, Φ, 1) = 35+10 = 45

cost (3, {4}, 1) = dist(3, 4) + cost (4, Φ, 1) = 30+20 = 50

cost (4, {2}, 1) = dist(4, 2) + cost (2, Φ, 1) = 25+10 = 35

cost (4, {3}, 1) = dist(4, 3) + cost (3, Φ, 1) = 30+15 = 45

cost (2, {3, 4}, 1) = min [ dist[2,3]+Cost(3,{4},1) = 35+50 = 85,

dist[2,4]+Cost(4,{3},1) = 25+45 = 70 ] = 70

cost (3, {2, 4}, 1) = min [ dist[3,2]+Cost(2,{4},1) = 35+45 = 80,

dist[3,4]+Cost(4,{2},1) = 30+35 = 65 ] = 65

cost (4, {2, 3}, 1) = min [ dist[4,2]+Cost(2,{3},1) = 25+50 = 75

dist[4,3]+Cost(3,{2},1) = 30+45 = 75 ] = 75

cost (1, {2, 3, 4}, 1) = min [ dist[1,2]+Cost(2,{3,4},1) = 10+70 = 80

dist[1,3]+Cost(3,{2,4},1) = 15+65 = 80

dist[1,4]+Cost(4,{2,3},1) = 20+75 = 95 ] = 80

So the optimal solution would be 1-2-4-3-1

## Pseudo-code

Here’s the implementation in C++:

## Implementation in Python:

- The classical symmetric TSP is solved by the Zero Suffix Method.
- The Biogeography‐based Optimization Algorithm is based on the migration strategy to solve the optimization problems that can be planned as TSP.
- Multi-Objective Evolutionary Algorithm is designed for solving multiple TSP based on NSGA-II.
- The Multi-Agent System solves the TSP of N cities with fixed resources.

## Application of Traveling Salesman Problem

- Planning, logistics, and manufacturing microchips : Chip insertion problems naturally arise in the microchip industry. Those problems can be planned as traveling salesman problems.
- DNA sequencing : Slight modification of the traveling salesman problem can be used in DNA sequencing. Here, the cities represent the DNA fragments, and the distance represents the similarity measure between two DNA fragments.
- Astronomy : The Travelling Salesman Problem is applied by astronomers to minimize the time spent observing various sources.
- Optimal control problem : Travelling Salesman Problem formulation can be applied in optimal control problems. There might be several other constraints added.

## Complexity Analysis of TSP

## You Might Like:

- Combination Algorithm: Print all Possible Combinations of R
- Longest Common Subsequence: Python, C++ Example
- Dijsktra’s Algorithm: C++, Python Code Example
- Linear Search: Python, C++ Example
- Doubly Linked List: C++, Python Example

## Travelling Salesman Problem in C and C++

## Travelling Salesman Problem (TSP) Using Dynamic Programming

T ( 4, {2} ) = (4,2) + T (2, {} ) 1+0 = 1

T ( 2, {3} ) = (2,3) + T (3, {} ) 2+0 = 2

Minimum distance is 7 which includes path 1->3->2->4->1.

After solving example problem we can easily write recursive equation.

## Recursive Equation

## Time Complexity

Here after reaching i th node finding remaining minimum distance to that i th node is a sub-problem.

## Program for Travelling Salesman Problem in C

Enter Elements of Row: 4 3 1 5 0 The cost list is: 0 4 1 3 4 0 2 1 1 2 0 5 3 1 5 0

## Program for Travelling Salesman Problem in C++

## Travelling Salesman Problem (TSP)

Travelling Salesman Problem Example 1

## Confused about your next job?

Output – Minimum weight Hamiltonian Cycle : EACBDE= 32

- Consider city 1 as the starting and ending point. Since the route is cyclic, we can consider any point as a starting point.
- Now, we will generate all possible permutations of cities which are (n-1)!.
- Find the cost of each permutation and keep track of the minimum cost permutation.
- Return the permutation with minimum cost.

Time complexity: O(N!), Where N is the number of cities. Space complexity: O(1).

- First of them is a list that can hold the indices of the cities in terms of the input matrix of distances between cities
- And the Second one is the array which is our result
- Perform traversal on the given adjacency matrix tsp[][] for all the city and if the cost of reaching any city from the current city is less than the current cost the update the cost.
- Generate the minimum path cycle using the above step and return their minimum cost.

Time complexity: O(N^2*logN), Where N is the number of cities. Space complexity: O(N).

Q: How is this problem modeled as a graph problem?

Q: What is the difficulty level of the Travelling salesman problem? A: It is an NP-hard problem.

## Previous Post

Gcd of two numbers (c, python, java) with examples, difference between c and java.

## Traveling Salesperson Problem

## Create the data

The code below creates the data for the problem.

- The number of vehicles in the problem, which is 1 because this is a TSP. (For a vehicle routing problem (VRP), the number of vehicles can be greater than 1.)
- The depot : the start and end location for the route. In this case, the depot is 0, which corresponds to New York.

## Other ways to create the distance matrix

## Create the routing model

The inputs to RoutingIndexManager are:

- The number of rows of the distance matrix, which is the number of locations (including the depot).
- The number of vehicles in the problem.
- The node corresponding to the depot.

## Create the distance callback

## Set the cost of travel

## Set search parameters

## Add the solution printer

The function displays the optimal route and its distance, which is given by ObjectiveValue() .

## Solve and print the solution

Finally, you can call the solver and print the solution:

This returns the solution and displays the optimal route.

## Run the programs

When you run the programs, they display the following output.

## Save routes to a list or array

You can use these functions to get the routes in any of the VRP examples in the Routing section.

The following code displays the routes.

For the current example, this code returns the following route:

## Complete programs

The complete TSP programs are shown below.

## Example: drilling a circuit board

Here's scatter chart of the locations for the holes:

## Compute the distance matrix

## Add the distance callback

## Solution printer

## Main function

## Running the program

Here's a graph of the corresponding route:

Here are the complete programs for the circuit board example.

## Changing the search strategy

The examples below show how to set a guided local search for the circuit board example.

For other local search strategies, see Local search options .

For more search options, see Routing Options .

## Scaling the distance matrix

## Notes From Industry

If you just want to read about the 2-opt, you can jump directly to the end of this article. You can also use the Python package that I developed below to solve a TSP.

## In optimization, 2-opt is a simple local search algorithm with a special swapping mechanism that suits well to solve the…

First, let me explain TSP in brief.

## Artificial Intelligence: Unorthodox Lessons: How to Gain Insight and Build Innovative Solutions

## Traveling Salesman Problem

## I. Dynamic Programming

Suggestion- If you want to solve traveling salesman problem with a large number of cities the dynamic programming method is not the best choice. The DP method can guarantee the global optimum but it just needs much time and computational power that we mostly can not afford in real-world problems.

## II. Simulated Annealing

- The moving direction must be probabilistically determined in each step with the hope of not getting trapped in a local optimum and moving toward the global optimum.
- The search step must be reduced in size while the search process is moving forward and getting close to the final result. That helps to move vigorously in early steps, and cautiously in later steps.

Suggestion- The outcome of the simulated annealing method is sensitive to its parameters and its stopping criteria. A simulated annealing method is a powerful tool. But if you want to work with it, make sure you are aware of its flaws.

## pdrm83/py2opt

Suggestion- The 2-opt method can be implemented easily and executed fast. Plus, it works much better than the expectation, especially when you decrease its sensitivity to the initial point in the search space. I highly suggest using this method to solve the TSP unless a good-enough result is not appropriate for you.

## IV. Summary

The video below is a good summary of this article. You will enjoy watching it.

The last words- When you want to find a solution for any problem including TSP, always think about how a simple technique such as the 2-opt method can work well. Why? Because its heuristic is very well-suited to the problem.

## Thanks for Reading!

If you like this post and want to support me…

- Follow me on Medium !
- Check out my books on Amazon !
- Become a member on Medium !
- Connect on Linkedin !
- Follow me on Twitter !

## Join Medium with my referral link — Pedram Ataee, PhD

## More from Towards Data Science

Your home for data science. A Medium publication sharing concepts, ideas and codes.

## Get the Medium app

## Pedram Ataee, PhD

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary

## C++ Program to Solve Travelling Salesman Problem for Unweighted Graph

This is the program to find shortest route of a unweighted graph.

## 0 Followers

- Related Articles
- Travelling Salesman Problem
- C++ Program to Implement Traveling Salesman Problem using Nearest Neighbour Algorithm
- C++ Program to Find Hamiltonian Cycle in an UnWeighted Graph
- C++ Program to Solve N-Queen Problem
- C++ Program to Solve a Matching Problem for a Given Specific Case
- C++ Program to Solve the Dominating Set Problem
- Write a C# program to solve FizzBuzz problem
- C++ Program to Solve the Fractional Knapsack Problem
- A Peterson Graph Problem in C Program?
- C++ Program to Solve Knapsack Problem Using Dynamic Programming
- C++ Program to Solve the 0-1 Knapsack Problem
- C++ program to Solve Tower of Hanoi Problem using Binary Value
- C Program for Activity Selection Problem
- Python Program to solve Maximum Subarray Problem using Kadane’s Algorithm
- C Program for Number of stopping station problem

## IMAGES

## VIDEO

## COMMENTS

The six steps of problem solving involve problem definition, problem analysis, developing possible solutions, selecting a solution, implementing the solution and evaluating the outcome. Problem solving models are used to address issues that...

When multiplying or dividing different bases with the same exponent, combine the bases, and keep the exponent the same. For example, X raised to the third power times Y raised to the third power becomes the product of X times Y raised to th...

All press is good press — until that press goes too well. Although the Netherlands’ beautiful, canal-filled city of Amsterdam garners about $91.5 billion a year through tourism, the city and its residents feel more overwhelmed than grateful...

Traveling Salesman Problem (TSP) Implementation · Consider city 1 as the starting and ending point. Since the route is cyclic, we can consider

1) Consider city 1 as the starting and ending point. · 2) Generate all (n-1)! Permutations of cities. · 3) Calculate the cost of every permutation

Algorithm for Traveling Salesman Problem · Set cost(i, , i) = 0, which means we start and end at i, and the cost is 0. · When |S| > 1, we define

Program for Travelling Salesman Problem in C ; #include<stdio.h> ; int ary[10][10],completed[10],n,cost=0; ; void takeInput(). { ; int i,j; ; printf("Enter the

Simple Approach · Consider city 1 as the starting and ending point. · Now, we will generate all possible permutations of cities which are (n-1)!.

In this video, Kodeeswaran will help you solve the Traveling Salesman Problem step by step using Dynamic Programming.

Traveling Salesperson Problem · Create the data · Create the routing model · Create the distance callback · Set the cost of travel · Set search

Travelling Salesman, by director Timothy Lanzone, is the story of four mathematicians hired by the U.S. government to solve the most elusive problem in computer

You can solve the traveling salesman problem or TSP with dynamic programming, simulated annealing, and 2-opt methods. My suggestion is the 2-opt method.

TSP is the travelling salesman problem consists of a salesperson and his travel to various cities. The salesperson must travel to each of the

Begin Define a variable vr = 4 universally. Declare an integer function TSP to implement Travelling salesman Problem. Declare a graph grph[][]