Learn through the super-clean Baeldung Pro experience:
>> Membership and Baeldung Pro.
No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with.
Last updated: February 12, 2025
Combinatorial Optimization Problems (COP) apply to a lot of interesting problems with real-world impacts. In this tutorial, we’ll learn about major problems and their solutions. Also, we’ll understand their difficulty level with a detailed example of a popular COP in the field of computer science.
COP is the process of finding an optimal solution through the evaluation of a finite and fixed number of combinations. Mostly, they are modeled by graph theory or linear programming.
COP appears in several applications such as delivering goods to clients, finding the shortest path, assigning tasks to workers, etc. They help us increase efficiency by reducing cost and time.
Let’s show some models used to simplify and formalize real-world problems:
The original problem involves a traveling salesman who must visit several cities. The question is which order to visit the cities to make the shortest possible trip. Particularly, the salesman must visit each of the cities once and then return to the original position. Following, we’ll give the mathematical model of TSP and show a concrete example.
Usually, we use a graph to model the TSP problem.
, with
, is the set of vertices representing the cities, while
is the set of edges representing the distance between each pair of cities:
Let’s take a TSP example with a relatively small number . We assume the computer takes one unit of time to compute a solution. That is a microsecond (ms) per trajectory.
To go through each possible solution and take the best one, we need to compute candidate solutions. In our case, it’ll be
and will take a computation time of 60 ms:
However, let’s say we have . Then the exploration of the search space will take 19 centuries. Clearly, it is a very huge amount of time. In fact, the factorial scales very bad in complexity computation:
| Number of cities (n) | Number of possible routes | Computation time |
|---|---|---|
| 5 | 12 | 12 ms |
| 10 | 181 440 | 0.18 s |
| 15 | 43 billions | 12 hrs |
| 20 | 6E+16 | 19 centuries |
| 25 | 3E+23 | 9.8 billions of years |
| 30 | 4E+30 | 1.4 millions of billions of centuries |
We’ll examine in the next section the possible methods to resolve COP.
As we have seen previously with TSP, COPs are not always easy to solve. The number of possible solutions is usually huge and requires an exhaustive search through the solution space. That is why COPs are computationally expensive. They belong to the NP-hard category of problems. Usually, we tend to find a near-optimal solution in a reasonable time.
We cite two major approaches to solving COPs:
To sum up, in this tutorial, we’ve defined COPs and explained their level of difficulty as well as the possible solutions.