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

Chapter 4
Modeling with Compact Notation

Learning Outcomes

The models of the previous chapters fit on an index card: two or three variables, a handful of constraints, every coefficient written out by hand. Now imagine your client is a grocery chain: 40,000 products, 200 stores, 52 weeks of demand. Nobody, however patient, writes out that objective function term by term. And when next year’s data arrive, nobody wants to retype the model. The notation of this chapter (sets, parameters, and summations) is how one page of mathematics describes a million-variable model, and how the same page describes it again next year when every number has changed.

A Brief Review of Summation Notation and Its Relation to Vector Products

Summation notation is a concise way to express the addition of a series of terms. It is commonly written as

i=mnexpression involving i,

where i is the index of summation, m is the starting index, and n is the ending index.

1. Sum of xi:

i=1nx i = x1 + x2 + + xn.

In vector terminology, if we let x be an n-dimensional vector,

x = [ x1 x2 x n ] ,

then i=1nxi represents the sum of all components of x.

2. Sum of aixi:

i=1na ixi = a1x1 + a2x2 + + anxn.

This expression is the dot product (or inner product) of two n-dimensional vectors a and x, where

a = ( a1 a2 a n ) .

In vector notation, the dot product is written as:

ax = a x = i=1na ixi.

This product yields a scalar value that combines the corresponding components of the two vectors.

Notes on Sets, Indices, and Summation

When modeling with compact notation, sets help organize the problem and clearly indicate which indices appear in sums and constraints.

We typically denote sets with uppercase letters and use the corresponding lowercase letter as the index.

Example 4.1: Summing over a set

Let I be the set of months in the year:

I = {1,2,3,,12}.

We can write a sum over all months in two equivalent ways:

iIaixior i=112a ixi.

Multiple Sets and Multiple Indices. Sometimes, variables are indexed over two or more sets. For example, let:

J = {’red’,’green’,’blue’}

and suppose we have a variable yij indexed by both i I (months) and j J (colors).

If, for each color j, the sum of yij over all months must equal 1, we write:

iIyij = 1j J.

This single compact expression actually represents three constraints—one for each color—where in each case, 12 monthly variables are summed to equal 1.

Important Rule: Every Index Must Be Defined. In any mathematical expression, every index must appear either:

1.
in a summation, or
2.
in a “for all” ( ) quantifier.

In the above example, yij uses both indices i and j.

Without these definitions, the mathematical meaning of the expression would be incomplete or ambiguous.

Learning Checkpoint 4.0.1

Consider the incorrect formulation:

iIyij = 1

Write down what is missing from this statement to make it mathematically complete. Which index is undefined, and how should it be introduced?

4.1 Production Planning Models

Production Planning Model (for T Periods)

Schematic of a multi-period production network: gray circles labelled 1, 2, ..., T-1, T. Up-arrows show production x_t; down-arrows show demand d_t; horizontal arrows show inventory s_0 in, s_1, ..., s_{T-1} between nodes, s_T out. Rows labelled Production, Inventory, Demand.

Figure 4.1: Schematic of a multi-period production network: gray circles labelled 1, 2, ..., T-1, T.

Sets:

Parameters:

Variables:

Model:

min x,s z = t=1T (c tprodx t + cinvs t ) (Total cost)  s.t.  s0 + x1 = d1 + s1 (Period 1 balance) st1 + xt = dt + st for all t = 2,,T (Inventory balance) xt 0,st 0 for all t = 1,,T.

Example 4.2: Production Planning with 10 Periods ( T = 10)

[Excel] [PuLP] [Gurobipy]

Initial Inventory:

s0 = 5units

Data: (Download the data)

Parameter 1 2 3 4 5 6 7 8 9 10
Production Cost ($ per unit) 10 12 14 16 18 20 22 24 26 28
Demand (units) 8 6 9 7 10 5 8 6 4 7
Table 4.1: Production planning data for the ten-day horizon.

Inventory Holding Cost:

cinv = 5per unit

Variables:

Model:

min x,sz = 10x1 + 12x2 + 14x3 + 16x4 + 18x5 + 20x6 + 22x7 + 24x8 + 26x9 + 28x10 + 5(s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10) (Total cost)  s.t.  5 + x1 = 8 + s1 (Period 1) s1 + x2 = 6 + s2 (Period 2) s2 + x3 = 9 + s3 (Period 3) s3 + x4 = 7 + s4 (Period 4) s4 + x5 = 10 + s5 (Period 5) s5 + x6 = 5 + s6 (Period 6) s6 + x7 = 8 + s7 (Period 7) s7 + x8 = 6 + s8 (Period 8) s8 + x9 = 4 + s9 (Period 9) s9 + x10 = 7 + s10 (Period 10) xt 0,st 0 for all t = 1,,10.

Production Planning with Overtime

A manufacturing firm seeks to optimize its production schedule over a T-day planning horizon to meet daily demand while minimizing costs. The firm starts with an initial inventory of s0 units. Production can be carried out during regular time and via overtime. The costs are as follows:

The goal is to determine the number of units to produce during regular time and overtime on each day, and the inventory levels, in order to minimize the total cost while satisfying daily demand.

Sets:

Parameters:

Variables:

Model:

min t=1T (c tprodx t + ctovery t + cinvs t ) (Total cost)  s.t.  s0 + x1 + y1 = d1 + s1 (Day 1 balance) st1 + xt + yt = dt + st for all t = 2,,T (Inventory balance) xt,yt,st 0 for all t = 1,,T.

Example 4.3: Production Planning with Overtime ( T = 10)

[Excel] [PuLP] [Gurobipy]

Consider a 10-day planning horizon ( T = 10) with the following data:

Data:

Parameter 1 2 3 4 5 6 7 8 9 10
Regular Production Cost ($) 10 12 14 16 18 20 22 24 26 28
Overtime Production Cost ($) 16 18 20 22 24 26 28 30 32 34
Demand (units) 8 6 9 7 10 5 8 6 4 7
Table 4.2: Production planning data with overtime for the ten-day horizon.
Download Data

Assume the following additional parameters:

Variables:

Model:

min 10x1 + 16y1 + 5s1 (Total cost) + 12x2 + 18y2 + 5s2 + 14x3 + 20y3 + 5s3 + 16x4 + 22y4 + 5s4 + 18x5 + 24y5 + 5s5 + 20x6 + 26y6 + 5s6 + 22x7 + 28y7 + 5s7 + 24x8 + 30y8 + 5s8 + 26x9 + 32y9 + 5s9 + 28x10 + 34y10 + 5s10  s.t.  s0 + x1 + y1 = 8 + s1 (Day 1 balance) s1 + x2 + y2 = 6 + s2 (Day 2 balance) s2 + x3 + y3 = 9 + s3 (Day 3 balance) s3 + x4 + y4 = 7 + s4 (Day 4 balance) s4 + x5 + y5 = 10 + s5 (Day 5 balance) s5 + x6 + y6 = 5 + s6 (Day 6 balance) s6 + x7 + y7 = 8 + s7 (Day 7 balance) s7 + x8 + y8 = 6 + s8 (Day 8 balance) s8 + x9 + y9 = 4 + s9 (Day 9 balance) s9 + x10 + y10 = 7 + s10 (Day 10 balance) xt,yt,st 0 for all t = 1,,10.

