Contents  |  ‹ Previous  |  Next ›  |  Download EPUB  |  PDF

Chapter 1
Mathematical Programming

Learning Outcomes

1.1 Warm-Up Scenario

Imagine you’re starting a new clothing company and decide to sell shirts. You’ve opened a store in Roanoke and, based on market research, you estimate the demand for the upcoming weekend:

Your supplier can deliver shirts in one day, meaning an order placed on Thursday will arrive on Friday, and so on. As a business owner, you need to decide how many shirts to order and when to place each order to ensure you meet the daily demand without overstocking. Figure 1.1 shows the timing: each order arrives one day after it is placed, so Thursday’s order covers Friday’s customers.

Timeline of four days, Thursday through Sunday, drawn as rounded boxes with orange arrows from each day to the next labeled 'order arrives next day'. Friday, Saturday, and Sunday are marked with demands 5, 10, and 7.

Figure 1.1: Orders placed one day arrive the next, so ordering decisions and demands are linked across the weekend.

Defining the Problem

To tackle this challenge, you’ll need to think strategically about two main factors:

You can define these decisions using variables:

Your goal is to meet the projected demand while managing costs. Costs could include:

Refining the Scenario

As your business grows, additional complexities may arise. For instance:

By clearly defining variables and constraints for these decisions, you can systematically approach the problem and develop an optimal strategy. This step-by-step process of defining the problem, incorporating real-world details, and refining the solution is a fundamental aspect of optimization.

Model Development Cycle

This multi-stage example illustrates the iterative cycle of modeling:

1.
Initial Problem: Determine ordering quantities to meet demand.
2.
Modeling: Formulate an optimization model based on available information.
3.
Solution: Solve the model to find the optimal ordering plan.
4.
New Information: Incorporate additional real-world complexities (varying costs, inventory costs, budget constraints, additional products, fixed ordering costs).
5.
Refinement: Update the model to reflect new information and solve again.

Further Extensions

Looking ahead, there are several ways to expand this scenario:

In this book, we will focus on deterministic models where all data is known and fixed. Building a strong foundation with these models will prepare us to tackle more complex problems involving uncertainty and randomness in future studies.

1.2 Why Study Operations Research?

You already interact with optimization many times a day without noticing. The route your phone suggests, the price of your plane ticket, the fact that the store had what you wanted in stock, the schedule of your favorite sports league, and which kidney patients get matched with which donors: behind each one is an optimization model of the kind this book teaches. Even the AI assistants making headlines are trained by optimization; fitting a large language model is a nonlinear programming problem with billions of variables.

Operations Research (OR) is, in the words of the professional society INFORMS, a discipline that applies advanced analytical methods to help make better decisions. In a world where resources are limited and organizations face complex challenges, OR provides the tools and methodologies to model, analyze, and solve problems involving the optimal allocation of scarce resources. Studying OR equips individuals with a systematic and quantitative approach to decision-making, which is invaluable in industries such as logistics, finance, healthcare, and manufacturing.

By understanding OR, you gain the ability to construct mathematical models of real-world systems, allowing for the simulation and optimization of different scenarios. This leads to improved efficiency, reduced costs, and enhanced performance. The skills developed through studying OR, such as critical thinking, problem-solving, and data analysis, are highly transferable and sought after in today’s data-driven economy.

Operations Research also bridges the gap between theory and practice. It transforms abstract mathematical concepts into actionable strategies that can have a tangible impact on organizational success. Whether it’s optimizing supply chains, scheduling flights, or managing portfolios, the applications of OR are vast.

These are not hypothetical savings. A few documented examples:

Every one of these is, at its mathematical center, the kind of model you will learn to build in this book.

1.3 What is Mathematical Programming?

Mathematical Programming is a core area within Operations Research that focuses on the formulation and solution of optimization problems. It involves creating mathematical models that represent the decision-making process of a system, where the goal is to find the best possible outcome under given constraints. The term “programming” in this context refers to planning or scheduling, not computer programming.

Four-step flowchart: Real decision problem (what to make, ship, schedule) leads to Mathematical model (max c-transpose x subject to Ax <= b), then to Solver, then to Decision plus guarantee (a plan, and how good it is).
Figure 1.2: The mathematical programming workflow.

