ArticleslgStudy

computer science

Travelling salesman problem

Travelling salesman problem is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Travelling salesman problem rather than just read about it. In short: In the theory of computational complexity, the travelling salesman problem (TSP) asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?" It is an NP-hard problem in combinatorial optimization, important in theoretical computer science and operations research. The travell…

Travelling salesman problem — main illustration
Travelling salesman problem — illustration

Key takeaways

  • Travelling salesman problem belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Travelling salesman problem to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Travelling salesman problem from memory before moving on to harder problems.

Reference excerpt

In the theory of computational complexity, the travelling salesman problem (TSP) asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?" It is an NP-hard problem in combinatorial optimization, important in theoretical computer science and operations research. The travelling purchaser problem, the vehicle routing problem and the ring star problem are three generalizations of TSP. The decision version of the TSP (where given a length L, the task is to decide whether the graph has a tour whose length is at most L) belongs to the class of NP-complete problems. Thus, it is possible that the worst-case running time for any algorithm for the TSP increases superpolynomially (but no more than exponentially) with the number of cities. The problem was first formulated in 1930 and is one of the most intensively studied problems in optimization. It is used as a benchmark for many optimization methods. Even though the problem is computationally difficult, many heuristics and exact algorithms are known, so that some instances with tens of thousands of cities can be solved completely, and even problems with millions of cities can be approximated within a small fraction of 1%. The TSP has several applications even in its purest formulation, such as planning, logistics, and the manufacture of microchips. In warehouse operations, order picking routes are often modelled as variants of the travelling salesman problem, where a picker must visit multiple storage locations and return to a start or drop-off point while minimizing travel distance or time. Slightly modified, it appears as a sub-problem in many areas, such as DNA sequencing. In these applications, the concept city represents, for example, customers, soldering points, or DNA fragments, and the concept distance represents travelling times or cost, or a similarity measure between DNA fragments. The TSP also appears in astronomy, as astronomers observing many sources want to minimize the time spent moving the telescope between the sources; in such problems, the TSP can be embedded inside an optimal control problem. In many applications, additional constraints such as limited resources or time windows may be imposed.

History The origins of the travelling salesman problem are unclear. A handbook for travelling salesmen from 1832 mentions the problem and includes example tours through Germany and Switzerland, but contains no mathematical treatment.

The TSP was mathematically formulated in the 19th century by the Irish mathematician William Rowan Hamilton and by the British mathematician Thomas Kirkman. Hamilton's icosian game was a recreational puzzle based on finding a Hamiltonian cycle. The general form of the TSP appears to have been first studied by mathematicians during the 1930s in Vienna and at Harvard, notably by Karl Menger, who defines the problem, considers the obvious brute-force algorithm, and observes the non-optimality of the nearest neighbour heuristic:

… excerpt ends here. Continue reading the full article.

Illustrations

Travelling salesman problem: The travelling salesman problem seeks to find the shortest possible loop that connects every red dot.
The travelling salesman problem seeks to find the shortest possible loop that connects every red dot.
Travelling salesman problem: Solution of the above problem
Solution of the above problem
Travelling salesman problem: William Rowan Hamilton, c. 1850
William Rowan Hamilton, c. 1850
Travelling salesman problem: Symmetric TSP with four cities
Symmetric TSP with four cities
Travelling salesman problem: Solution to a symmetric TSP with 7 cities using brute force search. Note: Number of permutations: (7−1)!/2 = 360
Solution to a symmetric TSP with 7 cities using brute force search. Note: Number of permutations: (7−1)!/2 = 360

Worked examples

Example 1 — a first encounter with Travelling salesman problem

Start with the simplest possible case. Write down what Travelling salesman problem claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Travelling salesman problem before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Travelling salesman problem ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Travelling salesman problem

In research
Travelling salesman problem appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Travelling salesman problem in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Travelling salesman problem is common in secondary-school and first-year university syllabi. It links to neighbouring topics Combinatorial optimization, Computational problems in graph theory, Graph algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Travelling salesman problem outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Travelling salesman problem” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Travelling salesman problem in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Travelling salesman problem means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Travelling salesman problem out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Travelling salesman problem in simple terms?

In the theory of computational complexity, the travelling salesman problem (TSP) asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?" It is an NP-ha…

Why does Travelling salesman problem matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Travelling salesman problem?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Travelling salesman problem.

Tags

  • Combinatorial optimization
  • Computational problems in graph theory
  • Graph algorithms
  • Hamiltonian paths and cycles
  • Metaphors referring to people
  • NP-complete problems
  • NP-hard problems
  • Travelling salesman problem

Keep exploring