In this 10-day example, the decision is how many units to produce on regular time ( xt) and overtime ( yt) on each day, and what the end-of-day inventory levels ( st) should be, so as to satisfy daily demand at minimum total cost.

4.2 Assignment Problem

The assignment problem is a fundamental optimization problem in combinatorial optimization. It involves assigning a set of n agents (or workers) to n tasks (or jobs) such that each agent is assigned exactly one task, and each task is assigned to exactly one agent. The goal is to minimize the total assignment cost.

Bipartite assignment diagram: three people P1, P2, P3 drawn as stick-figure icons in blue circles on the left and three tasks T1, T2, T3 drawn as clipboard icons in red squares on the right, with lines connecting every person to every task.

Figure 4.2: Bipartite assignment diagram: three people P1, P2, P3 drawn as stick-figure icons in blue circles...
Sets:

Parameters:

Variables:

Model:

min iI jJcijxij (Total cost)  s.t.  jJxij = 1 for all i I (Each agent one task) iIxij = 1 for all j J (Each task one agent) xij {0,1} for all i I,j J. (Binary)

Explanation:

Assignment Problem

Given m machines and n jobs, find a least cost assignment of jobs to machines. The cost of assigning job j to machine i is cij.

Example 4.4: Machine Assignment

[Excel] [PuLP] [Gurobipy]

A small manufacturing workshop has four specialized machines and four jobs to be completed today. Each machine can perform any job, but the time and energy cost vary depending on the job–machine combination. For example, Machine 0 might perform Job 2 very efficiently, while it would take much longer and cost more to complete Job 1. Management wants to assign exactly one job to each machine and exactly one machine to each job so that the total operating cost is minimized. The cost matrix cij reflects the expected operating cost (in dollars) for assigning Machine i to Job j. In this instance the costs are

c = [ 9 2 7 8 6 4 3 7 5 8 1 8 7 6 9 4 ],

and the optimal assignment (machine 0 job 1, 1 0, 2 2, 3 3) has total cost 13.

Sets:

Parameters:

Variables:

Model:

min iI,jJcijxij (Total cost)  s.t.  iIxij = 1 for all j J (Each job assigned one machine) jJxij = 1 for all i I (Each machine assigned one job) xij {0,1} for all i I,j J.

Example 4.5: School Bus Routing Problem

[Excel] [PuLP] [Gurobipy]

A school district has a set of schools I and a fleet of school buses J. Each bus needs to be assigned to a school every morning to pick up students. The cost cij represents the fuel cost for bus j to reach school i and complete the route. The district aims to minimize the total fuel cost while ensuring that each school is served by exactly one bus and each bus is assigned to exactly one school.

The fuel costs can be found in the following table. They are also in csv file format here.

Bus/School School A School B School C School D School E
Bus 1 50 80 60 90 100
Bus 2 60 85 55 70 110
Bus 3 75 65 50 85 90
Bus 4 70 90 55 80 95
Bus 5 80 70 60 75 85
Table 4.3: Cost of assigning each bus to each school.
We can model this as follows:

Sets:

Parameters:

Variables:

Model:

min iI,jJcijxij (Total fuel cost)  s.t.  iIxij = 1 for all j J (Each bus serves one school) jJxij = 1 for all i I (Each school served by one bus) xij {0,1} for all i I,j J.

Example 4.6: Hiring for tasks

[Excel] [PuLP] [Gurobipy]

Recall Example 2.15. We define the following sets, parameters, and variables to construct the mathematical model.

Sets:

Parameters:

Variables:

Model:

The complete model is:

min iI jJCijxij (Total cost)  s.t.  jJxij = 1 for all i I (Each person one task) iIxij = 1 for all j J (Each task one person) xij {0,1} for all i I,j J.

This model assigns each person to exactly one task and each task to exactly one person at minimum total cost.

The assignment problem has an integrality property, such that if we remove the binary restriction on the x variables (now just non-negative, i.e., xij 0) then we still get binary assignments, despite the fact that it is now an LP. This property is very interesting and useful.

Of course, the objective function might not be quite what we want; we might be interested in ensuring that the team with the worst assignment is as good as possible (a fairness criterion). One way of doing this is to modify the assignment problem using a max-min objective:

Max-min Assignment-like Formulation
Here z is a lower bound on the total score jJCijxij of every team i, and maximizing z makes the worst team’s score as large as possible.

max z  s.t.  z jJCijxij,   for all i I iIxij = 1,   for all j J jJxij = 1,   for all i I xij 0,   for all i I,j J

Min-max Assignment-like Formulation

min z  s.t.  z iICijxij,   for all j J iIxij = 1,   for all j J jJxij = 1,   for all i I xij 0,   for all i I,j J

Does this formulation have the integrality property? (It is not an assignment problem.)

Consider a simple example where two teams are to be assigned to two projects, and the teams provide the following rankings (lower ranking is better):




Project 1 Project 2






Team 1 2 1
Team 2 2 1



Table 4.4: Rankings given by the two teams for the two projects (lower is better).

Both teams prefer Project 2.

If we remove the binary restriction on the x-variable, the values can range between 0 and 1. For the original assignment problem, the optimal solution has z = 2, and fractional x-values do not improve z.

For the min-max assignment problem, however, this is not the case. The optimal solution has z = 1.5, occurring when each team is assigned half of each project (i.e., for Team 1, we have x11 = 0.5 and x21 = 0.5). By fractionalizing assignments, the worst-case project cost is minimized.

Case Study: Preference-Based Housing Assignment in Uruguayan Cooperatives

Housing cooperatives in Uruguay play a crucial role in providing affordable housing to their members. Traditionally, once a new cooperative building was completed, the assignment of individual housing units was conducted through a random draw. This method, while simple, ignored individual preferences such as sunlight orientation, floor level, and proximity to shared facilities. Recognizing the potential for improved member satisfaction, researchers developed an alternative assignment method based on mixed-integer programming (MIP).

The Challenge

In Uruguayan housing cooperatives, every member is entitled to a housing unit. Since the assignment process happens only once per building, it is crucial to ensure fairness while maximizing overall satisfaction. The existing lottery-based system failed to account for members’ preferences, sometimes leading to dissatisfaction and informal exchanges of units after the assignment. The challenge was to develop a new assignment process that:

The Solution: A Two-Stage Optimization Model

A team of researchers proposed a two-stage mixed-integer programming (MIP) model to address these concerns. The assignment problem was formulated with the following structure:

Stage 1 – Ensuring Fairness: The model maximizes the satisfaction of the least satisfied member. This ensures that no one is assigned an extremely undesirable unit.

Stage 2 – Optimizing Global Satisfaction: Given the fairness constraints from Stage 1, the model then seeks to optimize the total satisfaction across all cooperative members.

The assignment process was implemented using a software tool called MTAV (Mejor Tecnología de Asignación de Viviendas – A Better Technology for Housing Assignment), designed to be transparent and user-friendly.

Implementation and Results

The first real-world test of the model occurred in 2016 with the Virazón housing cooperative, consisting of 50 members. Before deployment, the cooperative members reviewed and voted to approve the new method. Their individual housing preferences were collected and input into the system.

On the day of the assignment:

The outcomes were striking:

The cooperative members overwhelmingly supported the new system, reporting higher satisfaction compared to previous assignment methods.

Broader Impact

Since the successful implementation at Virazón, over 30 housing cooperatives in Uruguay have adopted the model. Further developments have included:

Beyond its technical achievements, this case study highlights how operations research techniques can be applied to solve real-world social challenges. By integrating mathematical optimization with participatory decision-making, the project has significantly improved the way housing is assigned in cooperative communities, setting a precedent for future applications in housing policy and beyond.

Optimization models

The optimization model required the following input parameters and variables:

Sets:

Parameters:

Variables:

Two-Stage Optimization Approach

Stage 1: Ensuring Fairness

This is achieved by the model

S = min z  s.t.  z jJpijxij for all i I jJxij = 1 for all i I iIxij = 1 for all j J xij {0,1} for all i I,j J z

Stage 2: Optimizing Global Satisfaction

This is achieved by the model

min iI jJpijxij  s.t.  jJxij = 1 for all i I iIxij = 1 for all j J jJpijxij S for all i I xij {0,1} for all i I,j J

Implementation Notes

References

4.3 Modeling Tricks

4.3.1 Maximizing a minimum

When the constraints could be general, we will write x X to define general constraints. For instance, we could have X = {x n : Ax b} or X = {x n : Ax b,x n} or many other possibilities.

Consider the problem

max min {x1, ,xn}  such that  x X Having the minimum on the inside is inconvenient. To remove this, we just define a new variable y and enforce that y xi and then we maximize y. Since we are maximizing y, it will take the value of the smallest xi. Thus, we can recast the problem as

max y  such that  y xi for i = 1,,n x X

Example 4.7: Minimizing an Absolute Value

[Excel] [PuLP] [Gurobipy]

Note that

|t| = max (t,t),

so to minimize |t| we can instead write

min z  s.t.  t z t z.

The accompanying code applies this trick to find the point minimizing the total absolute distance to several given points (whose optimum is their median).

4.4 Network Flow Models and Applications

Network flow models are used to optimize the movement of commodities, resources, or information through a network while satisfying capacity and demand constraints. These models have a broad range of applications in various fields:

To begin a discussion on Network flow, we first need to discuss graphs.

4.4.1 Graphs

Undirected Graphs

Definition 4.8

A (undirected) graph G = (V,E) is defined by a set of vertices V and a set of edges E that contains pairs of vertices.

For example, the following graph G can be described by:

Undirected network with six numbered circular nodes: edges join 6-4, 4-5, 4-3, 5-1, 5-2, 3-2, and 2-1.

Figure 4.3: Undirected network with six numbered circular nodes: edges join 6-4, 4-5, 4-3, 5-1, 5-2, 3-2, and 2-1.

In an undirected graph, we do not distinguish the direction of the edge. That is, for two vertices i,j V , we can equivalently write (i,j) or (j,i) to represent the edge.

Directed Graphs

Alternatively, we will want to consider directed graphs.

Definition 4.9

A directed graph (or di-graph for short) is denoted as G = (V,A) where V is a set of vertices and A is a set of ordered pairs of vertices called arcs. That is, an arc is like an edge, but the direction of it matters.

For example, the following directed graph G can be described by

Directed version of the same six-node network: curved arrows show arc directions, including a two-way pair of arcs between nodes 6 and 4 and a cycle through nodes 5, 1, 2, and 3.

Figure 4.4: Directed version of the same six-node network: curved arrows show arc directions, including a...

4.4.2 Example: Minimum-Cost Flow in a Transportation Network

Example 4.10: Minimum-Cost Network Flow

[Excel] [PuLP] [Gurobipy]

To illustrate the minimum-cost network flow problem, consider a company that wants to transport goods from two warehouses to two retail stores at the lowest possible cost. The company can send goods through a network of transportation routes, each with a given capacity and per-unit transportation cost.

The transportation network consists of:

Graph Representation

The transportation network can be represented as a directed graph G = (V,A), where:

The network data is summarized in the following table:




Route Cost per unit ( cij) Capacity ( uij)



Warehouse 1 to Store 1 4 15
Warehouse 1 to Store 2 6 10
Warehouse 2 to Store 1 5 20
Warehouse 2 to Store 2 2 20



Table 4.5: Transportation cost and capacity for each route.
Model:

Let xij represent the amount of goods transported from warehouse i to store j. The problem is formulated as:

min 4xW1,S1 + 6xW1,S2 + 5xW2,S1 + 2xW2,S2 (4.1)  s.t.  xW1,S1 + xW1,S2 20 (Supply constraint for Warehouse 1) xW2,S1 + xW2,S2 30 (Supply constraint for Warehouse 2) xW1,S1 + xW2,S1 = 25 (Demand constraint for Store 1) xW1,S2 + xW2,S2 = 25 (Demand constraint for Store 2) 0 xij uij for all (i,j) A. (4.2)

Solution

Solving the linear program, we obtain the following optimal flow values:



Route Optimal Flow ( xij)


Warehouse 1 to Store 1 15
Warehouse 1 to Store 2 5
Warehouse 2 to Store 1 10
Warehouse 2 to Store 2 20


Table 4.6: Optimal flow on each route.
The total minimum cost is given by:
(4 × 15) + (6 × 5) + (5 × 10) + (2 × 20) = 60 + 30 + 50 + 40 = 180.

Interpretation of the Solution

This solution meets all constraints while ensuring goods are transported at the lowest possible cost.

4.4.3 Minimum Cost Network Flow Problem

The minimum cost network flow problem generalizes basic flow models by incorporating arc capacities, arc costs, and supply/demand at the nodes. The goal is to determine how to route flow through a network at the lowest possible cost while meeting demand and respecting all constraints.

Example 4.11: Amazonian’s Distribution Network

Amazonian must ship goods from large regional warehouses to local retail stores through intermediate distribution centers. Each warehouse has a certain supply capacity, each store has a demand, and each route incurs a transportation cost (fuel, time, and labor). Amazonian wants to decide how to route products to minimize cost, while ensuring demand is met and no transportation link exceeds its capacity.

The figure below shows a small example. There are:

Transshipment network: supply nodes W1 (+30) and W2 (+20) on the left, transshipment nodes D1 and D2 in the middle, and demand nodes S1 (-20), S2 (-15), S3 (-15) on the right. Arcs are labeled with unit costs: W1 to D1 costs 4, W1 to D2 costs 6, W2 to D1 costs 5, W2 to D2 costs 4, D1 to S1 costs 2, D1 to S2 costs 3, D2 to S2 costs 1, and D2 to S3 costs 2.

Figure 4.5: Transshipment network: supply nodes W1 (+30) and W2 (+20) on the left, transshipment nodes D1 and...

The problem is to determine how many units to send along each route to minimize the total shipping cost.

Sets:

Parameters:

Variables:
xij: amount of flow shipped along arc (i,j) A

Model:

min (i,j)Acij xij  s.t.  j:(k,j)Axkj i:(i,k)Axik = dk for all k V (flow balance) 0 xij uij for all (i,j) A (capacity constraints)

This problem can be solved using linear programming, and efficient specialized algorithms exist due to its structure. Applications span:

4.4.4 (Unstructured) Minimum Cost Network Flow Problem

The minimum cost network flow problem is an extension of the network flow problem that considers not only the capacities of the arcs, but also the costs associated with sending flow along the arcs and the demands at the nodes. The objective is to find the flow of minimum cost that satisfies the demands at the nodes and the capacity constraints on the arcs.

A network can be described as a directed graph G = (V,A), where V is the set of nodes and A is the set of arcs. Each arc (i,j) A has a capacity uij and a cost cij. Each node i V has a demand di, which can be positive, negative, or zero. A positive demand means that the node requires that amount of flow, a negative demand means that the node supplies that amount of flow, and a zero demand means that the node neither requires nor supplies flow.

Consider, for example: The set of vertices is given by:

V = {a,b,c,d,e,f,g,h}

The set of directed arcs is:

A = {(b,a),(a,c),(b,d),(b,e),(c,e),(c,f),(h,d),(g,e),(e,h),(g,f)}

Directed network with eight nodes labeled a through h arranged left to right. Blue numbers give node supplies (+10 at a, -5 at b, +5 at d, 0 at c and e, -5 at g and h) and red numbers on the arcs give unit costs.

Figure 4.6: Directed network with eight nodes labeled a through h arranged left to right.

The minimum cost network flow problem can be defined as follows: Given a network G = (V,A), capacities uij and costs cij on the arcs, and demands di at the nodes, find the flow xij on the arcs that minimizes the total cost of the flow, while satisfying the demands at the nodes and the capacity constraints on the arcs.

Sets:

Parameters:

Variables:

Model: The minimum cost network flow problem can be formulated as a linear programming problem as follows:

min (i,j)Acijxij  s.t.  i:(i,k)Axik j:(k,j)Axkj = dk for all k V 0 xij uij for all (i,j) A

Objective: - The objective is to minimize the total cost of the flow.

Constraints: - Flow Conservation: The first set of constraints ensures that the flow into each node minus the flow out of the node is equal to the demand at the node.

- Capacity Constraints: The second set of constraints ensures that the flow on each arc does not exceed its capacity.

Minimum-cost network flow problems are widely used in transportation planning, supply chain logistics, and production scheduling, where the goal is to efficiently allocate resources at the lowest possible cost.

4.4.5 Maximum flow

The maximum flow problem is a fundamental problem in operations research and computer science, with applications in a wide variety of fields. It involves finding the maximum amount of flow that can be sent from a source node to a sink node in a network, without exceeding the capacities of the individual arcs, and ensuring that the flow on each arc is non-negative. This problem arises in many real-world situations, such as in transportation, where it can be used to find the maximum amount of goods that can be transported from a factory to a warehouse, or in telecommunications, where it can be used to find the maximum amount of data that can be sent from one server to another. Other applications include supply chain optimization, water distribution, and electrical power grid optimization. In this section, we will describe a linear programming formulation for the network flow problem.

A network can be described as a directed graph G = (V,A), where V is the set of nodes and A is the set of arcs. Each arc (i,j) A has a capacity uij, which is the maximum amount of flow that can traverse the arc from node i to node j.

The network flow problem can be defined as follows: Given a network G = (V,A), a source node s, a sink node t, and capacities uij on the arcs, find the maximum flow from s to t that respects the capacity constraints.

For example, consider the directed graph here with capacities on the arcs.

Capacity network: green source s on the left, red sink t on the right, intermediate nodes a, b, c, d, e. Orange numbers give arc capacities: s-a 4, s-b 2, s-c 8, a-d 2, a-c 5, b-c 6, b-e 9, c-d 1, c-t 4, c-e 6, d-t 7, e-t 5.

Example 4.12: Airline Transfer Network: Maximizing Passenger Throughput

[Excel] [PuLP] [Gurobipy]

An airline is trying to reroute as many stranded passengers as possible from an origin city ( s) to a destination city ( t) using a network of connecting flights. Each flight has a known number of available seats, and passengers may transfer at intermediate airports. The objective is to determine the maximum number of passengers that can be routed from origin to destination, using available seat capacity and respecting flight routes.

The network includes:

Sets and Parameters:

Variables:
xij: number of passengers assigned to fly from airport i to j for all (i,j) A

Model:

max xsa + xsb + xsc (max passengers from origin)  s.t.  xac + xad xsa = 0 (flow balance at a) xbc + xbe xsb = 0 (at b) xcd + xce + xct xac xbc xsc = 0 (at c) xde xad xcd = 0 (at d) xet xbe xce xde = 0 (at e) 0 xsa 4,0 xsb 2,0 xsc 8 (available seats on initial flights) 0 xac 5,0 xad 2,0 xbc 6,0 xbe 9 0 xcd 1,0 xce 3,0 xct 4 0 xde 7,0 xet 5

In compact summation notation form, we have

max jV :(s,j)Axsj  s.t.  jV :(k,j)Axkj iV :(i,k)Axik = 0for all k V {s,t} 0 xij uij for all (i,j) A

This model helps the airline determine how to assign passengers to flight legs in a way that makes maximum use of the network’s available capacity. It is especially useful during disruption scenarios like:

The same framework can be extended to include priorities, time windows, or rebooking costs.

The solution is shown here in bold values on the graph. There is a total flow of 12.

Directed max-flow network with optimum shown: green source s (left), red sink t (right), intermediate nodes a, b, c, d, e. Arcs are labelled with capacity (orange) and optimal flow (bold black); total source outflow equals 12.

The maximum flow problem can be written mathematically in the following way.

Sets:

Parameters:

Variables:

Model: The network flow problem can be formulated as a linear programming problem as follows:

max j:(s,j)Axsj  s.t.  i:(i,k)Axik j:(k,j)Axkj = 0 for all k V {s,t} 0 xij uij for all (i,j) A