At the heart of Mathematical Programming is the objective function: a mathematical expression that defines the criterion to be optimized, such as minimizing costs or maximizing profits. The decision variables represent the choices available, and the constraints reflect the limitations or requirements of the problem, such as resource capacities or regulatory conditions.

There are various types of mathematical programming, each suited to different kinds of problems:

Mathematical Programming provides a powerful framework for optimizing complex systems and making informed decisions. It combines elements of mathematics, economics, and computer science to develop solutions that are both efficient and effective.

1.4 Applications

Operations Research and Mathematical Programming have a wide range of applications across various industries and sectors:

Mind map with Optimization in a central circle connected to six application areas: Manufacturing, Finance, Logistics, Healthcare, Energy, and Public sector.

Figure 1.3: The same modeling toolkit shows up across sectors; only the words in the story change.

Throughout the book, case-study boxes tell the stories of real deployed optimization models, each with the published model and its citation:

Each box states what kind of model was used, what was assumed, and where to read the original paper.

These applications demonstrate the versatility and impact of OR and Mathematical Programming. Using these tools, organizations can make data-driven decisions that lead to significant improvements in performance, cost savings, and competitive advantage. As global challenges become more complex, the importance of skilled professionals in Operations Research continues to grow.

1.5 Types of Optimization Problems

We will state the main general problem classes to be associated with in these notes. These are Linear Programming (LP), Mixed-Integer Linear Programming (MILP), Non-Linear Programming (NLP), and Mixed-Integer Non-Linear Programming (MINLP).

A hierarchical classification of optimization models showing Convex models and Non-convex models as subcategories.

Figure 1.4: Tree diagram classifying optimization models.

Along with each problem class, we will associate a complexity class for the general version of the problem. Complexity classes are discussed in a later portion of the book. Although we will often state that input data for a problem comes from (as a real number), when we discuss complexity of such a problem, we actually mean that the data is rational, i.e., from (rational numbers that are encoded in the computer typically), and is given in binary encoding.

Warning

In the following subsections, we will use advanced notation that may be unfamiliar at this point. These mathematical notations will be developed throughout the book.

Also, don’t be too concerned about the specific definitions of the complexity classes at this point. For now, you can read that Polynomial time (P) means it should be relatively easy to solve, while the other classes might be much more difficult to solve.

1.6 Linear Programming (LP)

Some linear programming background, theory, and examples will be provided in Part I of this book.

Linear Programming (LP)

Polynomial time (P)

Given a matrix A m×n, vector b m and vector c n, the linear programming problem is

maxcx  s.t. Axb x ≥ 0 (1.1)

Linear programming can come in several forms, whether we are maximizing or minimizing, or if the constraints are ,= or . One form commonly used is Standard Form given as

Linear Programming (LP) Standard Form

Polynomial time (P)

Given a matrix A m×n, vector b m and vector c n, the linear programming problem in standard form is

maxcx  s.t. Ax = b x ≥ 0 (1.2)

A linear programming visualization showing a light blue hexagonal feasible region with labeled vertices, an objective direction arrow, and a red objective function line.

Figure 1.5: Linear programming constraints and objective.

1.7 Mixed-Integer Linear Programming (MILP)

Mixed-integer linear programming will be introduced in chapter 15, with additional topics covered in Book 2. Recall that the notation means the set of integers and the set means the set of real numbers. The first problem of interest here is a binary integer program (BIP) where all n variables are binary (either 0 or 1).

Binary Integer programming (BIP)

NP-complete

Given a matrix A m×n, vector b m and vector c n, the binary integer programming problem is

maxcx  s.t. Ax ≤ b x{0,1}n (1.3)

A slightly more general class is the class of Integer Linear Programs (ILP). Often this is referred to as Integer Program (IP), although this term could leave open the possibility of non-linear parts.

PIC

Figure 1.6: Comparing the LP relaxation to the IP solutions

Integer Linear Programming (ILP)

NP-complete

Given a matrix A m×n, vector b m and vector c n, the integer linear programming problem is

maxcx  s.t. Axb xn (1.4)

An even more general class is Mixed-Integer Linear Programming (MILP). This is where we have n integer variables x1,,xn and d continuous variables xn+1,,xn+d . Succinctly, we can write this as x n × d, where × stands for the cross-product between two spaces.

