Combinatorial optimization

On this page 8

Combinatorial optimization is the branch of mathematical optimization that searches for the best solution among a finite set of discrete candidates, such as orderings, subsets, assignments or graph structures, where the number of candidates grows explosively with problem size. In artificial intelligence it underpins planning, scheduling, routing and resource allocation, and it increasingly appears inside machine learning itself, for example in neural architecture search, feature selection and the training of models that learn to solve such problems.

The defining difficulty is that the search space is discrete and combinatorially large: there are no gradients to follow, and a problem with only 60 binary decisions already has more than a quintillion candidate solutions. Many of the most important problems in this class are NP-hard, so practitioners combine exact algorithms, heuristics and learned components to obtain provably good or practically good answers within limited time.

How a combinatorial optimization problem is defined

Every combinatorial optimization problem has three parts: a finite set of feasible solutions, an objective function that assigns a cost or value to each solution, and the goal of finding a solution that minimizes cost or maximizes value. Feasibility is usually expressed through constraints, such as vehicle capacity, precedence between jobs or a budget limit on selected items.

The same problem can often be written in several ways. A graph formulation is natural for routing and matching, while an integer programming formulation expresses decisions as variables restricted to whole numbers and makes the problem accessible to general-purpose solvers. The table below lists the canonical problems that most practical applications reduce to.

ProblemDecisionTypical objectiveComplexity
Traveling salesman problemOrder of cities in a tourMinimize total distanceNP-hard
Knapsack problemSubset of items to packMaximize value within capacityNP-hard, pseudo-polynomial
Vehicle routing problemRoutes for a fleetMinimize cost or vehicles usedNP-hard
Minimum spanning treeEdges connecting all nodesMinimize total edge weightPolynomial
Maximum matchingPairs of compatible nodesMaximize matched pairsPolynomial
Graph coloringColor per vertexMinimize colors usedNP-hard
Canonical combinatorial optimization problems

Why combinatorial problems are computationally hard

The hardness of combinatorial optimization comes from exponential or factorial growth of the solution space. A traveling salesman tour over n cities has (n-1) factorial divided by 2 distinct orderings, so 20 cities already produce about 6 x 10^16 tours. Exhaustive enumeration is impossible beyond small instances, and for NP-hard problems no known algorithm guarantees an optimal answer in polynomial time.

Hardness in theory does not always mean hardness in practice. Many industrial instances have exploitable structure, and modern solvers routinely prove optimality for problems with thousands of variables. Conversely, some problems resist approximation altogether: general traveling salesman with arbitrary distances cannot be approximated within any constant factor unless P equals NP, while the metric version admits a 1.5 factor guarantee.

Exact, approximate and heuristic solution methods

Solution methods fall into three families that differ in their guarantees and running time. Exact methods return a proven optimum but may take exponential time; approximation algorithms offer a worst-case quality bound in polynomial time; heuristics and metaheuristics give no formal guarantee but often find excellent solutions quickly.

Method familyExamplesGuaranteeTypical use
Exact searchBranch and bound, branch and cut, dynamic programmingProven optimum with gapPlanning with moderate size
Approximation algorithmsGreedy set cover, Christofides algorithmBounded ratio to optimumTheory and quick bounds
Local searchHill climbing, 2-opt, tabu searchLocal optimum onlyLarge routing and scheduling
MetaheuristicsSimulated annealing, genetic algorithmsNone, probabilisticRugged search landscapes
Constraint programmingPropagation with backtrackingFeasibility or optimumTightly constrained schedules
Learned heuristicsGraph neural networks, reinforcement learningNone, empiricalRepeated similar instances
Families of solution methods

Exact solvers based on mixed-integer linear programming solve a continuous relaxation, branch on fractional variables and add cutting planes. They report an optimality gap between the best solution found and a proven bound, which lets an operator stop early with a known worst-case loss, for example 1 percent.

Combinatorial optimization compared with continuous optimization

Combinatorial optimization differs from continuous and convex optimization mainly in the structure of the search space. Continuous problems allow small moves and gradient information, while discrete problems force jumps between distinct configurations. The following comparison summarizes the practical consequences.

AspectCombinatorial optimizationContinuous optimization
VariablesIntegers, permutations, subsetsReal-valued vectors
Search informationNeighborhoods and boundsGradients and curvature
Local versus globalLocal optima are commonConvex cases have one optimum
Main toolsBranch and bound, heuristicsGradient descent, interior-point methods
Role in AIPlanning, routing, selectionModel training, calibration
Discrete versus continuous optimization

The two worlds meet in relaxation: replacing integer constraints with continuous ones turns a hard problem into a linear or convex one whose solution provides a bound. Techniques such as Lagrangian duality and the simplex algorithm therefore remain central even when the final answer must be discrete.

Combinatorial optimization in machine learning

Machine learning interacts with combinatorial optimization in two directions. First, many learning tasks contain discrete subproblems: selecting features, pruning network weights, choosing architectures, decoding sequences with beam search and assigning tokens to experts in mixture-of-experts models. Second, researchers train models to learn solution strategies, often called neural combinatorial optimization.

Learned approaches use graph neural networks or attention models to predict promising moves, branching decisions or partial tours, sometimes trained with reinforcement learning because optimal labels are expensive. Their strongest use is guiding a classical solver, for example by learning which variable to branch on, rather than replacing it, because classical methods still provide the feasibility and quality guarantees that production systems require.

Choosing an approach and avoiding common mistakes

The right method depends on instance size, time budget and whether a quality guarantee is needed. The decision table below reflects common practice in operations research and AI engineering teams.

SituationRecommended approachReason
Small or medium instance, audit requiredMILP solver with gap toleranceProvable optimum or bound
Very large routing instance, minutes availableLocal search with metaheuristicScales to many thousands of stops
Many tight logical constraintsConstraint programmingStrong propagation prunes search
Thousands of similar daily instancesLearned heuristic plus solverTraining cost amortized
Real-time decision under 100 msGreedy rule or precomputed policyPredictable latency
Choosing a solution strategy
  • Weak formulations: an integer model with loose constraints gives poor bounds and slows exact solvers dramatically.
  • Ignoring symmetry: interchangeable vehicles or machines multiply equivalent solutions and waste search effort.
  • Overtrusting benchmarks: learned methods tested on random instances often fail on structured real data.
  • Optimizing the wrong objective: a cost function that omits service quality produces optimal but unusable plans.

A non-technical view

Combinatorial optimization is about picking the best option from a huge list of choices. Think of packing a suitcase. You can take some items but not all. Each choice changes what else fits. The number of possible combinations grows very fast.

Checking every combination would take far too long. So experts use clever shortcuts. Some methods prove that an answer is the best. Others find a very good answer quickly. The key idea is a smart search, not a full search.

A concrete example

A regional grocery distributor plans deliveries every night for 42 trucks and about 900 store drops. Each truck has a weight limit, each store has a delivery window, and drivers may work at most 10 hours. This is a vehicle routing problem with time windows, a classic combinatorial optimization task.

The planning team builds an initial plan with a greedy insertion heuristic and then improves it with local search moves that swap and relocate stops for 15 minutes. A mixed-integer model on a smaller subproblem confirms that the result is within about 2 percent of the proven lower bound. Compared with the previous manual plans, the optimized routes cut total driving distance by roughly 11 percent and remove three trucks from the nightly schedule.