Objective: - The objective is to maximize the total flow from the source node s to the sink node t.

Constraints: - Flow Balance: The first set of constraints ensures that the flow into each node is equal to the flow out of the node, except for the source and sink nodes.

- Capacity Constraints: The second set of constraints ensures that the flow on each arc does not exceed its capacity.

We will discuss duality later. But duality is a concept that helps create bounds on a problem. For this particular problem, we can think of a dual as a cut in the graph - something that separates s from t. For example:

The same s-t capacity network with a wide gray diagonal band crossing four arcs; circled numbers 2, 1, 4, and 5 mark the capacities of the crossed arcs, illustrating an s-t cut of total capacity 12.

The selected arcs are a cut that separates s from t. The sum of their weights is 2 + 1 + 4 + 5 = 12, which implies that there is not a flow more than 12 units from s to t.

This bound is a form of duality. We will explore the concept more in later chapters. This duality is captured in the following theorem.

Theorem 4.13

The maximum flow amount is equal to the size of the minimum cut.

4.4.6 Multi-Commodity Minimum Cost Network Flow with Integrality Constraints

The multi-commodity minimum cost network flow problem is a generalization of the minimum cost network flow problem that considers multiple commodities flowing through the network. Each commodity has its own demand at each node and its own cost on each arc. The objective is to find the integer flow of minimum cost that satisfies the demands of all commodities at the nodes and the capacity constraints on the arcs.

A network can be described as a directed graph G = (N,A), where N is the set of nodes and A is the set of arcs. Each arc (i,j) A has a capacity uij. Each commodity k has a demand dik at each node i N and a cost cijk on each arc (i,j) A.

The multi-commodity minimum cost network flow problem can be defined as follows: Given a network G = (N,A), capacities uij on the arcs, demands dik and costs cijk for each commodity k, find the integer flow fijk on the arcs for each commodity k that minimizes the total cost of the flow, while satisfying the demands of all commodities at the nodes and the capacity constraints on the arcs.

Sets:

Parameters:

Variables:

Model: The multi-commodity minimum cost network flow problem can be formulated as an integer linear programming problem as follows:

min kK (i,j)Acijkfijk  s.t.  kKfijk uij for all (i,j) A j:(j,i)Afjik j:(i,j)Afijk = dik for all i N,k K fijk 0 for all (i,j) A,k K

Objective: The objective is to minimize the total cost of the flow, summed over all commodities and all arcs.

Constraints:

Example 4.14: Multi-commodity network flow

[Excel] [PuLP] [Gurobipy]

Consider a small network with 4 nodes and 4 arcs, transporting 2 commodities. Each arc has a shared capacity, and each commodity has its own per-unit cost on each arc and its own supply/demand pattern at the nodes (negative values indicate supply, positive values indicate demand).

# Sample data
nodes = [1, 2, 3, 4]
arcs = [(1, 2), (1, 3), (2, 4), (3, 4)]
commodities = [1, 2]
capacities = {(1, 2): 20, (1, 3): 15, (2, 4): 25, (3, 4): 20}
costs = {(1, 2, 1): 2, (1, 2, 2): 3, (1, 3, 1): 3,
         (1, 3, 2): 2, (2, 4, 1): 1, (2, 4, 2): 2,
         (3, 4, 1): 2, (3, 4, 2): 1}
demands = {(1, 1): -10, (1, 2): -5, (2, 1): 0, (2, 2): 0,
           (3, 1): 0,   (3, 2): 0,  (4, 1): 10, (4, 2): 5}

The two figures below show the input network (left) and the optimal flow assignment (right). Each arc is labelled with the commodity flows it carries; the arc capacity constraint requires the sum of those commodity flows to stay within the arc’s capacity.

Flow network with four blue circular nodes: arcs 3 to 1 with capacity 15, 1 to 2 with capacity 20, 2 to 4 with capacity 25, and 3 to 4 with capacity 20. Boxed labels beside each node give two numbers: node 3 (0, 0), node 1 (-10, -5), node 2 (0, 0), node 4 (10, 5).

Figure 4.7: Data for multi-commodity network flow example: four nodes with paired supplies/demands (di1,di2) and four arcs labelled with their shared capacities.

The same four-node network annotated with a flow solution: arcs carry interval labels [5.0, 5.0] on 3 to 1, [10.0, 0.0] on 1 to 2, [10.0, 0.0] on 2 to 4, and [-0.0, 5.0] on 3 to 4, with boxed node labels [-10, -5], [0, 0], [0, 0], and [10, 5].

Figure 4.8: Solution to multi-commodity network flow: each arc is labelled with the optimal flow of each commodity [fij1,fij2].

4.4.7 Multicommodity Flow: Source–Sink Formulation

A common alternative formulation of the multi-commodity flow problem expresses each commodity in terms of a single source node, a single sink node, and a demand value, with flow variables that represent the fraction of the demand routed on each arc. The formulation below follows the description on the Wikipedia article https://en.wikipedia.org/wiki/Multi-commodity_flow_problem.

Problem Definition Given a flow network G(V,E), where each edge (u,v) E has capacity c(u,v), suppose there are k commodities K1,K2,,Kk, defined by Ki = (si,ti,di), where si and ti are the source and sink of commodity i, and di is its demand. The variable fi(u,v) denotes the fraction of commodity i routed along edge (u,v); we take fi(u,v) [0,1] when flow may be split among multiple paths, and fi(u,v) {0,1} when each commodity must follow a single path (“single path routing”). The problem is to find an assignment of all flow variables that satisfies the following four conditions.

(1) Link capacity. The total flow routed over any link, weighted by demands, does not exceed the link’s capacity:

(u,v) E : i=1kf i(u,v) di c(u,v).

(2) Flow conservation on transit nodes. For any intermediate node u (other than the source or sink of commodity i), the flow of commodity i entering u equals the flow leaving u:

wV fi(u,w) wV fi(w,u) = 0whenever usi,ti.

(3) Flow conservation at the source. The full unit of commodity i must leave its source:

wV fi(si,w) wV fi(w,si) = 1.

(4) Flow conservation at the destination. The full unit of commodity i must arrive at its sink:

wV fi(w,ti) wV fi(ti,w) = 1.

Corresponding optimization problems. Three natural objective functions can be paired with the constraints above:

Relation to other problems. The minimum-cost variant generalizes the (single-commodity) minimum cost flow problem of Section 4.4.3 (which has only one source s and one sink t). More broadly, every flow problem can be cast as a special case of the circulation problem.

Example 4.15: Source–Sink Multicommodity Flow

[Excel] [PuLP] [Gurobipy]

Consider the directed network on nodes V = {1,2,3,4} with the arc capacities c(u,v) and per-unit costs a(u,v) listed below. Two commodities must be routed from source node 1 to sink node 4: commodity 1 with demand d1 = 10 and commodity 2 with demand d2 = 5.