Below, the matrix A now has n + d columns, that is, A m×(n+d). Also note that we have not explicitly enforced non-negativity on the variables. If there are non-negativity restrictions, this can be assumed to be a part of the inequality description Ax b.

Mixed-Integer Linear Programming (MILP)

NP-complete

Given a matrix A m×(n+d), vector b m and vector c n+d, the mixed-integer linear programming problem is

maxcx  s.t. Ax ≤ b x ∈ n × d (1.5)

1.8 Non-Linear Programming (NLP)

NLP

NP-hard

Given a function f(x): d and other functions fi(x): d for i = 1,,m, the nonlinear programming problem is

minf(x)  s.t. fi(x) ≤ 0 for i = 1,…,m x ∈ d (1.6)

Nonlinear programming can be separated into convex programming and non-convex programming. These two are very different beasts and it is important to distinguish between the two.

1.8.1 Convex Programming

Here the functions are all convex!

Convex Programming

Polynomial time (P)  (typically)

Given a convex function f(x): d and convex functions fi(x): d for i = 1,,m, the convex programming problem is

minf(x)  s.t. fi(x) ≤ 0 for i = 1,…,m x ∈ d (1.7)

Observe that convex programming is a generalization of linear programming. This can be seen by letting f(x) = cx and fi(x) = Aix bi.

1.8.2 Non-Convex Non-linear Programming

When the function f or functions fi are non-convex, this becomes a non-convex nonlinear programming problem. There are a few complexity issues with this.

IP as NLP As seen above, quadratic constraints can be used to create a feasible region with discrete solutions. For example

x(1 x) = 0

has exactly two solutions: x = 0,x = 1. Thus, quadratic constraints can be used to model binary constraints.

Binary Integer programming (BIP) as a NLP

NP-hard

Given a matrix A m×n, vector b m and vector c n, the binary integer programming problem is

maxcx  s.t. Ax ≤ b [1.5pt]x ∈{0,1}n xi(1 − xi) = 0 for i = 1,…,n (1.8)

Alternatively, consider the transformation where xi {1,1}.

min cx  s.t. Ax b x {1,1}n

This can be reformulated with a single nonconvex constraint as

min cx  s.t.  Ax b 1 xj 1,1 j n, x2 n.

1.8.3 Machine Learning

Machine learning is, at its mathematical center, learning functions from data. Instead of a person writing down the rule, we choose a family of functions f(x;𝜃) with tunable parameters 𝜃 and let an optimization algorithm pick the parameters that fit the data best. The learned function might categorize data (is this email spam? does this scan show a tumor?), predict a number (tomorrow’s demand, a house price), or group similar things together without labels (customer segments, related news articles).

This is why machine learning belongs in an optimization book: training a model is solving an optimization problem, usually a continuous and often nonconvex one. The same recipe runs everywhere:

Below are the two most common mathematical shapes these problems take. We will see both in greater detail later in the book.

Loss Function Minimization

In supervised learning, this objective is typically a loss function L that quantifies the discrepancy between the predictions of a model and the true data labels. The aim is to adjust the parameters 𝜃 of the model to minimize this loss. Mathematically, this can be represented as:

min 𝜃L(𝜃) = min 𝜃 1 N i=1Nl(y i,f(xi;𝜃)) (1.9)

where N is the number of data points, l is a per-data-point loss (e.g., squared error for regression or cross-entropy for classification), yi is the true label for the i-th data point, and f(xi;𝜃) is the model’s prediction for the i-th data point with parameters 𝜃.

Scatter plot of data points with a blue fitted line f(x; theta); short red vertical segments connect each point to the line, labeled as the per-point losses l(y_i, f(x_i; theta)).

Figure 1.7: Supervised learning as loss minimization: the parameters 𝜃 slide and tilt the curve f(x;𝜃) until the total mismatch with the data (the red residuals) is as small as possible.
Clustering Formulation

Clustering, on the other hand, learns structure with no labels at all: group the data so that points in the same group are similar and points in different groups are not. A retailer might cluster customers into segments for targeted offers; a biologist might cluster genes by expression pattern. One popular method is the k-means clustering algorithm. The objective of k-means is to partition the data into k clusters by minimizing the within-cluster sum of squares (WCSS). The mathematical formulation can be given as:

min c1, ,ck j=1k xiCj xi cj 2 (1.10)

where Cj represents the j-th cluster and cj is the centroid of that cluster.

Scatter plot of three colored point clusters (blue, orange, green), each with an X marking the cluster centroid c_j.

Figure 1.8: Clustering: with no labels given, the optimization chooses centroids (and the assignment of points to them) to make each group as tight as possible.

This encapsulation presents a glimpse into how ML problems are framed mathematically. In practice, numerous algorithms, constraints, and regularizations add complexity to these basic formulations.

1.9 Mixed-Integer Non-Linear Programming (MINLP)

MINLP

NP-hard

Mixed Integer Nonlinear Programming (MINLP) combines elements of integer programming and nonlinear programming. In MINLP, some or all of the decision variables are constrained to be integers, and the objective function or constraints are nonlinear. A general MINLP problem can be formulated as:

minf(x,y)  s.t. gi(x,y) ≤ 0 for i = 1,…,m hj(x,y) = 0 for j = 1,…,p x ∈ n,y ∈ k (1.11)

where f is the objective function, gi and hj are constraint functions, x is a vector of continuous variables, and y is a vector of integer variables.

MINLP is particularly challenging due to the nonlinearity in the objective and/or constraints and the discrete nature of some decision variables. It finds applications in various fields such as industry for process optimization, computational geometry, and machine learning for hyperparameter tuning.

1.9.1 Convex MINLP

In the convex case, both the objective function and the constraints are convex functions. This subclass is easier to solve compared to its non-convex counterpart.

Convex MINLP

NP-hard, but Polynomial time (P) in fixed dimension (typically)

For a convex MINLP, the problem is defined as:

minf(x,y)(convex)  s.t. gi(x,y) ≤ 0(convex constraints) x ∈ n,y ∈ k (1.12)

Convex MINLPs, while still challenging, are typically more tractable due to the properties of convexity, which allow for more efficient solution methods.

1.9.2 Non-Convex MINLP

Non-convex MINLPs are significantly harder due to the presence of non-convex functions, which can lead to multiple local minima.

Non-Convex MINLP

NP-hard(in fact, undecidable)

The non-convex MINLP problem is formulated as:

minf(x,y)(non-convex)  s.t. gi(x,y) ≤ 0(possibly non-convex constraints) x ∈ n,y ∈ k (1.13)

Non-convex MINLPs pose significant computational challenges due to the possibility of multiple local optima and the inherent complexity of integer constraints. These problems are common in real-world applications where decisions are discrete, and the system behavior is non-linear and complex.

Complexity and Applications

MINLP problems are known for their computational complexity, primarily due to the combination of non-linearity and integrality. The non-convex variants, in particular, are NP-hard, making them some of the most challenging problems in optimization.

In practice, MINLP models find extensive applications across various domains. In industry, they are used for complex decision-making processes like supply chain optimization and production planning. In computational geometry, MINLP techniques help in solving problems like optimal packing or layout design. In machine learning, MINLPs are used for tasks like feature selection and hyperparameter optimization where discrete choices and nonlinear relationships are involved.

The versatility of MINLP models, combined with their inherent complexity, makes them an important area of study in optimization.

A comprehensive list of optimization software organized by problem type (including free solvers, commercial solvers with academic licenses, and modeling interfaces) is provided in Appendix E.

1.10 Optimization Under Uncertainty

Optimization problems often involve uncertainty in their parameters, whether due to measurement errors, variability in input data, or unpredictable future events. Addressing uncertainty is crucial for developing solutions that are effective in real-world settings. Two primary approaches to optimization under uncertainty are stochastic optimization and robust optimization.

1.10.1 Stochastic Optimization

Stochastic optimization deals with problems where some parameters are uncertain but can be described probabilistically. In this framework, the optimization process incorporates the expected values, variances, or other statistical characteristics of uncertain parameters. Solutions are often evaluated based on their performance over a distribution of possible scenarios.

For example, in supply chain management, uncertain demand can be modeled using probability distributions. A company may aim to minimize costs while ensuring a high service level under varying demand conditions. Similarly, in finance, portfolio optimization often accounts for uncertain future returns by maximizing expected returns while managing risk.

