Data and modeling

Machine learning for optimization

Machine learning feeds optimisation by predicting the numbers a solver needs, such as travel times, demand or costs. It is also used as a fast surrogate for expensive simulations, and to tune the settings of models and solvers themselves.

How machine learning is used in optimisation

Predicting the inputs a solver needs

Routing, scheduling and pricing solvers need numbers such as travel times or demand. Machine learning predicts them from historical data, and the optimiser then chooses the best plan given those predictions.

Real exampleTraffic prediction with graph neural networks (Google DeepMind and Google Maps, 2020)DeepMind describes how it worked with Google Maps to improve traffic predictions and estimated times of arrival using graph neural networks.

Controlling physical systems

Models trained on sensor history predict how a system will respond to different settings, and an optimiser picks settings that save energy within safety limits. Data centres, buildings and industrial plants use this approach.

Real exampleDeepMind AI for Google data centre cooling (2016)Google DeepMind reports that applying its machine learning to Google data centres reduced the energy used for cooling by up to 40 percent.

Speeding up solvers with learned heuristics

Mixed integer programming solvers rely on hand-designed heuristics for branching and finding good solutions. Neural networks trained on many related problem instances can replace or guide those heuristics.

Real exampleSolving Mixed Integer Programs Using Neural Networks (Nair et al., 2020)The paper adds neural network components to a MIP solver for finding good variable assignments and for bounding the gap to the optimal objective value.

Tuning models and settings

Hyperparameter optimisation searches for the settings that give a model the best validation score, using methods that learn from earlier trials. The same tools tune simulation and solver parameters.

Real exampleOptuna (Akiba et al., KDD 2019)Optuna is an open-source hyperparameter optimisation framework with a define-by-run interface, pruning of unpromising trials and efficient sampling.

Can you learn machine learning for optimisation?

Yes. You need Python, calculus for gradient-based training, and linear and integer programming for the solver side. Most people learn supervised machine learning first and then how to feed its predictions into an optimisation model.

  1. PythonWrite Python confidently, since both ML libraries and solvers such as OR-Tools and Pyomo are driven from it.Learn it in Python
  2. Calculus and optimisationLearn derivatives, gradients and gradient descent, which is how most machine learning models are trained.Learn it in Maths
  3. Predictive modelsTrain regression models for quantities such as demand or travel time and measure their error on held-out data.Learn it in Machine Learning
  4. Mathematical programmingLearn linear and integer programming and model a routing or scheduling problem in OR-Tools or Pyomo, then plug in predicted inputs.

Moving into machine learning and optimisation work

If you already work in the field

Operations researchers already model decisions and know solvers well. Add supervised learning for the uncertain inputs, then test whether learned predictions change and improve the plans your models produce.

If you come from data science or ML

If you come from ML, learn how predictions are used in decisions: constraints, objective functions and why a small forecast error can change an optimal plan. An introductory operations research course and a routing exercise in OR-Tools are a practical start.

Roles that do this workOperations research scientistOptimisation engineerDecision scientistSupply chain data scientistMachine learning engineer

Tools you will use

ToolWhat you use it for
Google OR-ToolsSolve routing, scheduling and assignment problems once costs are predicted.
PyomoWrite linear and nonlinear optimisation models in Python and pass them to solvers.
SciPy optimizeMinimise continuous functions and solve small linear programs.
OptunaSearch model hyperparameters efficiently, pruning poor trials early.
scikit-learnFit the cost, time or demand predictors that feed the optimisation model.

Public data to practise on

  • NYC TLC Trip Record Data: Taxi and for-hire trip records with pickup and drop-off times and zones, for travel-time prediction.
  • CVRPLIB: Benchmark vehicle-routing instances with best known solutions, for testing route optimisation.

Your first project

Download NYC TLC trip records, predict trip durations with gradient boosting, and compare it with a distance-over-average-speed baseline using mean absolute error. Then check whether a small OR-Tools route changes when you swap in the learned times.

Common questions

Is machine learning an optimisation problem?

Training a model is: it minimises a loss function over the model's parameters, usually with gradient descent. Using ML for optimisation is different, and means using predictions to make better decisions.

What is the difference between operations research and machine learning?

Operations research chooses the best decision given a model of the problem and its constraints. Machine learning estimates unknown quantities from data. Many real systems use both.

What is a surrogate model?

A surrogate is a fast model trained to approximate a slow simulation or experiment. Optimisers can then explore many candidate designs quickly and run the full simulation only on the most promising.

Which optimisation methods are used to train neural networks?

Variants of stochastic gradient descent, such as SGD with momentum and Adam, compute gradients on small batches of data and update the weights repeatedly.

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.