Arc (u,v) Capacity c(u,v) Cost a(u,v)



(1,2) 10 1
(1,3) 8 2
(2,3) 4 1
(2,4) 7 3
(3,4) 9 1
Table 4.9: Arc capacities and costs for the two-commodity network.

Using the fractional flow variables fi(u,v) [0,1] with the minimum-cost objective and constraints (1)–(4), the optimal routing sends all of commodity 2 along 1 3 4 and splits commodity 1 across the 1 2 4 and 1 3 4 paths (routing a small share through arc (2,3)), for a minimum total cost of 51.

4.5 Transportation Problem

The transportation problem involves determining the optimal way to transport goods from a set of suppliers to a set of markets. The goal is to minimize total transportation costs while satisfying supply availabilities at the suppliers and demand requirements at the markets.

Additional resources:

Let I be the set of suppliers and J be the set of markets.

Parameters:

Variables:

Model:

minimize: iI jJcijxij(total shipping cost) subject to: jJxij si i I (supply limit at each supplier) iIxij = dj j J (demand met at each market) xij 0 i I,j J (non-negativity)

The objective minimizes total shipping cost; the constraints ensure that the shipment from each supplier does not exceed its available supply, and that the demand at each market is satisfied. The decision variables xij specify the optimal shipment quantities.

Concluding Comments

Solving the Minimum-Cost Network Flow Problem

This problem can be efficiently solved using specialized algorithms such as:

Resources

Try it out visually!

Network Flow Problems: min-cost flow, transportation, and shortest path on interactive networks, with plain-language descriptions and applications.

4.6 Multi-Period Capital Investment

Example 4.16: Multi-Period Capital Investment Problem

[Excel] [PuLP] [Gurobipy]

You are managing a multi-period investment fund with $50,000 to start. Over the course of four periods, you can allocate capital to a set of investment opportunities. Each investment requires an upfront cost and offers an expected payout at the beginning of the following period, which can then be reinvested. The goal is to maximize the total funds available at the end of the fourth period.

The following table lists the available investments, the required initial investment for each period, and their respective payouts for the next period. Formulate an LP to determine the optimal investment strategy over the four periods.





Period Investment Investment Required ($) Payout in Next Period ($)








1 A 10,000 15,000
1 B 20,000 30,000
1 C 15,000 22,000




2 D 12,000 18,000
2 E 25,000 35,000
2 F 18,000 26,000




3 G 15,000 20,000
3 H 10,000 14,000
3 I 20,000 28,000




4 J 8,000 10,000
4 K 16,000 22,000
4 L 12,000 16,000




Table 4.10: Investment Opportunities Over Four Periods

Solution

Variables:
xi,t: whether to invest in opportunity i during period t, where xi,t = 1 if investment i is chosen in period t, and xi,t = 0 otherwise.

Parameters:
ci,t: investment required for opportunity i in period t.
pi,t: payout from investment i in the next period.

Objective: The cash on hand at the end of period 4 is the payout of the period-4 investments:

max z = 10,000xJ + 22,000xK + 16,000xL.

Constraints:

Case Study: Amazon Redraws Its Map: Regionalizing the Fulfillment Network

When you order from Amazon, the item might ship from a building 20 miles away or 2,000 miles away. Around 2023, Amazon restructured its US fulfillment network into largely self-sufficient regions so that most packages stay close to home: the “Regionalization” initiative. The redesign was driven by network optimization models, published in the INFORMS Journal on Applied Analytics, and made Amazon a 2025 Edelman Award finalist. In 2023 it reduced the cost to serve by $0.45 per item in the US while achieving Amazon’s fastest delivery speeds to date.

The Challenge

Serving a customer from a distant fulfillment center is expensive and slow, but keeping every product in every region requires more inventory. The network design must decide which connections (fulfillment center sortation delivery station) to operate and how demand should flow over them, balancing cost, speed, and capacity across thousands of facilities and arcs.

The Solution: A Path-Based Network Design MIP

Model type: mixed-integer linear program on a network (with machine learning used only to forecast the inputs: demand, travel times). The published paper is explicit about this division of labor.

A simplified core of the “topology” model:

Sets and Parameters:

Variables:

Model:

min pcpfp + aAgawa (flow cost + cost of operating connections)  s.t.  pPrfp = dr for all r R (serve all demand) pafp uawa for all a A (use only open connections, within capacity) fp 0,wa {0,1}.

Note the second constraint: it is exactly the big- M/linking trick from the integer programming chapter, with the capacity ua playing the role of M. Regionalization shows up as the optimizer choosing to open mostly within-region connections.

Assumptions and Simplifications

Implementation and Results

Deployed across Amazon’s US network in 2023: cost to serve fell by $0.45 per item, delivery speeds hit record levels, and the share of shipments fulfilled within their own region rose sharply.

References

4.7 Exercises

Warm-ups

Exercise 4.17: Production Planning over Five Periods

  This exercise mirrors Example 4.2 (Production Planning with 10 Periods) with a shorter horizon and new data. A plant must meet demand over T = 5 periods. Production costs are (8,10,12,14,16) dollars per unit in periods 1 through 5, demand is (5,7,6,8,4) units, the holding cost is cinv = 3 dollars per unit per period, and the initial inventory is s0 = 2.

1.
Write the LP with production variables xt and inventory variables st, using one inventory-balance constraint per period.
2.
Solve it (in Excel, with a solver, or by inspection). As a check, the minimum total cost is 342.
3.
Explain why the optimal plan carries no inventory between periods.

4.1, Example 4.2]

Exercise 4.18: Machine Assignment with New Costs

  This exercise mirrors Example 4.4 (Machine Assignment). The same workshop faces a new set of four jobs with cost matrix

c = [ 7 3 8 6 5 9 4 8 6 7 2 9 8 5 7 3 ],

where row i gives the costs for machine i and column j corresponds to job j (machines and jobs numbered 0 through 3). Write the assignment model for this data and find a minimum-cost assignment. As a check, the optimal total cost is 13.

4.2, Example 4.4]

Exercise 4.19: Warehouse Shipping with New Data

  This exercise mirrors Example 4.10 (Minimum-Cost Network Flow). Keep the same network, supplies ( 20 at Warehouse 1 and 30 at Warehouse 2), and route capacities ( 15, 10, 20, 20), but change the data: the per-unit costs are now 4, 6, 3, 2 on routes W1 S1, W1 S2, W2 S1, W2 S2, and the demands are now 20 units at Store 1 and 30 units at Store 2.

1.
Update the model from the example to this data and solve.
2.
As a check, the minimum cost is 170. Which routes are at capacity?

4.4.3, Example 4.10]

Core problems

Exercise 4.20: Fair Housing Assignment for 12 Families

  A new apartment complex has been completed, and 12 families need to be assigned to 12 available apartments. Each family has ranked the apartments (1 = most preferred, 12 = least preferred).