1.10.2 Robust Optimization

Robust optimization, on the other hand, focuses on creating solutions that perform well across the worst-case realizations of uncertainty. Rather than assuming a specific probability distribution, robust optimization works with uncertainty sets, which define the range of possible values that uncertain parameters can take. The goal is to find solutions that are feasible and effective for all possible scenarios within the uncertainty set.

Applications of robust optimization include power grid operations, where uncertainties in demand and renewable energy generation need to be managed, and scheduling problems, such as airline crew scheduling, where disruptions must be minimized under varying operational conditions.

1.10.3 Applications

Optimization under uncertainty has a wide array of applications across industries:

Addressing the complexity of uncertain data typically makes these problems much harder than their deterministic counterparts. While these methods are powerful and applicable to a wide range of real-world scenarios, we will not focus on optimization under uncertainty in this textbook.

1.11 Exercises

Warm-ups

Exercise 1.1: Classify It: Production Plan

  A juice company decides how many liters of apple juice x1 and orange juice x2 to produce. Each liter of apple juice earns $2 and each liter of orange juice earns $3. Pressing capacity gives x1 + 2x2 800, bottling capacity gives x1 + x2 600, and both quantities are non-negative. The company maximizes earnings. Classify this model as LP, ILP/BIP, MILP, NLP, or MINLP. Point to the two features of the model (type of functions, type of variables) that justify your answer.

1.6, Problem (1.1)]

Exercise 1.2: Classify It: Choosing Projects

  A city can fund any subset of five park projects. Project i costs ai dollars and benefits ci residents, and the budget is b dollars. Let xi = 1 if project i is funded and xi = 0 otherwise, and consider

max { i=15c ixi : i=15a ixi b,xi {0,1} }.

Classify this model as LP, ILP/BIP, MILP, NLP, or MINLP, and justify your answer. What changes about the classification if the city can also fund a fraction of a project?

1.7, Problem (1.3)]

Exercise 1.3: Classify It: Fitting a Line

  Given data points (t1,y1),,(tN,yN), we choose slope m and intercept q to minimize

i=1N (y i (mti + q) )2,

with m,q unrestricted. Classify this model as LP, ILP/BIP, MILP, NLP, or MINLP, and justify your answer. Is the objective function linear in the decision variables m and q?

1.8, Problem (1.6), §1.6]

Exercise 1.4: Classify It: Warehouses with Congestion

  A retailer decides which of k candidate warehouses to open ( yj {0,1}) and how much product xj 0 to route through each open warehouse. Handling cost at warehouse j grows quadratically with volume, so the objective includes terms xj2, and product can flow through warehouse j only if yj = 1. Classify this model as LP, ILP/BIP, MILP, NLP, or MINLP, and justify your answer by naming which ingredient rules out each simpler class.

1.9, Problem (1.11)]

Core problems

Exercise 1.5: Shirt Store: Variables and One Constraint

  Return to the shirt store of Section 1.1: demand is 5 shirts Friday, 10 Saturday, and 7 Sunday, orders arrive one day after they are placed, and the store starts Thursday with no shirts.

1.
Define decision variables for the shirts ordered on Thursday, Friday, and Saturday, and for the inventory held at the end of Friday and Saturday.
2.
Using your variables, write one linear equation that relates Thursday’s order, Friday’s demand, and Friday’s ending inventory.
3.
Which constraint in your model prevents the store from running out of shirts on Friday?

1.1, Figure 1.1]

Exercise 1.6: Spot the Pieces: Food Truck

  A food truck owner must decide how many tacos and how many burritos to prepare tomorrow. Each taco uses 0.1 kg of meat and each burrito uses 0.25 kg, and only 30 kg of meat will be available. Prep labor is limited to 10 hours. Tacos earn $2 profit and burritos $3.50. Without writing the full model, identify in words: the decision variables, the objective function, and each constraint. State the units of every quantity you name.

1.3, Figure 1.2]

Exercise 1.7: Spot the Pieces: Tutoring Center

  A tutoring center schedules tutors for next week. It may hire each of 12 tutors for a whole number of one-hour sessions, at most 8 sessions per tutor. The center needs at least 40 total sessions covered, and its weekly budget is $900; tutor i charges pi dollars per session. The center wants maximum total sessions within budget. Identify the decision variables, objective, and constraints in words. Then explain which model class from Section 1.5 fits this problem and why it is not simply an LP.

