O'Reilly logo
live online training icon Live Online training

Intro to Mathematical Optimization

Practical AI for Practical Problems

Topic: Data
Thomas Nield

The field of operations research is not new, but its techniques and algorithms are vital to practical everyday problems. How do you maximize profit across several product lines with only so much factory capacity? How do you schedule 200 nurses in a hospital with different vacation requests, seniorities, union restrictions, and work hour regulations? What if you need to schedule sports tournaments and minimize team travel distances? How about optimizing the on-time performance of a train network? Or simply solving a Sudoku? This class will introduce the algorithms and techniques that power our world, and effectively solve these kinds of problems.

Why are those important for what companies need?

Machine learning is quite the rage these days, so much it is easy to lose sight of the fact there are other algorithms in the “AI” space. As a matter of fact, these algorithms can be so crucial that it can be neglectful to overlook them. Optimization problems exist all around us like scheduling staff, optimizing costs/revenue/profit, routing vehicles the shortest distance, and even solving games. For companies to be effective, an awareness of operations research algorithms and when to apply them is critical, as machine learning does not solve these problems effectively.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • The basic principles behind common optimization techniques and what problems they are good for.
  • Recognize which situations require optimization and which techniques to use.
  • The relationship between machine learning and optimization algorithms.

And you’ll be able to:

  • Have enough information to code optimization algorithms themselves or use libraries that do it for them.
  • Align more appropriate solutions to their businesses by having a greater breadth of “AI” methodologies in their tool belts.

This training course is for you because...

  • You are a data scientist interested in optimization methodologies and how they apply to machine learning
  • You are a programmer looking to solve nondeterministic problems like scheduling staff, server jobs, or other resources.
  • You are a manager of a data science/analytics team wanting to understand other methodologies outside of machine learning, and what algorithm to use and when.


  • Familiarity with a programming language like Python, Java, or Scala, may be useful, but the conceptual explanations in this course will be accessible to those without any prior programming experience.

Complete the below before the course begins:

Please do these two thought experiments and write down what you think is the best approach to solve these two problems (hint: machine learning is not the answer). Try not to research online and the answers will be revealed in class. Even if you cannot figure out a solution, make a guess on what direction you would pursue.

  • 1) Take a sheet of paper and mark 25 dots in random places, like they were cities on a map. Pretend you had to visit each city in a round-trip tour, starting and ending in the same city. How do you find the shortest tour possible?
  • 2) You run a small business with 50 workers reporting to you. Your business partner complains how much time is spent scheduling the workers, and trying to make sure they don’t exceed 40 hours. On top of that, she has to keep senior workers happy by giving their preferred shifts, prevent wages from exceeding a budget, and try to respect vacation requests. How do you schedule your workers algorithmically while respecting these constraints?

About your instructor

  • Thomas Nield is an operations research consultant as well as a writer, conference speaker, and trainer. He enjoys making technical content relatable and relevant to those unfamiliar or intimidated by it. Thomas regularly teaches classes on analytics, machine learning, and mathematical optimization. He’s authored two books, including Getting Started with SQL (O'Reilly) and Learning RxJava (Packt), and has written several popular articles, including “How It Feels to Learn Data Science in 2019” and “Is Deep Learning Already Hitting Its Limitations?”


The timeframes are only estimates and may vary according to how the class is progressing

Introduction (10 minutes)

  • The Traveling Salesman Problem
  • What to expect in this course

Metaheuristics (40 minutes)

  • Hill Climbing and Simulated Annealing with the Traveling Salesman Problem explained
  • Doing a linear regression with hill climbing/simulated annealing
  • Other metaheuristics algorithms
  • Exercise: True/false and multiple choice questions
  • Q&A

Tree Search Algorithms (40 minutes)

  • Solving a Sudoku
  • Creating a schedule under constraints
  • Knapsack Problem (Choosing which shipments to put in container)
  • Branch-and-bound Intuition
  • Exercise: Choose the right heuristic
  • Q&A
  • Break (10 minutes)

Linear/Integer/Mixed Programming (40 minutes)

  • Basic Convex Optimization Intuition
  • Using libraries for linear/integer/mixed programming
  • Blending Problem
  • Manufacturing problem
  • Exercise: Finding the right constraints
  • Q&A

Gradient Descent (40 minutes)

  • Understanding Gradient Descent
  • Doing linear regression with gradient descent
  • How neural networks use gradient descent
  • Types of gradient descent
  • Exercise: Choosing the right methodology
  • Q&A
  • Homework exercises for after class