1.
Use Excel Solver to find an assignment that minimizes the sum of preferences.
2.
What units were assigned to which families, and what was their preference score?
3.
What is the worst preference score assigned?

Download the data for this problem here data.

4.2]

Exercise 4.21: Maximum Network Flow to a Single Node

  A disaster relief effort is underway to transport supplies to a central distribution hub in a flooded region. The network consists of multiple warehouses (nodes) that currently have varying inventory levels of emergency supplies. Each transportation route (arc) between warehouses is serviced by a single truck with a limited carrying capacity. The goal is to determine the optimal transportation plan that maximizes the amount of supplies delivered to the central hub while respecting inventory constraints and truck capacities on each route.

Formulate a max-flow optimization problem for this scenario. Define your decision variables, objective function, and constraints explicitly. Assume that you do not want to leave any inventory at the distribution centers.






Node Type Inventory (if applicable) Connected To Capacity





W1 Warehouse 200 D1 100
W2 Warehouse 300 D1, D2 150, 70
W3 Warehouse 150 D2 120
W4 Warehouse 250 D3, D1 100, 120
W5 Warehouse 180 D3 90





D1 Distribution N/A Hub, D2 200, 80
D2 Distribution N/A Hub 180
D3 Distribution N/A Hub 160





Hub Central Hub N/A





Table 4.11: Node data for the distribution network: type, inventory, connections, and capacity.

Disaster-relief transportation network: warehouse rectangles W1-W5 (inventories 200, 300, 150, 250, 180), distribution circles D1, D2, D3, and a central diamond Hub. Directed arcs labelled with capacities route supplies through distribution centers to the Hub.

Figure 4.9: Disaster-relief transportation network: warehouse rectangles W1-W5 (inventories 200, 300, 150, 250...

4.4.5]

Exercise 4.22: Max Flow

  Write out the explicit constraints that define the max flow problem given in the picture. Solve this problem as a linear program using Excel.

Directed max-flow exercise network: green source s and red sink t with intermediate nodes v1, v2, v3, v4. Arc capacities: s to v1 is 11, s to v2 is 8, between v1 and v2 are 10 and 1, v1 to v3 is 12, v3 to v2 is 4, v4 to v3 is 7, v2 to v4 is 11, v3 to t is 15, v4 to t is 4.

Figure 4.10: Directed max-flow exercise network: green source s and red sink t with intermediate nodes v1, v2, v3, v4.

4.4.5]

Exercise 4.23: Min Cost Network Flow

  Use the picture below to formulate the corresponding capacitated min cost network flow. Each arc is labeled with its capacity (black) and its per-unit cost (red); the blue number at each node is its net demand (positive = demand, negative = supply). Solve this problem using Excel. As a check, the minimum cost is 67.

Six-node directed network for a min-cost flow exercise: nodes v1 through v6 with blue supply values (6 at v1, -5 at v2, -3 at v3, -6 at v4, -2 at v5, 10 at v6). Each arc shows its capacity in black and a red cost value, for example v5 to v1 has capacity 11 and cost 4.

Figure 4.11: Six-node directed network for a min-cost flow exercise: nodes v1 through v6 with blue supply values...

4.4.3]

Exercise 4.24: Transshipment Through Regional Hubs

  Two factories ship a product to three stores through two regional hubs; no route connects a factory directly to a store. Factory A can supply up to 40 units and factory B up to 60 units. Stores S1, S2, S3 require 30, 45, and 25 units. The per-unit shipping costs are:

H1 H2



A 2 4
B 3 1
S1 S2 S3




H1 4 6 7
H2 5 3 2
Table 4.12: Per-unit shipping costs from factories to hubs (left) and from hubs to stores (right).

The hubs neither create nor store product: whatever enters a hub must leave it.

1.
Formulate this as a minimum-cost network flow problem. State the flow-balance constraint at each hub explicitly.
2.
Solve the model and report the optimal shipping plan and the minimum total cost.

4.4.3]

Exercise 4.25: Assignment with Forbidden Pairs

  Five workers must be assigned to five jobs, one job per worker and one worker per job. The cost matrix is

C = [ 12 8 10 9 11 7 9 13 10 8 9 11 6 7 12 10 7 9 8 6 8 10 11 6 9 ],

where rows are workers 1 through 5 and columns are jobs 1 through 5. Certification rules forbid worker 1 from doing job 2 and worker 4 from doing job 5.

1.
First ignore the certification rules and solve the assignment problem. As a check, the minimum cost is 33.
2.
There are two standard ways to model a forbidden pair (i,j): add the constraint xij = 0, or replace cij with a prohibitively large cost. Explain why each works.
3.
Solve the problem with the forbidden pairs enforced. As a check, the minimum cost is now 37. How much do the certification rules cost the company?

4.2, Example 4.4]

Exercise 4.26: Multi-Period Inventory with a Production Cap

  A plant can produce at most 120 units per period. Over six periods, demand is (80,120,60,140,90,110) units, production costs are (20,20,22,25,24,23) dollars per unit, the holding cost is 2 dollars per unit per period, and the initial inventory is s0 = 0.

1.
Extend the production planning model of Section 4.1 with the capacity constraints xt 120.
2.
Before solving: demand in period 4 exceeds the production cap, so some units must be built ahead. For each earlier period, compute the cost of producing one period-4 unit there (production cost plus holding). Which options are cheapest?
3.
Solve the LP. As a check, the minimum total cost is 13,450. Verify that the solver’s prebuilding matches your cost comparison from part 2 (there may be ties, so alternative optimal plans exist).

4.1]

Concepts and connections

Exercise 4.27: Why Everything Ships Somewhere

  Consider the minimum-cost network flow model of Section 4.4.3, with a flow-balance constraint j:(k,j)Axkj i:(i,k)Axik = dk at every node k.

1.
Add the flow-balance constraints over all nodes k V . Show that every variable xij cancels, and conclude that the model can only be feasible when kV dk = 0, that is, when total supply equals total demand.
2.
Explain in words why the balance constraint at an intermediate node (one with dk = 0) means flow cannot vanish or appear there, so every unit that leaves a supply node must arrive at some demand node.
3.
Exercise 4.21 asked you not to leave inventory at the warehouses, yet writing the warehouse constraints as equalities makes that problem infeasible. Use parts 1 and 2 to explain the conflict, and describe a standard fix (inequality supply constraints, or a dummy node that absorbs the surplus at zero cost).

4.4.3]

Exercise 4.28: Integer Answers for Free

  The assignment problem is stated with binary variables, but Section 4.2 notes that solving its LP relaxation (replace xij {0,1} with xij 0) still returns a binary assignment.

1.
The reason, stated informally, is that the assignment constraint matrix is totally unimodular: this guarantees that every corner point of the LP feasible region has integer coordinates, and the simplex method always returns a corner point. Restate this in your own words. No proof is expected.
2.
The transportation problem of Section 4.5 has the same network structure. What can you conclude about the optimal shipments when all supplies and demands are integers?
3.
The max-min fair formulation in Section 4.2 adds the constraints z jCijxij. Using the two-team example given there, explain why that formulation no longer has the integrality property.