1.3, §1.5]

Concepts and connections

Exercise 1.8: Half a Bus

  A school district’s model says the optimal fleet is 12.5 buses. A shirt store’s model says the optimal order is 2361.4 shirts.

1.
In which of the two cases is rounding the LP answer to a nearby integer likely acceptable, and why?
2.
Explain what the divisibility issue means for choosing between the LP and MILP problem classes, and what price we pay (in computational difficulty) for insisting on integer variables.

1.5, §1.7]

Exercise 1.9: Why “Programming”?

  The word “programming” in mathematical programming predates modern software. Explain in one or two sentences what the term refers to in this subject, and why “linear programming” does not mean writing computer code in a linear fashion.

1.3]

Exercise 1.10: Reading a Success Story

  Pick one of the documented successes in the box “What is optimization worth?” in Section 1.2 (UPS ORION, American Airlines yield management, or the Netherlands Railways timetable). For your chosen system, describe: (a) what the decision variables likely were, (b) what objective was likely optimized, and (c) one constraint the model must have respected. You do not need to be exactly right; the goal is to translate a news-style claim into model components.

1.2, §1.3]

Challenge problems

Exercise 1.11: Shirt Store: The Full Model

  Formulate the complete shirt-ordering problem of Section 1.1 as a linear program. Demand is 5 shirts Friday, 10 Saturday, and 7 Sunday. Orders placed Thursday, Friday, and Saturday arrive the next day and cost $8, $9, and $10 per shirt respectively. Every shirt still in the store at the end of Friday or Saturday incurs a $0.50 holding cost for that night. The store starts with no inventory, all demand must be met on time, and leftover shirts after Sunday are allowed but earn nothing.

1.
Write the LP: decision variables, objective, inventory-balance equations for Friday, Saturday, and Sunday, and non-negativity.
2.
Solve it (software or by reasoning about the costs) and report the optimal ordering plan and total cost.
3.
The variables should really be integers. Does that matter here? Explain.

1.1, §1.6, Figure 1.1]

Selected Solutions

Solution

(Exercise 1.2) This is a binary integer program (BIP): the objective and the budget constraint are linear, and every variable is restricted to {0,1}. If fractions of projects may be funded, replace xi {0,1} with 0 xi 1; all constraints are then linear over continuous variables and the model becomes an LP.

Solution

(Exercise 1.5) Let xT,xF,xS be the shirts ordered on Thursday, Friday, and Saturday, and let sF,sS be the inventory at the end of Friday and Saturday. Thursday’s order is all the store has on Friday, so Friday’s balance is

xT = 5 + sF.

The constraint sF 0 (together with this balance equation) is what forbids a Friday stockout: it forces xT 5.

Solution

(Exercise 1.9) Here “programming” means planning or scheduling: a “program” was a plan of activities, as in a military logistics program or a concert program. Linear programming is the construction of an optimal plan using linear relationships, and the term was coined before computer programming was common.

Solution

(Exercise 1.11) Let xT,xF,xS 0 be the orders placed Thursday, Friday, Saturday, and sF,sS,sSun 0 the end-of-day inventories. The LP is

min 8xT + 9xF + 10xS + 0.5sF + 0.5sS  s.t.  xT = 5 + sF (Friday) sF + xF = 10 + sS (Saturday) sS + xS = 7 + sSun (Sunday) xT,xF,xS,sF,sS,sSun 0.

Covering a Saturday shirt by ordering Thursday costs 8 + 0.5 = 8.50, cheaper than the $9 Friday order; covering a Sunday shirt from Thursday costs 8 + 0.5 + 0.5 = 9, cheaper than $9.50 (order Friday, hold one night) and $10 (order Saturday). So the optimal plan orders everything on Thursday: xT = 22, xF = xS = 0, with sF = 17, sS = 7, sSun = 0 and total cost 22 8 + 0.5(17 + 7) = $188. Integrality is not a concern in this instance: the demands are integers and the optimal LP solution is already integer, so the LP and integer models agree.

© 2026 Robert Hildebrand and contributors · Licensed CC BY-SA 4.0 · Sources and attribution · Book home