Images, language and games

Deep learning for optimization

Deep learning for optimisation trains networks to propose solutions to routing and scheduling problems, predict costs inside a solver, or act as fast surrogates for expensive simulations. Every proposed solution is still checked for feasibility and compared with a classical solver.

How deep learning is used for optimisation

Learned heuristics for routing

A neural network trained on many random instances learns to build routes city by city, giving good solutions quickly. Results are compared with classical solvers on the same instances.

Real exampleAttention model for routingKool, van Hoof and Welling trained an attention-based model with reinforcement learning to construct solutions to the travelling salesman and vehicle routing problems.

Guiding exact solvers

Inside branch-and-bound, a network learns which variable to branch on by imitating an expensive expert rule. The solver stays exact while the learned choices speed up its search.

Real exampleGCNN branchingGasse and colleagues trained a graph convolutional network by imitation learning to choose branching variables for mixed-integer linear programs.

Neural components for mixed-integer programs

Learned models propose partial assignments and branching decisions, so a solver finds good feasible solutions sooner on a family of similar problems.

Real exampleNeural Diving and Neural Branching (DeepMind)DeepMind and Google researchers built neural network components called Neural Diving and Neural Branching to use inside a MIP solver.

Fast surrogates for simulations

A network trained on simulator output predicts the next state much faster than the original simulation. Optimisation can then search over many designs using the surrogate.

Real exampleLearning to Simulate (DeepMind)DeepMind's graph network simulator learned to simulate fluids, rigid solids and deformable materials from data.

Optimising control of real systems

Models trained on sensor history predict how settings affect performance, and the system chooses settings that improve it within safety limits.

Real exampleGoogle data centre coolingDeepMind reported that applying its machine learning to Google data centres reduced the energy used for cooling by up to 40 per cent.

Can you learn deep learning for optimisation?

Yes, but it combines two fields, so expect to learn classical optimisation as well as deep learning. Learn Python and linear algebra, then linear and integer programming with a solver, then neural networks and reinforcement learning.

  1. Python and linear algebraWrite NumPy code and understand vectors, matrices and gradients.Learn it in Maths
  2. Classical optimisationModel problems as linear and integer programs and solve them with OR-Tools or CVXPY, which are the baselines you must compare against.
  3. Neural networksTrain networks with PyTorch, including attention and graph models, which suit routing and solver data.Learn it in Deep Learning
  4. Learning to optimiseReproduce a learned routing model with RL4CO, check every solution for feasibility, and report the gap to the best known solution.

Moving into learning-based optimisation

If you already work in the field

If you work in operations research, logistics or planning, you already know the problems, constraints and solvers. Add PyTorch and reinforcement learning, then try learning a heuristic for a family of instances you solve repeatedly.

If you come from data science or ML

If you come from machine learning, learn linear and integer programming, duality and how solvers work. Always compare against a classical solver and check feasibility, because a fast infeasible answer is worthless.

Roles that do this workOperations research scientistMachine learning engineer, optimisationApplied scientist, supply chainResearch scientist

Tools you will use

ToolWhat you use it for
OR-ToolsSolve routing, scheduling and integer programs to produce baselines and reference solutions.
CVXPYModel convex optimisation problems in Python with a readable syntax.
cvxpylayersPut a convex optimisation problem inside a PyTorch network and differentiate through its solution.
RL4COTrain neural solvers for routing and scheduling problems with reinforcement learning in PyTorch.
PyTorchBuild surrogate models and custom training loops for learned optimisation components.

Public data to practise on

  • TSPLIB: Classic travelling-salesman instances with known optimal tour lengths, for measuring a learned solver's gap.
  • CVRPLIB: Vehicle-routing benchmark instances with best known solutions, for testing routing heuristics.
  • MIPLIB 2017: Mixed-integer programming benchmark instances, for learning branching rules or solver settings.

Your first project

Download TSPLIB instances of up to about 100 cities, solve them with an RL4CO attention model trained on random instances, and compare with OR-Tools routing using the gap to the published optimal tour lengths.

Common questions

Can deep learning replace optimisation solvers?

Rarely on its own. It works best inside or alongside solvers, giving fast starting solutions, guiding search or replacing slow simulations.

Is deep learning itself an optimisation problem?

Yes. Training a network minimises a loss with gradient-based optimisers. This page is about the reverse: using trained networks to help solve other optimisation problems.

When does learning-based optimisation pay off?

When you solve many similar instances, such as daily routes or schedules, so training time is repaid. For one-off problems, a classical solver is usually better.

Courses for these skills

New to programming or maths? Start with Python, or follow the machine learning path in order. Published lessons are free to read; compare Free and Pro.