4.2, §4.5]

Challenge problems

Exercise 4.29: Multicommodity Rerouting Under a Tighter Capacity

  Return to the network of Example 4.14: nodes {1,2,3,4}, arcs (1,2), (1,3), (2,4), (3,4) with capacities 20, 15, 25, 20, commodity 1 sending 10 units and commodity 2 sending 5 units from node 1 to node 4, and the per-unit costs given in the example.

1.
Solve the LP relaxation ( fijk 0, integrality dropped) and verify that the minimum total cost is 45, with commodity 1 routed along 1 2 4 and commodity 2 along 1 3 4.
2.
Now suppose arc (2,4) has capacity 8 instead of 25. Re-solve. As a check, the minimum cost rises to 49. Report how each commodity is routed and which arc is at capacity.
3.
The capacity constraints kfijk uij couple the commodities. Construct a small example (two parallel paths and two commodities suffice) in which routing each commodity on its own cheapest path violates a shared capacity, and explain how the joint LP resolves the conflict.

4.4.6, Example 4.14]

Exercise 4.30: Max-Min Fair Project Assignment

  Three teams must each take on one of three projects. Team i gives project j a satisfaction score Sij (higher is better):

S = [ 8 6 5 7 8 4 6 9 7 ].

The fairness discussion in Section 4.2 suggests maximizing the satisfaction of the worst-off team instead of the total.

1.
Find the integer assignment that maximizes total satisfaction. As a check, the maximum total is 23.
2.
Find the integer assignment that maximizes the minimum team satisfaction. As a check, the best achievable minimum is 7. Argue that no assignment achieves a minimum of 8.
3.
Now solve the max-min LP with xij 0, as in the max-min formulation of Section 4.2. Show that the optimal value increases to 7.5, which requires fractional assignments. Why does allowing fractions help the worst-off team here, when it cannot improve the total-satisfaction objective in part 1?

4.2]

Selected Solutions

Solution

(Exercise 4.18) The model is the one in Example 4.4 with the new cost matrix: binary variables xij, one assignment constraint per machine and one per job, and objective i,jcijxij. The optimal assignment is machine 0 job 1 (cost 3), machine 1 job 0 (cost 5), machine 2 job 2 (cost 2), and machine 3 job 3 (cost 3), for a total cost of 3 + 5 + 2 + 3 = 13. Checking all 4! = 24 assignments confirms this is optimal; the next-best assignment costs 16.

Solution

(Exercise 4.21) Introduce one variable per transportation route: let xij 0 be the number of units of supplies sent along the arc from node i to node j, for each arc in the picture (for example xW1,D1, xD1,D2, xD 1,Hub, and so on). The objective is to maximize the total amount reaching the hub,

max xD 1,Hub + xD2,Hub + xD3,Hub.

There are three families of constraints. Each arc has a truck capacity, xij uij, where uij is the capacity written on the arc. Each distribution node passes along everything it receives, so flow is conserved there; for example at D1,

xW1,D1 + xW2,D1 + xW4,D1 = xD1,D2 + xD 1,Hub,

and similarly at D2 and D3. Finally, each warehouse can ship at most what it has on hand: the total flow leaving warehouse Wi is at most its inventory. One caution about the “leave no inventory behind” request: writing the warehouse constraints as equalities makes the model infeasible, since for instance W1 holds 200 units but its only outgoing route has capacity 100. So treat inventory as an upper bound on warehouse outflow and let the objective push as much through the network as the capacities allow.

Solution

(Exercise 4.22) Let xij 0 denote the flow on arc (i,j). Maximize the flow arriving at t subject to flow conservation at the four internal nodes and the arc capacities:

max xv3t + xv4t  s.t.  xsv1 + xv2v1 = xv1v3 + xv1v2 (v1) xsv2 + xv1v2 + xv3v2 = xv2v4 + xv2v1 (v2) xv1v3 + xv4v3 = xv3t + xv3v2 (v3) xv2v4 = xv4t + xv4v3 (v4) xsv2 8,xsv1 11,xv1v2 10,xv2v1 1,xv2v4 11, xv1v3 12,xv3v2 4,xv4v3 7,xv4t 4,xv3t 15, xij 0for all arcs (i,j).

Solving this LP (in Excel or otherwise) gives a maximum flow of 19. One optimal flow is xsv1 = 11, xsv2 = 8, xv1v3 = 8, xv1v2 = 3, xv2v4 = 11, xv4t = 4, xv4v3 = 7, xv3t = 15, and all other arcs at 0. You can certify optimality without any theory: the two arcs into t have capacities 15 + 4 = 19, so no flow can exceed 19, and this flow achieves it.

Solution

(Exercise 4.24) Introduce a flow variable for each of the ten arcs: xA,H1,xA,H2,xB,H1,xB,H2 from the factories to the hubs, and xHh,Sj from each hub to each store. Supplies give xA,H1 + xA,H2 40 and xB,H1 + xB,H2 60; demands give hxHh,Sj = dj for the three stores. The hub balance constraints are

xA,H1+xB,H1 = xH1,S1+xH1,S2+xH1,S3,xA,H2+xB,H2 = xH2,S1+xH2,S2+xH2,S3.

Total demand ( 100) equals total supply, so both factories ship everything. An optimal plan sends xA,H1 = 30, xA,H2 = 10, xB,H2 = 60, then xH1,S1 = 30, xH2,S2 = 45, xH2,S3 = 25, with minimum total cost

30 2 + 10 4 + 60 1 + 30 4 + 45 3 + 25 2 = 465.

The structure is intuitive: factory B uses its cheap arc to H2, hub H2 serves the stores it reaches cheaply ( S2 and S3), and store S1 is served through H1.

Solution

(Exercise 4.30) For part 1, the assignment team 1 project 1, team 2 project 2, team 3 project 3 has total satisfaction 8 + 8 + 7 = 23; enumerating the six assignments shows this is the unique maximizer. For part 2, the same assignment gives minimum team satisfaction min (8,8,7) = 7. A minimum of 8 is impossible: team 1 scores at least 8 only on project 1, while teams 2 and 3 score at least 8 only on project 2, and both cannot have it. For part 3, the max-min LP achieves z = 7.5, for example with

x = [ 56 0 16 16 34 112 0 14 34 ],

which is doubly stochastic and gives every team an expected satisfaction of exactly 7.5. Fractions help because the max-min objective rewards evening out the teams: splitting projects lets the worst-off team trade some of another team’s surplus for its own shortfall. The total ijSijxij is linear, so in part 1 some optimal corner point is integral and fractions cannot improve it; the added constraints z jSijxij destroy that structure, exactly as in the two-team example of Section 4.2.

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