100% found this document useful (6 votes)
4K views

Inventory Optimization

This document provides an overview of the book "Inventory Optimization: Models and Simulations" by Nicolas Vandeput. The book covers deterministic and stochastic inventory optimization models, including economic order quantity, reorder point, safety stock, and multi-echelon models. It also discusses how to apply these models using tools like Excel and Python. The book is intended to help readers understand inventory modeling and simulations.

Uploaded by

dey.joybroto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (6 votes)
4K views

Inventory Optimization

This document provides an overview of the book "Inventory Optimization: Models and Simulations" by Nicolas Vandeput. The book covers deterministic and stochastic inventory optimization models, including economic order quantity, reorder point, safety stock, and multi-echelon models. It also discusses how to apply these models using tools like Excel and Python. The book is intended to help readers understand inventory modeling and simulations.

Uploaded by

dey.joybroto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 328

Nicolas Vandeput

Inventory Optimization
Nicolas Vandeput
Inventory Optimization

Models and Simulations


ISBN 9783110673913
e-ISBN (PDF) 9783110673944
e-ISBN (EPUB) 9783110673999
Bibliographic information published by the Deutsche
Nationalbibliothek
The Deutsche Nationalbibliothek lists this publication in the
Deutsche Nationalbibliografie; detailed bibliographic data are
available on the Internet at http://dnb.dnb.de.
© 2020 Walter de Gruyter GmbH, Berlin/Boston
Contents
Acknowledgments
About the Author
Foreword
Introduction
Inventory Done Right
Inventory Done Wrong
Impact of Inventory
Inventory Modeling
Models
Simulations
Limitations and Assumptions
Model Accuracy and Sustainability
Book Organization
Inventory Confusion
Other Resources
Tools
Excel
Python
Other Resources

Part I Deterministic Supply Chains


1 Inventory Policies
1.1 Policy #1 – Continuous Review and Reorder Point
1.2 Policy #2 – Periodic Review and Order Up-to Level
1.3 Policy #3 – Periodic Review, Reorder Point and Fixed
Order Quantity
1.4 Other Policies
1.5 Confusion Curse: Inventory Target
1.6 Recap
2 How Much Should I Order?
2.1 Supply Chain Costs
2.2 Model Optimization
2.3 A Brief History of the EOQ Model
2.4 Sensitivity Analysis
2.5 Extensions
2.6 Recap
3 When Should I Order?
3.1 Lead Time
3.2 Review Period
3.3 Confusion Curse: Long Lead Times
3.4 Recap

Part II Stochastic Supply Chains


4 Safety Stocks
4.1 Service Level
4.2 Stochastic Demand
4.3 Demand Variation over Multiple Periods
4.4 Recap
5 Inventory Policies
5.1 Safety Stocks and Inventory Policies
5.2 Inventory Analysis
5.3 Simulation
5.4 Recap
6 Stochastic Lead Times
6.1 Lead Time: What Is It Made of?
6.2 Stochastic Lead Time and Fixed Demand
6.3 Stochastic Lead Time and Demand
6.4 Simulation
6.5 Recap

Part III Advanced Stochastic Models


7 Fill Rate
7.1 Service Level Definition
7.2 Expected Unit Shorts
7.3 Fill Rate Model
7.4 Impact of Order Cycle Length
7.5 Simulation
7.6 Recap
8 Cost and Service Level Optimization
8.1 Profits and Losses
8.2 (R,S) Policy
8.3 (s,Q) Policy
8.4 Simulation
8.5 Recap
9 Beyond Normality
9.1 When Normality Fails
9.2 Skewness
9.3 Gamma Distribution
9.4 Distribution Selection
9.5 Impact on Inventory Policies
9.6 Simulation
9.7 Recap
10 Multi-Echelon Inventory Optimization
10.1 Supply Chain Network Topology
10.2 Local vs. Global Inventory Optimization
10.3 Multi-Echelon Inventory Optimization
10.4 Serial Supply Chains Using GSM
10.5 Simulation
10.6 Distribution Supply Chains Using GSM
10.7 A Brief History of the Guaranteed-Service Model
10.8 Recap

Part IV Discrete Inventory Optimization


11 Newsvendor
11.1 A Question of Chocolate Muffins
11.2 Newsvendor Model
11.3 Newsvendor Model Optimization
11.4 Recap
12 Discrete Probabilistic Demand
12.1 Histograms
12.2 Kernel Density Estimation
12.3 From Gaussian Kernels to Discrete Distributions
12.4 Recap
13 Simulation Optimization
13.1 Safety Stock Optimization
13.2 Complex Policies Optimization
13.3 Stability
13.4 Recap
Now It Is Your Turn!
A Python
How to Install Python
Lists
NumPy
Slicing
Pandas
Slicing DataFrames
Dictionaries
Other Libraries
B Proofs
B.1 Sum of a Random Number of Random Variables
B.2 Normal Loss function
B.3 Loss Function Derivative
B.4 Cost Optimization
B.4.1 (R,S) Policy
B.4.2 (s,Q) Policy
B.5 Discrete Newsvendor Optimization
Bibliography
Glossary
List of Symbols
Statistics
Statistics – Normal distribution
Statistics – Gamma distribution
Inventory Policies
Deterministic Models
Stochastic Models
Multi-echelon Models
Newsvendor
Subject Index

I think that there is only one way to science—or to philosophy, for that matter: to
meet a problem, to see its beauty and fall in love with it; to get married to it, and
to live with it happily, till death do you part—unless you should meet another and
even more fascinating problem, or unless, indeed, you should obtain a solution.
But even if you obtain a solution, you may then discover, to your delight, the
existence of a whole family of enchanting though perhaps difficult problem
children for whose welfare you may work, with a purpose, to the end of your days.
Karl Popper, Realism and the Aim of Science

Acknowledgments
I would like to thank the many friends, practitioners and academics
who have helped me reach the level of excellence I was pursuing
throughout the writing of this book.
First and foremost, I would like to warmly thank my friend
Gwendoline Dandoy for her help. Chapter after chapter, she
carefully hunted down mistakes and inconsistencies, allowing the
content of this book to be clearer, simpler and more consistent.
Thank you, Gwen.
I would like to thank the publishing team at De Gruyter: Jeffrey
Pepper, Jaya Dalal, as well as Mary Sudul for their incredible work,
support and trust.
The help of many experts and practitioners was essential to the
writing of this book. I am particularly grateful to three of them for
their invaluable help, reviews, advice and corrections. Koen
Cobbaert (Director at PwC) for our discussions about backorders,
lost sales and multi-echelon inventory optimization. Stefan de Kok
(Wahupa CEO & Founder) for our discussions about safety stock
and probabilistic forecasts (his book An Introduction to Probabilistic
Planning and Forecasting will be available by the end of 2020). Steven
Pauly (Research Scientist at Slimstock) for our discussions about
various inventory models, the tremendous number of models and
papers he advised me about and his careful review of all the math
included in this book.
I also had the great pleasure of discussing concepts with Professors
Ton de Kok (Eindhoven University of Technology), Stephan Graves
(MIT) and Sean Willems (Haslam Chair in Supply Chain Analytics at
University of Tennessee). Ton de Kok for his help on single-echelon
inventory policies; Stephan Graves and Sean Willems for their help
on multi-echelon inventory policies.
Special thanks goes to the whole Qalinca research unit (Université
Libre de Bruxelles) and in particular Professor Alassane Ndiaye, for
his advice and kind support. I am also grateful to my colleagues:
Alexis Nsamzinshuti, Haingo Rabarijaona, Yasin Tadayonard and
Carole Biloé, and to my previous students Lynda Dhaeyer and Fanny
Marcelis, who all provided me with continuous support and
numerous reviews.
I would also like to extend my sincere thanks to my friends Romain
Faurès, François Grisay and Charles Hoffreumon for their numerous
reviews and invaluable advice. Romain for his dedicated reviews
and spot-on remarks, François for his consultant point of view
(usually shared in cafés and restaurants) and Charles for his
statistician point of view (usually shared in his office at the
university).
A special thanks goes to Joannes Vermorel (Lokad CEO) who has
been a constant source of inspiration to me since we first started
working on Bridgestone inventory optimization models in 2017. You
can see Joannes and myself discussing inventory and forecasting on
YouTube.1 Joannes published his book The Quantitative Supply Chain
in 2018.2
I can also always count on the LinkedIn supply chain community. I
would like to especially thank Niels De Smet (PhD researcher at
Solventure & UGent) for his help on multi-echelon models, Suraj
Vissa, Steve Frampton and Guillaume De Bruycker for their help,
corrections and reviews. The reliability of the supply chain
community on LinkedIn is impressive: no matter the question, there
will always be someone there to help you.
I also had the great pleasure of working with my Bridgestone
colleagues Jon San Andres, Niek Vaessen and Henri-Xavier Benoist.
Year after year, our team managed to consistently deliver new
models by pushing data science in supply chains further.
Last but not least, my friend Nathalie Dufour for her reviews—she
allowed me to make the first part of the book more clear. Finally,
special thanks to my family Veronique and Pierre Vandeput-Dellis,
Caroline and Quentin Vandeput-Mortier as well as my friends Bruno
and Emmeline Deremince-Everaert and Nicolas and Flore Pary-
D’Argent for their support throughout 2019.
Nicolas Vandeput
February 2020
[email protected]
About the Author

Nicolas Vandeput is a supply chain data

scientist specialized in demand forecasting and inventory optimization. He founded his


consultancy company SupChains in 2016 and co-founded SKU Science—a smart online
platform for supply chain management—in 2018. He enjoys discussing new quantitative
models and how to apply them to business reality. Passionate about education, Nicolas is
both an avid learner and enjoys teaching at universities: he has taught forecasting and
inventory optimization to master students since 2014 in Brussels, Belgium. He published
Data Science for Supply Chain Forecasting in 2018 and Inventory Optimization: Models and
Simulations in 2020.

Foreword
What makes a supply chain great? As supply chains are made of
people, a frequent answer is great leadership is what it takes.
Indeed...but great is vague. More specifically, what sort of qualities
and competencies should a company seek to foster among its
supply chain management? The 20th century answer to this
question has primarily been reliable, diligent, energetic if not
charismatic leaders, capable of organizing the work of thousands of
workers, and literally creating the mass production supply chains as
we know them today.
Yet, with the advent of the barcode reader, supply chains had, by
the end of the 20th century, already outgrown the direct capabilities
of the human mind, even the most talented ones. There are too
many SKUs, too many suppliers, too many clients, too many
channels to expect management to sort it all out through sheer
willpower. Instead of directly controlling fine-grained supply chain
decisions, companies transitioned toward indirect management
through software.
In this respect, supply chain management has been lagging behind.
Factories have been heavily automated for over two decades—a few
verticals such as textiles aside. Warehouses are getting there and
will be almost exclusively automated by the end of the 2020s.
Transportation still faces the last mile problem that resists
automation, but within one decade—two at most—autonomous
vehicles will be commonplace and deliver the last major
productivity gains to be ever observed in supply chains. Beyond this
point, blue collar jobs will have almost completely disappeared from
supply chains.
Yet, software-driven supply chain management takes a fairly
distinctive skill set compared to people-driven supply chain
management. Being great at software takes a hacker mindset that
emphasizes tinkering with programs or machines, experimenting
for fun and profit, and treating reverse engineering as much as a
learning opportunity as a way to hack your way into a better
system. This hacker mindset wasn’t part of the recipe for 20th
century leadership, and yet, I firmly believe it will be the
cornerstone of 21st century leadership.
In this book Inventory Optimization: Models and Simulations, Nicolas
Vandeput hacks his way through the maze of quantitative supply
chain optimizations. This book illustrates how the quantitative
optimization of 21st century supply chains should be crafted and
executed. This book is based on many years of experience, earned
the hard way from the supply chain trenches of large companies.
With usually no more than 10 lines of Python, Nicolas Vandeput
revisits classic models and turns mathematical models into
actionable pieces of software. Doing so, Nicolas demystifies the
discourse of (most?) large software vendors in supply chain who—
under the guise of Big Data/AI/Demand Sensing (pick your
buzzword)—end up delivering less than what Nicolas achieves with
highly accessible tools, be it Excel or Python.
Also, after revising the classics, the last five chapters, starting from
“Beyond Normality,” venture into hard problems that do not have
nice, closed-form, analytical solutions. Yet, once again, the book
delivers the hands-on demonstration that even tough problems can
be brute-forced to some extent with histograms, kernels or Monte
Carlo algorithms.
The optimization of the 21st century supply chain will be driven by
hackers. Hackers share insights, but more importantly, they share
code as well. Nicolas Vandeput is at the forefront of a new and
better way of doing supply chains, and thanks to a richly illustrated
book, where every single situation gets its own illustrating code
snippet, so could you.
Joannes Vermorel
March 2020

Introduction
Supply chains are complex.
In the current business landscape of our global economy, supply
chains and businesses are made of international networks of
suppliers and clients. As the competition became fiercer on quality
and price, the pressure increased on supply chain execution. And its
management only grew more complex. The catalog of products
each company is offering is ever expanding—despite their best
efforts to keep it limited. This is mainly due to an increased (global)
competition pressure; and a wave of customization and product
innovation that started during the second half of the 20th century.
As businesses are dealing with more products, the average life-cycle
is becoming shorter and the demand variability is increasing. On
top of this, international supply chains result in longer lead times,
imposing more constraints on operational planning.
The complexity of supply chains is also due to all the humans—us!
—interacting with each other over long distances, with different
tools, capabilities and information. More importantly, even if
business leaders strive to align their teams, each actor is pursuing
its own objectives often resulting in divergent actions.
For better or for worse, inventories lie at the bottom of these
complex supply chains. The central question of how much
inventory is needed, and where it is needed, is often an endless
debate among colleagues. Especially when the game of politics
drives decisions.

Inventory Done Right


Stocking products is helping companies around the globe to supply
their clients on time and provides a buffer against any unforeseen
event (we’ll discuss this in the second part of the book). Since
holding inventory disconnects the production process from the
sales process, it allows planners to produce longer production
batches decreasing the production costs (we’ll discuss this in
Chapter →2). In other words, inventory optimization done right
reduces overall costs, while optimizing the service level.

Inventory Done Wrong


Nevertheless, holding inventory comes with two drawbacks. The
first one is of course its cost: inventory is nothing more than
sleeping cash that is depreciating over time. It costs money to store
products, and it comes with risks. The more you keep, the higher
the cost, and the riskier it gets. Will you really be able to sell all
these products? There is always the risk of ending up with dead
stock. Keeping less inventory might partially prevent the risk of
dead stock, but won’t help to provide adequate service levels to
your clients. Actually, in some cases, inventory management is so
flawed that supply chains face both low service levels and dead
stock.
Too much inventory will also prevent companies from
improving their processes because they don’t see any of the
process fluctuation anymore. Too much protection against
unforeseen events won’t incentivize the different process-owners to
improve.

Impact of Inventory
Based on the 30th Annual Council of Supply Chain Management
Professionals State of Logistics Report,1 inventory yearly costs
accounted for around $500 billion in the US in 2018 (around 2% of
US GDP). These are more or less equally spread between financial
costs, storage costs and other costs (like obsolescence, handling,
insurance). We will discuss holding costs in detail in Chapter →2.
As shown in →Figure 1, the →U.S. Census Bureau (→2019) reports
that the amount of inventory for manufacturers, wholesalers and
retailers has been rather flat for the last four years at around 1.4
months of sales (their all-time low was in 2010, with inventory levels
10 to 15% lower).

Figure 1 Seasonally Adjusted Inventories/Sales. Source: →U.S.


Census Bureau (→2019).

Inventory is here to stay. We should therefore be serious about


optimization—avoiding the trap of bad service levels and dead
stock, and reaping the benefits of a properly orchestrated inventory
policy. In this book you will see how to optimize your own inventory
policies based on various tools and models.

Inventory Modeling
All models are wrong, but some are helpful.
George Box (1919–2013)

As the amount of inventory grows, so does the need for


optimization. Unfortunately, the science of optimizing inventories—
keeping the right amount of inventory—can become as complex as
the different modern supply chains. Even if an inventory policy
seems simple—“Buy 4 when you have 5 left”—the models behind
these can easily become massively complex. In order to solve these
policies we have two methods at our disposal: mathematical
models (i. e., equations) and simulations.

Models
Since the first inventory optimization model was published in 1913
by Harris, academics have published an ever-growing list of
mathematical models to optimize how much inventory should a
supply chain hold, and where it should be stored. Each new set of
equations would tackle a supply chain under another set of
assumptions. A model would discuss supply chains with perishable
products; another one with multiple warehouses; or with a specific
seasonality and production constraints; and so on. Unfortunately,
even the cutting-edge models won’t be enough to perfectly describe
a supply chain.2 As explained by Ton de Kok—professor at the
Eindhoven University of Technology—“Inventory models are
abstractions that cannot capture all possible actions to balance supply
and demand.” We are only at the beginning of our journey of
inventory optimization and yet we already know that perfection is
out of reach. And most likely will be forever.

Simulations
An equation can’t handle the complexity of a modern supply chain,
but we can nevertheless try to simulate it. Simulations can either be
used to test the outcome of a mathematical model; or they can be
used to find a good-enough policy when no equations are up to the
challenge. In the final part of the book, you will learn to use
simulations to optimize inventory policies. Simulations will allow
you to cope with much more complexity than equations, but this
will come at a cost: longer computation times and variable results.
We will discuss in Chapter →13 how to overcome these limitations.
Limitations and Assumptions
Throughout the book we will pay careful attention to the
assumptions (read limitations) behind the models (and simulations)
we use. We won’t be able to create perfect simulations or models,
but as we understand their weaknesses, we will be able to assess
when it is right to use them (and when we should go for another
model).

Model Accuracy and Sustainability


Does it make sense then to continue on this path of optimizing
inventory policies despite the impossibility to be absolutely correct?
Yes. Being correct 95% of the time should be enough to bring
substantial savings to any supply chain.3
In this book, we will discuss models that deal with enough
complexity to properly understand what drives supply chain
inventory levels, costs and profits. We will also discuss the
assumptions we make, and how we can refine them with some
hacks and fit them to reality, while keeping them practical. As
supply chain scientists, we have to make trade-offs for our models
between complexity and accuracy on one side, and simplicity and
practicality on the other. As Jordan Ellenberg explained in his book
How Not to Be Wrong: The Power of Mathematical Thinking: “If the
universe hands you a hard problem, try to solve an easier one instead,
and hope the simple version is close enough to the original problem
that the universe doesn’t object.”4 This is exactly what we will do. A
complex model will most likely be more accurate resulting in fewer
costs and more profits; but less understandable and usable for
different users. A simple model, on the other hand, will be less
accurate, resulting in higher costs and waste; but might be more
usable and sustainable for a business process. At some point, it is
better for a model to be 80% accurate but trusted and always used;
rather than be 95% accurate and never used nor well understood.
There is a Latin saying, “Vires acquirit eundo,” which means,
“We gather strength as we go.” This represents perfectly the path
we will follow in this book: as shown in →Figure 2, we will start with
a simple model and, as we apply it, we will learn new things. These
will allow us to build a stronger model. And so on. We will gather
insights and intuitions about supply chains as we go.

Figure 2 Inventory optimization journey.


Book Organization
The book is divided into four parts:
I →Deterministic Supply Chains where our journey
starts by discussing common inventory policies
(Chapter →1) and then creating the first simple
deterministic model (Chapters →2 and →3). This
part will be mostly theoretical, but will lay the
necessary ground for the next parts.
II →Stochastic Supply Chains where you will create
your first stochastic model:5 first based on
stochastic demand only (Chapters →4 and →5),
then all together with stochastic lead times
(Chapter →6). You will code in Chapter →5 your
first inventory simulation. Going forward, it will help
you to assess the accuracy of each of your models.
III →Advanced Stochastic Models where you will refine
the stochastic model from part →II. We will first
discuss the expected backorders and fill rate
(Chapter →7). Then you will learn to minimize the
cost of your inventory policies in Chapter →8, and
create policies for non-normal demand (Chapter
→9). These three chapters are the most technical of
the book, nevertheless they should help you to
optimize and refine your inventory policies beyond
what is usually done in the industry. Finally, you will
answer the question “where should we locate
inventory” as you will create a model to optimize a
multi-echelon inventory policy6 (Chapter →10).
IV →Discrete Inventory Optimization where you will
learn to use simulations to optimize inventory
policies. We discuss first a simple newsvendor
model (Chapter →11), then we model custom
demand probability distributions (Chapter →12) to
finally optimize inventory policies with regard to
simulations (Chapter →13).
Of course, inventory modeling is not an end. The real goal is to
analyze your supply chain, optimize your inventory policy, minimize
your costs and maximize your profits. We will often discuss the
business implications of the various models, shifting from a
scientific mindset to a business one.

Inventory Confusion
Throughout the book we will also discuss major sources of
confusion and sub-optimalities in inventory policies.
Vocabulary and definitions First and foremost, inventory
management suffers from major confusion due to
its terminology: “safety stock,” “reorder point,”
“stock target,” “expected inventory”... These might
all refer to different concepts depending on the
software vendor, consultant or colleague you are
talking to. We will take the time to define each of
these in Parts →I and →II.
Long lead times As the lead times get longer, the spread
between the order up-to level of an inventory policy
and the expected average inventory gets bigger.
We will discuss these in Chapters →3 and →5.
Review period Often practitioners forget to include the review
period of their policies into the computation of
safety stock targets (and only look at the lead time).
You will see how to include the review period in
Chapter →5.
Fill rate vs. Cycle service level A major confusion for
practitioners is how to measure the service level of
an inventory policy. Most of the safety stock models
use the cycle service level whereas most companies
record the fill rate. We will define both in Chapter
→4 and learn to fit our inventory policies to a fill
rate target in Chapter →7.
Optimal service level Finally, the service level targets are often
set as arbitrary numbers. You will see in Chapter
→8 how to set the optimal service level that will
minimize your costs.

Other Resources
In order to help you with the various concepts presented in this
book, there is a glossary and a list of symbols at the end of the
book. Please note that throughout the book you will see that
boldface is used to highlight important text for emphasis.
We will discuss many models, and refer whenever possible to their
initial authors as well as current research and helpful resources.
You can also check the following general resources about inventory
and supply chains:
Inventory and Production Management in Supply Chains by
Edward Silver, David Pyke and Douglas Thomas.7 The authors
are well-known professors in the field of inventory
management and operation management; their book is most
likely one of the main reference for PhD students as it
includes a thorough literature review and covers many topics
in-depth.
Matching Supply with Demand: An Introduction to Operations
Management by Gérard Cachon and Christian Terwiesch.8 The
book offers an introduction to many supply chain subjects: it
is great as a textbook for students.
Inventory Control by Sven Axsäter.9 This (mathematical)
reference book covers in detail various inventory models
(mainly continuous ones).
Next to these reference books, you can also check the shorter
Inventory Management in Supply Chain Networks from Horst
Tempelmeier.10 It also focuses on mathematical models.
You can also register to the excellent online class Supply Chain
Fundamentals proposed by MIT on the online platform edX.11
It covers various inventory optimization models as well as
forecast models.
MIT also offers the online class “Supply Chains for
Manufacturing I” on edX.12 This class covers inventory and
forecast models and is given by Stephen Graves and Sean
Willems—known for their research work in the field of
inventory optimization (we will discuss their models in
Chapter →10).

Tools
As a painter needs the proper brush, the inventory analyst needs
the proper tools to create her or his model. We will use two tools to
build our models, experiment and share our results.

Excel
Excel is the data analyst’s Swiss knife. It will allow you to easily
perform simple calculations and plot data. The big advantage of
Excel, compared to any programming language, is that you can see
the data. It is much easier to debug a model or to test a new one if
you see how the data is transformed by each step of computation.
Therefore, Excel can be a first go-to to experiment with new models
or data.
Excel also has many limitations. It won’t perform well on big
datasets and will hardly allow us to automate difficult tasks. It is
therefore a good tool to test ideas and models on small datasets, or
to visualize data, but it is not our preferred tool to create complex
or massive models.
Python
Python is a programming language initially published in 1991 by
Guido van Rossum, a Dutch computer scientist. If Excel is a Swiss
knife, Python is a full army of construction machines awaiting
instructions from an analyst. Python will allow you to perform
computations on huge datasets in an automated, fast and simple
way. It also comes with many libraries dedicated to data analysis
(pandas), data visualization (Seaborn and Matplotlib), scientific
computations (NumPy and SciPy) and machine learning (scikit-
learn). These will soon be your best friends, if they aren’t already.

Why Python?
We chose Python over other programming languages because it is
both user-friendly (it is easy to read and understand) and one of the
most used programming languages in the world. In 2019, it was the
programming language that was the most googled and it is the
most commonly used for machine learning and deep learning.

Should You Start Learning Python?


Yes, you should.
Excel will be perfect to visualize results, perform some simple
computations and simple data cleaning tasks. But it won’t allow you
to scale up your models to bigger datasets nor to easily automate
any data cleaning. Excel will also make your life difficult if you want
to define customized statistical functions, such as those we will
need in the second half of the book.
Many practitioners are afraid to learn a coding language.
Everyone knows a colleague who uses some macros/VBA in Excel—
maybe you are this colleague—and the complexity of these macros
might be frightening to the uninitiated. Python is much simpler
than Excel macros and much more powerful. As you will see
yourself in the following chapters, even the most advanced models
won’t require so many lines of code or complex functions. It means
that you do not have to be an IT genius to use Python. You can
start to use it yourself, today, on your own computer, for free.
Python will give you a definitive edge over anyone using Excel.
Today is a great day to start learning Python. Many resources are
available: videos, blogs, articles, books... You can, for example, look
for Python courses on the following online platforms:
→www.edx.org
→www.coursera.org
→www.udemy.com
→www.datacamp.com
I personally recommend the MIT class:
→“IntroductiontoComputerScienceandProgrammingUsingPython,”
available on edX.13 This will teach you everything you need to know
about Python to start using the models presented in this book.
You can also look at the Appendix →A, where I briefly introduce
the most useful Python concepts (and how to install it) in order to
help you out with the first code extracts.

Python Libraries

We will use throughout the book some of Python’s very well-known


libraries. As you can see below, we will use their usual import
conventions. And, for the sake of clarity, we won’t show the import
lines over and over in each code extract.
Simplicity vs. Efficiency
The various Python code extracts throughout the book are made
with the objective of simplicity and clarity. Simple code is much
easier to understand, maintain, share and improve than complex
one. This simplification was sometimes done at the expense of
efficiency or speed. This means that the codes are not as fast as an
experienced Python user could produce, but the implementations
are easy to understand—which is the primary goal here.

Perfection is finally attained not when there is no longer anything to add, but
when there is no longer anything to take away.
Antoine de Saint-Exupéry (1900–1944)

Other Resources
You can download the Python codes shown in this book on
→supchains.com/resources-invopt (password: SupChains-IO).
There is also a glossary (and an index) at the end of the book where
you can find a short description of all the specific terms we will use.
Do not hesitate to consult it if you are unsure about a term or
acronym.
Part I Deterministic Supply Chains
1 Inventory Policies
An inventory policy determines how much and when a product should be
ordered (or produced).1 Inventory policies determine how the products flow
through a supply chain. We can categorize them into two types, based on
when the inventory review is done:
Continuous review policies: an order can be made at any time.
Periodic review policies: the orders can only be made at specific times.
Let’s discuss in detail three of the main inventory policies used in practice.

1.1 Policy #1 – Continuous Review and Reorder Point


In this first inventory policy, we order our products based on a fixed
threshold: as soon as the net inventory reaches the threshold (or goes
below), we order a predetermined number of units from our supplier (or
launch a production batch). This threshold is called the reorder point or
ROP.
With a continuous review policy, the elapsed time between two consecutive
orders will vary (as the demand fluctuates), but the order quantity will
always be the same (as you can see in →Figure 1.1).

Figure 1.1 Fixed reorder point policy (with immediate replenishment):


“Order 10 when less than 3 left.”

Typically, with such a policy, you could say that:


When the stock level reaches 3 pieces, I order 10.
Here the fixed reorder point is 3, and the order quantity is 10 (see
→Figure 1.1). Note that, even if you only have 2 pieces in stock, you will
still only order 10 pieces. Remember: with the fixed reorder point, the
order quantity (10 in this case) is always fixed.
As soon as I am left with 2 bottles of milk in my refrigerator, I’ll go to the
supermarket and buy 6.
When my printer says that I am left with only 10% of ink, I’ll order a new set
of cartridges.

Advantages
This policy is safe (i. e., the risk of being out-of-stock is low) as it assumes you
can make an order whenever you need to. It is therefore a good policy for
expensive and/or important items that need to be monitored closely.
Another important advantage of this policy is that you can optimize the
order quantity based on some (often obvious) constraints or costs. For
example, you might get a rebate if you order a full pallet or a truckload. With
such a policy you are sure to get the reduction each time you make an order.

Limitations
First, it won’t allow you to group into a single order different items with
a single supplier. Imagine that you supply a hundred different products
from a single-favorite supplier: you might want to simplify your operations
and buy all these products at once (in one single order) instead of doing
different orders multiple times a day, when each one of your items needs to
be replenished.
Then, we assume that a client can make an order with its supplier at
any time. In reality, this might not be the case. For example, a supplier
might only accept orders once a month (or only send one shipment a month
—which is the same). In such a case, it is foolish to think that you would
follow a fixed reorder point policy, as the supplier is actually following its
own calendar.
Finally, the pure theoretical mathematical model of this policy (that we
will discuss in the following chapters) assumes that each client can only
buy one product at a time, so that the reorder point will always be perfectly
reached.
In practice, these assumptions are not often respected. A pure
continuous policy is therefore exceptional (some fully automated production
processes, or internal processes, could follow these assumptions). It is
therefore used as a (useful) theoretical simplification.

Notation
The fixed reorder point policy is noted (s, Q) , with s the reorder point and Q
the fixed order quantity.

1.2 Policy #2 – Periodic Review and Order Up-to Level


For this second inventory policy, we will order products periodically, based
on a fixed schedule and on an up-to level. At the beginning of any review
period, we will order enough products to bring our net inventory to the up-
to level. As you can see in →Figure 1.2, with this fixed periodic schedule, we
will order a different quantity each time. The order quantity depends on how
much inventory we have at the time we make the order, and is therefore
variable. On the other hand, the orders are made following a fixed schedule:
the elapsed time between two consecutive orders will always be the same
(but the order quantity will always change).

Figure 1.2 Fixed review period policy (with immediate replenishment):


“Order up to 13 every 5 days.”

Here are some typical examples:


We make an order every Friday evening to our supplier, so that they can
prepare our order on Monday morning and deliver it on Tuesday.
We make an order every third business day of the month with our supplier
in China.
I go to the supermarket every Saturday morning. I buy enough bottles of
milk in order to have a total stock of 6 liters.

Advantages
This periodic replenishment policy (with an order up-to level) is actually the
most common inventory policy because it allows businesses to group their
orders with each of their suppliers. This will help both clients and suppliers
to streamline their operations as they can plan orders and workload in
advance, and define a periodic review process.
A periodic replenishment policy is also often forced onto supply chains
by the use of a MRP/DRP.2 These tools follow a predefined schedule—often
daily or weekly—resulting in the implicit use of a periodic review policy.

Limitations
As we will discuss later in Chapter 4, “Safety Stocks,” this policy is riskier, due
to the blind spot it creates: you cannot order in-between two review periods.
If you make an order every Friday with your supplier, but are out-of-stock on
Monday evening, you will have to wait four more days before making a new
order. You will possibly suffer lost sales due to being out-of-stock in the
meantime. That is riskier than the fixed reorder point policy, where you
would have made a new order directly on Monday evening.
Another issue is that the order quantity will vary at each order. This
might disrupt a smooth operational flow. If you have a palletized product,
you might not want to remove the packaging around an entire pallet in
order to get a single unit.

Notation
The fixed review period policy is often noted (R, S) , with R being the fixed
review period and S the up-to level. Don’t get confused by the notation:
academics usually use s to denote the reorder point and S to denote the
order up-to level. As a mnemonic device, lowercase s denotes a minimum
amount of stock, and uppercase S a maximum.
1.3 Policy #3 – Periodic Review, Reorder Point and Fixed Order
Quantity
We just discussed a first inventory policy that offered us the convenience of a
fixed order quantity, and a second that gave us the convenience of a fixed
review period. We can then create an inventory policy combining the best of
both worlds in terms of operational convenience. This policy will consist of
making orders of fixed quantity Q, based on a fixed schedule, if the inventory
level reaches a threshold s (see →Figure 1.3).

Figure 1.3 Period review with reorder point and fixed order quantity: “Order
10 pieces every 4 days only if inventory level reaches 5 pieces.”

Here are some examples:


Every Saturday, if I have less than 2 bottles of milk in my refrigerator, I go
to the supermarket to buy 6 bottles of milk.
Every Friday evening, if our net inventory reaches 10 units (or below), we
make an order of 10 pieces to our supplier (we order 10 pieces due to the
packaging). We place the order on Friday, so that the supplier can prepare
the order on Monday morning and deliver it on Tuesday.
Advantages
This policy has two strong advantages:
The order quantity is always constant, allowing transportation and
packaging to be optimized (e. g., full pallet, full truckload).
The order is always made at a predefined time slot (e. g., at the end of
the day/week), allowing smooth operations and the ability to group
orders with a supplier.

Limitations
The risk is high with this kind of policy: we have a review period possibly
blocking us from making an order when we need it; on top of that, we will
only make an order if the stock reaches a certain threshold. This extra risk
will need to be compensated for by an extra amount of safety stock,
resulting in higher inventory levels and costs. Besides, this policy is also
much more difficult to optimize mathematically, and therefore less discussed
in the academic literature.3 As the models become too complex (and based
on too many assumptions), we will optimize this policy with simulations in
Chapter →13.

Notation
We will note this policy (R, s, Q) , where R denotes the fixed review period, s
the fixed reorder point, and Q the fixed order quantity. This policy is also
sometimes noted (R, s, n ⋅ Q) if we can order a multiple of Q units at once
(typically in the case of truckload or packaging constraints).

1.4 Other Policies


Of course, a supply chain can be piloted with other policies.

(R,s,S) Policy
We can imagine an (R, s, S) policy, where the inventory is reviewed
periodically and, if the inventory level reaches a threshold s, an order is
placed up-to a certain level S. Again, such policies are more difficult to
optimize mathematically—yet analyzed since at least the 1960s—and are,
therefore, out of scope for this book.4

Multi-Sourcing
We can also create even more complex policies. For example, in order to
reduce the supply risk, it is rather common for a supply chain to have an
emergency supply lane in addition to a regular supply lane with a preferred
supplier. As the behavior of these policies become more complex, it will
become impossible to solve them perfectly based on tractable5 models.
That, of course, is not a reason not to use them. The question should be:
how can we approximate these policies in order to get a useful and
understandable model? Even if we cannot create such a model, we have
another tool to optimize these: running simulations. We will discuss this
technique in Chapter →13, “→Simulation Optimization.”

1.5 Confusion Curse: Inventory Target


Pay attention to the fact that supply chain practitioners—and software
vendors—often use different terms to refer to the same policies. For
example the term “reorder point” (or ROP) could define an order up-to level
or a replenishment threshold. This means that a periodic review policy could
be called an ROP policy as you set a “reorder point” (which is actually
nothing more than the up-to level).
The term “stock target” is actually the most confusing. When a
practitioner refers to a “stock target of 10,” it is never clear what she refers
to. Is it an order up-to target in a periodic review policy? Or the reorder point
in a fixed reorder point policy? Or the average on-hand inventory they
expect to have? We will discuss this confusion curse further in Chapter →3,
“→When Should I Order?” and Chapter 4, “Safety Stocks.”

1.6 Recap
An inventory policy defines when an order needs to be made and how
many units should be ordered. We can categorize them between continuous
and periodic review inventory policies. A policy can be defined by different
parameters:
the order up-to level S
the review period R
the order quantity Q
the reorder point s
We analyzed three policies:
(s, Q) A continuous review policy with a reorder point s and a fixed
order quantity Q.
+ Pros: low amount of safety stock needed;
optimized order quantity.
- Cons: continuous review needed; multiple
items cannot be grouped in one order with
one supplier.
See Section →1.1.
(R, S) A periodic review policy following a review period R and an
order up-to level S.
+ Pros: multiple items can be grouped in one
order with one supplier.
- Cons: more safety stock needed; order
quantity varies and can’t be optimized.
See Section →1.2.
(R, s, Q) A periodic review policy following a review period R, with a
reorder point s and a fixed order quantity Q.
+ Pros: can group multiple items in one order
with one supplier; optimized order quantity.
- Cons: even more safety stock needed;
optimization is difficult.
See Section →1.3.
2 How Much Should I Order?
The policies discussed in Chapter →1 come with questions:
Fixed reorder point: What is the optimal order quantity? What is the best
reorder point?
We begin the discussion about these subjects in Chapter →2.
Periodic replenishment and order up-to level: What should be the up-to
level? What is the optimal review period?
We will discuss these in Chapter →3.
In order to answer these questions, we will follow the Model-Optimize-Apply-
Learn framework shown in →Figure 2.1. We will first model the costs of our
supply chain, based on the order quantity. Then we will optimize this model
(i. e., find the optimal order quantity that minimizes costs) in order to find
the optimal order quantity. We can finally apply this optimal order quantity
in a supply chain to update its inventory policies.

Figure 2.1 Inventory optimization journey.


2.1 Supply Chain Costs
Let’s begin our first model with a simple supply chain in a deterministic
world.
As shown in →Figure 2.2, let’s imagine, a supply chain with:
A single stocking site.
A single supplier.
A single product that is reordered from the supplier instantaneously
when the stock drops to zero (i. e., the lead time is 0).
A deterministic, constant demand: we note the yearly demand D and
the demand per period d.
A fixed order quantity Q.
The attentive reader will notice that here we have a supply chain system that
works thanks to a fixed reorder point policy (reorder point of 0 and a fixed
order quantity of Q).

Figure 2.2 Supply chain model.

We will add new layers of complexity down the road:


In Chapter →3, we will increase the lead time and discuss periodic
review.
In Chapter 4, we will use safety stock as a buffer against stochastic
demand.
In Chapter →6, we will discuss stochastic lead times.
Let’s analyze the inventory level over time in our simple supply chain. The
stock level of our unique product in our single location will follow a pattern
similar to the one we can see in →Figure 2.3.
Figure 2.3 Simple inventory policy.

In this supply chain, the maximum inventory level we can have is Q and the
lowest is 0. Because the demand is constant, the inventory will decrease
uniformly from its maximum Q to its minimum 0: this means that we will
have in stock Q/2 pieces on average. This is very interesting as, in other
words, once the order quantity Q is set, the average inventory level is
independent from the demand or the number of transactions per year. We
will call this stock the cycle stock.

In such a simple supply chain we will have two types of costs:


Holding costs related to storing (or simply possessing) our products.
Transaction costs triggered by making an order (or a transaction) with our
supplier (either internal or external).
Let’s discuss these two costs in detail.

2.1.1 Holding Costs


These costs—incurred as we store or possess products—can be either
variable (the more inventory, the more expensive) or fixed (constant no
matter how much is stored). Here are some examples:
Variable holding costs —products’ cost of capital, products’ insurance,
obsolescence, damages, losses, theft, spoilage (mostly for
perishable goods), inventory control (i. e., periodically
counting inventory).
Fixed holding costs —employees, warehouse insurance, warehouse cost
of capital (or rent), warehouse security, warehouse lighting
and heating, storage equipment (e. g., shelving, IT systems).
In order to simplify our model, and because the fixed holding costs are
independent of the order quantity Q (i. e., we incur them no matter how
much inventory we have in stock), we will take them out of the equation.
Let’s define h as the yearly holding costs for keeping one single piece in
stock. As we have Q/2 units in stock on average through the year, we can
multiply the two to get the total yearly holding costs.
Q
(Yearly) Holding Costs= h
2

= holding cost per unit × average cycle stock


In this equation, h is expressed as a cost per year per unit ( unit⋅year
) . In the
literature h is typically expressed as a percentage of the cost ( 1
unit⋅year
) .1
The holding costs equation becomes
Q
Holding Costs = (h ⋅ c)
2

where c is the product unit (or production) cost.2

What is important to understand here is that the holding costs are


proportional to the order quantity Q (as you can see in →Figure 2.4).
Figure 2.4 Yearly holding costs.
2.1.2 Transaction Costs
The transaction costs are all the costs incurred when we order a new batch
of products. The order can either be made with an external supplier or
trigger a production batch (in which case the production department can be
seen as an internal supplier). As we did for the holding costs, we can split the
transaction costs between variable and fixed. Let’s take a look at some
examples.
Variable transaction costs Supplier side: transport, packaging
Client side: reception, inspection, unloading and storing
Fixed transaction costs Supplier side: fixed (administration) fee, change-
over/set-up time
Client side: working time (stock analysis, buying process,
negotiations)
Naturally some of these costs might be partially fixed or fixed up to a certain
point. For example, the transportation cost of a transaction could be
considered as fixed as long as it is not more than a full truckload.

Change-over Time

In a production environment, the time it takes to do a change-over/set-up (i.


e., the time it takes to switch production from one product to another) will
often be the most important transaction cost we will face. Long change-over
times can be due to many factors: need to cool down or clean a machine,
need to move parts around, wasted time because of bad organization, etc.
This change-over time has been the enemy of lean practitioners for a long
time and they have developed many tools to reduce it.3 As we will see later, if
you reduce the fixed transaction costs, you can reduce the optimal order
quantity, which will result in less inventory. Lean practitioners know this very
well.

Number of Yearly Transactions

Let’s assume that we have a yearly demand of D pieces. During the year, one
way or another, we will have to order these pieces from our supplier. If we
assume that we will always order a fixed quantity of Q pieces with the
supplier (same assumption as for the holding costs above), we know that we
will have to do D/Q transactions throughout the year to cover the demand.
The yearly number of transactions we will have to make with our supplier is
inversely proportional to the order quantity Q. The more you order at once,
the fewer transactions you will need.
Let’s define k as the fixed cost of a single transaction and c as the
T

variable transaction costs. The total yearly transaction costs will be equal
to the fixed cost k multiplied by the number of transactions per year ( D/Q ),
plus the variable costs c multiplied by the total yearly demand D.
T

(Yearly) Transaction costs= Fixed costs + Variable costs

D
= k + cT D
Q

Holding costs are proportional to the order quantity, but fixed transaction
costs are inversely proportional to the order quantity (as shown in
→Figure 2.5). The intuition is: as you order more at once (Q is big), you will
need to do fewer transactions with your supplier (or fewer different
production batches), resulting in fewer transaction costs.
Figure 2.5 Yearly transaction costs.

2.1.3 Lost Sales and Backorders


For any product a business sells, being out-of-stock will result in, at best,
backorders (frustrating the client), or, at worst, lost sales if the client doesn’t
maintain its order and decides to go to the competition.
Unfortunately, it is difficult (if not impossible) to evaluate the cost of lost
sales and backorders, because of different factors:
Short term you do not know if the client will go to the competition or will
just wait and come back later. This means that you do not
know if you lost the sale or not. Your client could also decide
to buy a similar product available in your inventory, and it
could even be a more expensive item resulting in more profit
for you.
Long term your brand image could be impacted and some of your
clients may never come back. They could even spread the
word and damage your reputation.
Moreover, it is hard for some companies to estimate the exact profit per
product sold. Some companies do not even want to know the exact profit per
product sold, as they fear it could be negative. We will discuss the impact of
backorders on deterministic models in Section →2.5.2 and its impact on
stochastic models in Chapters →8 and →11 when we will discuss costs and
service level optimization.

2.2 Model Optimization

2.2.1 Supply Chain Costs


If we sum up the transaction and holding costs, we obtain this model of the
supply chain costs:4
Total Costs= Holding Costs + Transaction Costs

Q D
C (Q)= h + k + cT D
2 Q

Where 𝓒(Q) denotes the total (holding and transaction) costs based on Q.
We observe that:

Only the variable holding costs ( h ) and the fixed transaction costs (
Q

k
D
Q
) depend on the order quantity Q.
The variable transaction costs ( c D ) only depend on the total demand
T

D. No matter the order quantity, the total variable transaction costs will
be the variable transaction cost per unit multiplied by the yearly
number of units sold.
Since we are interested in minimizing the supply chain costs based on the
order quantity, we can simplify our model by only keeping what is relevant
for us. In our current model, we can remove everything that is not
dependent on the order quantity. The costs are then expressed as:
Q D (2.1)
𝓒(Q)=h + k
2 Q

→Figure 2.6 shows how transaction and holding costs behave based on Q.
We are interested in the order quantity that minimizes the total costs.
We note the optimal order quantity Q or EOQ (for Economical Order

Quantity as it is historically called). We observe visually that Q is achieved


when the holding and transaction costs are equal.

Figure 2.6 Supply chain costs.

2.2.2 Order Quantity Optimization


Now that we have an equation that models the cost of our supply chain, we
can look for the optimal order quantity Q that minimizes the costs. To do

this we will compute the derivative of the total costs by Q and set it to zero.
∂C (Q)

= 0 ⇔ Q = Q
∂Q

Q D
∂C (Q) ∂(h + k )
2 Q
=
∂Q ∂Q

h D
= − k
2
2 Q

We have to set this derivative to 0 to find the optimal Q value.5 ∗

h D (2.2)
− k = 0
∗2
2 Q


2kD
Q = √
h

This expression of Q is a very interesting first result as we see that the


optimal order quantity is proportional to the fixed transaction costs and


inversely proportional to the holding costs.
This makes sense:
If you have high fixed transaction costs, you want to do fewer
transactions to avoid paying these fees. To do so, you will increase the
order quantity. This will result in a higher inventory level.
If you have high holding costs per unit, you do not want to stock too
much. To do so, you will reduce your order quantity but order more
frequently.

2.2.3 Cost Optimization


Based on the Q expression (eq. →2.2 in Section →2.2.2), we can compute

the minimal cost C by replacing Q in the total costs equation (eq. →2.1 in

Section →2.2.1).


Q D
C = h + k

2 Q

2kD

h D
= h + k
2 2kD

h

After some simplification, we obtain:


∗ (2.3)
𝓒 = √ 2kDh

The expression of C is also interesting as we see that the optimal cost is


proportional to the square root of the holding costs per unit and fixed
transaction costs. This means that in order to reduce the inventory costs, it is
of equal importance to reduce the fixed transaction costs as well as the
yearly variable holding costs per unit. Of course, this relationship only
applies based on the assumption of our simple model, specifically that there
is no demand variation and therefore no safety stock.

2.2.4 A Question of Balance


We also observe that if we use Q in our supply chain, the total yearly

holding costs will be equal to the yearly transaction costs (see →Figure 2.6).

2kD
∗ √
Q h √ 2kDh
Holding costs = h = h =
2 2 2

D D √ 2kDh
Transaction Costs = k = k =

Q 2kD 2

h

Both the total holding and transaction costs will be . As shown in


√ 2kDh

→Figure 2.7, this confirms that, at the optimal order quantity, the
transaction and the holding costs are equal.
Figure 2.7 At the optimal order quantity, the transaction and the holding
costs are equal.

There is actually a feedback loop between the transaction costs and the
holding costs. An increase (or decrease) in either one of them will change
the optimal order quantity so that both costs will be equal again: one will
partially compensate the other’s increase (or decrease).
For example, if your supplier increases the fixed transaction costs, the
model would advise you to increase your order quantity in order to
compensate for this with a reduced number of transactions. This will result
in more inventory (as the order quantity is higher) and therefore in higher
inventory costs. In other words, if your supplier charges you more per order,
you will want to order more at once to do fewer orders and, in the end, this
increase of the transaction costs will impact your total holding costs as well.
Let’s imagine that you managed to decrease the holding costs per unit—
for example, thanks to a cheaper warehouse. The model will advise you to
increase your order quantity so that you will do fewer transactions per year
and thus keep more inventory. In other words, if you find a cheaper
warehouse, you will want to use your new cheap asset to reduce your costs
by placing bigger orders with your supplier to reduce the number of orders
(but resulting in a higher inventory).
To sum up, based on our (simple deterministic) model, at the optimum,
the total holding costs and the total transaction costs will always be equal.
2.2.5 Forecast or Historical Demand?
In the EOQ formula (eq. →2.2 in Section →2.2.2), we used the historical
demand D. Actually, you can decide to use instead a (demand) forecast
rather than historical numbers. That way, if a trend is observed (or is
projected based on external insights), it can be used to improve the setting
of the optimal order quantity. We then have


2kF
Q = √
h

where F is the forecast (aligned with the periodicity of the holding costs h).

2.3 A Brief History of the EOQ Model


Ford Whitman Harris (1877–1962), an American engineer, published in 1913
his article “How many parts to make at once,” which introduced the idea of
optimal order quantity. His initial article was followed-up by a second one,
“How much stock to keep on-hand” that was published the same year.6 Harris
already explained a century ago that his model shouldn’t be used as a silver
bullet to model any complex supply chain but rather to be used as a practical
tool.
Unfortunately, the story of Harris and his paternity of the EOQ model
was forgotten. It was only in 1988 (75 years later!) that Donald Erlenkotter
rediscovered it.7 As Erlenkotter explained, even Ford Harris’ grandson, who
used the EOQ model from the 1960s until the 1980s in the US Air Force,
where he was a supply officer, didn’t know his grandfather was behind this
model.
The EOQ model is in fact often referred to as the “Wilson model” based
on R. H. Wilson’s work. Wilson was a consultant who used the EOQ model in
the first part of the 20th century. He published in 1934 an in-depth analysis
of the model in his article: “A Scientific Routine for Stock Control.”8
Over the years, many extensions to the EOQ model have been
published.9 Here are the main ones: in 1918, Taft analyzed the optimal
production quantity;10 in 1963, the first model to include a discount based on
the order quantity was published by Hadley and Whitin;11 in the 1980s and
1990s, models with backorders were solved, namely by Grubbstrom and
Erdem who proposed a model in 1999;12 in 1995, Trietsch13 optimized the
order quantity with regard to the ROI instead of the usual cost minimization.

2.4 Sensitivity Analysis


Now that we have a model to optimize our order quantity, we will want to
use it. To do this, we will first gather pieces of information about the holding
and transaction costs to plug them in to our EOQ model. Of course, we can
never achieve a perfect estimation of the holding and transaction costs. You
will always have to make some simplifying assumptions (i. e., shortcuts) in
your cost estimation. The risk is this: what if your cost estimation is really
wrong? Will it have a big impact on the model’s output—the optimal order
quantity?
There are two ways to answer this question. A simple one, based on the
graph of the supply chain costs; and a second, more rigorous, thanks to our
EOQ mathematical model.

Graphical Intuition
As you can see in →Figure 2.8, in the area close to the optimal order
quantity, the total cost curve is rather flat. The intuition here is that, if you
stay close to Q , you will achieve a total cost very close to the optimal one.

Figure 2.8 Supply chain costs.

Mathematical Demonstration
Let’s now mathematically prove this graphical intuition. If you are not
interested in this demonstration, don’t hesitate to skip it and go directly to
the paragraph starting with “→Conclusion” below.
Let’s imagine we initially computed an optimal Q and a C based on an
ini ini

estimation of h, D and k. But we realize afterward that we missed a part of


the transaction costs in our assumptions. So that we have,
k = αk ini

where k is the initial estimation we made for the transaction costs; and k
ini

is the final estimation. Typically, we might have missed 20% or 50% of these
costs. It seems to be a big mistake.
Let’s take a look at the EOQ model to see how it behaves with this mistake.
We need to compute the correct Q and C based on the initial estimations
∗ ∗

of Q and C .
ini ini

2kD 2Dαk ini
Q = √ = √ = √ α Q ini
h h


C = √ 2kDh = √ 2Dαk ini h = √ α C ini

We see that the actual optimal order quantity Q is equal to the initial ∗

(wrong) one multiplied by √α . The same holds true for the actual optimal
cost C .∗

If we assumed the transaction costs to be half of the actual value (i. e.,
k = 2k ini ), then our estimation of the optimal costs and order quantity was
off by 41% ( 1.41 = √2 ). This might seems like a big difference, but using
Q ini as an operational order quantity in our supply chain will actually not
result in a huge loss.
Let’s take a look at what would happen to our operational costs if we chose
an order quantity that is different than the optimal one.
D Q
C (Q) k + h
Q 2
=

C (Q ) √ 2kDh

D Q
k h
Q 2
= +
√ 2kDh √ 2kDh

√ kD Q√ h
= +
Q√ 2h 2√ 2kD

However, know that Q ∗


= √
2kD
h
, so

C (Q) Q Q
= +
∗ ∗
C (Q ) 2Q 2Q


1 Q Q
= ( + )

2 Q Q

We now have a good relationship between the two different costs. We can
solve it, as we know that Q = √αQ , so we have:


C (Q) 1 Q Q
= ( + )
∗ ∗
C (Q ) 2 Q Q

1 1
= (√ α + )
2 √α

This ratio is actually rather limited, even for an impressive value of α. For
example, if α = 2 , this ratio will only be 1.06. This is very interesting. It
means that, even if you forgot half of the transaction costs (or the holding
costs), and therefore wrongly estimated the optimal order quantity and total
cost by 41%, your wrong assumption will only result in an extra cost of 6%
compared to the optimal policy.
We also observe that the impact of α on the optimal cost is symmetrical:
the impact of α = 1/2 is the same as the one of α = 2 .

Conclusion
We can expand this conclusion by saying that it is virtually inexpensive to
round the optimal order quantity to a close number in order to simplify
order processing. This helps, for example, to order based on a packaging
requirement, if any.

2.5 Extensions
Various extensions to the original EOQ model have been thoroughly
discussed in the academic literature. Let’s discuss in detail three of them—
production rates, backorders and order discounts—and focus on the various
insights and recommendations we can draw.

2.5.1 Production Rate


In most supply chains, the production process is not instantaneous but
rather constrained to a maximum throughput. This constraint results in a
(slow) ramp up of inventory level when production starts. If we need to
optimize the EOQ for an internal production process (rather than optimizing
the EOQ for an order with an external supplier) we should take this limit into
account. The EOQ model with a production rate has been thoroughly
discussed in the literature14 since the first model was published by →Taft
(→1918).
Here are the main findings.

Model

Let’s note r the production rate expressed in units produced per period.
We also note d the demand per period. We define the production
throughput ratio ρ as:
d
ρ = 1 −
r
This could be seen as a percentage of capacity available.

Let’s now update our EOQ cost model based on ρ. As shown in →Figure 2.9,
the maximum on-hand inventory is now ρQ instead of simply Q, and the
average inventory is . We then have:
ρQ

D ρQ
Cρ = k + h
Q 2


2kD Q ρ=1

Qρ = √ =
ρh ρ

∗ ∗
C ρ = √ 2kDρh = √ ρ C ρ=1

This model is more general than the initial one we created without
production rate (see Section →2.2.2):
D Q
C (Q) = k + h
Q 2
Figure 2.9 Order pattern with constrained production.

Insights

We observe that if we limit the production rate, we actually reduce the


costs. It is rather exceptional that adding a constraint to a model helps to
optimize it. We should actually conclude that having a lower production
throughput helps to flatten production and align it to our needs (i. e., the
demand). In other words, producing too much too fast doesn’t help to
reduce the overall costs. It is much better to produce a constant
appropriated throughput rather than producing massive batches at once.

2.5.2 Backorders
Even if it seems counter-intuitive to many professionals, it is actually optimal
for a supply chain to allow some backorders and not aim for 100% service
level. In other words, it is optimal for a company to have some backorders
instead of serving each and every order directly from the on-hand inventory.
In B2B relationships, backorders can be allowed through negotiation with
suppliers. The contract between a supplier and its client will then stipulate a
backorder penalty (per order, or based on the waiting time).

Model
Let’s define B as the maximum number of backorders we allow in our
inventory policy (the model is shown in →Figure 2.10). We then have an
order pattern that looks like the one in →Figure 2.11.

Figure 2.10 Supply chain model.

Figure 2.11 Order pattern with backorders.

We can already note some interesting relationships:


The maximum inventory level is Q − B .
The minimum net inventory level is −B .
An order cycle lasts T = Q/D (remember D is the yearly demand)
and is composed of two phases T and T :
+ −

A first phase where on-hand inventory is available. This lasts for


T
+
= T
Q−B

Q
.
A second phase where the net inventory level is below 0. During
this phase we have backorders because we can’t serve the
demand directly from the on-hand inventory. This lasts for
T

= T .
B
Q

Using these relationships, we can estimate the average on-hand level and
the average backorder level by computing the area of the positive and
negative triangles in →Figure 2.12.

Figure 2.12 Inventory levels for backorders model.

+ 2
1 T (Q − B)
Average on-hand level (grey area)= (Q − B) =
2 T 2Q

− 2
1 T B
Average backorder level (hatched area)= B =
2 T 2Q

Let’s now look at the costs of the policy. We will note b the backlog costs
τ

per unit (that is the cost per unit backordered per unit of time—similar to h).
The backlog costs are then,
2
B
Backlog costs = b τ
2Q

The total costs are then,


C (Q, B)= Transactions + Holding + Backorder

2 2
D (Q − B) B
C (Q, B)= k + h + bτ
Q 2Q 2Q

Cost Optimization

Now that we have defined the costs C, based on the order quantity Q, and
the backorder quantity B, we can minimize them. The algebra is out of scope,
see →Grubbström and Erdem (→1999), →Robert et al. (→2004) for the
detailed computation.

∗ ∗
bτ + h 2kD bτ + h
Q B = Q B=0 ⋅ √ = √ ⋅ √
bτ h bτ


h 2kDh

B = QB ⋅ ( ) = √
bτ + h b τ (b τ + h)

∗ ∗
bτ bτ
C = C B=0 ⋅ √ = √ 2kDh ⋅ √
bτ + h bτ + h

We see that if we set b = ∞ , B should be 0, and we are back to the initial


τ

C (Q) model (see eq. →2.3 in Section →2.2.3):

D Q
C (Q) = k + h
Q 2

Insights

We observe some interesting insights from allowing backorders:


The average on-hand inventory is reduced, resulting in lower holding
costs.
The number of transactions per year is reduced (because the order
quantity is increased) resulting in lower transaction costs.
The total costs are reduced by a ratio √b /(b + h) .τ τ
We can conclude that allowing (the right amount of) backorders in a
supply chain is good and will bring down the total costs.
In practice, very few supply chains use the EOQ model with backorders to
optimize their inventory policy. Nevertheless, the insights we discussed here
are a good starter for the discussion we will have later in Chapters →8 and
→11, where we will optimize the costs of stochastic models.

2.5.3 Discounts
In order to incentivize buyers to increase their order quantities, many
suppliers offer a discount depending on the order quantity (bulk orders).
This can be incorporated into the EOQ model in order to update the optimal
order quantity. In 1963, Hadley and Whitin published in their book Analysis of
Inventory Systems the first model that dealt with such discounts.15 They have
been followed since by many other publications and models that deal with
more complex discounts.16
As a general rule, let’s imagine a supplier offers a volume discount δ (delta)
as of a quantity threshold Q . The volume discount δ is computed as such:
δ


δ =
c

where c is the product purchase cost and c is the discounted purchase cost.
δ

For example, a supplier could give you a 5% rebate if you buy at least 1000
units at once. δ is then 0.95 and Q = 1000 .
δ

We can find the optimal order quantity by following these rules:


1. Compute the Q based on the volume discounted purchase

δ

cost c .δ


2kD
Qδ = √
cδ h

2. If Q falls into the discount limits ( Q



δ

δ
> Qδ ), this is the
optimal order quantity.
3. If not, test if

C (Q ) + cD < C (Q δ ) + c δ D
if so, Q is the optimal order quantity (thus, without volume

discount); otherwise you should order exactly Q units (the


δ

minimal quantity to benefit from the discount).

2.5.4 Other Extensions


Numerous other extensions to the EOQ model have been discussed by
academics over time. Here, briefly, are two other extensions:
Return on investment The EOQ model is focusing on cost minimization
whereas most businesses are actually looking to maximize
their return on investment (ROI). In 1995, Trietsch looked at
the order quantity optimization of multiple products with
regard to the ROI.17 His model shows that the EOQ that
maximizes the company ROI will be lower or equal to the
EOQ that minimizes the supply chain costs.
Batch size and set-up times In the case of production batch sizes,
→Cachon (→2018) discusses an optimization model based
on the various set-up times across a production line,
prioritizing the process bottleneck.

2.6 Recap
In this chapter, we asked ourselves a simple question: How much should I
order? We found an answer by optimizing the supply chain costs based on
the order quantity. We obtained a set of equations known as the EOQ
(Economic Order Quantity) model:
Q D
C= h + k (see eq. 2.1 in Section 2.2.1)
2 Q


2kD
Q = √ (see eq. 2.2 in Section 2.2.2)
h


C = √ 2kDh (see eq. 2.3 in Section 2.2.3)

This means that the optimal order quantity Q is proportional to the square

root of the fixed transaction costs k, to the yearly total demand D; and
inversely proportional to the square root of the variable holding costs per
unit h.
We noted that a proper setting of the order quantity balances the
ordering costs against the holding costs, and that high transaction costs will
result in high inventory levels. We saw that the EOQ model is robust to a
wrong evaluation of the transaction costs or the holding costs. This allows us
to round the optimal order quantity (or the optimal time between two
consecutive orders) to streamline our process with only a minimal impact on
the total costs.
3 When Should I Order?
Now that we know how much we should order, we have to find when we
should order. To do so, we will have to discuss two aspects of a supply
chain: the supply (or order) lead time and the review period (as shown in
→Figure 3.1).

Figure 3.1 Supply chain model.

3.1 Lead Time


Until now, we assumed there was no wait time between the moment an
order is made and its reception. In other words, we assumed that as soon as
we want to make an order, we receive it.
It’s time we remove this assumption—and replace it with a fixed lead
time.1 This means that if we place an order with our (internal or external)
supplier, it will take a certain amount of time (fixed) before we receive our
goods.
How does this influence our inventory policy? Remember that, in a
continuous review policy with a reorder point, we order Q units when the on-
hand inventory reaches the reorder point s. When we assumed no lead time,
we ordered Q units when the on-hand inventory reached 0. With a lead time
L (as shown in →Figure 3.2), we will have to order Q units when the net
inventory level will reach the demand over the lead time. We will note the
demand over the lead time d =d ⋅ L .
L

s=d L (3.1)
Pay attention to the units of measure: d is the demand per unit of time and L
is the lead time expressed in the same unit of time. We could also compute
dL as D (the yearly demand) times L, if the lead time is expressed in years.
So that we would have d = D ⋅ L .
L

Once an order is made, it takes a lead time L to receive the goods. During
this time L we have Q pieces of in-transit inventory (sometimes called on-
order inventory).

As you can see in →Figure 3.2, we can compute the expected average in-
transit inventory I as the ratio between the lead time L and the cycle time T
s

multiplied by the number of units ordered Q.


L L (3.2)
Is = Q = Q
T Q/D

I s =D ⋅ L=d L

This identity is remarkable: the expected amount of in-transit inventory is


the demand over the lead time. It will hold for any inventory policy
(continuous or periodic), and for any demand (deterministic or stochastic).
This means that, if you want to decrease the in-transit inventory, you should
not try to reduce the number of orders (making fewer orders but ordering
more at once will result in the same average amount of in-transit inventory),
instead you should look at how to reduce the lead time.
Figure 3.2 Reorder point policy (s, Q) with lead time L.

Note that in-transit inventory might be owned by the supplier (shipper)


or the client (receiver), depending on the agreement, resulting in holding
costs for either one or the other.

3.2 Review Period


Apart from the lead time, the length of the review period also has an impact
on any inventory policy following a periodic review (as shown in →Figure
3.3). How does a review period R impact our policy?

Figure 3.3 Review period and order up-to level policy (R, S) with lead time
L.
1. Order up-to level
The order up-to level is now defined as the demand over the
lead time plus the demand over the review period (noted d R

):
S=d L + d R =d ⋅ L + d ⋅ R (3.3)

In other words, in the case of a periodic review policy, the


up-to level will increase to cover both the demand over the
lead time and the demand over the review period.

2. Cycle stock
The amount of product ordered for each cycle is the demand
over the review period d so that the expected cycle stock
R

level is:
1
Cs = dR
2

3. In-transit inventory
Even if the length of an order cycle changes compared to the
continuous review policy, we would still have the same
expected level of in-transit inventory per cycle:
L L (3.4)
Is = dR = dR
R R

I s =d L

4. Review period
Let’s note T the optimal review period, computed as (see

eq. →2.2 in Section →2.2.2 for Q expression):





Q 1 2kD
T = = √
D D h

Finally we have,
(3.5)

2k
T = √
hD

What should we do if the optimal review period is not a


round number? If you have an optimal review period of 1.23
days, should you really make an order every 29 hours, 31
minutes and 12 seconds?
We discussed in Section →2.4 that we could round Q to a ∗

more appropriated number if needed. For example, if


Q = 2094.24 pieces, we can order 2000 pieces for a

marginal extra cost of only 0.1%. It would be much more


convenient to order a batch of 2000 pieces rather than
2094.24 pieces.
As we face the same issue with the optimal review period T ∗

, couldn’t we round this 1.23 days to 1 day?

3.2.1 Rounding the Review Period


Let’s discuss two methods to round the review period and the impact on the
inventory policy costs.

Method #1 – Simple Rounding

With the first technique—a simple rounding—we set the review period T as a
multiple of a base time period T like a day or a week. If you have the
B

possibility to make an order every day—the base time period is a day—you


would want to round the review period to an integer (1 day instead of 1.23).
Thanks to our sensitivity analysis in Chapter →2, “→How Much Should I
Order?” (see Section →2.4 specifically), we know that the impact on the total
cost will be marginal. This technique will work well for a supply chain with a
single item. However, we might be missing another cost-saving opportunity.
As most supply chains deal with thousands of stock keeping units
(SKU), you probably want to avoid keeping track of thousands of different
order schedules—even if they are all expressed in days. In order to reduce
schedule complexity, couldn’t we round the various review periods to
specific values? Remember, we want to use the periodic review policy in
order to group orders at specific points in time, in order to have the same
periodic review for multiple products.

Method #2 – Power-of-2 Policy

A practical way to round a review period is to use the power-of-2 policy. It


was initially discussed in →Maxwell and Muckstadt (→1985). Their idea was
to round the review period to a multiple of a base time period multiplied by a
power-of-2:
k
R = 2 TB

For example, if the base period is 1 week, the optimal review period should
be rounded to either 1, 2, 4, 8, 16... weeks. That way, products will fall into a
smaller number of categories according to their respective optimal review
period, therefore reducing schedule complexity. An example with a base
time period of one week is shown in →Table 3.1.

Table 3.1 Power-of-2 policy with a weekly base time period.


Review Period k 2
k
W1 W2 W3 W4 W5 W6 W7 W8 W9 W10
Weekly 0 1 x x x x x x x x x x
Bi-weekly 1 2 x x x x x
Monthly 2 4 x x x
Bi-monthly 3 8 x x

We choose k as the smallest fitting value:



T k ∗
≤ 2 T B ≤ √ 2T
√2
So the ratio between T and T is at worst √2 :


T

≤ T ≤ 1.41 ⋅ T
1.41

Cost Impact

The power-of-2 policy is very useful to synchronize timing for different


products across a supply chain. But what is the impact on the costs for not
using the optimal review periods?
From the sensitivity analysis we did in Section →2.4 we know that:

C (Q) 1 Q Q
= ( + )
∗ ∗
C (Q ) 2 Q Q

By extension, as T = Q/D , we have:



C (T ) 1 T T
= ( + )
∗ ∗
C (T ) 2 T T

Remember that the ratio between T and T is at worst √2 . So the worst


ratio between the actual cost and the optimal is:

C (T ) 1 √2 1
≤ ( + ) ≃ 1.06

C (T ) 2 1 √2

This means that, by using the power-of-2 policy, we only take the risk of
increasing the total cost by 6%. That’s in theory. In practice, we are much
more likely to reduce the total cost as we are able to group different orders
into a single transaction.

3.2.2 Forecast or Historical Demand?


In both policies, we used the demand per period to compute the reorder
point s and the order up-to level S (see eq. →3.1 in Section →3.1 and eq. →3.3
in Section →3.2). You can decide to use a (demand) forecast rather than
(demand) historical numbers. So that, if a trend is observed (or is projected
based on external insights), it can be used to improve the setting of your
inventory policies. You have then
s= F L

S= F L + F R

where F is the forecast over the lead time and F the forecast over the
L R

review period.

3.3 Confusion Curse: Long Lead Times


Inventory policies with order up-to levels can be misleading for practitioners
—especially when the supply chain faces long lead times. Often, practitioners
assume that this order up-to level is the expected inventory level. The fact
that the up-to level is often called “target stock” is not helping. The
difference between the up-to level and the actual expected physical
inventory will actually grow further as the lead time increases. This confusion
can even get worse when orders need to be created while others are still
waiting to be received.
We will create a small simulation in Section →5.3 to show the impact of the
review period, lead time and order up-to level on the expected inventory
level.

3.4 Recap
We improved our EOQ model by taking into account the (supply) lead time
as well as the review period (if any). Let’s recap how much we should order
and when we should make an order for the two main policies we discussed
in Chapter →1:
(s, Q) Continuous review policy with a reorder point and a fixed
order quantity.
(R, S) Periodic review policy with an order up-to level.
Reorder point (s, Q) Review Period (R, S)
How much? Order Quantity 2kD Up-to level S = dL + dR
Q = √
h

When? Reorder point s = dL Review period R = 2 TB


k

Expected inventory Cs =
1

2
Q Is = dL Cs =
1

2
dR Is = dL

We saw that as the lead time grows bigger, the up-to level of a fixed review
period policy can’t be assumed to be the expected average stock on-hand.
We will discuss this effect further in Section →5.2 for stochastic supply
chains.
Part II Stochastic Supply Chains
4 Safety Stocks
Buffer or suffer.

So far, we have discussed the EOQ inventory and have gained some insights into this
model. It is suited for simple supply chains that don’t face any kind of uncertainties. But,
in reality, a supply chain does not have a steady flow and does not come without
variation. Supply chains face many random events that simply cannot be predicted,
leading ourselves to questions such as: Are our clients going to buy as much as forecasted?
Is the supplier going to be on time for its delivery? Will we have enough production capacity
to produce these goods on time? Safety stocks are a straightforward way to create a
buffer against these unforeseen events. In this chapter and the next one, we will be
discussing two potential causes of fluctuation in a supply chain:
1. Demand side The actual demand varies over time and is different from
the forecasted demand.
2. Supply side Suppliers can be late compared to the announced (or
negotiated) lead times.
In order to mitigate the risks resulting from these fluctuations, we will create, through
the chapters in this second part, a first model that computes how much safety stock is
needed. As usual, we will create our new model gradually. In this chapter, we will
introduce stochastic demand and build our first stochastic model. Then, we will take the
time to discuss in detail inventory policies and inventory analysis in Chapter →5,
“→Inventory Policies.” Finally, we will introduce stochastic lead times in Chapter →6,
“→Stochastic Lead Times.”
In order to make our first stochastic model, we will have to make a couple of
simplifying assumptions:
The demand and the lead time are continuous random variables. This means
that the demand and the lead time can take any value, not just integers.
We will discuss discrete models (where the demand can only take integer values)
later, in Part →IV, “→Discrete Inventory Optimization.”
They both follow a normal distribution.
We will discuss gamma-distributed demand in Chapter →9, “→Beyond Normality,”
and custom discrete distributions in Chapter →12, “→Discrete Probabilistic
Demand.”
The demand that cannot be fulfilled by on-hand inventory is backordered until
inventory is available (we will re-discuss this assumption in Section →x). In other
words, the excess demand will not result in lost sales.
We will stick to simple inventory policies:
Either a fixed review period with an order up-to level (R, S) .
Or a continuous review with a fixed reorder point and an order quantity
(s, Q) .

More complex inventory policies such as (R, s, Q) or (R, s, S) have been studied
by academics,1 but solving them—even with many assumptions and
simplifications—results in complex mathematical models that are difficult to
implement in practice. We will discuss these later in Chapter →13, “→Simulation
Optimization.”

4.1 Service Level


How should we determine the right amount of safety stock we need? On one hand,
based on the service level that we want to deliver to our clients and, on the other hand,
based on the magnitude of the demand and supply fluctuations that our supply chain is
facing.
Let’s first discuss the service level. Even though this seems to be a simple and
straightforward concept, measuring it brings the same confusion as measuring the
forecast error. As discussed in my previous book, Data Science for Supply Chain
Forecasting, everyone agrees that a forecast qualifies as being perfect if the forecast
error is 0.2 Measuring the forecast error is trickier. What exactly is an accuracy of 60%, or
an error of 25%? The same goes for the service level: everyone agrees that a perfect
service level is achieved when all clients are served on time and in-full. The confusion
comes when this is not the case. Let’s review some possible ways to measure service
levels:
Cycle service level α The probability of not having a stock-out during an order
replenishment cycle. This is the probability that the inventory available
at the beginning of an order cycle (that is just after we received the
order from the previous order cycle) will be greater than (or equal to)
the demand during this cycle. In other words, this is the probability that
there is no stock-out between the time you receive a replenishment until
the next replenishment arrives (“Now that we have received an order, we
have a 5% probability to run out-of-stock by the time we receive the next
one”).
This is also often called the “Type 1 service level.”
Period service level α The probability that there is no stock-out during one arbitrary
p

period (e. g., a day, a week). The period service level can be
similar or different to the cycle service level depending on the length of
an order cycle. It is also much easier to understand than the cycle
service level (“We only have a 5% probability to run out-of-stock by the end
of any given business day”). Due to the mathematical complexity, it is not
common for inventory models to use this service measure.
Nevertheless, we will track it in our simulations.
Client service level The probability that a client receives their full order (often
containing multiple different products) from stock (often called On Time
In Full or OTIF). Due to its modeling complexity, it is not common to use
it in inventory models. Nevertheless, business-wise it might be the most
relevant.
Fill rate β The fraction of the demand (over the long term) that is supplied directly
from the on-hand inventory. It is often called the “Type 2 service level.”
Over the long term we should have (if we assume that a period is shorter than a cycle):
Fill rate β > Client service level > Period service level α p > Cycle service level α

Other service level key performance indicators (KPIs) could also be tracked. For example,
the average backlog per period could also be a relevant KPI. If you divide it by the
average period demand you would get a KPI close to the fill rate (the amount of
backorders/lost sales per period). However, it would be a more conservative approach
since some backorders would stay for multiple periods in the backlog. You can also track
how long on average an order stays in the backlog.
Let’s use, for now, the cycle service level as the metric to measure our service level. We
will discuss the fill rate in Chapter →7, “→Fill Rate.” We will also assume, for now, that we
know how much service level we want to reach. We will discuss later, in Chapter →8, how
to optimize the service level.

4.2 Stochastic Demand


Once a service level target is defined by management, supply chain practitioners often
translate this into overly simplistic rules like: “We take x weeks of average demand as
safety stock.” But these rules do not take into account each of the products, unique
facets of demand variability and supply reliability. Some products might face volatile
demand, while others could face stable demand but unreliable supply. For that reason,
safety stocks should protect us against:
The demand variation that could happen during the average (supply) lead time.
The average demand over the lead time variation.
We will add these two new layers of insights to the EOQ model: suppliers will now have
the possibility to be late (i. e., the lead times will no longer be constant) and clients won’t
order the exact same amount of products in each period. We will first tackle the issue of
stochastic demand in this chapter and discuss the case of stochastic lead times in
Chapter →6.
4.2.1 Normal Distribution
Let’s start by looking at the demand variation. Let’s note d the demand per period
(day, week, month...). Until now, we assumed that this demand was constant in each
period. Now, let’s change this and assume that the demand follows a normal
distribution, defined by a mean μ and a standard deviation σ .3
d d

2
Demand per period ∼ N (μ d , σ d )

The demand standard deviation is defined as:

2
∑ (d t − μ d )

σd =
n − 1

where n is the number of (historical) demand observations and d the demand at time t.
t

If you are not familiar with the concept of a standard deviation, simple intuition says it is
a measure of how the demand is spread around its mean. A high deviation will simply
represent a demand that fluctuates a lot.

Sample Deviation

In our standard deviation formula, we divided the sum of the deviation by n − 1 and not
simply by n. The rigorous explanation of this trick is outside the scope of this book.
Nonetheless, we can try to estimate the true standard deviation of the demand by
looking at only a few observations: a sample of the true demand. Therefore we want to
be conservative in our estimate by dividing the sum of deviation by n − 1 instead of n,
resulting in a higher estimate of σ than the actual standard deviation of the demand
d

sample at hand.

Discrete vs. Continuous Distributions

We will discuss in Parts →II and →III inventory models based on continuous
distributions. This means that we assume that the demand can take any value. In
practice, this is often not the case. Client can often buy products only in specific
packaging (bottles, packs, pallets), and some products simply can’t be cut into arbitrary
pieces (selling 0.13 iPhones makes no sense). Nevertheless, we will first focus on
continuous models since these are easier to implement in practice than discrete models.
We will discuss the latter in Part →IV, “→Discrete Inventory Optimization.”

Statistical Definitions

Before we go back to our demand analysis and inventory level, let’s take some time to
define some important statistical concepts.

Standard Normal Distribution

A standard normal distribution is a normal distribution with a mean of 0 and a standard


deviation of 1, or N (0, 1) . It is also called a Gaussian distribution.

Probability Density Function

The intuition behind the probability density function (PDF) of a random distribution is
that the higher the PDF is around a value, the higher the probability (likelihood) that an
occurrence of the distribution is close to this value. In other words, if the PDF of a
distribution is high around 1, it is likely that an occurrence of this distribution would fall
close to 1. We note f 𝓧 (x) the probability density function of distribution 𝓧
expressed at a value x .

Figure 4.1 Probability density function of N (0, 1) .

Like any other statistical distribution, a normal distribution is also defined by a PDF. It is
mathematically defined as:
2
1 (x − μ)
f N (x; μ, σ) = ⋅ exp(− )
2
√ 2πσ 2 2σ

There is an exception to this notation: the PDF of a standard normal distribution is


noted φ(x) (phi). You can see in →Figure 4.1 the PDF of such a Gaussian probability
function.
2
1 x
φ(x) = f N (x; 0, 1) = ⋅ exp(− )
√ 2π 2

Cumulative Distribution Function

The cumulative distribution function (CDF) of a random distribution is the probability for
an occurrence of this distribution to be less than or equal to a certain value. In other
words, the CDF of a random distribution X will tell you how likely it is that an
occurrence x of this distribution is lower than a threshold z. We note F 𝓧 (z) the CDF of
a distribution 𝓧 evaluated at a threshold z .
z

F X (z) = Probability that X ≤ z = ∫ f X (x) dx

−∞

The CDF of a random distribution is expressed as a probability; it is therefore always


between 0 and 1 (and can also be expressed as a percentage). We note α this
percentage:
F X (z) = α 0 ≤ α ≤ 1

Again we note Φ(z) (phi) the CDF of a standard normal distribution (see →Figure
4.2).
Figure 4.2 Cumulative distribution function of N (0, 1) .

We have this relationship between the CDF of a normal distribution and the one of a
standard normal distribution:
x − μ
F N (x; μ, σ) = Φ( )
σ
Inverse Cumulative Distribution Function

We note F (α) the inverse cumulative distribution function (also known as the
X
−1

quantile function) of a distribution 𝓧 evaluated at the probability α. It will give us the


threshold z that will achieve a probability α for an occurrence of the distribution X to
be below this threshold z.
−1
F (α) = z ⟺ F X (z) = α

This threshold is often called the quantile.


We note Φ −1
(α) the standard inverse cumulative distribution.
−1 −1
F (α; 0, 1) = Φ (α)
N

More generally, we have this useful relationship between the two:


−1 −1
F (α; μ, σ) = μ + σ ⋅ Φ (α)
N

For example, there is a 95% probability that an occurrence of a random variable


following a Gaussian distribution will be lower than 1.645:
(0.95) = 1.645 ⇔ Φ(1.645) = 0.95 . We say that the standard cumulative
−1
Φ

distribution of 1.645 is 95% and that the standard inverse cumulative distribution of 0.95
is 1.645.

4.2.2 A Demand Assumed to Be Normal


You can see in →Figure 4.3 the PDF and CDF of a normal demand where μ = 100 and d

σ = 25 . In other words, the probability density of a demand that varies around 100
d

units per period with a standard deviation of 25. We observe that there is a 10% chance
for the demand during a period to be higher than 132 units (as
(0.9; 100, 25) = 132 there is a 90% probability for the demand to be below 132
−1
F
N

units), and only 5% to be higher than 141 ( F (0.95; 100, 25) = 141 ).
−1

Figure 4.3 Demand probability density function with d ∼ N 2


(100, 25 ) .

The CDF of our demand distribution is particularly useful as it tells us the


probability for the demand (during one period) to be below a threshold.
We can then simply compute the inventory level ι (iota) needed at the beginning of a
period to achieve a service level α:
−1
ι = F (α; μ d , σ d )
N

Similarly, we can compute the expected cycle service level during a period based on an
initial inventory level.
α = F N (ι; μ d , σ d )

In other words, this means that if we have an inventory of ι pieces at the beginning of a
period, we can expect, with a probability α, to have enough inventory to fulfill all the
demand during this period.
We show in →Table 4.1 (for this specific demand distribution) the relationship
between the inventory level at the beginning of a period and the expected cycle service
level.
Table 4.1 Impact of the inventory level ι on the cycle service level α.
Inventory level ι 100 106 113 121 132 141 149 158
Cycle service level α 50% 60% 70% 80% 90% 95% 97.5% 99%

4.2.3 Safety Stocks


We can now compute how much inventory we need at the beginning of a period in order
to reach a certain service level. Let’s refine this by splitting the inventory between the
cycle stock on one side and the safety stock on the other side.
We have:
Inventory= Cycle + Saf ety (4.1)

ι= C s + S s

−1
ι= F (α; μ d , σ d )
N

−1
ι=μ d + σ d Φ (α)

where the cycle stock at the beginning of the period is μ (in other words, the expected
d

demand over the period) and the safety stock is σ Φ (α) .


d
−1

(α; μ , σ ) can be read as “ι is the inventory necessary to guarantee a


−1
ι = F d d
N

cycle service level α if the demand follows a normal distribution d ∼ N (μ , σ ) .”


d
2
d

4.2.4 Service Level Factor

Usually the safety stock formula is noted as:4


Saf ety= Service level f actor ⋅ Demand deviation (4.2)

S s =z α σ d

We call z the service level factor, because it is the ratio that multiplies the demand
α

deviation in order to compute the required safety stock and to obtain a desired service
level. z is computed as Φ (α) . Remember, this is the inverse cumulative standard
α
−1

distribution function, estimated at the probability α. Some examples are shown in


→Table 4.2 and →Figure 4.4. Typically, with a service level factor of 1.64 we can expect to
reach a service level of 95%.
Table 4.2 Service level factor.
Service level factor zα 0 0.25 0.52 0.84 1.28 1.64 1.96 2.33
Cycle service level α 50% 60% 70% 80% 90% 95% 97.5% 99%

Figure 4.4 Demand level thresholds.

Impact of Service Level Factor

The relationship between the service level (that we want for our clients) and the amount
of safety stock needed is not at all linear.
Figure 4.5 Impact of the service level α on the service level factor z .
α

As shown in →Figure 4.5, in order to achieve a (cycle) service level of 60% you will
need a service level factor of 0.25, but achieving 95% is already 1.64. And 99% is 2.33.
This means that the marginal extra cost of guaranteeing an extra point of service level is
growing fast. In other words, increasing service level by 1% from 98% to 99% is much
more expensive than the increasing it from 60% to 61%. It means that, the closer you
approach a 100% service level, the faster your marginal extra cost grows.
Actually, based on our model, a service level of 100%—which is a risk of 0.00% of
being out-of-stock—will only be achieved thanks to an infinite amount of safety stock. In
other words, there is no such thing as zero risk in our continuous normal model.
You will see in Chapter →8, “→Cost and Service Level Optimization,” how to optimize
the service level in order to minimize the inventory policy costs.

4.2.5 Forecast or Historical Demand?


In the safety stock formula (see eq. →4.2 in Section →4.2.4), we use the demand
standard deviation ( σ ). As for the EOQ formula, you can decide to use a (demand)
d
forecast rather than (demand) historical numbers. That way, if a trend is observed (or is
projected based on external insights), it can be used to improve the setting of the
optimal order quantity. We then have
Ss = zα σe

where σ is the standard deviation of the forecast error.


e

The forecast error is defined as the forecast minus the demand.


e = f − d

And its standard deviation is computed as for any other statistical distribution:

2
∑ (e t − μ e )

σe =
n − 1

We assume that the forecast is not biased,5 so that we should have μ e = 0 .

4.3 Demand Variation over Multiple Periods


We just made our first safety stock model, but we assumed that the demand variation
was computed on the same period length as the lead time. For example, we assumed
that we computed the demand variation per week and that we had a lead time of one
week. But what happens if we have a lead time of two weeks but we compute the
demand variation at a weekly level? Or the other way around, what if the lead time is
only two days?

4.3.1 Demand Aggregation


If we look at the demand distribution over multiple periods at once (rather than a single
period), the demand coefficient of variation should decrease, as the demand variation
in each period might offset the others.

If we assume that the demand is normally and independently spread across each period
(we’ll discuss this in a moment), statistics teach us that the demand standard deviation
is proportional to the square root of the number of periods τ (tau). Mathematically we
have:
2 2
τ ⋅ N (μ d , σ ) = N (τ μ d , τ σ )
d d

So that the coefficient of variation is lowered by √τ .

√τ σ 2
d σd CV d
CV dτ = = =
τ μd √τ μ d √τ

A good illustration of this effect is to look at the difference between throwing one die or
multiple dice. If you throw one die, you have as many chances of getting a 1 as a 6 (the
two most extreme values)—you have a high variance. But the more dice you throw at
once, the lower the probability of getting an extreme value. For example, if you throw 3
dice, the probability to get the maximum possible value (18) is only 1 out of 216; on the
other hand you also have 1 chance out of 4 to get either a 10 or 11. In short, the
probabilities at the extremes are very low and probabilities near the middle are high.
The results are bunched closer together toward the middle, hence the coefficient of
variation of throwing three dice is lower than that of throwing a single die.
The same effect will happen with the demand distribution. You have less chance to face
an extreme month than an extreme day. Let’s say that you track the daily demand in a
shop, you then have these relationships between daily, weekly and monthly variations
(as shown in →Figure 4.6, assuming you have 5 business days per week and 22 per
month):
2
Daily demand∼ N (μ day , σ day )

2 2
Weekly demand∼ N (μ w , σ w ) = N (5μ day , 5σ day )

⇒ σ w = √ 5σ day

2 2
Monthly demand∼ N (μ m , σ m ) = N (22μ day , 22σ day )

⇒ σ m = √ 22σ day

2
Demand over multiple days∼ N (τ μ day , τ σ day )

⇒ σ τ = √ τ σ day
Figure 4.6 Simulated demand variation over different temporal aggregations.

4.3.2 Demand Disaggregation


Let’s imagine now that we estimate the demand per week as d ∼ N (μ , σ ) , but we
w w
2
w

need to assess the demand at a daily level (we have a daily replenishment). We can then
assume:
2
μw σw
d day ∼ N ( , )
5 5

so we see that the daily demand is five times lower than the weekly one but its deviation
only got reduced by the square root of five.
We can then summarize these relationships by saying that, if we aggregate the demand
over τ multiple periods, we have:
2
τ ⋅ d ∼ N (τ μ d , τ σ d )

and, if we want to disaggregate it, we have:


2
d μd σ
d
∼ N ( , )
τ τ τ

So that, if the demand over one period is assumed to follow d ∼ N (μ d,


2
σ )
d
, the
required amount of safety stock S to guarantee a service level α is,
s

S s =z α σ d √τ
(4.3)

which is a more general expression than what we had before: S s = zα σd (see eq. →4.2
in Section →4.2.4).
4.3.3 Demand Independence and Correlation
The safety stock model we created assumes that the demand during a period is
independent of the demand during the next one. This independence is not observed in
practice most of the time. A high demand during one period can result in a lower
demand during the following one, as your clients will already have bought what they
needed. In other cases, a high demand during one period might be followed by...
another high demand period. An external factor might be affecting the overall demand.
For example, you can have a sunny weekend, so your sales are high both on Saturday
and on Sunday. In this case of positive auto-correlation (i. e., a high demand period
followed by another high demand period), our model will undershoot the required
amount of safety stock to reach the desired service level.
The fact that this independence is not respected is, of course, an issue. It will only get
worse if you use a demand deviation value estimated at a monthly level to compute the
daily demand deviation by simply dividing it by √22 . Or, stated differently, it is not a
good idea to estimate the demand deviation at a monthly level by multiplying the one
computed at a daily level by √22 . There are too many assumptions present at once:
The monthly demand is normally distributed.
The daily demand is normally distributed.
The daily demand is uniformly and independently distributed through a month.
We have to think of another solution.
The best way to get rid of this question of independence is to compute the demand
variation at the same level of time aggregation as the lead time and the review period.
Best practice is to generate a forecast at the same level of aggregation as the supply
chain it is used to work on. For example, if your supply chain works with a weekly review
period (i. e., with weekly replenishment), it is better to forecast the demand—and
measure the forecast accuracy—in weekly buckets rather than in monthly buckets. If you
can’t do this (for example, due to the limitation of the forecast model) you can at least
measure the forecast accuracy per week using a flat split6 of the monthly forecast.
This becomes unfortunately more complex—too complex?—if you face a review
period based on another scale than the lead time. As usual, we have to do a trade-off
between usability and accuracy.

Correlation

When you need to combine the demand of multiple products into one (for example if
you need to estimate the right amount of safety stock for raw materials) you need to pay
attention to the correlation between the demand of these products.
We can measure the correlation between two variables with a mathematical
expression.
Sum of Correlated Variables

Once we know the correlation between two variables, we can compute the expected
mean and deviation of their sum as below.
If we have X and Y defined as:
2 2
X ∼ N (μ X , σ X ) Y ∼ N (μ Y , σ Y )
Then their sum is characterized as:
μ X+Y = μ X + μ Y

2 2
σ X+Y = √ σ + σ + 2ρ σ X σ Y
X Y

These equations can be used to estimate the standard deviation when combining two
products or markets into one. Remember if ρ = 0 , then we say that X and Y are linearly
uncorrelated (or, with slight abuse, independent). Unfortunately, it is much more
complex to use it to properly estimate the demand deviation over multiple periods
because some periods could be positively correlated and other negatively correlated.

Warehouse Centralization

Supply chain network analysts often look at the impact of warehouse centralization on
the cycle and safety stock levels. This impact has been studied thoroughly since
→Maister (→1976). The mathematical models used to assess the impact of centralization
are similar to those we discussed here to aggregate or disaggregate the demand across
different time buckets. See →Wanke (→2009) for a more recent literature review and
detailed models. Warehouse centralization will help to reduce demand variability, but it
won’t help against supply variability (we will discuss this in Chapter →6, “→Stochastic
Lead Times”). On the other hand, adding a central warehouse to an existing inventory
network will increase the handling costs and might result in longer total lead times.
4.4 Recap
We defined the cycle service level α as the probability of no stock-out within an order
cycle. In order to achieve this cycle service level over τ periods of demand, we computed
that we need a safety stock S :
s

S s = z α σ d √τ (see eq. 4.3 in Section 4.3.2)

where
zα is the service level factor and is computed as z = Φ (α)
α
−1

σ is the demand standard deviation per period


d

we assume that the demand observed in each period is independent from one
another.
We will now to integrate this safety stock into our inventory policies.
5 Inventory Policies

5.1 Safety Stocks and Inventory Policies


We just created our first mathematical model that computed how much safety stock we
need to achieve a desired cycle service level, over a certain period, and based on the
demand variation. As we know, in order to run a supply chain (as modeled in →Figure
5.1), we need a proper inventory policy—which is not the same as simply knowing how
much safety stock we need. For our two main policies, (s, Q) and (R, S) , let’s see how
much safety stock we need, and then answer the two questions needed to run an
inventory policy: how much and when to order. We will answer the question where to
keep inventory in Chapter →10, “→Multi-Echelon Inventory Optimization.”

Figure 5.1 Supply chain model.

5.1.1 Policy #1 – Continuous Review and Reorder Point (s,Q)


Let’s first discuss the fixed reorder point (s, Q) policy. Remember that, with this policy,
we order a fixed amount Q when the stock on-hand reaches a threshold: the reorder
point s. You can see in →Figure 5.2 this kind of policy with a stochastic demand.
Figure 5.2 (s, Q) policy with stochastic demand d ∼ N 2
(μ d , σ )
d
.

How Much Safety Stock?

We know from Chapter →4 (see eq. →4.3 in Section →4.3.2) that the required safety
stock S to guarantee a service level α over τ periods, is computed as
s

S s = z α σ d √τ

In a continuous (s, Q) policy, the required safety stock is based on the square-root of
the supply lead time L:

S s = z α σ d √L

Indeed, the risk-period x in an (s, Q) policy (as shown in →Figure 5.2) is the lead time
τ

L: at any point in time, you can make an order and should get it within time L. Therefore,
in order to guarantee a cycle service level of α over the order cycle, you need to keep a
safety stock to protect it against any demand variation that could happen during the
lead time.

Reducing risk-periods (or lead times) should be a priority for supply chain managers. As
the safety stocks are proportional to the square root of the lead time, it means that
reducing the lead time is profitable for a supply chain. For example, if you divide the
(total) lead time by 2, you can reduce the safety stock by √2 (=1.41). This will also
reduce the amount of in-transit inventory in the supply chain, resulting in less cash tied
up in useless inventory.

How Much to Order?

We compute the order quantity, which we know from the EOQ model (see Chapter →2,
specifically eq. →2.2 in Section →2.2.2):


2kD
Q = √
h

When to Order?

The reorder point s is now computed as the sum of the demand over the lead time d L

and the safety stocks S (as discussed in Chapter →3).


s

s = dL + Ss

5.1.2 Policy #2 – Periodic Review and Order Up-to Level (R,S)


As a reminder, a fixed review period policy (R, S) is an inventory policy where
replenishment orders follow a specific schedule: every R periods we make an order to
bring the net inventory level1 to S. When computing the safety stock in such a policy, we
have to take into account the review period R, as well as the up-to level S. You can see in
→Figure 5.3 an example of this kind of policy with a stochastic demand.
Figure 5.3 (R, S) policy with stochastic demand.

How Much Safety Stock?

As the length of the risk-period x is R + L in an (R, S) policy, we have:


τ

(5.1)
S s =z α σ d √ x τ =z α σ d √ R + L

The required safety stocks are proportional to the square root of the sum of the lead
time and the review period. In order to understand why we have to compute the
demand variation over the lead time plus the review period, we have to look at the risk-
period of such a policy. As shown in →Figure 5.4, when a supply planner places an order,
at the time of the review R , the next time she will be able to make an order is at the
1

time of the next review R . Even then, she will still have to wait the supply lead time L
2

before receiving this second order. So when she makes the order at the review period
R she must keep enough safety stock in order to be protected during the total time of
1

the risk-period R + L .
Figure 5.4 risk-period for (R, S) policy.

In other words, the risk-period is now R + L (it was only L with a continuous review
policy).

How Much to Order?

We order enough quantity to bring the net inventory level to the up-to level S (not to be
confused with S the safety stock).
s

S= d L + d R + S s

Q= S − net inventory

When?

We make an order at each review period. Remember, the optimal (but not practical)
review period is based on the EOQ (see Section →3.2):


2kD
Q = √
h


Q
T =
D

From here, we can either round the optimal review period T to a practical number, or

use the power-of-2 policy (see Section →3.2.1):



T k ∗
≤ R = 2 T B ≤ √ 2T
√2
Unfortunately, as the amount of safety stock required is impacted by the review period,
the cost optimization of an (R, S) policy under stochastic demand is not as easy as with
the deterministic EOQ model. We will discuss this cost optimization in detail in Chapter
→8, “→Cost and Service Level Optimization.”

Similarities between (s,Q) and (R,S)

We can easily draw many similarities between an (s, Q) and an (R, S) , and interchange
their respective equations by replacing a few variables as shown in →Table 5.1.

Table 5.1 Similarities between (s, Q) and (R, S) .


Variable Notation (s, Q) (R, S)

Inventory to cover the risk-period ι s S


Length of the risk-period xτ L R + L

Demand over an order cycle dc Q d R = dR

We can express in a very general way the equations that set our policy:
S s = z α σ d √x τ

ι= S s + dx τ

5.1.3 Periodic Review and Order Quantity (R,s,Q)


In practice, many supply chains rely on both a periodic review R and a fixed quantity Q:
“We review the inventory once a week and order a full truck if needed.” These policies are
(much) more difficult to optimize than (s, Q) and (R, S) policies due to the
undershoot U (see →Figure 5.5).

The mathematical optimization of this policy is complex due to the estimation of the
undershoot U that gets rapidly complex—even under restrictive assumptions—and
changes depending on the assumptions made about the lead time and the demand.
Therefore, a mathematical optimization of (R, s, Q) is out-of-scope for this book. You
can nevertheless check →Tempelmeier (→2011) and →Johansen and Hill (→2000) for
more information.
Figure 5.5 Undershoot U under an (R, s, Q) policy.

Instead of using mathematical models to solve (R, s, Q) policies, we can optimize


them—and even more complex ones—with simulations shown in Part →IV, “→Discrete
Inventory Optimization.”

5.2 Inventory Analysis


Now that we have updated our inventory policies with our new safety stock model, we
can shift our mindset from that of a scientist working on a model to that of a business
analyst looking at the inventory levels in a supply chain. Let’s use our model and policies
to answer some interesting business questions:
Do we currently have the right amount of stock?
What is the expected inventory level?
How does my current (or expected) inventory level balance between safety, cycle
and in-transit stock?
How much impact does the safety stock level have on my total inventory?
Before we start to discuss these points, let’s recap the different kinds of inventory we’ve
covered so far:
On-hand This is the physical inventory available in a warehouse for clients to buy.
We divided it into two types of inventory:
Safety The stock kept to guarantee a service level if there is any
demand or lead time fluctuation.
Cycle
The amount of inventory we need through an order
cycle to cover the expected demand.
In-transit The amount of inventory that is currently in-transit from a supplier to
the warehouse.
In practice we can also distinguish between other types of inventory such as:
On-hold The amount of inventory physically in a warehouse but waiting to be
shipped to a client (who already booked it). In some cases, these goods
can stay a couple of days in a warehouse before being shipped, resulting
in extra useless inventory.
Anticipation Some inventory is produced in advance to prepare for a busy season
and stored for when the production (or supply) capacity is not sufficient
to produce on time what will be required.
Merchandising In some businesses, goods are required to fill shelves in stores. The
purpose of this inventory is only related to merchandising, marketing or
branding.

5.2.1 Theoretical Inventory Levels


Let’s compute the theoretically expected inventory levels. We will look at the simulations
later. With the safety stock model, we still have the same expected levels of cycle C and s

in-transit I inventory as with the regular deterministic EOQ model (as discussed in
s

Chapter →3):

Policy Cycle C s In-transit I s Safety S s

Continuous review (s, Q)


1

2
Q dL z α σ d √L

Periodic review (R, S)


1

2
dR dL z α σ d √R + L

The expected on-hand inventory is simply the expected cycle stock C plus the s

expected safety stock S . This means that the on-hand inventory should fluctuate
s

between the bounds [S , C + S ] . Of course, as the demand varies over time, the
s s s

actual on-hand inventory level will fluctuate outside of these bounds (we will see that
in Figures →5.6 and →5.7).
As an inventory analyst, you can estimate how much inventory is missing (if the on-
hand inventory is lower than S ) or how much short-term excess there is (if the on-hand
s

inventory is higher than C + S ). In an (R, S) policy, the net inventory level should
s s

never exceed the up-to level S—except if S decreased abruptly (for example, if the
demand decreases resulting in a lower inventory target).
Inventory Zones

Now that we have computed the expected theoretical inventory levels, we can use these
to assess the quality of our actual inventory. In order to do so, you can use a color-
system to flag inventory. A proposition of thresholds is presented in →Table 5.2.

Table 5.2 Inventory thresholds and color-codes.

Of course, these can be defined differently. For example, the red zone could be
defined as below 25% of the safety stock theoretical level. The thresholds are also
defined based on the on-hand inventory, but you could do the same with the net
inventory level.
We can also easily estimate—based on the actual on-hand level—how much safety,
cycle, excess or missing inventory there is.
5.3 Simulation
Nullius in verba – Take nobody’s word for it. Royal Society motto, originally from the Roman poet Horace

5.3.1 Stock Levels


Now that we discussed the theoretical expected inventory levels, let’s make a simulation
of these policies to see how the inventory level would behave.

Figure 5.6 (R, S) policy with R = 1 ; L=1 , d = N (10, 5 )


2
and α = 99% .
Figure 5.7 (R, S) policy with R = 1 , L=4 , d = N 2
(10, 5 ) and α = 99% .

You can see in Figures →5.6 and →5.7 how a change in lead time impacts the
inventory level, remember that S = d(R + L) + z σ √L + R . We clearly see that, as
α d

the lead time gets bigger (→Figure 5.7), the difference between the up-to level and the
average inventory gets bigger. We also see that, with a longer lead time, the on-hand
inventory level fluctuates much more around the expected average on-hand level.
Another important finding is that it is common for the on-hand inventory level to be
below the safety stock. In other words, it is common to consume part of the safety stock.
This might seem obvious, but it can be confusing for some practitioners. Some see the
“safety” stocks as being there for emergency situations only. This is obviously not the
case here. If you need to have an emergency-only inventory it should be determined out
of the current safety stock model.
We will discuss further the estimation of the on-hand inventory levels in Chapter →8
(see specifically Section →8.4.1).
5.3.2 Service Levels
Since we used simulations to compare actual and theoretical inventory levels, we can do
the same to compare expected and simulated cycle service levels.

As you can see in →Table 5.3, the theoretical and simulated cycle service levels are very
close when the demand coefficient of variation CV is rather low. Remember you can
d

compute CV as:
d

σd
CV d =
μd

And CV (the risk-period coefficient of variation) as


x

σx σ d √R + L σd CV d
CV x = = = =
μx μ d (R + L) μ d √R + L √R + L

Long lead times ( L > R ) and low cycle service levels also drive the gap between the
theoretical expected cycle service level and the actual one.
Table 5.3 Simulated cycle service level (%) over 1,000,000 periods for an (R, S) policy
with R = 4 .
L CV d CV x Theoretical cycle service level (%)
70 80 90 95 99
2
d ∼ N (100, 25 ) 1 .25 .11 70.1 80.3 90.2 95.1 99.0
4 .25 .09 70.2 80.4 90.1 95.0 98.9
10 .25 .07 69.9 80.0 90.2 95.0 99.0
2
d ∼ N (100, 50 ) 1 .50 .22 70.1 80.0 90.0 95.0 99.0
4 .50 .18 69.7 79.8 89.9 95.0 99.0
10 .50 .13 69.5 79.6 89.9 95.1 99.0
d ∼ N (100, 100 )
2
1 1.00 .45 66.4 77.9 89.3 94.7 99.0
4 1.00 .35 64.1 76.3 88.3 94.2 98.9
10 1.00 .27 60.9 73.6 86.7 93.4 98.7

Negative Demand?

Our model assumes that the demand follows a normal distribution. As the demand
coefficient of variation grows, so does the probability that the demand during a period is
negative. Negative demand is not realistic, so in our simulations, we set the minimum
demand to be 0. This results in a gap between the theory (a normal demand) and the
simulation (a truncated normal demand). As the average demand in the simulation is
higher than in the theoretical model, therefore, our simulation shows a lower-than-
expected cycle service level.
With a CV of 100%, there is a 16% chance for the demand during a period to be
d

lower than 0.2


In the (common) case of highly variable demand, we should look into new statistical
distributions such as gamma (see Chapter →9, “→Beyond Normality”) or custom
distributions (see Chapter →12, “→Discrete Probabilistic Demand”).

Backorders or Lost Sales?

One of the main assumptions we made in our model is that the excess demand would
result in backorders until new stock is available. In other words, if a client comes with an
order and there is no stock available, her order will be put in the backlog and served as
soon as new stock is available. The client’s demand is not lost but backordered.

Backorders
In many businesses—especially in B2B—this assumption is correct. If you have some
excess demand during one order cycle, at least part of it will be pushed to the next cycle.

Lost Sales

In other businesses, this assumption is not correct. Clients won’t wait or simply will go to
the competition, resulting in lost sales. The mathematics to compute the required safety
stock under the assumption of lost sales are out of our scope,3 but we can include this
effect in a simulation and see its impact on the service level. Note that, in a lost sales
model, the net inventory can never be negative, because there are no backorders.
As shown in →Table 5.4, if the excess demand is lost (and not backordered), the cycle
service level increases. This is normal, as the incoming orders are not used to fill
previous orders but are only used to deliver to new clients in subsequent periods. The
spread between an inventory policy with backorders, and one with lost sales, grows as
the cycle service level decreases because it results in more and more stock-outs (so that
the backorder policy needs to keep more stock aside to fill the backlog rather than new
clients).

Table 5.4 Simulated cycle service level (%) over 1,000,000 periods for an (R, S) policy
with R = 4 and d ∼ N (100, 25 ) and lost sales.
2

L Theoretical cycle service level (%)


70 80 90 95 99
Backorders 1 70.0 80.1 90.2 95.1 99.0
Lost sales 1 74.8 82.6 91.0 95.4 99.0
Backorders 4 69.6 80.0 90.0 94.9 98.9
Lost sales 4 75.5 83.5 91.5 95.5 99.0
Backorders 10 70.4 80.4 90.2 95.2 99.1
Lost sales 10 81.2 86.9 93.0 96.3 99.2

Period Service Level

Our model is setting a safety stock to achieve a cycle service level α, but many supply
chains record (and are interested in) the period service level αp

As a reminder,
The cycle service level α is the probability not to have a stock-out during a cycle
order (which can contain multiple periods).
The period service level α is the probability not to experience a stock-out during
p

a single period (e. g., a day, a week).


Our safety stock model is based on the cycle service level. It does not provide us a
prediction about α , so we need to simulate it.
p

Table 5.5 Simulated cycle and period service levels (%) over 1,000,000 periods for an
(R, S) policy with L = 4 and d ∼ N (100, 25 ) .
2

Service level R Theoretical cycle service level (%)


70 80 90 95 99
Cycle α 1 70.2 80.3 90.3 95.1 99.0
Period α p 1 70.2 80.3 90.3 95.1 99.0
Cycle α 4 69.8 80.2 90.1 95.0 99.0
Period α p 4 92.1 94.9 97.5 98.7 99.7
Cycle α 10 69.8 79.8 90.0 95.0 99.0
Period α p 10 96.5 97.7 98.9 99.5 99.9

As you might expect, when the review period R grows (i. e., more time elapses
between two consecutive orders), so does α . You have multiple periods in one cycle
p

order, so that even though you could be out-of-stock by the end of the order cycle, most
of the periods during this cycle could still have had enough inventory. The impact is
especially impressive for small values of α. In →Table 5.5, you can read the case where
R = 10 and the theoretical cycle service level is 70% as follows (let’s say each period is

a working day): “If we make an order every 2 weeks (10 days) and aim for a cycle service level
of 70%, we can expect a probability of only 3.5% of stocking out on any given day.” We
conclude that it makes no sense to use cycle service level as a service level KPI if the
supply order cycles are long compared to the daily activities of a supply chain. To
overcome the limitation of the cycle service level, we will discuss the fill rate later in
Chapter →7.
5.4 Recap
We have created an initial safety stock model where the safety stocks are meant to
protect us against the demand variation.

S s =z α σ d √ R + L (see eq. 5.1 in Section 5.1.2)

These safety stocks are proportional to:


The demand standard deviation σ (in other words, the more the demand
d

fluctuates, the more safety stocks we’ll need)


To the cycle service level α we want
To the square root of the lead time plus the review period (if any)
We took the following assumptions to make our model:
The demand is independently distributed in each period.
The demand is assumed to be normally distributed and continuous.
Excess demand is backordered (no lost sales).
The lead time is deterministic.
Let’s recap our two favorite inventory policies so far:
6 Stochastic Lead Times

So far we have created a safety stock model— S = z σ √R + L (see eq. →5.1 in


s α d

Section →5.1.2)—that is able to deal with stochastic demand and deterministic lead
times. That was a good improvement from the EOQ model where both the demand and
the lead time were assumed to be determined and known in advance. But most of the
real supply chains actually face stochastic lead times: you never know if your supplier—
or your (production) process—will deliver your order on time. Therefore, we want our
safety stocks to protect us against longer-than-expected lead times, as well as against
variable demand.
We will improve our model in two steps:
1. First, we will assume that the demand is fixed and the lead time varies.
2. Then, we will assume that both the demand and the lead time vary.
By the end of this chapter we will model our supply chain as shown in →Figure 6.1.

Figure 6.1 Supply chain model.

6.1 Lead Time: What Is It Made of?


Before jumping into the mathematical models, an important point to realize is that the
lead time in the safety stock model is not limited to the transportation time. It does
actually include all kinds of other waiting times that accumulate along the supply chain
and result in the need for more safety stock. It is therefore a pity that most supply chain
practitioners confuse lead time and transportation time. The time it takes for a truck (or
boat, train, plane) to move goods from point A to point B is not the only delay between
the time a planner places an order and the time the goods are available in her
warehouse.
Let’s review one-by-one all the possible delays and waiting times.
Review period In a periodic review policy (as discussed in Chapter →1) this is the time
between two consecutive orders. Typically a day, a week or a month.
Production frequency
Time between each production batch. Typically, you might want to
produce some goods once every 6 months or so. So when a production
order is made, you might want to produce enough to cover 6 months of
demand. The production frequency is a specific case of the review
period where you set the review period based on production cycles.
Frozen period Period during which production planning is frozen: no changes are
allowed. This frozen period is forcing production planners to fix the
production schedule for subsequent weeks in order for the operational
teams to properly plan their different agendas.
Production time Time needed to produce the goods. The products currently under
production are called work-in-progress (WIP).
Planning time Time needed for production planning and/or to plan the transportation
of the goods (in or out of a warehouse for example).
Preparation time Time needed to pick the goods and prepare the order (can also
include administrative tasks).
Transportation time Time needed to move stock from one location to another. This is
what most practitioners consider as being the (total) lead time. We call
the inventory being transported from one warehouse to another the in-
transit inventory. Computing the transportation time is not always
straightforward:
In the case of multimodal shipments, you might need to include
some extra handling time on top of the transportation time.
Sometimes suppliers deliver the goods up to a port (or an external
warehouse). Their quote will only include the transportation time up
to this point. You will then need to take into account additional
transportation time to include the transportation of the goods from
this external warehouse to your main warehouse.
You might also have to take custom time into account.
External events External (unexpected) events like strikes, thefts, storms, earthquakes
or black swans like the coronavirus can also impact total lead time.

Lead Time Variability


The total lead time is often variable. You can never know exactly when a specific order
will be delivered. These fluctuations can be due to many factors: process variability,
production constraints, lack of raw materials, mistakes, defects, planning constraints
and so on.
6.2 Stochastic Lead Time and Fixed Demand
Let’s assume that we have a product that we sell consistently the same amount every
day. Because the supplier is not as reliable as we wish it to be, we will model its lead
time as a normal distribution.1 Mathematically, we can express this as:
2
Lead time ∼ N (μ L , σ L )

This means that a supplier can be late or early compared to its announced time of
arrival.2
If it is late, we have a potential issue with our on-hand inventory at risk of being
depleted.
If it is early, we would have too much inventory on-hand resulting in higher (useless)
holding costs.
You can see in →Figure 6.2 the probability density function of our supplier lead time
if the supply process follows a random normal distribution with a mean of 20 and a
deviation of 5.

Figure 6.2 Expected lead time.

Just as for the stochastic demand (see Table →4.2) we can estimate the probability for
the demand during the (stochastic) lead time to be below a certain threshold thanks to
its cumulative distribution function (CDF). For example, as shown in →Figure 6.2, there is
a 10% probability that the lead time is longer than μ + 1.22 σ resulting in a 10%
L L

probability that the demand during the lead time is higher than d(μ + 1.22 σ ) .
L L
Let’s generalize our findings to compute the amount of safety stock we need to protect
our supply chain against lead time variations. This safety stock will be computed as:
the service level factor z (as discussed in Section →4.2.4),
α

times the lead time standard deviation σ ,


L

times the average demand μ . d

We finally obtain:
S s =z α μ d σ L (6.1)
6.3 Stochastic Lead Time and Demand
We now have two different safety stock models:

One for stochastic demand and fixed lead times: S = z σ √R + L (see eq.
s α d

→5.1 in Section →5.1)


Another for fixed demand and stochastic lead times: S = z σ μ (see eq.
s α L d

→6.1 in Section →6.2)


In order to deal with both variable demand and lead times, we have to bring these two
models into a single unified model. In other words, we have to define the probability
function of the demand over the lead time while both are random.

6.3.1 The Sum of a Random Number of Random Variables


The demand over the lead time is now defined as
the sum,
of a random number (the lead time),
of random variables (the demand).
As an analogy, you can imagine throwing a first die (representing the random lead
time), then, based on the result obtained, throwing an equivalent number of dice. Each
die of the second throw represents the (random) demand during one period. We are
interested in the probability distribution of this second throw.
To compute this, let’s define C as C = A ⋅ B where A and B are random variables. In
other words, C is a random distribution equal to the sum of a random number A of
random variables B. Now we have to define the expected value of C ( E[C] ) as well as its
variance ( V [C] ). Assuming A and B are independent3 we have,
E[C]=E[A]E[B] (6.2)

V [C]=E[A]V [B] + V [A]E[B]


2 (6.3)

The proof is given in Appendix →B.1. Note that, if A and B are normally distributed (as
assumed), so is C.

6.3.2 Fixed Reorder Point (s,Q)


If we replace (in eq. →6.2) A by the lead time, B by the demand and C as the demand
over the lead time, we obtain:
E[C] = E[A]E[B] ⇒ μ dL = μ L μ d

2 2 2 2
√ V [C] = √ E[A]V [B] + V [A]E[B] ⇒ σ dL = √ μ L σ + σ μ
d L d

So the demand over the lead time behaves as N (μ μ , σ μ + μ σ ) . Specifically, as


L d
2
L
2
d L
2
d

the risk-period4 is the lead time in an (s, Q) policy, the standard deviation of the
demand over the risk-period is:

2 2 2
σ x = σ dL = √ μ L σ + σ μ
d L d

You can see in →Figure 6.3 how a stochastic lead time impacts an (s, Q) policy.
Figure 6.3 (s, Q) policy with stochastic demand and lead time.

We can then compute the required safety stock as:


Ss = zα σx (6.4)

2 2 2
σ x = √μ L σ + σ μ
d L d

2 2 2
S s =z α √ μ L σ + σ μ
d L d

6.3.3 Fixed Review Period (R,S)


In the case of a periodic review policy (R, S) , we have to refine this model one step
further by taking into account the periodic review. We have to protect ourselves against
the demand variation over the lead time plus the review period. As shown in →Figure
6.4, the elapsed time between when we make an order and the reception of the next
order is:
2 2
R + L ∼ R + N (μ L , σ L ) = N (R + μ L , σ L )

See Section →5.1.2 for a detailed explanation of the case where both R and L are
deterministic.
Figure 6.4 (R, S) policy with stochastic demand and lead time.

The demand deviation over the risk-period is:

2 2 2
σ x = √ (μ L + R)σ + σ μ
d L d

We can then update our safety stock model by taking into account the review period:
Ss = zα σx (6.5)

2 2 2
S s = z α √ (μ L + R)σ + σ μ
d L d
6.4 Simulation
The model we created to compute the required safety stock is not a perfect
representation of reality. However, we can test it further through simulations. In order
to do so, let’s return to the simulation we created in Chapter →5 and add random lead
times.
6.4.1 Results and Limitations
We now have a powerful model that can allocate safety stocks based on both the lead
time variation and the demand variation.
As usual, our model makes some assumptions about the lead time. These are
necessary in order to obtain tractable mathematical models; but these assumptions
might not be realistic, resulting in over- or under-estimation of the expected service
level. Let’s review them one by one.

Continuous Lead Time


The model assumes the lead time to be a continuous normal random variable.
However, in practice, the lead time will often be a discrete variable since an order can
only be received and stored at fixed periods (e. g., at the start/end of the day/shift) or
can only be shipped at certain point in time (e. g., the supplier makes one delivery per
day). This is also what we do in our simulations where orders can only be received at the
end of a timestep.
As you can see in →Table 6.1, the stochastic lead times model often deviates from the
expected cycle service level target. The actual service level is close to the target in cases
where:
R ≫ L ≫ σL

We see this for example when R = 50 , L = 20 , σ L = 5 .

Table 6.1 Simulated cycle service level (%) over 1,000,000 periods for an (R, S) policy
with d ∼ N (100, 25 ) . 2

μL σL Theoretical cycle service level (%)


R = 1 R = 50

70 80 90 95 99 70 80 90 95 99
10 1 45.9 58.5 73.5 83.1 93.1 69.8 79.7 89.8 94.7 98.9
5 59.4 81.2 95.5 98.9 99.9 70.5 80.0 89.6 94.9 99.0
10 67.7 92.0 99.5 100.0 100.0 70.2 79.8 90.0 94.9 99.0
20 1 49.1 61.5 76.0 85.0 94.5 69.8 80.0 89.9 94.9 98.9
5 59.3 80.6 95.1 98.7 99.9 70.1 79.8 90.0 94.8 98.9
10 69.7 91.8 99.4 100.0 100.0 69.9 80.1 90.2 95.0 99.0
40 1 52.5 65.0 78.8 87.3 95.9 70.3 80.1 89.5 95.0 98.9
5 59.3 79.6 94.4 98.5 99.9 69.8 80.1 89.7 94.9 99.0
10 69.3 91.4 99.3 99.9 100.0 70.1 79.9 89.9 95.0 98.9

In many other cases, the actual cycle service level is much lower than expected.
Especially when the lead time coefficient of variation and the cycle service are low (
CV L< 25% ). Generally, the shorter the lead time variation, the bigger the spread is

between the discrete values in the simulation and the continuity assumption of our
model, resulting in a discrepancy between the expected service level and the observed
level.
To summarize, we have to conclude that the stochastic lead time model is not robust
and will only achieve the expected results in a few cases. If you face random lead times,
you should rely on policy optimization via simulation rather than models. We will do this
in Chapter →13, “→Simulation Optimization.”
We will see later in Chapter →7, “→Fill Rate,” (specifically in Section →7.5.1), that our
stochastic lead time model gives more appropriate results when measuring the fill rate
rather than the cycle service level.

Lead Time Independence

Just as for the demand, our model assumes that the lead times of different orders are
independent from each other. Again, in practice, this is not true. If a supplier is late to
deliver an order one week, it is likely to be late the next week as well—maybe it is
currently overloaded.
Our model also assumes—implicitly—that two orders can cross each other. This
means that a first order O could be delivered after a second order O (that was
1 2

ordered afterward). In practice these cases are rather exceptional: orders should be
delivered in the sequence they were ordered. This limitation has been discussed since
the 60s at least,5 but modeling mathematically this sequencing results in complex
models.

Normality

In practice, the lead time probability distribution is not normal but often looks like a
right-curved bell: the supplier is most of the time on-time, only a few times late and
nearly never early.
We have to refine our model further. We will discuss skewed probability functions in
Chapter →9, “→Beyond Normality,” and discrete optimization with custom distributions
in Part →IV, “→Discrete Inventory Optimization.”

6.5 Recap
We have created a unified safety stock model that protects us against two different
sources of variation:
1. The demand over the lead times variation.
2. The demand variation over the average lead time.
We compute the safety stock as:

2 2 2
S s =z α √ (μ L + R)σ + σ μ (see eq. 6.5 in Section 6.3.3)
d L d

where
μL + R are the average lead time and the review period (if any)
σd is the demand standard deviation
μd is the average demand
σL is the lead time standard deviation
zα is the service level factor
We now have the ability to create two much stronger inventory policies which can deal
with a variable lead time, a review period (if any) and a stochastic demand.

This model still makes some strong assumptions about the demand and the lead
time:
They are both continuous and normally distributed.
The demand is independently distributed in each period and independent from
the lead time.
Excess demand is backordered.
Different orders can cross each other.
Part III Advanced Stochastic Models
7 Fill Rate

7.1 Service Level Definition


Until now we have used the cycle service level α as the metric to measure the service level.
Remember that the cycle service level is the expected probability that during an order cycle there
is no stock-out. For example, for a supply chain with a weekly order cycle, a cycle service level of
95% means that you will have enough stock to fulfill your demand 19 weeks out of 20.1
But the cycle service level does not say how much in backorders (or lost sales) you can expect
during a cycle. In the example above, you know you can expect to run out-of-stock once every 20
weeks, but you do not know how much excess demand you will face due to lack of stock.
Remember, the excess demand is the demand that cannot be served directly from the on-hand
inventory. Actually, you might be able to fulfill 99% of the demand on-time through the year,
achieving a very high fill rate even if your cycle service level is lower. The fill rate β is defined as
the expected part of the demand you will be able to serve directly from your inventory (it is also
often called volume fill rate in order to avoid any confusion with the order fill rate). Mathematically,
we compute it as 1 minus the expected excess demand divided by the expected total demand over
an order cycle.
excess demand (over the order cycle)
β = 1 −
demand (over the order cycle)

We can also express the fill rate based on the number of units short noted U : s

Us
β = 1 −
dc

Where d is the expected demand over an order cycle (remember, an order cycle is the period
c

between two consecutive orders), it is computed based on the inventory policy:


Q if (s, Q)
dc = {
dR if (R, S)

As you can see in →Figure 7.1, the expected fill rate is actually higher than the cycle service level
(assuming a stationary normal demand)—especially for low service levels. In the example shown
in →Figure 7.1 (and the following Example box), when α = 21% , β = 77% . That’s a difference of
56 points!
Figure 7.1 Service levels for d c = 100 and σ x = 25 .

As a metric for a supply chain service level, the fill rate often makes more sense than the cycle
service level. Especially when the order cycles are long (we will discuss this in Section →7.4). On
the other hand, the fill rate is more difficult to record than the cycle service level:
In order to compute the cycle service level, you just have to see if your stock goes to zero
during an order cycle (assuming that some demand is unmet as soon as the item is out-of-
stock, which is not always true).
In order to properly record the fill rate, you need to be able to record the excess demand.
If the excess demand is backordered (i. e., the excess demand is kept in a backlog until
inventory is available) this is easy since the total demand is known (as shown in →Figure
7.3). This is usually the case in B2B.
If the excess demand is lost, measuring the fill rate can become difficult. This is usually
the case in B2C. For example, a client who doesn’t find a product on a shelf won’t always
mention it to the retailer.

7.1.1 Curse of Lost Sales


As shown in →Figure 7.2, not being able to measure lost sales will result in a vicious circle.
Because you can’t measure the true demand, you will use the sales as a proxy and therefore will
most likely under-evaluate the demand.2 As you start to underestimate the demand in your
forecast, you will produce or deploy fewer products resulting in a bigger part of lost sales (that is
not measured), resulting in a lower forecast. And so on. A virtuous circle between demand and
inventory can be achieved when all the demand is properly recorded as shown in →Figure 7.3.

Figure 7.2 Lost sales vicious circle.

Figure 7.3 Backorders virtuous circle.

This effect is also called the “Spiral-down effect” in field of revenue management3—a discipline
where it has been observed and analyzed.4
Measuring lost sales is unfortunately not possible for every business. Just think about a
grocery store: the customers won’t go to the cashier to mention they couldn’t find the chocolate
bar they wanted to buy. They’ll simply buy another snack instead.
Unconstraining the Demand

Instead of recording the lost sales, you can try to estimate them. This is called unconstraining the
demand. One simple—but not perfect—way to do this is to use a smart forecast model.5 When
you are out-of-stock during a certain period, instead of using the sales as a proxy for the demand,
you can estimate the demand as the initial forecast for this period. Your forecast is then used as a
proxy for the lost sales—it is actually your best guess. In other words, when you are out-of-stock,
your forecast is a better estimation of the demand than the actual sales. Of course, in order to
apply this technique, you will have to record your inventory level over time to track out-of-stocks.

7.2 Expected Unit Shorts

7.2.1 Normal Loss Function


Let’s model the expected fill rate that we are looking for (see →Figure 7.4, our current supply
chain model). The question we ask ourselves is the following: “If I have ι pieces at the beginning of
the risk-period,6 what is the expected amount of excess demand (or units short) I am likely to face?”
Figure 7.4 Supply chain model.

Before looking at an equation, let’s try to express in plain English how to compute the
expected amount of units short over the risk-period. This is the same as the expected excess
demand over this risk-period.
The expected excess demand (or number of units short) over the risk-period is the sum of:
Each possible value of the demand d, that is higher than the initial inventory level ι,
times the probability f (d) of the demand d to materialize,
times the number of units short d − ι (i. e., the difference between the demand d and the
inventory ι).
As we model the demand as a continuous distribution function “over each value of the demand d
that is higher than inventory level ι,” is translated into an integration over d from d = ι to d = ∞ ,
so that we obtain this elegant formulation:

U s = L (ι) = ∫ (d − ι) f (d) dd

d=ι

where 𝓛(ι) is the demand loss function evaluated at ι, and f (d) is the demand probability density
function7 of d (over the risk-period). For the sake of clarity, we simplify the notation, by using f (d)
instead of f (d) .
Dx

If we assume d ∼ N 2
(μ x , σ x ) over the risk-period, we have:

U s = L N (ι; μ x , σ x )= ∫ (d − ι) ⋅ f (d) dd

d=ι

∞ ∞

= ∫ d ⋅ f (d) dd − ι ∫ f (d) dd

d=ι d=ι

2
= σ x f (ι) + μ x (1 − F (ι)) − ι(1 − F (ι))

2
𝓛 𝓝 (ι;μ x ,σ x )=σ x f (ι) + (μ x − ι)(1 − F (ι))

where f (d) and F (d) are respectively the PDF and CDF of the demand d over the risk-period
(assumed to be normally distributed).
The proof is shown in Appendix →B.2. Note that this solution to the loss function only applies
to a normal distribution (we call L (ι; μ, σ) the normal loss function).
N
7.2.2 Standard Normal Loss Function
Usually, academics prefer to use the standard normal loss function 𝓛 N (x) :
L N (x)= L N (x; 0, 1)

2
= σ f (x) + (μ − x)(1 − F (x))

2
= 1 φ(x) + (0 − x)(1 − Φ(x))

𝓛 N (x)=φ(x) − x(1 − Φ(x))

You can use the standard normal loss function L N (x) to compute the expected units short of
any normal distribution. It can be shown that:
x − μ (7.1)
𝓛 𝓝 (x;μ,σ)=σ ⋅ 𝓛 N ( )
σ
7.3 Fill Rate Model

7.3.1 Expected Fill Rate


We can now compute the expected number of units short U over the risk-period based on the
s

initial on-hand inventory level ι.


U s = L N (ι; μ x , σ x )

where (see →Table 7.1 for the exact expressions):


μx is the demand during the risk-period
σx is the demand deviation during the risk-period
ι is the inventory at the beginning of the risk-period
Table 7.1 d , μ , σ and ι for (R, S) and (s, Q) policies.
c x x

Policy dc μx σx ι
(s, Q) Q dL
√ Lσ
2 2 2 s
+ σ μ
d L d

(R, S) dR d(R + L)
√ (R + L)σ
2 2 2 S
+ σ μ
d L d

We are actually interested in determining the expected amount of units short over an order cycle
(an order cycle is the period between two consecutive supply orders). During an order cycle, we
assume we only witness units short during the risk-period.8 It follows that the expected number
of units short over the risk-period is the same as the expected number of units short over the full
order cycle.
We can then compute the expected fill rate over an order cycle as:
Us L N (ι; μ x , σ x )
β = 1 − = 1 −
dc dc

where d is the expected demand during an order cycle.


c

Using eq. →7.1 (see Section →7.2.2) we can compute the fill rate based on the standard normal
loss function.
ι − μx
U s = L N (ι; μ x , σ x ) = σ x L N ( )
σx

Us σx ι − μx
β = 1 − = 1 − LN ( )
dc dc σx

This answers the question, “If I have ι pieces at the beginning of the risk-period, what is the expected
amount of excess demand (or units short) I am likely to face?”
Safety Stocks

Let’s imagine that you have a certain amount of safety stock S . What is the service level you can
s

expect? We defined ι as “the available quantity at the beginning of the risk-period,” which is the sum
of the expected demand over the risk-period μ and the safety stock S . We then have,
x s

ι = μx + Ss

σx ι − μx
β= 1 − LN ( )
dc σx

σx (μ x + S s ) − μ x
= 1 − LN ( )
dc σx

σx Ss
= 1 − LN ( )
dc σx

So we have this relationship between the fill rate β and the amount of safety stock S : s

σx Ss
β=1 − 𝓛N ( )
dc σx

Remember that, by definition (see Section →4.2.4), the service level factor z is computed as:
Ss ι − μx
z = =
σx σx

Meaning that we can also compute the expected fill rate based on the service level factor:
σx
β=1 − 𝓛 N (z)
dc

Actually, the question is most often asked the other way around:
“If I want to get a fill rate of 95%, how much safety stock should I keep?” We already answered a
similar question with the cycle service level in Chapter →4, “→Safety Stocks” (see Section →4.2.4).
We had this relationship:
−1
Cycle service level = α ⇔ z α = Φ (α)
We can do the same for the fill rate:
σx d c (1 − β)
−1
Fill rate = β = 1 − 𝓛N
L N (z β ) ⇔ z β = ( )
dc σx

We want to achieve a fill rate β, and in order to do this we need to compute the service level factor
z , based on the inverse of the normal loss function.
β

However, an issue remains. There is no mathematical formula to compute the inverse of the
standard normal loss function. Should we then stop here? No, we have other tools at hand.

7.3.2 Inverse Loss Function


If we cannot compute the exact inverse standard normal loss function, we can nevertheless solve
it by using either a solver or an approximation.

Solver

We can use a solver to minimize the difference between the desired number of units short and
the expected number of units short.
The desired number of units short is simply derived from the fill rate β and the cycle demand d : c

U s = d c (1 − β)

The expected number of units short based on z is:


U s = σ x L N (z)

Now, we want the expected and desired number of units short to be equal:
σ x L N (z) = d c (1 − β)

In other words, we have to find the value of z that minimizes the absolute difference between:
d c (1 − β)
L N (z) and
σx

We express this mathematically as:


d c (1 − β)
z = arg min z [ L N (z) − ]
σx

which means that z is the value that minimizes the absolute difference between L N (z) and
d (1 − β)/σ .
c x

To compute this, we can use a solver (in Excel or Python).


Approximation

In 2016 two researchers—Andrade and Sikorski—published a polynomial approximation to the


inverse standard normal loss function.9 This approximation works quite well and can be used to
find z without using a solver. Nevertheless, it requires the evaluation of a 12th degree
β

polynomial at the logarithm of the value we want to inverse. In other words, L (x) is
−1

approximated as:
−1
L (x) ≃ a 0 + a 1 log (x) + a 2 log (x) + a 3 log (x) + ... + a 12 log (x) + ϵ
N

Where the various coefficients a to a


0 12 are defined below.
7.4 Impact of Order Cycle Length

7.4.1 (R,S) Policy


The cycle service level is only linked to the safety stock. An increase of the review period (e. g.,
going from a weekly order to a monthly order) would always result in a lower cycle service level if
the safety stock level is left constant. This is obvious: you face more volatility, so you need more
protection.
But, this is no longer the case when using the fill rate. As we have seen, it has a very
interesting property: it is impacted by both the cycle demand and the safety stock.

When Do We Take Risks?

When we have a simple inventory policy (as shown in →Figure 7.5), we understand that the high-
risk period is the one preceding the reception of an order. This is the time when the on-hand
inventory is at its lowest point; this is when the risk of running out-of-stock is at its peak. In other
words, it is when you are about to receive the order from your supplier, that your stock is at its
lowest point: this is when you face the most risk to run out of stock.

Figure 7.5 Policy with short review periods.

As shown in →Figure 7.6, if we make less frequent orders—but order more at once—we get a
policy with less of these high-risk periods. This means that we are safe during most of the order
cycle since we have ample cycle stock left. It is only at the end of the order cycle that we are in a
riskier situation.

Figure 7.6 Policies comparison.

For these long order cycles, the fill rate is guaranteed by the massive amount of cycle stock.
The safety stock is only required to buffer the last period of the order cycle. On the other hand,
the cycle service level is not guaranteed by the cycle stock; the only thing that matters is how likely
the safety stock will be enough to resist the high-risk period at the end of the cycle.
Actually, if you analyze the fill rate and the cycle service level for varying review periods, ceteris
paribus, you see that the fill rate virtually doesn’t change whereas the cycle service level only
decreases. As the order cycle gets longer, the difference between the fill rate and the cycle service
level increases. Therefore using the cycle service level as a service level metric makes less sense.
As you can see in →Figure 7.7, the cycle service level can be around 60–70% for long cycles despite
a fill rate of around 95%.

Figure 7.7 Service levels for d ∼ N 2


(100, 25 ) with 50 pieces of safety stock.

7.4.2 (s,Q) Policy


A similar effect arises with production batches. In an (s, Q) policy, if the production batch Q
increases, the amount of safety stock can be decreased to achieve a similar fill rate.

7.4.3 Mathematical Analysis


Now that we understand the business intuition behind the fill rate and its relation to cycle stocks,
we can look at the mathematics involved. Let’s imagine that we have a fixed amount of safety
stock S . These are the service level metrics to expect:
s

−1
Ss σx −1
Ss
α = Φ ( ) β = 1 − L ( )
N
σx dc σx

(R,S) Policy

We have

2 2 2
dc = d ⋅ R σ x = √ (R + L)σ + d σ
d L

If we increase R,
α will decrease as σ increases and S stays constant.
x s

β will change, but the direction is not straightforward:


1. σx
should decrease (approximately) proportionally to √R as
dc

σx will increase at worst by √R (if L is deterministic).


dc will increase proportionally to R.
2. L
−1

N
(S /σ ) will increase as S is constant and σ increases.
s x s x

This means that the relationship between the fill rate β and R can’t be easily computed and can go
in both directions; on the other hand, an increase in R can only result in a decrease of α.

(s,Q) Policy

We have

2 2 2
dc = Q σ x = √ Lσ + d σ
d L

If we increase Q,
α is not impacted.
β increases as the expected lost sales per cycle stays constant but the cycle gets longer.
Increasing the order quantity (or the batch size) will result in a higher fill rate. Again, this extra
service level doesn’t come for free: you also get a higher amount of cycle stock as C = Q/2 . s
7.5 Simulation
As shown in →Table 7.2, our model works remarkably well for policies with a demand coefficient
of variation ( CV = σ /μ ) below 50%.
d d d
Table 7.2 Simulated cycle service level (%) over 1,000,000 periods for an (R, S) policy with R = 4 .
L CV d CV x Theoretical fill rate (%)
70 80 90 95 99
2
d ∼ N (100, 25 ) 1 .25 .11 69.9 80.0 90.0 95.0 99.0
4 .25 .09 69.9 79.9 90.0 95.0 99.0
10 .25 .07 70.0 80.0 90.0 95.0 99.0
2
d ∼ N (100, 50 ) 1 .50 .22 69.9 79.9 90.0 95.0 99.0
4 .50 .18 69.7 79.8 89.9 95.0 99.0
10 .50 .13 69.7 79.7 89.8 94.9 99.0
d ∼ N (100, 100 )
2
1 1.0 .45 69.0 79.4 89.9 95.0 99.0
4 1.0 .35 67.6 78.2 89.0 94.6 99.0
10 1.0 .27 66.2 76.8 88.0 94.0 98.8

Negative Demand
As CV grows, so does the spread between the theoretical model and the simulation. This is due
d

to the fact that our simulation forbids negative demand (as discussed in Section →5.3.2,
“→Negative Demand?”). We will solve this limitation by using a strictly positive demand
distribution in Chapter →9, “→Beyond Normality.”

7.5.1 Random Lead Times


As we saw in Section →6.4, random lead times resulted in rather different actual cycle service
levels compared to our theoretical expectations. This is actually not surprising because the length
of an order cycle depends on the lead time (see Section →4.1). As you can see in →Table 7.3, the
simulated fill rates are much closer to the theoretical targets. This is reassuring because it means
that our stochastic lead time model from Chapter →6 gives usable results and can therefore be
used.
Table 7.3 Simulated cycle service level (%) over 1,000,000 periods for an (R, S) policy with R = 4 .
μL σL CV d CV x Theoretical fill rate (%)
70 80 90 95 99
2
d ∼ N (100, 25 ) 4 1 .25 .15 69.4 79.2 89.1 94.1 98.4
4 2 .25 .27 67.5 77.5 87.7 92.9 97.7
10 1 .25 .10 69.3 79.0 89.1 94.2 98.5
10 2 .25 .16 67.9 77.6 87.7 93.0 97.8
10 5 .25 .36 81.0 88.5 95.4 98.0 99.7
2
d ∼ N (100, 50 ) 4 1 .50 .22 69.5 79.1 89.1 94.1 98.4
4 2 .50 .31 67.9 77.5 87.4 92.7 97.7
10 1 .50 .15 69.9 79.4 89.2 94.3 98.6
10 2 .50 .20 68.6 77.9 87.7 93.1 97.9
10 5 .50 .38 79.8 87.4 94.5 97.6 99.6
d ∼ N (100, 100 )
2
4 1 1 .38 67.8 77.7 88.2 93.7 98.5
4 2 1 .43 66.2 75.6 86.2 92.0 97.5
10 1 1 .28 66.6 76.6 87.6 93.4 98.5
10 2 1 .30 65.5 75.0 85.7 92.0 97.6
10 5 1 .45 74.4 82.4 91.1 95.4 98.9
7.6 Recap
The fill rate service level is defined as the expected amount of demand that will be served from
the on-hand inventory directly. The fill rate is impacted by the cycle stock as well as by the safety
stock; whereas the cycle service level was only impacted by the safety stock.
We have developed mathematical tools to compute how much safety stock we need in order
to achieve a certain fill rate, therefore we can update our policies:
8 Cost and Service Level Optimization
Pecunia Nervus Belli – Money is the soul of war.
Ancient Roman quote

We discussed how much stock we need to achieve a desired service level in Chapter →4
through →7. We implicitly assumed that we had a good reason to desire this specific service level.
Supply chain managers often will aim for a 95% or 99% “service level” (it is not always clear if they
mean cycle service level or fill rate). But are these values optimal? Should we aim for 80% or for
99.5%? In order to answer this question, we will have to look at the total cost of our inventory
policies... and minimize it.
Service level is merely used as a mean to reach the real goal: profit.

8.1 Profits and Losses


Let’s start our profit maximization (or cost minimization1) journey with a general expression of
the profits as below:
Prof its= Sales − Purchasing costs − Holding costs − Transactions costs

−Backorders costs

Our profits are basically our sales incomes minus the purchasing,2 holding, transaction and
backorder costs. So that, over a period (a week, month, year, review period...), we have:
Prof its = (p − c) ⋅ Demand − h ⋅ (On-hand + In-transit) − k ⋅ Transactions − b ⋅ Backord

where,
p is the selling price per unit
c is the purchasing (or production) cost per unit
h is the holding cost per period per unit
k is the fixed cost of a single transaction
b is the cost of backlogging a unit
Let’s review this expression in detail:
Demand We assume that all the excess demand is backlogged (i. e., excess demand does
not result in lost sales but in backorders) so that the sales over a period are equal
to the demand over this period. The profits resulting from the sales are then
simply the period demand d multiplied by the margin p − c (selling price p minus
the purchasing cost c).
On-hand inventory We assume the (expected) average stock on-hand during a period to be the
safety stock S plus the cycle stock C (see →Table 8.1 for a recap, or Chapter
s s

→5, “→Inventory Policies,” for a detailed discussion about S and C ).


s s

In-transit inventory On top of this, the in-transit inventory I is also sometimes incurring
s

holding costs (see Section →3.1 for more details). This is the case when, for
example, the supply source is internal rather than an external supplier.
Remember, the inventory in-transit is the amount of inventory that is shipped by
the supplier but not yet received, and I = dL (see eq. →3.4 in Section →3.2).
s

Transactions The average transaction costs per period are equal to k (the cost of one
transaction) times the number of transactions during the period.
Backorders The expected costs due to backorders are the unit backorder cost b times the
expected number of units short over the period.
Remember, the unit backorder cost b represents all the costs related to putting
one item in the backlog. These costs can be penalties or loss of goodwill (see
Section →2.1.3).

For the sake of simplicity, we will look at the (inventory) costs rather than the profits (leaving aside
sales and purchasing costs), and we will leave the in-transit inventory aside (assuming we do not
incur holding costs for it). As shown in →Figure 8.1, we then have:3
Costs=h ⋅ On-hand + k ⋅ Transactions + b ⋅ Backorders (8.1)

We will also focus on normally distributed demand in this chapter (you can find a general proof in
Appendix →B.4).

Table 8.1 Stock levels.


(s, Q) (R, S)

Safety stock Ss z σx

Cycle stock Cs Q/2 dR/2

In-transit stock Is dL

Backorders Us σ x L N (z)

demand deviation over the Risk-period σx


√ Lσ
2 2 2
√ (R + L)σ
2 2 2
+ μ σ + μ σ
d d L d d L

Figure 8.1 Supply chain model.


Let’s now minimize the inventory costs for both the (R, S) and the (s, Q) policies.

8.2 (R,S) Policy

8.2.1 Expected On-Hand Inventory


A major contributor to our inventory costs are the holding costs. In order to compute these we
have to know how much on-hand inventory we expect to have in stock. With high service levels (
β > 0.95% ), we can easily stick to the assumption we made in Section →5.2 about expected on-

hand inventory. Remember, as shown in →Figure 8.2, we assumed that the stock on-hand varies
(linearly) between:
d + S when we just received an order. That is, the safety stock S plus the expected
c s s

demand over the order cycle d = dR .


c

S when we are just about to receive an order (we only have the safety stock S left).
s s

Our on-hand inventory varies then between d + S and S so that the expected average on-
c s s

hand inventory is (see Section →5.2.1 for a refresher about on-hand inventory):
dc dR
(average) On-hand = C s + S s = + Ss = + Ss
2 2

Figure 8.2 Stock level for an (R, S) policy.


Cost Expression

Since we know the expected on-hand inventory level, we can express the total cost per review
period R as:
C per review period = hR(C s + S s ) + k + b U s

where hR is the holding cost of keeping one unit in stock during a review period R ; and,
because we do a transaction at each review period, the transaction cost per period review period
is k.
We can also compute the (average) cost per period (noted simply C ) as:
C review period k b Us
C per period = C = = h(C s + S s ) + +
R R R

We also know that:


Ss = z σx

dR
Cs =
2

U s = σ x L (z)

So that we can express the average costs per period as:


k b σx 𝓛 N (z) (8.2)
𝓒=h(dR/2 + z σ x ) + +
R R
Intuition

As shown in →Figure 8.3, we understand that the more safety stock you have (which is to say, the
higher z) the lower the backorder costs are ( b σ L (z) is low) but the higher the holding costs
x N

are ( h z σ is high). In Chapter →2, we optimized the order quantity Q and saw that the holding
x

costs were balancing the transaction costs (see Section →2.2.2). Now, with our stochastic model,
the relationship is a bit more complex: holding costs increase when the backorders costs decrease
(more safety stock results in fewer backorders). The holding costs will also increase when the
transaction costs decrease (i. e., if R is high, we make fewer orders but have a higher amount of
cycle stock).
We will see in the following pages first how to optimize the required amount of safety stock,
and then how to optimize the review period.

We now have a good cost expression (see eq.


→8.2 in Section →8.2.1). What can we do, as supply chain managers, to reduce these costs?
We can easily tweak the service level factor z or change the review period R. We will do both in the
following pages.

Figure 8.3 Cycle service level impact on transaction, holding and backorder costs. Example with
h = 2 , k = 200 , b = 50 , L = 1 , R = 1 and d ∼ N (100, 25 ) .
2

Cost Optimization: Service Level Factor z

Let’s first optimize the cost function with regard to z. The question we ask ourselves is “What is the
optimal service level we should target in order to minimize our costs?”
k b σ x L N (z)
C (z) = h(dR/2 + z σ x ) + +
R R

Remember, the cycle service level is computed as:


α = Φ(z)

In order to find the optimal z , we can simply take the derivate of the cost function based on z

and set it to zero.


∂C (z)

z = z ⇒ = 0
∂z

∂C (z) ∂z b σ x ∂L N (z)
= hσ x + = 0
∂z ∂z R ∂z

hRσ x + b σ x (Φ(z) − 1) = 0

hR + b (Φ(z) − 1) = 0

hR
+ Φ(z) − 1 = 0
b

hR
Φ(z) = 1 −
b

The demonstration proving is given in Appendix →B.3.


∂L N (z)
= Φ(z) − 1
∂z
So that we have:
hR hR (8.3)
∗ −1 ∗
z =Φ (1 − )⇔α =1 −
b b

This is a very important result because it shows that the optimal cycle service level (i. e., the one
resulting in the lowest total cost) is 1 − hR/b . Moreover, this result holds for any demand
distribution (as proven in Appendix →B.4).

Should You Keep Inventory?

This model shows that you should keep inventory when the backorder cost is higher than the
holding cost over the review period. If not—since keeping a unit in stock is more expensive than
missing one item in stock—you should use a make-to-order policy (i. e., produce only when a client
makes an order) rather than a make-to-stock policy (produce and store goods in advance).

It’s Your Turn Now!

If you are managing inventory policies, this simple equation α = 1 − hR/b should help you to

easily reduce your total cost by optimizing the service levels. Go for it!
Cost Optimization: Review Period R

Now that we have an expression to find the best cycle service level α (eq. →8.3 see Section →8.2.1)
based on a given review period R, we should optimize R.
This can be done either via the power-of-2 policy (see Section →3.2.1), or simply by looking at
various possible values of R and picking the one resulting in the lowest cost. This is often a simple
routine computation as, in real life, only a few values of R are possible.
8.3 (s,Q) Policy
For the continuous (s, Q) policy—in which we order Q pieces when we reach a net inventory level
of s—we will look at the cost per year, rather than the cost per period as we did for (R, S) .

8.3.1 Cost Expression


We go back to the cost expression →8.1 (Section →8.1) and adapt it to the (s, Q) policy.
Costs = h ⋅ On-hand + k ⋅ Transactions + b ⋅ Backorders

D D
C = h(C s + S s ) + k + b Us
Q Q

where:
h is the cost to keep one unit in stock for a year
D/Q is the number of transactions per year

C is the average amount of cycle stock ( C = Q/2 )


s s

Ss = z σx

U s = σ x L N (z)

As we did for the (R, S) policy, we will see two ways to reduce the costs: optimize z and Q.

Cost Optimization: Service Level Factor z

We can then express the costs C based on z:


D D
C (z) = h(Q/2 + z σ x ) + k + b σ x L N (z)
Q Q

Once again, to find the optimal z factor, we can simply take the derivative of the cost function

with regard to z and set it to zero:


∂C (z)

z = z ⇒ = 0
∂z

∂z D ∂L N (z)
h(σ x ) + b σx = 0
∂z Q ∂z

D
hσ x + b σ x (Φ(z) − 1) = 0
Q

hQ + b D(Φ(z) − 1) = 0

hQ
Φ(z) = 1 −
bD

This is a very important result, since we can now easily compute the optimal cycle service level for
an (s, Q) policy as:
hQ hQ (8.4)
∗ −1 ∗
z =Φ (1 − )⇔α =1 −
bD bD

Note, in this equation h is expressed as the holding cost of keeping one unit in stock for a whole
year (and not just over a review period as we did for the (R, S) policy).
Similarly, as for the (R, S) model (see eq. →8.3 in Section →8.2.1), the optimal service level
found with eq. →8.4 can be used for any demand distribution (as proven in Appendix →B.4).
Actually, the solution for the (s, Q) policy is the same as that for the (R, S) (see eq. →8.3) if we
replace R with Q/D .

Cost Optimization: Order Quantity Q

In Chapter →2 (see eq. →2.2 in Section →2.2.2), we computed the optimal order quantity Q as


2kD
Q = √
h
This works for a deterministic demand, but what about a stochastic one? Let’s go back to the cost
expression:
D D
C (Q) = h(Q/2 + z σ x ) + k + b σ x L N (z)
Q Q

Just as we did for z , in order to find the optimal Q , we have to take the derivative of the cost
∗ ∗

function with regard to Q and set it to zero:


∂C (Q) (8.5)

Q = Q ⇒ = 0
∂Q

1 ∂Q ∂ 1
h + (k + b σ x L N (z)) ( ) = 0
2 ∂Q ∂Q Q

h −1
+ (k + b σ x L N (z)) = 0
2
2 Q

2
h
−Q + (k + b σ x L N (z)) = 0
2

2
2
Q = (k + b σ x L N (z))
h

2(k + b σ x 𝓛 N (z))D
∗ √
Q =
h

Equation →8.5 is specific to the normal distribution. More generally, we have:

2(k + b U s )D
∗ √
Q =
h

Intuition

You can understand intuitively that this equation is similar to the EOQ equation: Q = √2kD/h
(see eq. →2.2 in Section →2.2.2) with k = k + b σ L (z) . b σ L (z) = b U are the expected

x N x N s

backorder costs over a demand cycle, which is seen by our model as a fixed transaction cost. In
other words, the model sees the backorder costs per cycle as an extra transaction cost.

Deterministic Stochastic

Q 2kD 2(k+b U s )D
√ √
h h

Cost Optimization: Q and z

A simple way to optimize our costs is to iteratively use equations →8.4 and →8.5 until both Q and z
are reasonably stable. We say that the algorithm converges (i. e., it has found a solution). The
convergence will happen rather quickly if we force Q to take integer values.
1. Initialize Q as √2kD/h (based on the EOQ model)
2. Set z as Φ −1
(1 −
hQ
)
bD

3.
Update Q as √2(k + b σ L (z))D/h x N

4. Repeat steps 2 and 3 until both z and Q are reasonably stable.


8.4 Simulation
In this section we will run our simulations in order to answer these two questions:
1. Is the simulated on-hand inventory level aligned with the model?
This is crucial because the on-hand inventory level is driving the holding costs.
Therefore a correct estimation of this inventory level is required to get the total
costs right.
2. Is the model giving us an overall correct cost estimation, despite the assumption
we made?

8.4.1 On-Hand Inventory Level


In order to properly simulate the holding costs of our policy, we need to measure the average on-
hand inventory level (the inventory physically available for clients to buy).
Remember, so far, this is our simulation loop (see Section →7.5.1):
with hand[t]being the on-hand inventory level at the endof the timestep t. Actually, hand[t]is
not exactly the on-hand inventory as we defined it in Section →1.1: the inventory physically
available for our clients to buy. The difference is that hand[t]will be negative when we have
backorders. We did this for the sake of simplicity, in order to avoid a more complex simulation
loop. We then have to create another variable p[t]to keep track of the physically available
inventory. p[t]will be strictly positive (p[t]>=0).

How Do We Measure the Average Physical Inventory Level During a Period?

We will review three methods, each more correct than the previous. Let’s review them one by one.

First Method

One way to track the average physical inventory level through a period is to compute it as:

Remember, hand[t]is negative when we have a backlog, therefore we have to use


max(hand[t],0)to
track the physical inventory.
Unfortunately, this method is too simple.
Figure 8.6 Average physical inventory through a period.

As shown in →Figure 8.6, the issue is that hand[t] is the stock level at the end of a period, i. e.,
after the period demand d[t] is consumed and before the next replenishment transit[t,0] arrives
(if any). In other words, hand[t] is the lowest inventory point during the period. So if we define
p[t] as max(hand[t],0) we will undershoot the actual physical inventory.

Second Method

A second way to compute the average physical inventory is to take the average of the highest and
lowest inventory levels of each period. As shown in →Figure 8.6, the highest inventory level is
reached at the beginning of the period—just after we received a delivery if any (max(hand[t-
1]+transit[t-1,0],0))—and the lowest is reached at the end of the period (max(hand[t],0)).
The average physical inventory level during the period can then be expressed as:

Third Method

We can refine the computation of the physical inventory even further. The second method is
actually only correct when both the starting and ending inventory positions of a period are
positive. But, in the cases where the physical inventory is depleted by the end of the period
(hand[t]<0), we can expect that the inventory went to zero before the end of the period.
Figure 8.7 Average physical inventory through a period when hand[t]<0.

The average physical inventory level during a period is the grey area in →Figure 8.7. As any
triangle, this area can be computed as its height (hand[t-1] + transit[t-1,0]) multiplied by its
base ((hand[t-1] + transit[t-1,0])/max(d[t],1)) divided by 2: (hand[t-1] + transit[t-
1,0])**2/max(d[t],1)/2. Note that we take max(d[t],1) instead of d[t] in order to avoid division by
zero in the exceptional case of d[t]==0. We then have:

Obviously we assume a linear demand consumption through each period.

Simulation vs. Model

We see in →Figure 8.8 that the model and the simulation give very close results if the demand
deviation per period stays relatively low. But, as shown in →Figure 8.9, if the demand coefficient of
variation becomes too high ( CV ⩾ 100% ) we start to have an offset between the model and the
d

simulation. Remember, as we discussed in previous chapters, when CV increases the simulated


d

demand is higher than the theoretical demand, due to the fact that we don’t allow negative
demand in the simulation.4
Figure 8.8 Average physical inventory level per period with a low CV with d ∼ N
d
2
(100, 25 ) ,
R = 4 and L = 4 over 1 million timesteps.

Figure 8.9 Average physical inventory level per period with a high CV with d ∼ N
d (100, 100 )
2
,
R = 4 and L = 4 over 1 million timesteps.

We also observe that as the service level gets lower, the spread between the model and the
simulation grows (slightly). As noted in Section →8.2.1, the model does not take into account, in its
on-hand inventory level, the expected backlog per period. Nevertheless, as we observe for these
cases, this spread is virtually zero even for relatively low cycle service levels.

8.4.2 Cost Estimations


Now that we understand how to compute the physical inventory level, we can work on the cost
simulations.
Simulation vs. Model

As for the physical inventory simulation, we can confirm, thanks to our simulations, that for a low
demand coefficient of variation ( CV ∼ 25% ), the model and the simulation are virtually alike
d

(see →Figure 8.10). Again, a difference arises when the demand coefficient of variation is high (
CV ⩾ 100% ) as shown in →Figure 8.11.
d
Figure 8.10 Cost simulation for low demand variation with d ∼ N 2
(100, 25 ) , k = 1000 ,
h = 1.25 , b = 50 , R = 4 and L = 4 over 1 million timesteps.

Figure 8.11 Cost simulation for high demand variation with d ∼ N (100, 100 )
2
, k = 1000 ,
h = 1.25 , b = 50 , R = 4 and L = 4 over 1 million timesteps.

8.5 Recap
In this chapter we answered the (tremendously important) question: “What is the optimal service
level?” We obtained simple expressions for both periodic and continuous review policies as shown
in →Table 8.2.

Table 8.2 Optimal cycle service levels for each inventory policy.
Policy (s, Q) (R, S)

Cycle service level α



1 −
hD

bQ
1 −
hR

Order quantity Q


2(k+b U s )D

h
where
R is the review period
Q is the order quantity
b is the cost of backordering an item
k is the fixed cost per transaction
h is the holding cost per unit per period (for the (R, S) policy), or per year (for the (s, Q)
policy)
U is the expected backlog by the end of the risk-period
s

D is the yearly demand


In the case of a periodic review policy, the optimal review period can be obtained either via the
power-of-2 policy (see Section →3.2.1) or by testing a set of possible review periods (see Section
→x).
In order to optimize both the cycle service level α and the order quantity Q of a continuous
review policy (s, Q) , you can simply loop through both equations given in →Table 8.2 until both Q
and α converge (see Section →x).
9 Beyond Normality

9.1 When Normality Fails


Through Part →II we added variation to our model by describing the demand as following a
normal probability distribution (see Chapter →4). In Chapter →6, we did the same for the lead
time. Actually, if you open any academic book about inventory optimization—or supply chain in
general—you will see this same normality assumption over and over.
Does this normality assumption really make sense?
Or are we oversimplifying a complex world?
Many items in a supply chain fluctuate around a regular demand with a few high-volume
exceptions. Just think about a common product that you sell a certain number of pieces of each
day. From time to time you will face an exceptionally high demand. This can be due to many
factors: maybe there is a promotion running; or an unusually big group of customers wants to
buy it; or the weather was exceptional; maybe your competitor was out-of-stock, etc. These small
variations explain why we often observe items with a “usual” low demand have a few “unusual”
high sales.
Let’s look at an example. We show in →Figure 9.1 the sales of Ford cars in Norway from 2007
to 2017.1 Usually the sales are around 700–800 units per month with a few high exceptions.

Figure 9.1 Ford car sales in Norway.


9.1.1 Density Histogram
Let’s plot a histogram of the density of these monthly sales as well as their mode, median and
mean (respectively, 732, 772 and 824).

The mode is normally the most common value in a dataset. However, computing the mode of a
highly scattered distribution—as we face here—can be tricky and meaningless. In order to
overcome this, we grouped the sales in bins and defined the mode as the bin with the highest
number of occurrences (as shown in →Figure 9.2). In other words, we made a histogram and
selected the highest bar as the mode.
Figure 9.2 Monthly Ford car sales in Norway.

A density histogram is a good empirical estimation of the actual probability distribution


function (PDF) of our demand distribution. We will discuss PDF estimation further in Chapter →12,
“→Discrete Probabilistic Demand.” The trick here is to select the right number of bins as well as
the proper minimum and maximum limits. As a rule of thumb we will use a number of bins equal
to around a third of the available data points; and force the histogram range to go 20% beyond
the dataset min and max. On top of this histogram we will add a normal curve fitted to the sales
mean and variance N (824, 207 ) . As you can see, a normal distribution fits this demand dataset
2

poorly.
9.1.2 Why Does Normality Fail?
Let’s take a moment to discuss why normal distributions often fail to properly describe a real
supply chain demand dataset (or lead time fluctuations). Normal distributions have two main
characteristics that make them a poor fit:
1. Normal distributions contain negative values. Only returns could (potentially)
justify having negative demand in some specific cases. Arguably, often in a supply
chain, a return can’t compensate a sale from the on-hand inventory. So, if you
face returns, you might want to consider forecasting and managing them apart
from the normal demand.
Negative lead times are just nonsense.
2. Normal distributions are symmetric. In a normal distribution, the mode, the
median and the mean are the same value and the distribution is symmetrically
distributed around it. That’s the theory. In real supply chains, as shown in
→Figure 9.3, the demand—and the lead time—often fluctuate around a mode
with a few exceptional (positive) values. Real supply chain demand is therefore not
symmetrical around the mean; it is often skewed to the right. This means that we
have more high exceptions than a normal distribution would usually predict (and
fewer low exceptions).

Figure 9.3 Mode, mean and median for a typical demand distribution.

9.2 Skewness
In statistics, the skewness is a measure of a distribution asymmetry. It is noted γ and is
1

expressed as a number—just as the mean or the standard deviation. A positive number means a
right-tail skew, and a negative one means a left-tail skew as you can see in →Figure 9.4.

Figure 9.4 Examples of skewness.


Just as for the mean or the standard deviation, you can compute the skewness of a dataset based
on the formula:
n 3 (9.1)
1 xi − μx
γ1 = ∑( )
n σx
i=1

Usually (but not always) −1 < γ < 1 so that a skewness close to −1 or 1 is rather high. A
1

skewness of 0 represents a distribution that is perfectly symmetrical around its mean (e. g., the
normal distribution).
Right-skewed distributions always have a mean higher than the median, and they usually are
both higher than the mode (as shown in →Figure 9.3). This assertion is often correct when
describing a supply chain demand. Remember that for a normal distribution—as assumed in our
safety stock model so far—the mode, the mean and the median are equal.

9.3 Gamma Distribution


We understand now why a normal distribution is not always suited to approximate a supply chain
demand pattern. Because of this, we need to replace this distribution with a more appropriate
one that is right-skewed. Statisticians have many potential distributions that match this
description and inventory academics usually work with either triangular, gamma or log-normal
distributions.2
We will focus on the gamma distribution and leave the triangular and log-normal ones aside.
Log-normal and gamma distributions are very much alike, but we will favor the latter since it is
mathematically easier to deal with. Triangular distributions can also be used for inventory
optimization, especially for (new) products with few (or no) data available.3
It seems that using gamma distributions for inventory optimization was analyzed at least
since the late 1960s when T. A. Burgin—an English practitioner working for the tire manufacturer
Dunlop—published his first articles.4 He was soon followed by others.5
Unfortunately, gamma distributions never got the fame that normal distributions have in the
inventory world. Today, most academics, software and consultants still rely on normal
assumptions, even when a gamma distribution might be more appropriate. The few practitioners
using non-normal distributions are often seen as using some sort of advanced magic to optimize
inventory models.
Let’s see how we can use gamma distributions to improve our inventory models, while
keeping the mathematical complexity within reasonable levels.

9.3.1 Mathematical Definition


A gamma distribution Γ(k,θ) (Γ is the capital greek letter gamma) is defined by two
parameters: its shape k and its scale θ (theta). Both parameters can be estimated based on a
dataset mean and standard deviation:
2 2
μ σ
k = θ =
2
σ μ

So that,
2 2
μ σ
Γ(k, θ) = Γ( , )
2
σ μ

Note that both k and θ are strictly positive.

Figure 9.5 Gamma and normal distributions with μ = 100 .

As you can see in →Figure 9.5, when the standard deviation of a dataset increases, the gamma
distribution is more skewed resulting in a longer tail and a lower mode. On the other hand, as the
standard deviation of a dataset decreases, the gamma distribution gets closer and closer to a
normal distribution.
Another important property of the gamma distribution is that it is a strictly positive
distribution. Yet, as you can see in →Figure 9.5, its PDF around 0 is usually very low (i. e., there is a
low probability for a gamma distribution to get a value close to 0).

Skewness

The skewness of a gamma distribution can be computed as such:


2
γ1 =
√k

If we replace k in the above definition with μ 2



2
, we obtain:

γ1 =
μ

This matches what we saw in →Figure 9.5: skewness is proportionally related to σ.

9.3.2 Fitting Gamma


Thanks to these straightforward relationships between k, θ, μ and σ, we can easily fit a gamma
distribution to any demand dataset because we can compute μ and σ and therefore derive k d d d

and θ . Then we would simply have:


d

2 2 2 2
μ σ μ σ
d d d d
kd = θd = d ∼ Γ(k d , θ d ) = Γ( , )
2 2
σ μd σ μd
d d

Demand Offset

Gamma distributions always allocate some (low) probability for values close to 0, so that the
fitting shown above works well if the minimum demand value d is close to 0. But this is not min

always the case. For example, if we look at the monthly sales of Ford cars in Norway (→Figure 9.6),
the minimum monthly sales ever observed is around 400. In order to fix this and to improve
gamma fitting to our sales, we should offset the gamma distribution by d as summarized in min

→Table 9.1 (so the distribution will then start at our demand minimum value).

Figure 9.6 Fitting gamma distributions to Ford car sales with and without offset parameters.

Table 9.1 Gamma-distributed period demand based on μ , σ and d d d min .


Period demand Parameters
2 2
d ∼ Γ(k d , θ d ) μ σ
d d
kd = 2
θd =
σ μd
d

′ ′ ′2 2 ′
d ∼ Γ(k , θ ) + d min ′ μ ′ σ μ = μ d − d min
d d
d d k = 2
θ = ′
d
d σ d μ
d d
Let’s note k , θ and μ the offset parameters.
′ ′ ′
d

′2 2
μ σ
′ ′ ′ d ′ d
μ d = μ d − d min σd = σd kd = θd =
2 ′
σ μ
d d

′2 2
μ σ
′ ′ d d
d ∼ Γ(k d , θ d ) + d min = Γ( , ) + d min
2 ′
σ μ
d d

Note that we do not use σ in our equations, because offsetting the demand by d

d min does not
impact σ .
d

Optimal Value for dmin

As discussed, gamma distributions start with a PDF of zero at their minimum (i. e., f (0; k, θ) = 0 Γ

, as shown in →Figure 9.5). Therefore, you might want to define d slightly below the actual
min

minimum observed demand. In practice, the impact of this approximation is (very) low.
9.4 Distribution Selection
Now that we can properly fit a gamma distribution to a demand dataset, we need to find a proper
way to estimate if a distribution is more gamma than normal. Let’s discuss two rules of thumb.6

9.4.1 Method #1 – Skewness


The first technique is to compare the actual (i. e., observed) demand skewness γ to those of
1

fitted normal and gamma distributions. Remember, we saw in eq. →9.1 that you can compute the
actual skewness γ of the observed demand as:
1

n 3
1 di − μd
γ1 = ∑( )
n σd
i=1

We know that if the demand is close to a normal distribution its skewness should be close to 0;
and if the demand is close to a gamma distribution its skewness should be close to 2σ /μ .
d d
2σ d
2
d ∼ N (μ d , σ d ) ⇒ γ 1 = 0 d ∼ Γ(k d , θ d ) ⇒ γ 1 =
μd

Thereby we can use the actual demand skewness to assess if it is closer to a normal or a gamma
distribution:
2 σd
N (μ d , σ ) if γ 1 <
d μd
d ∼ {
σd
Γ(k d , θ d ) if γ 1 >
μd

One of the great merits of this technique is that it is straightforward to implement. Even in Excel.
As soon as you can compute the demand mean, deviation and skewness, you can assess if it is
more normal or more gamma. This should allow you to massively segregate demand signals
between normal and gamma distributions.

Demand Offset

If there is a minimal demand observed in the dataset, you can also try to fit the demand as

d

d ∼ Γ(k , θ ) + d
d min and see if the skewness obtained ( 2σ /(μ − d ) ) is closer to the actual
d d min

one.
If the actual skewness is still (much) higher than 2σ /μ , you might want to look at custom
d d

distributions (as we will discuss in Chapter →12, “→Discrete Probabilistic Demand”).

Limitation

The limitation of assuming the demand to be normal or gamma based on its skewness is that,
since we focus only on matching the skewness of the demand dataset against our fitted
distribution, we do not care if the fitted distribution looks like the actual demand distribution. In
other words, your demand can be skewed like a gamma distribution but not distributed like one.
9.4.2 Method #2 – Root Mean Square Error
Another (less straightforward) way to test the goodness-of-fit of a fitted distribution compared to
the actual demand distribution is to compute the difference between the two distributions. One
way to do this is to compute the Root Mean Square Error (RMSE) between the actual and the
fitted PDF.
We define the RMSE as

1 2
RM SE = √ ∑ (f d (x) − f (x))
n

where f (x) is the actual demand PDF estimated at x and f (x) is the PDF of either a gamma or a
d

normal distribution (evaluated at x).

Limitations
There is no such thing as a perfect representation of the PDF of our actual demand. We can
only estimate it based on a density histogram of the demand, which comes with some
arbitrary choices that we will discuss in detail in Chapter →12, “→Discrete Probabilistic
Demand.”
The RMSE test proposed here allocates as much importance to the left-tail as to the right-tail
of the demand distribution. The left-tail is less interesting to us since we often aim for high
service levels. We want to know the 90th or 99th percentile of the demand over the risk-
period, not the 10th. Therefore, we might want to allocate more importance to the right-tail
of the distribution because we are interested in extreme demand cases.7

9.5 Impact on Inventory Policies


Now that we have learned what a gamma distribution is and how to fit it to our (period) demand
distribution, we can use it to improve our inventory policies. We will now model the supply chain
as shown in →Figure 9.7.
Figure 9.7 Supply chain model.

9.5.1 Gamma Demand over the Risk-Period


We have analyzed the gamma distribution over one period, we now have to analyze the gamma
demand distribution over the risk-period (i. e., lead time and review period).8

Fixed Lead Time

If the demand follows a gamma distribution d ∼ Γ(k , θ ) over one period, we can compute its
d d

distribution over τ periods.9 To do this, we first have to compute the expected demand mean and
standard deviation over τ periods.

μτ = τ μd σ τ = √τ σ d

So that,
2 2 2
μτ τ μ
d
kτ = = = τ kd
2 2
στ τ σ
d

2 2
στ τ σ
d
θτ = = = θd
μτ τ μd

Let’s note d the demand over τ periods. We can express it based on either k and θ ; or k
τ τ τ d

and θ ; or μ and σ ; or even on μ and σ .


d τ τ d d
2 2 2 2
μτ στ μ σ
d d
d τ ∼ Γ(k τ , θ τ ) = Γ(τ k d , θ d ) = Γ( , ) = Γ(τ , )
2 2
στ μτ σ μd
d

As shown in →Table 9.2, we can express the demand over the risk-period by replacing τ by either
R + L for an (R, S) policy or by L for an (s, Q) policy. Remember, we note x the length of the τ

risk-period, so that we have either x = R + L or x = L .


τ τ

Table 9.2 Gamma-distributed risk-period demand based on μ , σ and d d d min .


Policy Risk-period
Length Demand Parameters
2 2
(R, S) xτ = R + L d ∼ Γ(k x , θ x ) μ σ
d d
kx = xτ 2
θx =
σ μd
d
(s, Q) xτ = L

′ ′ ′2 2 ′
(R, S) xτ = R + L μ σ
d ∼ Γ(k x , θ x ) + x min ′ d ′ d μ = μ d − d min
k = xτ 2
θ = ′
d
x σ x μ
d d

(s, Q) xτ = L

Note that, as the number of periods τ increases (in other words, as the risk-period gets
longer), the coefficient of variation of the distribution gets smaller so that the gamma distribution
is less and less skewed and looks more and more like a normal distribution. In other words, the
more you look into the demand distribution over a long period, the more it will follow a normal
distribution.10

Demand Offset

If we offset the gamma distribution by a minimum (as discussed in Section →9.3.2), we simply use

μ = μ − d
d d to compute k and θ (with x
min

d
being the demand offset over the risk-period

d min

xmin = x d τ ).
min

Stochastic Lead Time

What if we have a random lead time and a gamma demand? As we discussed in Section →6.3.1,
we already know a couple of parameters of the expected demand over the risk-period:

2 2 2
μ x = (μ L + R)μ d σ x = √ (μ L + R)σ + σ μ
d L d

Even though we can estimate the demand deviation and mean over the risk-period, we do not
know what its distribution looks like. Will we get the same distribution if the lead time is normal
than if it is gamma-distributed? What about a gamma lead time and a normal demand?
The exact mathematics to answer these questions are not always controllable.11 Moreover,
working with such mathematics might only slightly improve our inventory policies whereas the
extra complexity will make the maintenance of the model, at best, very difficult. We have two
solutions: using more simplifying assumptions or using simulations to optimize the policy.
As an extra simplifying assumption, we could approximate the demand over the (stochastic) lead
time as gamma. Using μ and σ , as defined above, we can compute k and θ , so that:
x x x x
2
2 2 2 2 2
μx σx ((μ L + R)μ d ) (μ L + R)σ + σ μ
d L d
d x ∼ Γ(k x , θ x ) = Γ( , ) = Γ( , )
2 2 2 2
σx μx (μ L + R)σ + σ μ (μ L + R)μ d
d L d

As discussed in Chapter →6, “→Stochastic Lead Times,” the normal stochastic lead time model
only worked well when R ≫ L ≫ σ . We now have a second layer of approximations because
L

we assume that the demand over the lead time follows a gamma distribution. This means that we
should use this model with caution (e. g., test it with a simulation before using it). As we will see
with our later simulations (in Section →9.6.2), if the lead time variability is rather low, simulations
will be relatively aligned with the theoretical model.
In conclusion, if you face gamma demand and stochastic lead time, it is advised not to use a
mathematical model to optimize your inventory policy but to use simulations instead as we will do
in Chapter →13.

9.5.2 Safety Stocks


Let’s note ι the inventory level at the beginning of the risk-period. In other words,
s if (s, Q) L if (s, Q)
ι = { Risk-period = {
S if (R, S) R + L if (R, S)

We can compute ι (i. e., s or S) easily as:


−1
ι = F (α; k x , θ x )
Γ

where F −1

Γ
(α; k x , θ x ) is the inverse of the gamma distribution Γ(k x, θx ) evaluated at service
level α.

Table 9.3 Expression of ι depending on the inventory policy and the assumed demand
distribution.
Policy Period demand General expressions Explicit expressions
−1 −1
(R, S) d ∼ Γ(k d , θ d ) ι = F (α; k x , θ x ) S = F (α; (R + L)k d , θ d )
Γ Γ

−1
(s, Q) s = F (α; L k d , θ d )
Γ

′ ′ −1 ′ ′ −1 ′ ′
(R, S) d ∼ Γ(k , θ ) + d min ι = F (α; k x , θ x ) + x min S = F (α; (R + L)k , θ ) + (R + L)d min
d d Γ Γ d d

−1 ′ ′
(s, Q) s = F (α; L k , θ ) + L d min
Γ d d

The various possible expressions of ι are shown in →Table 9.3. The safety stock level can then be
easily computed as:
Ss = ι − μx

Demand Offset

In the case of a demand offset ( d ∼ Γ(k d, θ d ) + d min ), we have:


−1 ′ ′
ι = F (α; k x , θ x ) + x min
Γ
where k and θ are computed based on μ

x

x

x
= μ x − x min . We still have S s = ι − μx

9.5.3 Unit Shorts


If we want to get serious about using a gamma distribution for an inventory model, we also need
to compute the expected units short U per order cycle, in order to know the expected fill rate β.
s

By definition, the expected units short for an initial inventory position ι over an order cycle where
d ∼ Γ(k, θ) is:

U s = L Γ (ι; k, θ) = ∫ (d − ι)f Γ (d; k, θ)dd

As a reminder, we note f (d; k, θ) the probability density function (PDF) of the gamma
Γ

distribution Γ(k, θ) evaluated at demand d. We solve L (ι; k, θ) as:12


Γ
𝓛 Γ (ι;k,θ)=kθ(1 − F Γ (ι;k + 1,θ)) − ι(1 − F Γ (ι;k,θ)) (9.2)

Unit Shorts over the Risk-Period

Obviously we are interested in the expected units short U over the risk-period of our inventory
s

policy:
U s = L Γ (ι; k x , θ x ) = k x θ x (1 − F Γ (ι; k x + 1, θ x )) − ι(1 − F Γ (ι; k x , θ x ))

Remember, ι is the inventory at the beginning of the risk-period: ι = S for an (R, S) policy,
ι = s for an (s, Q) policy.

Demand Offset

If we define the demand as d ∼ Γ(k ′


d

, θ ) + d min
d
, we have:
′ ′ ′ ′ ′ ′ ′ ′ ′ ′ ′ ′
U s = L Γ (ι ; k x , θ x ) = k x θ x (1 − F Γ (ι ; k x + 1, θ x )) − ι (1 − F Γ (ι ; k x , θ x ))

where:
′2 ′2
μx σx
′ ′ ′
kx = θx = ι = ι − x min
′2 ′
σx μx

We summarize in →Table 9.4 the expression of the expected units short based on x (the risk- τ

period length), μ , θ , d .
d d min
Table 9.4 Units short expression based on x , k , k and d
τ d d min .
Policy Risk-period Units short U s

Length Demand
(R, S) xτ = R + L x ∼ Γ(x τ k d , θ d ) x τ k d θ d (1 − F Γ (ι; x τ k d + 1, θ d ))

(s, Q) xτ = L −ι(1 − F Γ (ι; x τ k d , θ d ))

′ ′ ′ ′ ′ ′ ′
(R, S) xτ = R + L x ∼ Γ(x τ k , θ ) + x τ d min x τ k θ (1 − F Γ (ι ; x τ k + 1, θ ))
d d d d d d

′ ′ ′ ′
(s, Q) xτ = L −ι (1 − F Γ (ι ; x τ k , θ ))
d d

Gamma Inverse Loss Function

Just as for the normal distribution, there is no tractable equation to express the inverse of the
gamma loss function. We will again have to use a solver to compute it. This is what we are looking
for:

Us = {
d c (1 − β)

L Γ (ι; k x , θ x )


⇒ β = 1 −

Where ι is either s or S depending on the policy, and


Us

dc
= 1 −

The objective of our solver will be to minimize the difference between:


d c (1 − β)

by changing ι. We formalize this mathematically as


and L Γ (ι; k x , θ x )

ι = arg min ι [ L Γ (ι; k x , θ x ) − d c (β − 1) ]

which means that ι is the value that minimizes the absolute difference between L
d (1 − β)/σ .
c x
L Γ (ι; k x , θ x )

dc

L Γ (ι; k x , θ x ) = k x θ x (1 − F Γ (ι; k x + 1, θ x )) − ι(1 − F Γ (ι; k x , θ x ))

Γ (ι; kx , θx ) and
9.5.4 Gamma vs. Normal
Now that we have created a gamma model, we can analyze the differences with the normal model
we created in Part →II, “→Stochastic Supply Chains.” To do this, we show in →Table 9.5 and
→Figure 9.8 the various fill rates and cycle service levels achieved for different values of ι (the
stock level at the beginning of the risk-period) based on a risk-period demand μ = 100 ,
x

σx = 50 .
Table 9.5 Expected cycle service level α and fill rate β based on ι with μ x = 100 and σ x = 50 .
Service level Risk-period demand ι
80 100 120 140 160 180 200
α x ∼ Γ(k x , θ x ) 39.7 56.7 70.6 80.9 88.1 92.8 95.8
x ∼ N (μ x , σ )
2
x
34.5 50.0 65.5 78.8 88.5 94.5 97.7
β x ∼ Γ(k x , θ x ) 70.1 80.5 87.7 92.5 95.5 97.4 98.5
x ∼ N (μ x , σ )
2
x
68.5 80.1 88.5 94.0 97.2 98.8 99.6

We see two cross-over points when the normal model predicts higher service levels than the
gamma model (both for the cycle service level and fill rate).

Figure 9.8 Expected cycle service level α and fill rate β based on ι with μ x = 100 and σ x = 50 .

Low service levels It is usually easier to obtain a low service level with a gamma demand than
with a normal one. In other words, a small amount of inventory will result in a
higher service level when the demand over the risk-period follows a gamma
distribution rather than a normal one. This makes sense as the gamma
distribution is right-skewed resulting in a high probability for the demand not to
be too far away from the mode (which is lower than the average demand).
High service levels On the other hand, targeting a high service level is more difficult if the
demand is gamma-distributed due to its long right-tail (as there is always a small
probability that the demand will be really high).

9.6 Simulation

9.6.1 Fixed Lead Time


Let’s start our simulations by assuming the lead time is fixed.
As shown in Tables →9.6 and →9.7, the gamma model works well even for high levels of
demand variation over the risk-period ( CV > 0.5 ). Remember, for the normal model (analyzed
d

in Table →5.3) we had a misalignment between the simulation and the theory CV > 0.25 . d
Table 9.6 Simulated cycle service level (%) over 1,000,000 periods for an (R, S) policy with R = 4
and μ = 100 .
d

σd L CV d CV x Theoretical cycle service level (%)


70 80 90 95 99
25 1 .25 .11 70.4 80.1 90.1 95.0 99.0
4 .25 .09 70.7 80.4 90.2 95.1 99.0
10 .25 .07 70.3 80.4 90.2 95.1 99.0
100 1 1.0 .45 70.1 80.0 90.0 95.0 99.0
4 1.0 .35 70.3 80.1 90.1 95.1 99.0
10 1.0 .27 70.3 79.9 90.0 94.9 99.0
200 1 2.0 .89 74.5 82.9 91.4 95.6 99.1
4 2.0 .71 74.9 83.2 91.4 95.8 99.2
10 2.0 .53 75.2 83.5 91.7 95.8 99.1

Table 9.7 Simulated fill rate (%) over 1,000,000 periods for an (R, S) policy with R = 4 and
μ = 100 .
d

σd L CV d CV x Theoretical fill rate (%)


70 80 90 95 99
25 1 .25 .11 70.0 80.1 90.0 95.0 99.0
4 .25 .09 70.0 80.0 90.0 95.0 99.0
10 .25 .07 69.9 79.8 90.1 95.0 99.0
100 1 1.0 .45 70.3 80.2 90.0 95.0 99.0
4 1.0 .35 71.8 80.8 90.3 95.1 99.0
10 1.0 .27 74.0 82.2 90.8 95.3 99.1
200 1 2.0 .89 72.2 81.3 90.7 95.3 99.1
4 2.0 .71 76.3 83.7 91.8 95.7 99.1
10 2.0 .53 80.1 86.4 92.8 96.2 99.3

We see that the simulated service level (fill rate or cycle service level) tends to be higher than the
theoretical prediction from our model. This is especially true when the lead time is long compared
to the review period and the service level target is low.
9.6.2 Random Lead Times
Let’s now simulate our model with random lead times. As discussed in Section →6.4, random lead
times come with a lot of questions that theoretical models (and simulations alike) often ignore:
Is there a correlation between the lead times of different orders?
Is the lead time independent to the demand, or seasonal?
How do we model discrete lead time?
We see in Tables →9.8 and →9.9 that our model is giving appropriate results for both normal and
gamma-distributed lead times when the lead time variation is limited. Nevertheless, for high lead
time variation, the model seems to give stock targets that are too high, resulting in higher than
targeted service levels.
Table 9.8 Simulated fill rate (%) over 1,000,000 periods for an (R, S) policy with R = 4 and
μ = 100 , σ = 100 . Lead time distributed as L∼𝓝(μ ,σ ) .
2
d d L L

μL σL CV x Theoretical fill rate (%)


70 80 90 95 99
4 0.5 .36 71.8 80.8 90.2 95.0 99.0
1.0 .38 71.7 80.7 90.1 95.0 99.0
1.5 .40 70.8 79.8 89.4 94.6 98.8
10 1.0 .28 74.0 82.1 90.7 95.2 99.0
2.5 .32 73.8 82.0 90.6 95.2 99.0
5.0 .45 81.5 88.7 95.6 98.4 99.9

Table 9.9 Simulated fill rate (%) over 1,000,000 periods for an (R, S) policy with R = 4 and
μ = 100 , σ = 100 . Lead time distributed as L∼Γ(k ,θ ) .
d d L L

μL σL CV x Theoretical fill rate (%)


70 80 90 95 99
4 0.5 0.36 71.7 80.8 90.3 95.2 99.0
1.0 0.38 71.8 80.7 90.1 94.9 98.9
1.5 0.40 71.2 80.1 89.7 94.6 98.8
10 1.0 0.28 74.1 82.0 90.6 95.1 99.0
2.5 0.32 74.0 82.1 90.6 95.3 99.0
5.0 0.45 82.2 89.2 95.5 98.3 99.8
9.7 Recap
Policy

Risk-period
Demand distribution

Cycle service level

Fill rate

Safety stock

Solver

Demand Offset
Reorder point (s, Q)
Review Period (R, S)
σ x = √x τ σ d

d ∼ Γ(k d , θ d )

k =

β = 1 −
μ

σ2

Ss = ι − μx

above by replacing μ and ι by:

where x min
x

= x τ d min .
2

θ =

α = F Γ (ι; k x , θ x )

ι = F
−1


(α; k x , θ x )
σ

μ
μx = xτ μd

L Γ (ι;k x ,θ x )

If the period demand is distributed as d ∼ Γ(k


dc
ι = s

ι = S

ι = arg min [ L Γ (ι; k x , θ x ) − d c (β − 1) ]


ι
xτ = L

xτ = R + L
dc = Q

d x ∼ Γ(k x , θ x ) = Γ(x τ k d , θ d )

2
dc = dR

L Γ (ι; k x , θ x ) = k x θ x (1 − F Γ (ι; k x + 1, θ x )) − ι(1 − F Γ (ι; k x , θ x ))

If you want to compute the required stock level ι (at the beginning of the risk-period) to reach a fill
rate β, you need to use a solver that will look for the ι that minimizes the difference between
d (1 − β) and L (ι; k , θ ) .
c Γ x


d, θ d ) + d min

μ x = μ x − x min


ι = ι + x min
, the computations can be done as
10 Multi-Echelon Inventory Optimization
Per ardua ad astra – Through adversity to the stars.
Royal Air Force motto

So far, we have discussed models that described supply chains with only one stocking point
and one item. Real-world supply chains are often made up of multiple stocking points, each one
usually stocking several different items. In this chapter we will broaden our model by optimizing
inventories across multiple stocking points. Ton de Kok—professor at the Eindhoven University of
Technology—argued, “There is no hope to find optimal control policies for real-world multi-item multi-
echelon systems.”1 Nevertheless, as you will see, we can easily come up with good (enough) policies
—thanks to specific assumptions.

10.1 Supply Chain Network Topology


As shown in →Figure 10.1, we will represent a supply chain as a network of nodes and edges.
Each node is a (possible) stocking point and each edge symbolizes the customer-supplier
relationship between two nodes.

Figure 10.1 Supply chain represented as a network with nodes and edges.

Internal vs. External Nodes


We can differentiate two types of nodes: internal and external. You could say that an external
node is a stocking point that is not owned by a company. But actually, a company can have
visibility and control beyond its own warehouses. Therefore “internal” nodes could include
stocking points that are not fully owned by a company. This is typically the case in supply chains
that use vendor managed inventory (VMI).
We will call each layer of a supply chain network an echelon (think tier or stage).2 A supply chain
with only one echelon is called a single-echelon supply chain; a supply chain with more than one
echelon is called a multi-echelon supply chain. As shown in →Figure 10.2, the first echelon of a
supply chain (that is in contact with an external supplier if any) is the supply echelon; the last one
(directly facing the customer demand) is called the demand echelon.

Figure 10.2 Multi-echelon supply chain.

10.1.1 Types of Multi-Echelon Supply Chains


As shown in →Figure 10.3, we can classify multi-echelon supply chains in 4 main types of
networks: serial, assembly, distribution and general.
Serial This is the simplest supply chain network where each node (i. e., possible stocking
point) only has one downstream node (its client-node) and one upstream node
(its supplier-node).
Assembly Each node has only one downstream node (except for the demand nodes
obviously) and possibly multiple upstream nodes. We call this “assembly” as we
need multiple suppliers to supply a single node. This is a situation similar to an
assembly production unit where multiple items are assembled into a final
product. We will discuss the parallel between multi-echelon inventory
optimization and production processes in Section →x.
Distribution This is the opposite of an assembly supply chain. In a distribution system, each
node has (possibly) multiple downstream nodes but only one upstream node. This
is often the case for distributors that have one central warehouse distributing
goods in multiple shops.
General This is the general case where one node can have multiple upstream and
downstream nodes. These general networks are often segmented further into
cyclic and acyclic supply chains. Acyclic means that there can be no cycle
between various nodes, whereas cyclic supply chains describe potential return
flows.

Figure 10.3 Supply chain topology.

10.2 Local vs. Global Inventory Optimization


In many supply chains, each echelon is still managed separately—often based on simple rules of
thumb. Multi-echelon inventory optimization (MEIO) should then bring added value by
performing a global rather than local optimization. Let’s first discuss the issues of pursuing a
siloed local optimization before discussing the benefits of MEIO.

10.2.1 Local Inventory Optimization


In a supply chain that is locally optimized, each node (in →Figure 10.4, the production facility, the
regional hub and the distribution center) can choose (optimize) its own inventory policy—without
any alignment with the other echelons. It means that each node can pick their own safety stock
levels, optimal order quantity, review periods and so on. They could even change their inventory
policies without letting the others know. You can easily imagine that, with such a siloed myopic
organization, the slightest change in the external demand might drastically impact the supply
chain. Different nodes can even start to pursue rogue behaviors to secure some (profitable) stock,
to the detriment of the supply chain as a whole.
Figure 10.4 Locally optimized supply chain.

Bullwhip Effect

In many cases, supply chains that are stuck in local inventory optimization face a bigger issue than
simple misalignment. They face the risk of a massive bullwhip effect.

Figure 10.5 Bullwhip effect.

As shown in →Figure 10.5, the bullwhip effect describes a situation where the more upstream
an echelon is, the more demand variation it faces, despite the fact that the final demand is rather
steady. The more upstream a node is, the more pronounced the effect. The name “bullwhip”
comes from the fact that a small deviation of the final customer demand will produce a large
variability at the manufacturer end. Just like cracking a whip by a fast flick of the wrist.

A Brief History of the Bullwhip Effect

The bullwhip effect was initially theorized in the 1960s by Jay Forrester (professor at MIT). It got
more attention in the late 1990s, when the name “bullwhip” was bestowed by Procter & Gamble
(P&G) management team. P&G observed that, despite the fact that the final demand for Pampers
was stable (babies consumed a steady flow), the orders at the manufacturing sites were highly
variable.
As identified by →Lee et al. (→1997), there are 4 main causes to the bullwhip effect:
1. Order forecasting
2. Order batching
3. Price fluctuation and promotions
4. Shortage gaming
Let’s investigate them one by one.
1. Order forecasting If each node in the supply chain forecasts its demand based on the direct
orders coming from its downstream nodes—rather than on the final client
demand—the supply chain faces an issue. Each node will create a new forecast
that will tend to distort its own demand signal and (very often) overreact to it.
Then, based on the node inventory policy, this demand signal will be distorted
further (as we will discuss later). These forecasts are not “demand forecasts”
anymore but “order forecasts.”
For example, let’s imagine that you think that demand decreased by 10% per
week. Your current up-to level target is around 4 weeks of inventory (because of
lead time, review period and safety stock—see Chapter →5) so, you will then
decrease it by 4 times the demand decrease you observed. In turn, the node
directly upstream will see a massive order reduction from you (its client). This will
result in an even steeper order decrease from this node to the node upstream.
And so on. The smallest final client demand variation results in a massive variation
at the manufacturer end.
The beer game3—a supply chain simulation game often played at universities—
shows this effect to its players: everyone tends to overreact to the order patterns
they observe.
Being able to forecast directly the final clients demand is particularly important
when the supply chain includes multiple steps (and actors). Supply chains that are
able to accurately react as they see the final client demand, will get a definitive
edge over their siloed competitors. This is particularly important when an external
event results in massive demand shifts (as we saw with the coronavirus crisis).
2. Order batching Usually the more upstream a node is, the bigger its batch size (or the longer
its review period). This means that as we move upstream in the supply chain we
face fewer but bigger orders (resulting in a lumpier order signal). Policies such as
discounts for full truckloads will push this effect further. As each node is batch
ordering, the demand signal will get distorted along the supply chain.
3. Price fluctuation and promotions Price fluctuations (very) often create demand distortions
resulting in a more variable demand (but not always higher overall). As we saw
earlier, as we move upstream in the supply chain, small variations in final demand
will result in a massive bullwhip effect. Often the various supply chain nodes are
not aware that this demand variation is simply caused by pricing variations or
promotions. Promotions for the final client can also force manufacturing to
produce goods months in advance to compensate for lack of production flexibility
and capacity. Order batching and order forecasting will only make the impact of
price fluctuation worse.
4. Shortage gaming In some cases, when the supply chain is very siloed, each node might place
oversized orders in a rogue move to protect itself against a speculative future
supply shortage (this will often happen in time of supply crisis such as caused by
the coronavirus). This will be done at the expense of other nodes who will suffer
from the supply shortage (often resulting from a self-fulfilling prophecy). While
the one node which ordered too much will suffer from excess inventory.
I witnessed this specific issue in a distribution company that had one central
warehouse and multiple (independent) shops. Each shop usually tried to “steal”
inventory from the central warehouse to protect itself from future shortage. They
obviously do this only for profitable products. Overall, this behavior increased
stress and resentment among employees; and resulted overall in lower sales (as
one shop had excess inventory while others suffered shortages).
Shortage gaming can also happen at the very end of a supply chain when final
customers fear that they will lack supply. We observed this effect during the
coronavirus with toilet paper runs.

How Can We Fight the Bullwhip Effect?

The causes above can be fought one by one. Usually it requires a supply chain to:
1. Have a global view on demand and supply across each inventory node. This will
reduce shortage games and order forecasting. Typically using vendor managed
inventory (VMI) will allow a supplier to properly capture the final demand.
2. Have a central team responsible for setting inventory policies across the supply
chain, and check that these policies are followed. This will remove the shortage
gaming.
3. Use a fair-share allocation in case of shortage. And make sure everyone is playing
by the rules.
4. Reduce review periods, lead times and order quantities. This will reduce the
impact of order batching.
5. Orchestrate pricing, promotions and marketing based on supply and inventory
availability. This is often done through S&OP.4

10.2.2 Global Inventory Optimization


Multi-echelon inventory optimization (MEIO) consists of optimizing inventory allocation across a
supply chain in order to achieve a desired service level while minimizing the costs. We will first
discuss what to expect from MEIO and what drives inventory allocation across a supply chain,
before looking into MEIO models.

What to Expect from MEIO

Many software companies have been promoting multi-echelon inventory optimization advantages
through the late 2000s and 2010s, advancing the idea that MEIO can save from 20% to 30% of
inventory (compared to single-echelon inventory optimization). Many MEIO projects have been
documented in academic papers as well as in business cases. Observed inventory reductions
often vary from 10% to 35%. Let’s mention a few cases:
→Graves and Willems (→2000) described an MEIO project done for Kodak in the late 90s.
After two years, they could reduce the inventory by one-third while improving the service
level.
→Billington et al. (→2004) reports saving $130 million for HewlettPackard. Their inventory
level decreased by over 30 percent for the digital-camera business, resulting in a supply
chain total cost reduction of more than 5% (while keeping similar service levels).
In a blog post, →Tayur (→2007) reported that Deere & Company implemented an MEIO
solution for one of their divisions (accounting for 300 products across more than 2500 stock
locations). This resulted in an inventory reduction of $1 billion, while improving the service
level.
→Thonemann (→2011) describes a project undertaken by a big pharmaceutical company
that reduced the working capital tied up in safety stocks by 19% (keeping similar service
levels) for one of their best-selling drugs (in a global supply chain).
In a survey, →Aberdeen (→2012) reported for MEIO users an average 3.1% service level
increase along with a 15% reduction in cash-to-cash cycle.5
I personally witnessed extreme cases where inventory reduction was up to 40% thanks to
MEIO (and some warehouse-resizing adjustments).
Naturally, the magnitude of the results also depends on the supply chain initial maturity level.
Depending on the supply chain management objectives, one could also decide not to reduce the
total inventory level (or only partially), keeping it constant and increasing the service level instead
(thanks to a better allocation of safety stocks). In such cases, MEIO projects won’t deliver an
inventory reduction but a better service level.

Inventory Position Drivers

Let’s discuss three drivers that influence where the (safety) stock should be located in a supply
chain (as shown in →Figure 10.6):6

Figure 10.6 Stock allocation drivers for multi-echelon inventory optimization.

Lead time pooling


Demand pooling
Value increase
Lead time pooling [pushing downstream] As we aggregate demand variation over a longer
lead time (risk-period), we would need less safety stock to achieve the same
service level (see Section →4.3). In other words, it requires less safety stock for
one site to hold safety stock against a lead time of 10 weeks, rather than 10
consecutive sites to keep safety stocks against one week of lead time each. We
would then prefer to locate our stock downstream in order to aggregate the
demand over a longer lead time.
Demand pooling [pushing upstream] As we move upstream in the supply chain, various
different demand signals are aggregated and therefore smoother—for example,
the demand at a manufacturing site is more stable than the one that each shop
faces. Since it is easier to use safety stocks to bridge a stable (big) demand flow
than many small highly variable flows, you want to have the safety stocks
upstream.
Value increase [pushing upstream] Stocking products upstream is often less expensive than
downstream. This is the case for multiple reasons, for example:
Manufacturing sites are often located in cheaper locations than the selling
points (often in big cities), resulting in lower holding costs for upstream
echelons.
In a manufacturing process, raw materials are cheaper (and often easier to
store) than finished products, so you would prefer keeping inventory at the
early stages of the manufacturing process.

MEIO for Production Optimization

So far we discussed MEIO as a method to solve inventory localization in a supply chain network,
but it can also be used to decide where to keep inventory within a production process.7 A
production process can be described as a network with various (possible) stocking points, lead
times, varying holding costs and product values, and finally with different demand signals for
each possible final product. Production processes often rely on postponement or decoupling
points: you need to define which stage of the manufacturing process should hold inventory.
These can be optimized via MEIO techniques.

10.3 Multi-Echelon Inventory Optimization


Now that we reviewed the pitfalls related to single-echelon optimization, and saw the benefits that
await a properly optimized supply chain, we can now discuss multi-echelon models.

10.3.1 Two Schools of Thoughts


During the second half of the 20th century, two different schools of thoughts emerged concerning
the best way to optimize inventory policies across multi-echelon supply chains. Let’s quickly
describe the two different sets of assumptions on which they were based and the models that
resulted.
Stochastic-service model (SSM) This model attempts to model the multi-echelon network
entirely, including all the possible variability. It was initially described in 1960
by Clark and Scarf for a serial supply chain.8 They already noticed, in their initial
paper, that even though the “regular” lead time from an upstream node to a
downstream node might be deterministic—the actual time it takes for a
downstream node to be replenished by its upstream node depends on the
supplier node’s current inventory level.
For example, your supplier will deliver your orders in 2 weeks when it has some
inventory, but in an unknown amount of time if it has no inventory left.
This means that the actual lead time between two nodes is (always) stochastic.
The stochastic-service model becomes massively complex when one node faces
multiple supplier-nodes with various internal service levels (resulting in various
internal stochastic lead times).
Guaranteed-service model (GSM) This model was first described in 1958 by K. Simpson (an
operation consultant at Arthur D. Little).9 It is simpler than the SSM, thanks to a
counter-intuitive (yet central) assumption: the safety stock is only used to cover
demand variation up to a threshold.10 The demand above this threshold (if any)
will be served through exceptional means (e. g., the order can be delayed, extra
hours can be worked, fast shipments can be made, the production can be
externalized, etc.).11 Thanks to this assumption, the model can elegantly (and
relatively simply) optimally allocate safety stocks through a multi-echelon supply
chain. Each node will quote (i. e., guarantee) a maximum replenishment lead time
(the “guaranteed-service time”) to its downstream nodes: if the demand over the
lead time is lower than a bound (as assumed initially), it will consistently deliver its
orders within this time. And if it isn’t, the extra demand won’t impact the
inventory model, because it will be served through other means.

Comparing both Models

The stochastic-service model (SSM) analyzes the stochastic time it takes from one node to
replenish another (based on its inventory level). The stochastic-service model is driven by
internal service levels; whereas the guaranteed-service (time) model12 assumes that each node
will always serve its clients within a fixed quoted time, assuming that the demand is bounded. The
guaranteed-service model is driven by internal guaranteed-service times (in other words,
how much risk-period each node should cover). In short, where the SSM uses safety stocks as
buffer against the entire demand variability (resulting in random lead times), the GSM assumes
that safety stocks will be used until a certain demand threshold.

Results

We already saw that the GSM is simpler than the SSM (it is also faster to optimize mathematically).
But which one will deliver the best inventory policy? In order to see which model would result in
the lowest cost, academics threw both models into competitions over simulated supply chains.
Even though no definitive answer can be drawn on which one is best, →De Smet et al. (→2018)
saw that in most cases GSM would result in lower costs than SSM (depending on parameters such
as service level), with an overall cost reduction of 10%; whereas →Klosterhalfen and Minner
(→2010) showed that the difference between the two models was around 4% maximum
depending on the supply chain features.
Conclusion

We will focus on the GSM because it is—compared to the stochastic model—simpler to


understand, faster to run, and equally performing (even slightly better).

10.4 Serial Supply Chains Using GSM


Let’s start our journey with the guaranteed-service model by solving the simplest multi-echelon
supply chain: a serial network. Rather than first theorize about the model and then use it, we will
get an intuition on how it works (and its limitations) by solving it for a simple network—Vires
acquirit eundo, we gather strength as we go.
The question we ask ourselves is: “How much safety stock should each node keep?”

10.4.1 Case Description


For this example that we will use throughout this section, we will examine a supply chain with 3
echelons (a production facility, a regional hub and a distribution center) as shown in →Figure 10.7.
Each node has its own incoming natural lead time ( L = 4 , L = 3 , L = 2 ) and its own holding
1 2 3

costs ( h = 1 , h = 2 , h = 4 ). Remember that it is usual for downstream nodes to be more


1 2 3

expensive (see Section →x).

Figure 10.7 Example of a serial supply chain.

Review Policy

This supply chain also follows a periodic review policy, with a periodic review of 1 week. More
importantly, we assume that each stocking point is following the same review period, so that the 3
nodes review their stock at the same moment in time. We also assume that each stocking point
has a full view of the current inventory position of all the other stocking points.

Goods Flow

We assume that an order received by the end of a period in a node is directly available for
shipment at the beginning of the next period. In other words, in our example with a supply chain
with a weekly review period, it means that even an order received on Friday evening in the
production facility will be shipped on Monday morning to the regional hub.

10.4.2 Theory: Guaranteed-Service Model


The guaranteed-service time model is based on the allocation of guaranteed-service times to
each node and the fact that the demand is bounded. We will review these two concepts in detail,
before moving to an original risk-period framework that is more intuitive to use (and aligned
with the previous chapters). If you are not interested in the theory of the GSM (or its academic
description), feel free to go to the paragraph →Risk-Period Framework later in this section.

Guaranteed-Service Times

In the guaranteed-service time model, the question of inventory allocation is solved thanks to the
guaranteed-service time that each node quotes to its downstream direct clients.

Our initial question of optimal safety stock allocation is answered with another question: “how
much guaranteed-service time should each node quote?”
Naturally, the allocation of guaranteed-service times needs to respect some requirements:
1. Service times cannot be negative (you cannot quote a service time of minus one
week).
2. The demand nodes (those facing final clients) need to quote a guaranteed-service
time of 0 (except if clients accept otherwise).
Bounded Demand

A supplier-node can only guarantee a maximum service time to its clients if the client demands
are bounded. For example, you can only promise your clients to deliver all their orders within 3
weeks if they agree never to order more than 1000 pieces over 3 weeks. In practice, no supply
chain will forbid demand to be too high. Instead, the demand will be managed via safety stocks up
to a certain threshold (as shown in →Figure 10.9). Thereafter, it will be served via exceptional
means.
Figure 10.9 Bounded demand over τ periods.

Typically, we say that the demand over τ periods, noted d(τ ) , is bounded by the demand bound
ˆ
d(τ ) . We can set this bound similarly to the one for the cycle service level:
13

ˆ
d(τ ) ≤ d(τ ) = z σ d √τ + μ d τ

Based on factor z (see Section →4.2.4 for a refresher), we know the probability for the demand
during τ periods to be within the bound.

Note, the GSM assumes that the demand is bounded by d(τ ˆ


) for each τ within the total risk-

period of the supply chain. For example, if the total risk-period is 10 (as in our example), we
expect that:
ˆ
d(τ ) ≤ d(τ )

for any τ ≤ 10 .
In other words, as long as the clients buy less than d(τ
ˆ
) over τ periods, it will be served fully

on time.
Risk-Period Framework

The traditional approach to GSM is done based on the guaranteed-service times quoted by each
supplying-node to its client-nodes and under the restrictive assumption of bounded demand. We
prefer here an original (simplified) approach based on risk-periods.14 The question we ask is, “Over
which risk-period should each node protect itself?” We have a few (obvious) constraints to respect:
The total risk-period of the supply chain needs to be covered.
In our previous example, the total risk-period was 10 weeks (
L + L + L + R = 4 + 3 + 2 + 1 ) so that the 3 nodes should cover, in total, 10 weeks
1 2 3

of risk.
Each node can only have protection over the maximum risk-period they face.
In other words, if the total incoming lead time of a node is 4 weeks, this node cannot cover
more than 4 weeks of risk-period.
The demand-nodes will support the review period.
As we will see in the simulations (Section →10.5), as long as the targeted service level is rather
high, we shouldn’t worry too much about the bounded demand assumption. The risk-period
framework will therefore allow us to easily allocate safety stocks in a multi-echelon supply chain.

10.4.3 How to Allocate Safety Stock in a Serial Supply Chain


As already shown by Simpson in 1958, the optimal safety stock allocation in a serial supply chain
follows an all-or-nothing policy (if we assume deterministic lead times). It means that a stocking
point will either keep enough safety stock to cover all the reasonable demand (i. e., until dˆ)
over its (incoming) risk-period, or no safety stock at all. This will greatly help us to solve our
serial supply chain since we don’t have to compute many combinations. For our serial supply
chain, we know that there are only 4 potential cases that can be optimal (as shown in →Figure
10.11). More generally, the number of cases to test is 2 .15 That is 2
nodes−1 3−1
= 4 in our example.

You can see in →Figure 10.11 the 4 resulting possible (optimal) cases (where x is the length
i
τ

of the incoming risk-period of the stocking point i). A node with a white triangle means that it
holds enough safety stock to cover its incoming risk-period.

Figure 10.11 Different scenarios to optimize a serial supply chain.

In order to see what is the optimal safety stock allocation, we need to compute the total safety
stock requirement for each case. This is done by summing the safety stock required at each
stocking point S (computed based on eq. →4.3 in Section →4.3.2).
s
i

(10.1)
i i
S s =z σ d √ x τ

Cost Optimization
Actually, we are more interested in the total cost of each case. Minimizing safety stocks is not our
objective, minimizing costs is. The total costs C can be computed simply by multiplying the
h

safety stock in each site by its holding costs.

i i i i i
Ch = ∑ Ch = ∑ Ss h = ∑ z σ d √x τ h

i i i

We leave the cycle stocks aside from this cost equation as cycle stocks are expected to flow
through the supply chain (we assume that there is no minimum order quantity and the review
periods are aligned across the supply chain).
10.4.4 Multi-Echelon Inventory Policies

Local Inventory Policies

We just computed the optimal safety stock allocation for our serial supply chain. As we know,
safety stocks are only a part of the inventory policy. Because we are following a periodic review
policy (R, S) , we still have to compute each node order up-to level S . As shown in →Table 10.2,
i

we have for each node, S = μ + S where μ is the expected demand over the risk-period of
i i
x
i
s
i
x

the stocking point i (see Chapter →5 for a recap about (R, S) policies).

Table 10.2 Order up-to level S for each node.


i

Order up-to levels S i

Case i = 1 i = 2 i = 3

#1 482 371 371


#2 809 371
#3 482 701
#4 1130

Global Inventory Policies

In order to manage the supply chain globally, we have to follow global inventory policies (also
known as echelon policies). The policies we discussed so far are local policies: they deal with how
much stock should be present at a certain stocking point. An echelon inventory policy will deal
with the stock present at an echelon and all those downstream. The echelon order up-to
level of node i , noted 𝓢 , is the sum of all the up-to levels of this node and its (direct and indirect)
i

client-nodes. Formally we have,


i j
S = ∑S

j≤i

For example, as shown in →Table 10.3, the echelon policy of the second node (the regional hub) is
1180 units in the second case ( S = S + S = 809 + 371 ).
2 2 1

Table 10.3 Order up-to level S for each node.


i

Order up-to levels S i


Echelon up-to levels S i

Case i = 1 i = 2 i = 3 i = 1 i = 2 i = 3

#1 482 371 371 1224 742 371


#2 809 371 1180 1180 371
#3 482 701 1183 701 701
#4 1130 1130 1130 1130

In practice, when a node places its order, it will order based on the difference between its
echelon (actual current) inventory (i. e., its inventory plus all its client-nodes inventories) and its
echelon order up-to level.
10.5 Simulation
If we run simulations based on the cases described so far, as you can see in →Table 10.4 and
→Figure 10.12, Cases #1 to #3 will result in a slightly less than expected cycle service level. Case #4
(where all the safety stocks are located downstream) will result in exactly the targeted service
level. This makes sense, in Cases #1 to #3 the client-node is protected against its incoming risk-
period but its upstream supply chain is still impacted by a possible lack of service level (in other
words, Cases 1 and 2 will experience shortages since they don’t assume a 100% service level). In
case #4, the client-node is protected against the whole lead time and is therefore directly fulfilled
by an external supplier (which we assume to be perfectly reliable with a 100% service level).
As you can see in →Table 10.4, the results for cases #1 to #3 are close to the expected cycle
service levels, which confirm that our model can be used to optimize a real-life supply chain.
We will discuss later, in Chapter →13, “→Simulation Optimization,” how to rely directly on
simulations to optimize our supply chain.
Table 10.4 Simulation results for α = 95 and α = 90 .
Cycle service level (target) Case Risk-period coverage Safety stocks Fill rate Cycle service level
95 #1 [4, 3, 3] 224 99.0 94.6
#2 [0, 7, 3] 180 98.9 94.4
#3 [4, 0, 6] 183 98.7 94.9
#4 [0, 0, 10] 130 98.4 95.1
90 #1 [4, 3, 3] 174 97.3 88.4
#2 [0, 7, 3] 140 97.0 88.0
#3 [4, 0, 6] 142 96.6 89.0
#4 [0, 0, 10] 101 96.3 90.0

Figure 10.12 Simulation results for α = 95% .


Figure 10.13 How goods are flowing in our serial supply chain.
10.6 Distribution Supply Chains Using GSM
Thirty-three years after Simpson published his paper about serial supply chains, in 1991,
Inderfurth (Professor at the University of Bielefed, Germany) published an article that shows how
to optimize a distribution supply chain according to the guaranteed-service model.16
Remember, as shown in →Figure 10.14, a distribution supply chain is a supply chain where
each node has a maximum of one supplier (upstream node), and possibly multiple clients
(downstream nodes).

Figure 10.14 Distribution supply chain.

Inderfurth showed that optimizing a distribution supply chain (under the GSM framework) is
similar to solving a serial supply chain. Each site should either cover all its in-coming risk-period (i.
e., until the first upstream node that holds safety stocks) or none. This means that, even for very
wide distribution supply chains (tens or hundreds of sales points), only a few cases are worth
being checked in order to find the optimal case. As shown in →Figure 10.15, in a distribution
supply chain with 3 echelons, only 4 cases need to be checked.
Figure 10.15 Different scenarios to optimize distribution supply chains.

The resulting risk-periods against which each node should be protected are shown for each
case in →Table 10.5.

Table 10.5 Risk-period x for each node in each case.


i
τ

Case Node
1 2 3 4 5
#1 L1 L2 L3 + R L4 + R L5 + R

#2 L1 – L3 + R L2 + L4 + R L2 + L5 + R

#3 – L1 + L2 L1 + L3 + R L4 + R L5 + R

#4 – – L1 + L3 + R L1 + L2 + L4 + R L1 + L2 + L5 + R

10.6.1 Demand Pooling


In a distribution supply chain, some nodes are aggregating the demand of multiple end-clients. In
our example, this is the case of node 1, that deals with d , d , d and node 2 that deals with
3 4 5

d , d . This is serious business because the optimization of a distribution supply chain depends
4 5

on these specific nodes. We have two ways to deal with these:


1. Simply assume that all the final demands are independent (not correlated).
For normally distributed demand, we have these relationships (in our example):
3 4 2
d 1 = d 3 + d 4 + d 5 ∼ N (μ d3 + μ d4 + μ d5 , σ + σ d5 + σ d5 )
d4

2 2
d 2 = d 4 + d 5 ∼ N (μ d4 + μ d5 , σ + σ )
d4 d5

But these relationships will only hold if all the final demands are normally and
independently distributed (see Section →4.3.3 for a discussion about demand
independence).
What if d is gamma-distributed? What if they are not independently distributed?
3

2. We can also estimate the demand at each node directly by studying the demand
flowing through this node. In our example it means that we would directly
estimate d by summing the observations of d , d , d and assessing the
1 3 4 5

resulting μ , σ , and the distribution (normal, gamma...) as we discussed in


d1 d1

Section →9.4. This second approach will usually be more accurate but will require
more data processing.

10.7 A Brief History of the Guaranteed-Service Model


Figure 10.16 Papers published on GSM per year. Source: →Eruguz et al. (→2016).

Even though the very first MEIO models were published in 1958 and 1960 (for the guaranteed-
service and stochastic-service models respectively), the application of MEIO is rather recent for
multiple reasons:
1. The first papers were limited to very specific and serial supply chain networks. We
had to wait until the end of the 20th century for new, more general and applicable
models to be published by academics.
2. MEIO requires information systems able to centrally manage wide supply chain
networks (including inventory, supply and demand visibility across multiple
countries and business units).
3. MEIO requires more computation power and is more complex than single-echelon
inventory optimization (SEIO).
The guaranteed-service time model was initially proposed in 1955 by Kimball. This framework was
used by Simpson (both consultants for A. D. Little) in 1958 to solve a serial supply chain.17 After
the initial papers in the late 50s, it took 30 years to see more advanced models thanks to a
renewed interest from the academic world that started in the 90s (as shown in →Figure 10.16).
Inderfurth was the first to show how to solve a distribution network in 1991.18 In the following
decade, more advanced models were proposed.19 Most notably, →Graves and Willems (→2000)
had a profound impact on GSM: they showed how to solve a general (acyclic) supply chain thanks
to dynamic programming.20 Since this article was published, many academics published new
models (removing some of the initial assumptions)... And software developers implemented them
as they developed tight relationships with academics.
MEIO has been seen as the new frontier for supply chain optimization software as of the mid
2000s to mid 2010s—and it is now being replaced by the rise of artificial intelligence.

10.8 Recap
Siloed supply chains face many risks (too much inventory, fights over shortages, bullwhip effect)
that can be overcome with a proper global inventory policy. In order to do it, we need:
Visibility and control over the inventory levels in the supply chain
Multi-Echelon Inventory Optimization (MEIO) models
We saw in Sections →10.4 and →10.6 how to optimize serial and distribution supply chains thanks
to the risk-period framework: a simplification of the guaranteed-service time model. It is based on
three rules:
The total risk-period of the supply chain to be covered
Each node can only take protection over the maximum risk-period they directly face
The nodes facing the final clients will support the review period
For more complex networks (assembly and acyclic general) you can use the guaranteed-service
time model. See →Graves and Willems (→2000), →Moncayo-Martínez and Ramirez (→2016) for its
implementation.
Part IV Discrete Inventory Optimization
11 Newsvendor

In this chapter, we will discuss the newsvendor model,1 one of the most thoroughly studied
inventory models among academics. We will first go through the model with an example of a
small bakery shop. Then, we will discuss the theory behind this model in detail. As we discover the
newsvendor model, we will take the opportunity to discuss discrete demand distributions for the
first time. Remember, discrete demand distributions means that the demand can only take integer
values. Whereas continuous demand distributions can take any value. In practice, it is often more
accurate to assume that the demand can only take integer values as often a client can only buy a
round number of products.

11.1 A Question of Chocolate Muffins


You open a small bakery shop. Every evening, you need to decide how many (delicious) chocolate
muffins you want to bake for your clients to buy the following day. This is an important decision.
Baking muffins takes hours, mostly due to the time it takes to cook them in the oven. This means
that, if a client enters your shop during the day and wants to buy one of your delicious muffins,
you can’t take the time to bake a new one. You need to bake them in advance—through the night
—for the next day.
Every evening you have to make a decision on how many muffins you should bake for the next
day.
Through experience, you have analyzed how many muffins clients wanted to buy per day, as
shown in →Figure 11.1 and →Table 11.1.

Table 11.1 Muffin demand PMF p(d) and CDF P (D ≤ x) .


x 0 2 4 6 8 10
p(d) 40% 20% 20% 10% 5% 5%
P (D ≤ x) 40% 60% 80% 90% 95% 100%

Figure 11.1 Muffin daily demand probability distribution.


We will note
p(d) the demand probability mass function. This is the probability for the demand to be

d. In this chapter, for the sake of clarity, we abuse the notation a bit by using p(d) instead of
p (d) , as we implicitly assume that we are referring to the demand probability mass
D

function.
P (D≤x) the probability for random discrete variable D to be smaller than or equal

to x . This is equivalent of F (x) for a continuous distribution.


D

You took the time to analyze your costs. It costs 2€ to bake a muffin (mostly flour, sugar,
chocolate, electricity and love) and you sell them at 6€ per piece. If at the end of the day you
couldn’t sell all of them, you reduce their price to 1€ and by doing so, they always get sold. We will
call this the salvage value. You have to do this, because the muffins will lose their taste and
texture throughout the night anyway.

So, how many muffins should you bake?

11.1.1 Do It Yourself

Excel

In order to see how the quantity we decide to bake impacts our expected profits, let’s create a
simple model in Excel (later in Python), rather than diving directly into a mathematical model.
Let’s start by setting up a table as shown in →Figure 11.2.
The demand values and probabilities are on columns B and A respectively.
The different possible order quantities (or in this case, the baked quantities) are spread
across the second row (range C2:G2). Note that the choice is here arbitrary, you could create
another table to test a quantity of 20 muffins.
The different cost variables are on cells J2:J4.
Now, we have to compute the profit (or cost) for each combination of demand and quantity, we
note it 𝓟(Q,d) and compute it as below:
P(Q, d) = p ⋅ min(Q, d) + s v ⋅ max(0, Q − d) − c ⋅ Q
Where:
p ⋅ min(Q, d) is the price per unit multiplied by the amount of sales.
s v ⋅ max(0, Q − d) is the salvage value multiplied by the excess units (if any).
c ⋅ Q is the cost per unit multiplied by the order quantity.

This formula is translated into Excel by typing this formula in cell C3.
C3 = MIN($B3;C$2)*$J$2+MAX(0;C$2-$B3)*$J$4-C$2*$J$3

This formula can then be dragged onto the range C3:G8.

Figure 11.2 Table setup.

Finally we need to compute the expected profit for each quantity: we want to answer questions
like “What is the expected profit if I bake 4 muffins?” We can answer this by using the formula below:

P(Q) = ∑ P(Q, d) ⋅ p(d)

where p(d) is the demand probability mass function (the probability for the demand to be d). We
can compute this easily in Excel by typing this formula in cell C10 and then copy and paste it in the
range C10:G10.
C10 = SUMPRODUCT(C3:C8,$A$3:$A$8)

You should then obtain a table as shown in →Figure 11.3.


Figure 11.3 Final table.

Therefore, we have the answer to our question “How many muffins should I bake?” We should
bake between 4 and 6 muffins per day to maximize our profits.

Python

We can also solve this case easily with Python. Let’s first define the demand values and probability
mass function PMF and the possible order quantities as lists.

We will store the profits for each combination of demand and quantity in a NumPy array called
results.In order to do so, we will iterate through demandand quantityand update resultsfor each
combination. Note that, instead of the usual method range(), we use the method enumerate()which
returns at once an iterator and a counter.

You can then print resultsto confirm that it worked.


Let’s now compute the expected profit for each order quantity, we will store the results in
profits.

Again, we can print profitsto confirm that our code worked.

Finally, we want to get the optimal order quantity (EOQ).

We used here the escape character \nwhich prints a line break. We also used np.argmax()which
returns the position of the highest element of a list or array-like.

11.2 Newsvendor Model

11.2.1 A Brief History of the Newsvendor Problem

A horse, a horse, my kingdom for a horse.


Richard III by Shakespeare (around 1593)

In 1888, an Anglo-Irish economist—Francis Edgeworth—made an analysis to compute how


much cash a bank should hold to serve its clients,2 by using the normal probability function which
was discovered and analyzed 80 years earlier by Gauss and Laplace. This is usually referred to as
the first newsvendor model.
Actually, the modern formulation of the newsvendor problem dates back to 1951 with the article
“Optimal Inventory Policy” by K. Arrow, T. Harris and J. Marschak.3 To illustrate the shortage cost,
they quoted Richard III in the Shakespeare play about his horse. Where Richard III badly missed a
horse to finish his battle. Traditionally, this model is explained as followed:
You sell newspapers. Every morning you have to decide how many you want to buy from your distributor. You can’t buy new
ones during the day and if you have remaining newspapers at the end of the day you won’t be able to sell them. How many
newspapers should you buy?

We can generalize this story (and the chocolate muffins one from above) as the case where, as
you won’t be able to replenish your stock through the sale cycle (or season), you have to decide
how many products you want to source before the sales come in. In other words, this model is
applied for products with a limited lifecycle that you need to produce or order in advance.
Let’s define 4 conditions for an inventory problem to be defined as a newsvendor problem:
1. The order is placed before the season.
2. You cannot make an order through the season.
3. There is a cost for buying too much (i. e., excess cost).
4. There is a cost for buying too low (i. e., shortage cost).
Here are some examples:
Seasonal products Products that are purchased ahead of the season. This is typically the case
for most of the fashion industry (especially when sourced overseas).
A typical historical example are calendars: these are seasonal products (with a
very finite lifecycle) for which the production setup cost is high. It may then be
cheaper to make one order for the whole year. Nowadays, thanks to digitization,
the printing industry could reduce these setup costs.
Stock for a special event How much coffee—or champagne—to buy for a special event is a
typical newsvendor problem: you can’t buy more during the event, you face
excess costs if there are any leftovers and shortage costs if you don’t buy enough
(attendees won’t be happy!).
Safety stock The safety stock model (as created in Part →II and →III) is a newsvendor problem
with the season being one order cycle: you have to decide before the cycle how
much you want to source (until the next one).
Now that we understood what the newsvendor problem is about, let’s solve it and determine
what is the best order quantity. In order to do so, we will first model the supply chain costs, then
minimize them and finally find the optimal order quantity as shown in →Figure 11.4.
Figure 11.4 Inventory optimization journey.

11.2.2 Costs
As we did in Chapter →2 for the EOQ model, let’s start this new model by discussing the costs and
see how we can minimize them later.
We will be looking at two types of costs for the newsvendor model: the overage costs c and
o

the underage costs c . u

Overage Costs (co )

These are the costs the supply chain faces if a product is not sold at the end of a period (they
would literally be over the saleable age). These costs are also sometimes called excess costs and
actually have multiple components:
Purchase cost ( c ) If we assume that the products can’t be sold anymore at the end of a period
(in other words, they are considered to be lost), the main overage cost is then the
product purchasing costs (including all transportation, packaging and other
costs). Note that, in the newsvendor literature, the purchase cost is sometimes
noted w, as the model often describes a retailer buying its products from a
wholesaler.
Salvage value ( s ) The salvage value can either be an income (salvage price) or a cost (salvage
v

cost).
Income In some cases, you will be able to sell the remaining goods at the
end of a period at a discounted price. This happens, for example,
if your supplier will take back the goods or if you have a sales
channel selling the remaining goods at a discounted price (think
about the multiple yearly sales in the fashion industry). This
salvage value reduces the overage costs, as part of the purchase
cost will be recovered. When the salvage value is an extra income
we call it the salvage price.
Cost In other cases, a company faces extra costs to dispose of its
excess inventory (e. g., waste disposal). In such a case, the salvage
cost should then be added on top of the purchasing cost.
Holding costs ( h ) If you can sell your products over the next period, you don’t lose the full
purchase cost but simply the expense of the holding cost h (as defined in Section
→2.1.1 for the EOQ model).
Let’s recap the overage costs. If we assume that we cannot sell the products in a later period,
we have:
Overage Costs= Purchase cost − Salvage value

co = c − sv

Or, if we can sell the products in another period:


Overage Costs= Holding cost

co = h

Again, note that the salvage costs can be actually a salvage revenue in the case where the leftovers
can still be sold for a profit. For example, that was the case in our muffin case where the salvage
revenue was 1€ (i. e., you sold any remaining piece for 1€); so that the overall overage costs were
actually 1€ (the muffins initial selling price was 2€). We could imagine another scenario where you
have to pay a company to dispose of your leftovers (for example, in the case of hazardous goods).

Underage Costs (cu )

These are the costs we face if we lose a sale due to a lack of inventory, they are sometimes called
shortage costs.
Profit ( p − c ) If you lose a sale, you lose the opportunity to make a profit. The amount of
unrealized profits are then more an opportunity cost rather than a real expense or
loss. We simply define the profit as the price p minus the cost c.
The profits are included as an underage cost in the newsvendor model when it
minimizes the costs (so that we want to minimize the unrealized profits); but are
not included in the underage cost when the newsvendor model maximizes the
overall profits (otherwise it would include an opportunity cost into an actual
profits estimation).
Goodwill ( g ) This represents any extra cost associated with the risk of losing a client or—even
worse—the damage to your reputation, which could affect other clients buying
decision. As we already discussed in Section →2.1.3, this aspect is particularly
difficult to estimate and might be left to gut feelings rather than academic
research.
Penalty A penalty can be incurred for each lost sale or demand that cannot be delivered
directly from the stock on-hand. For example, these penalties are often used for
maintenance parts when the client values a high service level. When there are
penalties between parties for a lack of service, they are usually defined in the
service agreement between the supplier and the client.
As penalties have a similar effect as goodwill (i. e., an extra cost), we won’t give it
a special symbol in our model. We will group the penalties directly into the
goodwill for the sake of simplicity.
We then have:
Underage Costs= Price − Cost + Goodwill

cu = p − c + g

Note that, in case of potential confusion, we will call the cost of ordering 1 unit too much
(respectively too low) the unit overage (underage) costs. Whereas we call the total expected
overage (underage) costs the total overage (underage) costs.
Keep in mind that this underage cost—as it includes the opportunity cost of losing a sale—is
for analysis purposes and not for accounting.

11.3 Newsvendor Model Optimization


Now that we have analyzed the various costs of our system, we can model the expected profits (or
costs) based on the order quantity and the demand distribution. The demand in a newsvendor
model can be modeled as a continuous probability function—such as normal or gamma—or as a
discrete probability function (as we did for the muffin example). Remember, a discrete variable
means that the function can only take integer values and is described by a probability mass
function.

11.3.1 Expected Outcomes

As shown in →Table 11.2, we can compute the expected sales, excess units and units short4 for any
given order quantity Q and demand d. Then, as we know the demand distribution (either discrete
or continuous), we can compute the expected outcomes only based on Q.

Table 11.2 Expected outcomes based on d and Q.


Expression (Q, d) Discrete (Q) Continuous (Q)
Sales min(Q, d) ∑ d≤Q d p(d) ∫
Q
d f (d) dd
d=0

Excess units max(0, Q − d) ∑ d<Q (Q − d)p(d) ∫


Q
(Q − d)f (d) dd
d=0

Units short max(0, d − Q) ∑ d>Q (d − Q)p(d) ∫



d=Q
(d − Q)f (d) dd

You could see the “Expression (Q, d) ” column as the formula you have to type in Excel to
compute the actual expected values based on Q and d; the “Discrete (Q) ” column are the
formulas we will investigate in this chapter; finally the column “Continuous (Q) ” contains the
formula we discussed in Chapter →7.
Remember, p(d) is the demand probability mass function PMF at the value d, that is the
probability that the demand is d. This is the discrete equivalent to f (d) . D

11.3.2 Expected Profit Based on Q and d


We can now express the total revenues, costs and profits of our model.
Revenues= p ⋅ Sales

Costs= c o ⋅ Excess units + c u ⋅ Units short + c ⋅ Q

Prof its= Revenues − Costs

= p ⋅ Sales − c o ⋅ Excess units − c u ⋅ Units short − c ⋅ Q

P(Q, d)= p ⋅ min(Q, d) − c o ⋅ max(0, Q − d) − c u ⋅ max(0, d − Q) − c ⋅ Q

where p is the sales price, c the (unit) overage cost,5 c the (unit) underage cost and c the
o u

purchasing cost. Note that, in this equation, the underage costs shouldn’t include any opportunity
cost (i. e., the unrealized profit) but only costs such as penalties or goodwill.

Of course, this example only showed us what would happen if the demand was 1 piece. What
about all the other possibilities?

11.3.3 Expected Profit Based on Q


As we know the probability mass function of d, we can express the sales, excess units and units
short solely based on Q.

Sales (Q)= ∑ p(d)d

d≤Q

Excess units (Q)= ∑ p(d)(Q − d)

d<Q

Units short (Q)= ∑ p(d)(d − Q)

d>Q

So that we can express the total expected profits P solely based on Q:


Prof its= p ⋅ Sales − c o ⋅ Excess units − c u ⋅ Units short − c ⋅ Q (11.1)

P(Q)= p ∑ p(d)d − c o ∑ p(d)(Q − d) − c u ∑ p(d)(d − Q) − c ⋅ Q

d≤Q d<Q d>Q

What is particularly interesting about this profit expression is that it is universal regardless of the
demand probability mass function. This was not the case with the continuous safety stock model
from parts →II & →III, where a formula might change depending on the demand probability
function. This means that we can use any discrete custom demand distribution we need.

Insights

As shown in →Figure 11.5, the intuition here is as Q increases, so do the sales incomes (the higher
Q is, the lower units short you face). The underage costs will also decrease as Q increases (again,
as we face less units short). But, the overage costs and the purchasing costs will grow.

Figure 11.5 Optimal order quantity for the newsvendor model based on profits.

11.3.4 Expected Costs Based on Q


Instead of looking at the profits based on Q, we can simplify our model and only look at the costs
C (Q) . For both models to be equivalent, we have to include in the underage costs the unrealized

profits per sale missed. We then have:


Costs= c o ⋅ Excess units + c u ⋅ Units short (11.2)

C (Q)= c o ∑ p(d)(Q − d) + c u ∑ p(d)(d − Q)

d<Q d>Q

where c include the profit per item sold.


u

Insights
We already observe in Figures →11.6 and →11.7 that the minimal cost will be achieved when the
underage costs and the overage costs will be equal.

Figure 11.6 Optimal order quantity for the newsvendor model based on profits.

Figure 11.7 Optimal order quantity equilibrium for the newsvendor model.

11.3.5 Optimal Order Quantity


Now that we can express the expected costs based on the order quantity, we have to answer one
last question: “What is the optimal order quantity?” We want to find the optimal order quantity Q
which maximize our profits P(Q) (eq. →11.1 in Section →11.3.3); or, as we did in Chapter →8,
“→Cost and Service Level Optimization,” the quantity that minimizes the costs C (Q) (eq. →11.2).
We start then from the following cost equation

C (Q) = c o ∑ p(d)(Q − d) + c u ∑ p(d)(d − Q)

d<Q d>Q

Note that here the underage costs c include the unrealized profits per unit short.
u
Continuous Model

Economics teach us that the optimal order quantity of our model will be found when the marginal
gain and loss of ordering an excess unit will be equal. In other words, we will reach the
economical optimum when the marginal expected overage and underage costs of ordering an
extra unit are equal. Let’s compute these two marginal costs for the Qth unit ordered. As a
reminder, we note F (Q) the demand CDF at Q, that is the probability that the (continuous)
D

demand is lower than Q.


Expected marginal overage costs: c F (Q)
o D

This is the probability for the demand to be lower than the order quantity,
multiplied by the unit overage cost.
Expected marginal underage costs: c (1 − F (Q))
u D

This is the probability for the demand to be higher than the order quantity,
multiplied by the unit underage cost. Note that, for this model, we will include the
profit per unit in the expected marginal underage costs, in order to take into
account the opportunity costs in the total costs.
We can find the optimal order quantity Q by equalizing the expected marginal overage and

underage costs (as shown in →Figure 11.8).6

Figure 11.8 Optimal order quantity for the newsvendor model based on marginal costs.

Mathematically, we have:
c o F D (Q)= c u (1 − F D (Q))

(c u + c o )F D (Q)= c u

cu
F D (Q)=
cu + co
This means that with the optimal order quantity Q , we have an optimal cycle service level α
∗ ∗

equal to the ratio c /(c + c ) . This ratio is called the critical ratio.
u u o

cu cu (11.3)
∗ ∗ ∗ −1
α =F D (Q )= ⇔ Q =F D ( )
cu + co cu + co

In other words, if the demand is assumed to be continuous, the optimal cycle service level α ∗

should be equal to the critical ratio c /(c + c ) .


u u o

Discrete Model

Optimizing the discrete newsvendor model is slightly more complex than the continuous one. In
his book, Cachon proposes to tackle this problem by a similar approach (i. e., looking at marginal
costs).7 We want to increase our order quantity Q as long as the expected increase in overage
costs is lower than the expected underage cost reduction of ordering an extra unit.
The (total) expected underage cost reduction, if we order Q + 1 instead of Q is:
c u P (D > Q)

which is the probability that we sell more than Q, multiplied by the unit underage cost c . u

The (total) expected overage cost increase, if we order Q + 1 instead of Q is:


c o P (D ≤ Q)

which is the probability that we sell Q or less units, multiplied by the unit overage cost c .
o

So, we want to order Q + 1 instead of Q only if the expected overage cost increase is lower
than the expected underage cost reduction:
c o P (D ≤ Q)≤ c u P (D > Q)

c o P (D ≤ Q)≤ c u (1 − P (D ≤ Q))

c o P (D ≤ Q)≤ c u − c u P (D ≤ Q)

c u P (D ≤ Q) + c o P (D ≤ Q)≤ c u

P (D ≤ Q)(c u + c o )≤ c u

cu
P (D ≤ Q)≤
cu + co

This means that, as long as we have,


cu
P (D ≤ Q) ≤
cu + co

we want to increase Q (i. e., it is simply more profitable to order more units). So that the optimal
order quantity Q is the lowest order quantity Q that achieves

cu
P (D ≤ Q) ≥
cu + co

That is, the lowest value for which we do not want to order more.
Another demonstration, based on total costs, is available in Appendix →B.5.
11.4 Recap
The newsvendor model allows us to answer the question “How much should I order before the
season?” for products that need to be ordered before the sales cycle. In order to do so, we have to
compute two types of costs:
Overage costs ( c ) All the costs related to having too many products at the end of the season.
o

This is typically the purchasing/production cost of the product.


Underage costs ( c ) All the costs related to having not enough products through the season.
u

This is typically the expected profit of the lost sales.


We computed the optimal cycle service level α based on the critical ratio (see eq. →11.3 in

Section →11.3.5):


cu ∗ −1
cu
α = ⇔ Q = F ( )
D
cu + co cu + co

We can compute the expected sales, extra units and units short (see →Table 11.2) as:
We have this general expression for the profits (see eq. →11.3.2 in Section →11.3.2):
Revenues= p ⋅ Sales

Costs= c o ⋅ Excess units + c u ⋅ Units short + c ⋅ Q

Prof its= p ⋅ Sales − c o ⋅ Excess units − c u ⋅ Units short − c ⋅ Q

So that the total profits P can be expressed based on Q and d as:


P(Q, d) = p ⋅ min(Q, d) − c o ⋅ max(Q − d, 0) − c u ⋅ max(d − Q, 0) − c ⋅ Q

If the demand is discrete, we can then express the total profits based on Q solely as we know the
demand probability mass function (see eq. →11.1 in Section →11.3.3):
P(Q) = p ∑ p(d)d − c o ∑ p(d)(Q − d) − c u ∑ p(d)(d − Q) − c ⋅ Q

d≤Q d<Q d>Q

Expression (Q, d) Discrete (Q) Continuous (Q)


Sales min(Q, d) ∑ d≤Q d p(d) ∫
Q
df (d) dd
d=0

Excess units max(0, Q − d) ∑ d<Q (Q − d)p(d) ∫


Q
(Q − d)f (d) dd
d=0

Units short max(0, d − Q) ∑ d>Q (d − Q)p(d) ∫


d=Q
(d − Q)f (d) dd
12 Discrete Probabilistic Demand
In Part →II, “→Stochastic Supply Chains,” we initially assumed our demand to be normally
distributed. Later, in Chapter →9, “→Beyond Normality,” we analyzed gamma-distributed
demand. We will discuss in this chapter multiple techniques to estimate a demand distribution (or
density) via a custom probability mass distribution. In other words, we won’t use a predefined
continuous probability function to estimate our demand anymore, instead we will create a tailor-
fitted discrete distribution for it instead. Next, in Chapter →13 “→Simulation Optimization,” we
will discuss how to optimize a policy with a custom demand distribution.

12.1 Histograms
A first technique to estimate (discrete) demand density is to use histograms, as shown in →Figure
12.1 (using Toyota sales in Norway with an arbitrary choice of 10 bins starting at 550 and ending at
2050).1

Figure 12.1 Demand density based on a histogram with 10 bins.

Creating a histogram is simple (see Section →9.1.1 for a DIY in Python), but it requires that
you make arbitrary choices that come with issues. In order to understand the limitations, let’s
recap how a histogram is built.

How to Make a Histogram


The interval covered by data is first divided in sub-intervals, called bins. The frequency of each bin
(its height on the figure) is the fraction of observations (i. e., data points) that fall into it. This
frequency is then allocated to the center of each bin as shown in →Table 12.1.
Table 12.1 Demand frequency based on a histogram with 10 bins.
Bins # of observations Frequency
left center right
550 625 700 1 0.8%
700 775 850 2 1.7%
850 925 1000 9 7.5%
1000 1075 1150 10 8.3%
1150 1225 1300 20 16.7%
1300 1375 1450 26 21.7%
1450 1525 1600 28 23.3%
1600 1675 1750 13 10.8%
1750 1825 1900 10 8.3%
1900 1975 2050 1 0.8%

12.1.1 Limitations
Using a histogram to estimate the demand distribution comes with 4 main issues:
1. A probability is only given to a few values: the values at the center of the bins. For
example, in the resulting demand distribution from →Table 12.1, there is 21.7%
chance to have a demand of 1375 units, but 0% of having 1376.
Figure 12.2 Demand density based on a histogram with 10 bins.

2. We do not know how many bins we should use. As shown in →Figure 12.3, the
number of bins will impact the representation we have of the demand
distribution.
3. We do not know what the histogram limits should be (left and right edges).
Choosing another set of limits will also change the demand distribution
representation. For example, the two distributions obtained in →Figure 12.2 do
not give us the same demand distribution, whereas the only difference is the
histogram edges (respectively [550,2050] and [668,1901]).
To summarize, based on the arbitrary choices we make about the number of bins
and where they start, we can get a completely different picture of the (demand)
distribution.
4. The resulting demand distribution is not continuous (in other words, smooth). As
you can see in →Figure 12.1 the variation between two consecutive bins can be
rather high. For example, we have 23.3% for the demand to be 1525, but only
10.8% to be 1675. This is an abrupt change and it would be more realistic to see a
smooth decrease, but obviously (as stated earlier), with only a few possible
demand values, a smooth variation is difficult.
Figure 12.3 Impact of different numbers of bins on the demand distribution.
12.2 Kernel Density Estimation
We can improve our demand distribution estimation by getting rid of the issue of the arbitrary
number of bins, and the histogram limits. In order to do so, we will allocate a small density
probability around each demand observation thanks to a kernel function.2

This should be more accurate than a histogram where each observation is allocated to the closest
bin. Now each observation will get its own bin.
Let’s see a first simple example to understand how it works.3
12.2.1 Squared Kernel

Figure 12.4 Demand distribution based on squared kernels (bandwidth = 20).

As a first test, we will use a squared (or box) kernel. In other words, we will allocate a density
around each observation by drawing a square around it as shown in →Figure 12.4 (here with a
bandwidth of 20). The overall (demand) density is then the sum of density around each point. In
other words, if the kernels (represented by the dotted squares) around neighboring points
overlap, we simply map the resulting density as the sum of these kernels. The resulting demand
distribution is then the normalized4 sum of the distribution around each and every demand point.

12.2.2 Limitations
We solved two issues of the histogram—we don’t have to determine arbitrarily the number of
bins nor the edges of our distribution—but we still face other limitations:
1. The resulting distribution is not smooth because we have used a discontinuous
kernel as our building block. This will result in abrupt changes in the demand
density estimation.
2. We do not know what the bandwidth of our kernel should be. In other words,
what the ideal width is for each square.
As you can see in →Figure 12.5 (with a bandwidth of 40), depending on the bandwidth we use for
the squares, we get a different demand estimation (even a different overall interpretation of its
distribution).
Figure 12.5 Demand distribution based on squared kernels (bandwidth = 40).

12.2.3 Gaussian Kernel


In order to get a smooth demand distribution, we should use a continuous, smooth kernel
function. The usual way is to use a normal distribution as a kernel, instead of squares. Note that
we could use any other distribution instead of the normal one, but we choose to use it because it
is simple, well-known, centered around its mean and smooth.
As for the squared kernel, depending on the kernel bandwidth (i. e., the standard deviation of
the normal distribution around each data point) we get a different picture (compare Figures
→12.6 and →12.7) with a more or less extreme representation of the demand distribution.

Figure 12.6 Gaussian kernel with σ = 20 .


Figure 12.7 Gaussian kernel with σ = 40 .

Kernel Optimization

We have one last issue to solve: how to optimize the bandwidth of our kernel. In other words, how
wide should the normal distributions we draw around each datapoint be?

Usually, academics use the Silverman or Scott rule of thumbs to optimize the kernel bandwidth.5
Both rules of thumbs compute the bandwidth in a (very) similar fashion:
1 (12.1)
Scott: bandwidth=σ d
1/5
n

1
Silverman: bandwidth= σ d
3 1/5
( n)
4

where n is the number of demand observations in the dataset and σ is the standard deviation
d

estimated from the observations.


You can see in →Figure 12.8 multiple demand density estimations with various bandwidths.
The demand density estimations go beyond the minimum and maximum values actually
observed. This makes sense. Our kernel density estimation is smart enough to understand that it
is not because we never saw a demand above 1901 units before that we should estimate that a
probability for the demand of 1902 is 0%.
Figure 12.8 Kernel optimization.

Based on practical experience, it seems that Scott’s rule of thumbs tends to underfit the true
underlying distribution.6 In other words, as you can see in →Figure 12.8, the resulting distribution
will be too smooth (loose). Setting the bandwidth at 90% of Scott’s rule might then be a more
appropriate choice (the resulting distribution will be less smooth based on a lower bandwidth).
12.3 From Gaussian Kernels to Discrete Distributions
We just used a Gaussian kernel density estimation to determine a custom continuous demand
distribution based on a set of demand observations. The objective of this Part is to build a discrete
simulation optimization (we will create the optimization engine in Chapter →13), therefore we
now have to transform this distribution from a continuous PDF to a discrete PMF. For each
possible (integer) demand value within the range of our demand distribution, we want to
estimate its probability to occur.

12.3.1 How to Define a Set of Possible Values


The continuous distribution we created so far is giving us a probability for an infinite range of
possible demand values. Mathematicians say that the domain of the distribution goes from −∞
to ∞.

When we transfer this continuous distribution to a discrete one, it will not be feasible to compute
the probability for an infinite number of possible demand values. Especially as we know that the
probability for the demand to be extremely high (or low) is (virtually) zero.
This means that we have to define a reasonable range of possible demand values. In practice,
this means setting a lower and an upper bound to the demand distribution. A simple way to do
that is to set these arbitrarily. But we risk cutting the distribution too thin (resulting in losing some
possible values) or too wide (resulting in a slower simulation).
We can use a smarter technique: we can set these bounds based on the lowest and the
highest demand observations, respectively, subtracted or added to an arbitrary multiple of the
bandwidth.
As shown in →Figure 12.10, the lower bound can, for example, be set as the lowest
observation minus 3 times the bandwidth.
Figure 12.10 Lower and higher bounds for a demand distribution estimation via KDE.

As Φ(−3) = 0.13 , it means that there is a probability of only 0.13% for an occurrence of the
normal kernel around the lowest observation to be even lower.7 Moreover, as the overall
distribution contains n kernels, the probability for an occurrence of the demand distribution to be
below this threshold is 0.13
n
% (assuming that the probability for an occurrence of any other

kernel is lower than the lowest bound is 0). You can then set your own safety factor to arbitrarily
reduce this probability. Nevertheless, a factor such as 3 or 4 should be enough.
Finally, as we want to define our discrete distribution for round numbers, we have to round
the lower and upper bounds to an integer value. As a final conservative measure, we can round
them to the lower and upper integer respectively.
12.3.2 Demand Attributes
Now that we have defined a custom demand distribution (PMF) over a domain (x), we can
compute the demand distribution mean as:

μ d = ∑ pmf i ⋅ x i

where x is the demand domain.


And the demand variance ( Var ) and standard deviation as:
d

2 2
Var d = ∑ x i ⋅ pmf i − ∑ (x i ⋅ pmf i )

i i

σ d = √ Var d
12.4 Recap
As shown in →Figure 12.11, we can estimate a demand probability distribution thanks to a kernel
distribution estimation (KDE). We do this in two steps:
1. Drawing a kernel (i. e., a distribution function) around each demand observation
2. Estimating the demand distribution as the (normalized) sum of the kernels
We saw that using a normal distribution as the kernel was a meaningful choice because it would
result in a smooth demand estimation.
Figure 12.11 Gaussian kernel with σ = 40 .

The kernel bandwidth (i. e., the standard deviation of the normal distribution around each
demand observation) can be estimated by Scott’s rule of thumb:
1
Bandwidth = σ d ⋅ (see eq. 12.1 in Section 12.2.3)
1/5
n

where n is the number of demand observations.


A probability mass function (PMF) can then easily be estimated as the normalized PDF for
each integer value.
13 Simulation Optimization
As early as 1979, Nahmias noted that, “Research has tended to focus on providing rigorous analyses
of optimal policies for relatively simple problems rather than developing workable solutions to realistic
problems.”1 Indeed, the models we’ve seen so far rely on restrictive assumptions such as normally
distributed demand and lead times, or the fact that all excess demand would result in backorders.
Is this realistic? Most likely not.
Let’s review some of the assumptions we made:
We assumed that all excess demand would result in backorders. What if part of them would
result in lost sales? What if items staying in the backlog for too long would result in lost
sales as clients cancel their orders if they wait too long?
We assumed the demand to be either normally or gamma-distributed. What if it follows a
unique distribution (as presented in Chapter →12)?
We assumed that our goods do not deteriorate over time. But, in reality, many products will
suffer from some kind of deterioration (or even perish over a short timeframe).
It will be extremely difficult (impossible?) to solve these cases using mathematical models. This is
where simulation optimization (or simply sim-opt) will shine. Instead of creating a mathematical
model, in order to optimize a supply chain, we will run (many) simulations, each time with
different inventory policies, and pick the one that resulted in the lowest cost.

13.1 Safety Stock Optimization


Let’s create a first simulation optimization (sim-opt) model to optimize the amount of safety stock
we need in a complex setting.

13.1.1 The Case


Let’s imagine that we have a supply chain with:
A demand distribution as determined in Chapter →12, “→Discrete Probabilistic Demand.”
A lead time that follows a probability mass distribution (PMF) as shown in →Table 13.1.
A backlog cost denoted b , i. e., a cost per unit in the backlog per period (rather than a fixed
τ

backorder cost b that is a cost per unit short as in Chapter →8). In other words, we pay a
penalty based on how long clients have to wait for their goods to be delivered (rather than a
single penalty for not having the goods immediately).
We want to find an inventory policy that minimizes the costs of our supply chain. This would be
difficult to do with the mathematical models we’ve seen so far. Therefore, we will use sim-opt.

Table 13.1 Lead time probabilities.


Lead time 3 4 5
Probability 0.1 0.7 0.2

We will do this in 3 steps:


1. Model the demand and the lead time.
2. Create a simulation that returns an expected cost based on a given safety stock.
3. Run a search algorithm that will loop through simulations until it finds a proper
safety stock level.

13.1.2 Demand and Lead time Estimation


Let’s start by extracting the demand PMF and its attributes.

We can then work on the lead time.


13.1.3 Simulation Function
We continue by creating a simulation function that takes a safety stock as input and returns a
(simulated) average cost per period.
Now that we have a simulation function, we can work on a search algorithm that will find a
proper safety stock level based on the simulated results.
13.1.4 Optimization Algorithm
We will discuss two search algorithms to find a good level of safety stock. As usual, we will start
with a simple method and then improve it.

Method #1 – Start at 0 and Increase

This method is simple:


1. Start by simulating a first policy with a safety stock of 0.
2. Increase the level of safety stock by a step-size (we will discuss this in the
following pages).
S s = S s + step-size

3. Run a new simulation and analyze the resulting cost:


If it is smaller than the (current) optimal cost, we update the optimal cost as
the new one:
∗ ∗
if cost < cost ⇒ cost = cost

then,
If the ratio between the returned cost and the optimal cost is higher than a
threshold, we stop our search algorithm:
cost
if > threshold ⇒ Stop

cost

otherwise we perform steps 2 and 3 again.


→Figure 13.1 shows typical results for this first simple method (applied to the case described
earlier).

Figure 13.1 Method #1 – start at 0 and increase. Sim-opt with 248 iterations and a step-size of 14.

As we can see, starting with a safety stock level of 0 is not the smartest choice since the cost in
this region is particularly high. We will discuss a smarter technique later in this section.
Let’s discuss two important parameters of our search algorithm: the step-size and the
threshold.

Calibrating the Step-size

Using a small step-size will make our algorithm slow. But it should allow us to find a better
inventory level thanks to a more detailed searching grid. Typically, the step-size can be set as an
arbitrary percentage of the mean demand (1 to 5%). It can also be based on practical limitations: if
you are required to buy a product in batches of 100 pieces, a step-size of 100 seems a good
choice.

Calibrating the Threshold

The threshold defines the ratio (between the latest simulated cost and the current optimal cost)
determining when we stop the search algorithm.
cost
if > threshold ⇒ Stop

cost

A high threshold will allow us to search in a larger area, at the expense of a longer running time.
Due to the simulation output variability (as you can see in →Figure 13.1), a too small threshold
might stop the simulation too early just because one simulation-step might return a skewed
result. The more complex your supply chain is (i. e., complex lead time, customer behavior), the
more variable the simulation result might be, and so you might want to increase the threshold.
Another way to decrease the variability is to increase the number of timesteps in the simulation,
which, unfortunately, will increase the running time.
Method #2 – Smart Start and Double Runs

We saw in →Figure 13.1 that starting the search with an initial safety stock of 0 is not the smartest
starting position: the simulated cost in this region is really high. A smarter starting position would
have been around 1500 to 2500 pieces.
Instead of starting at 0 and increasing the safety stock level at each step, we can choose a
smarter starting position and search the optimal safety stock level by performing a search in two
directions. In other words (as shown in →Figure 13.2), we will perform two searches: one with a
positive step-size, and a second search with a negative step-size (we decrease the safety stock to
see if it results in lower costs).
Figure 13.2 Method #2 – Smart Start and Double Runs.

Naturally, we do not know the optimal amount of safety stock, since this is the reason why we
are doing simulations. So how can we find a good starting position? We will use heuristics to find
a good starting position and start searching for the optimal policy from there.

Heuristic for (R,S) Policy

Let’s assume that the demand and the lead time are normally distributed. Based on this
assumption, we know the optimal service level (see eq. →8.3 in Section →8.2.1) and we know how
much safety stock will be needed to achieve this cycle service level (see eq. →6.5 in Section
→6.3.3):
hR
α= 1 −
b

2 2 2
S s = z α √ (μ L + R)σ + σ μ
d L d

We can then start our search algorithm at this level of safety stock.
As you can see in Figure
→13.3, if we use this heuristic as a starting point for our simulation optimization, we end up
performing fewer iterations to find the optimal2 policy.

Figure 13.3 Method #2 – smart start and increase/decrease. Sim-opt with 153 iterations and a
step-size of 14 (against 248 iterations with Method #1).
Improving the Sim-Opt Further

The two methods presented here are of course simple ones. They only serve as an introduction to
simulation optimization. Here are a few ideas on how to achieve a faster optimization algorithm.
Feel free to test your own.
Faster simulation The code presented throughout this chapter is, as discussed in the
introduction, not optimized for speed. It seems feasible to make each simulation
loop 10x faster (and even more).
Two loops The idea here is to do a search in two loops. The first loop with a wide grid (i. e., a
big step-size); and a second one, starting at the optimum of the first, with a much
more detailed grid (i. e., small step-size). In other words, we first look quickly to
find the general area where the optimum might be; then we look in closer detail
to find where it actually is.
Smoothing results As you saw in →Figure 13.3, the simulated costs can be noisy. You could
reduce this variability by running each simulation during more timesteps, but this
will be (very) expensive (i. e., it will take time). Another way to reduce the result
variability is to smooth the results—for example, by replacing each result by the
average of the 3 closest observations.
Variable step-size Instead of performing fixed steps in the search algorithm, you could make
them bigger (or smaller) based on the slope of the cost decrease.
Approximation function After a few cost observations, you can fit a (polynomial) function to
them, and then look for this function’s minimum. Machine learning could even be
used here to approximate the cost function.

13.2 Complex Policies Optimization


It works in practice, but does it work in theory?

So far we’ve analyzed sim-opt techniques with one parameter (the safety stock in our case),
but what if we want to optimize more complex policies with multiple parameters at once?

13.2.1 (R,S) Policy Optimization


If we want to optimize both the review period and the safety stock of an (R, S) policy, we can
look at a method similar to the one we used in Chapter →8 (see Section →x):
1. Set a good starting review period (based on heuristics, for example, the power-of-
2 rule, see Section →3.2.1).
2. Find the optimal safety stock for this review period (based on the methods
explained in Section →13.1).
3. Compute the optimal safety stock (and cost) for a shorter and longer review
period.
4. If one provides a better result, look for an even longer or shorter period.
5. Repeat step 4 until a good combination of review period and safety stock is found.
In other words, we use our double search method for the review period R; and for each possible
review period we use the same method to optimize the safety stock.

13.2.2 (R,s,Q) Policy Optimization

Let’s imagine now that we want to follow an (R, s, Q) policy. Remember that, with this policy,3
we check every review period R if the inventory reached s. If so, we order Q units (or a multiple of
Q if this is not enough to bring the inventory level back to s).
This policy is rather difficult to optimize mathematically, even when you assume normal or
gamma-distributed demand with fixed lead times.4 Therefore, when we have a custom PMF for
the demand and for the lead time, together with a backlog cost, we should revert to a simulation
to optimize our policy.

Review Period Optimization

In an (R, s, Q) policy, the ordering cost is usually optimized with Q. As we saw in Chapter →2,
“→How Much Should I Order?” the higher the order quantity is, the lower the ordering costs are;
but also the higher the holding costs are. We usually assume that simply checking the inventory
(once per review period) does not incur any cost. If this is indeed the case, you want R to be as
small as possible. On the other hand, if simply checking the inventory position is already a cost—
this can be the case if you need to physically count the inventory—you might want to try multiple
values for R following a similar method to the one we just discussed for the (R, S) policy.

Setting of Initial Parameters


Before we discuss optimization techniques, let’s find a heuristic to pick reasonably good R, s and
Q. In order to do so, we will have to master the art of approximation.

Cycle Service Level α

In Chapter →8, “→Cost and Service Level Optimization,” we discussed two sets of equations to
determine the optimal service level. One for an (R, S) policy (eq. →8.3 in Section →8.2.1) and one
for an (s, Q) policy (eq. →8.4 in Section →8.3.1):


hR
(R, S) α = 1 −
b


hQ
(s, Q) α = 1 −
bD

None of these perfectly match the (R, s, Q) policy. Nevertheless, we have to find a heuristic to
find a good starting position. When hesitating between two estimations, a good approximation is
to take the average of the two. This is an application of the wisdom of the crowd.5 Our starting
service level could then be:
1 hR hQ
α = (1 − + 1 − )
2 b bD

Reorder-point s

We can use the usual equation of the (s, Q) policy in order to compute the required safety stock.
But the lead time L alone is not a good estimation of the risk-period x in an (R, s, Q) policy.
τ

Instead, we could use L + R as the risk-period length—as for an (R, S) policy—but as shown by
Tempelmeier,6 this might be too much. We will then choose an in-between solution and set the
risk-period x as L + R/2 . In other words, we assume that the risk-period is around L + R/2
τ

periods long in an (R, s, Q) policy. We then have:

S s = zσ d √ L + R/2

s= d L + d R/2 + S s

Order Quantity Q

We can simply use the EOQ formula (see eq. →2.2 in Section →2.2.2):


2kD
Q = √
h

or use a generalized expression of the stochastic EOQ formula (see eq. →8.5 in Section →8.3.1)
that includes the expected backorders per cycle:
2(k + b U s )D
∗ √
Q =
h

Using this equation is trickier: we do not know the expected backorders per cycle U . On top of
s

that, we use in our example a backlog cost b rather than a backorder cost b. Nevertheless, even
τ

by using rough approximations (such as U = 0.02 ⋅ Q and b = 1.1 ⋅ b ) you might get a better
s τ

starting position (as we will see in the following pages).


Now that we have a set of initial values for our parameters, rather than create our own search
algorithm, we will use one of the optimization functions available in Python.7

13.3 Stability
Simulation optimizations have one (quite significant) issue: the results are random. If you run the
same sim-opt twice, you will most likely get different results. This is explained by the fact that
simulations are based on random events, so their ultimate cost estimation is random as well. Two
consecutive sim-opts will often recommend two very similar—but different—policies that will
achieve similar results. But you can also end up with very different policies that still achieve similar
outcomes!
Nevertheless, even small inventory policy variations will make supply chain planners nervous
(potentially causing a bullwhip effect8 with your suppliers). These variations will likely confuse (or
worry) any practitioner, ultimately resulting in a lack of confidence in your inventory policies.
Let’s discuss 3 ways to make your sim-opt more stable.

13.3.1 #1 – Set a Random Seed


In Python (as with all computer software), all random processes are actually pseudo-random. It
means that the computer is simulating a random process, based on a random seed. In NumPy,
each time we call a random function it generates a new (pseudo-random) seed and uses it to
generate random numbers. If we set this seed to an arbitrary number—instead of letting NumPy
pseudo-randomly pick one—all the random functions will always return the exact same numbers.
We can then use this technique to be sure that if we run the same simulation twice, we will get
the same results.
Unfortunately this will not be enough: if you change the slightest number (a cost parameter,
the demand KDE, and so on) you will still get a different result from the sim-opt, ultimately
resulting in a new (slightly different) inventory policy.

13.3.2 #2 – Increase the Number of Timesteps


One of the main reasons for lack of stability is the fact that the result of a single simulation is
highly variable. The only way to reduce this inner variability is to increase the number of timesteps
performed by each simulation (you can simply increase the variable time in your Python
simulation).
Increasing the number of timesteps is good because it will bring more stable results.
Moreover, it will result in a better overall inventory policy since the simulation will be less likely to
pick an inventory policy that performed well only by chance on (a few) timesteps. Nevertheless,
this comes at a cost: the running time of your sim-opt will be much longer; and it won’t prevent
you from getting small inventory policy changes at each new sim-opt. We have to find another
solution.

13.3.3 #3 – Limit Policy Updates to Significant Changes


Another way to limit variability is to update an inventory policy only if it brings a certain added
value compared to the current one. For example you might want to update a policy only if the new
expected cost is at least 5% lower than that of the current policy. In other words, you have to find
the right trade-off between efficiency and stability.
Using this trick will help you to keep consistent inventory policies. On the other hand, it will not
help if you need to perform multiple scenario analysis. In such a case, increasing the number of
timesteps is the best way to achieve a reliable (and stable) analysis.

13.4 Recap
As we have seen throughout this book, mathematical models can only take us so far to optimize
real supply chains. This is where simulation optimization (sim-opt) will help by finding (very) good
inventory policies without requiring any mathematical model. Nevertheless, this comes at the
expense of computation time. Sim-opt should therefore be used when the supply chain at hand is
too complex to be properly approximated by mathematical models.
We discussed three sim-opt algorithms:
Simple search We start by simulating a policy with 0 safety stock. We perform new simulations
(each time increasing the safety stock by a step-size) until we find an “optimal”
amount.
Smart start and double search We start at a better initial position (based on heuristics) and
perform two searches: one by increasing the safety stock level and one by
decreasing it.
Black box algorithm We can also rely on external black box algorithms (such as those provided
by Python’s libraries).
In order to find an appropriate initial set of parameters for our search algorithms, we have to use
heuristics. These will allow us to perform a quicker search as we start closer to the optimal policy.
We can base our heuristics on the previous chapters, especially Chapter →8, “→Cost and Service
Level Optimization,” that gave us equations to optimize (R, S) and (s, Q) policies.
Finally, simulation optimizations face one drawback: they always provide (slightly) different
results. We saw that a good practice is to update an inventory policy only if it brings significant
improvement. You can also increase the number of timesteps in the sim-opt in order to get more
stable results.

Now It Is Your Turn!


We have not succeeded in answering all our problems—indeed we sometimes feel we have not completely answered any of
them. The answers we have found have only served to raise a whole set of new questions. In some ways we feel that we are
as confused as ever, but we think we are confused on a higher level and about more important things.
Earl C. Kelley

Supply chains are complex.


But that didn’t block us from creating sound mathematical models throughout this book to
optimize inventory policies. First, in Part →I based on the assumption of deterministic demand
and supply; then, in Part →II we introduced stochastic demand and supply. The breakthrough
came in Part →III where we computed the fill rate, optimized our policies to minimize the costs,
used gamma-distributed demand and finally looked at multi-echelon inventory optimization. Part
→IV showed you how to optimize virtually any inventory policy using simulations.
Now that you have finished the book, you will probably want to come back to it when you are
working on projects. So, I suggest that you create your models step by step (remember, Vires
acquirit eundo – We gather strength as we go). First use Parts →I and →II to properly define safety
stock targets (based on arbitrary service levels). Then use Part →III to optimize your service levels
—and maximize your profit. See if your demand is not gamma-distributed (this can be done easily
—even in Excel—as explained in Section →9.4); and finally use the risk-period framework to
optimize inventory across multi-echelon networks. Always keep track of the assumptions you are
making—it is not an issue to take shortcuts, as long as you are aware of them. If needed, you can
use simulation optimizations as presented in Part →IV to optimize (much) more complex policies.
Lastly, in order to avoid any blind spots, discuss your models, assumptions and ideas with
your colleagues—or even on social media. It is always better to have a model that works 95% of
the time, and is understood by its users; than a perfect—but too complex—model that is rejected.
Keep in mind, inventory optimization is a journey.
Now it is your turn!

A Python
If this is your first time using Python, let’s take some time to quickly introduce and discuss the
different libraries and data types we are going to use. Of course, the goal of this book is not to
give you full training in Python; if you wish an in-depth introduction (or if you are not yet
convinced to use Python) please refer to the recommended courses in the introduction.

How to Install Python


There are multiple ways to install Python on your computer. An easy way to do this is to install the
Anaconda distribution on →www.anaconda.com/download. Anaconda is a well-known platform
used by data scientists all over the world. It works on Windows, Mac and Linux. Anaconda will take
care of installing all the Python libraries you need to run the different models that we are going to
discuss. It will also install Spyder and Jupyter Notebook, two Python-code editors that you can use
to type and run your scripts. Feel free to check both and use your favorite.

Lists
The most basic object we will use in Python is a list. In Python, a list is simply an ordered sequence
of any number of objects (e. g., strings, numbers, other lists, more complex objects, etc.). You can
create a list by encoding these objects between []. Typically, we can define our first time series ts
as:

These lists are very efficient at storing and manipulating objects, but are not meant for
number computation. For example, if we want to add two different time series, we can’t simply
ask ts + ts2, as this is what we would get:

Python is returning a new longerlist. That’s not exactly what we wanted.

NumPy
This is where the famous NumPy1 library comes to help. Since its initial release in 2006, NumPy
has offered us a new data type: a NumPy array. This is similar to a list, as it contains a sequence of
different numeric values, but differs in the way that we can easily call any mathematical function
on them. You can create one directly from a list like this:

As you will see, NumPy is most often imported as np.


We can now simply add our array ts to any other array.

Note that the result is another NumPy array (and not a simple list).
NumPy most often works very well directly with regular lists because we can use most of the
NumPy functions directly on them. Here is an example:
You can always look for help on the NumPy official website.2As you will see yourself, most of
your Google searches about NumPy functions will actually end up directly in their documentation.

Slicing
To select a particular value in a list (or an array), you simply have to indicate between [] the index
of its location inside the list (array). The catch—as with many coding languages—is that the index
starts at 0 and not at 1; so that the first element in your list will have the index 0, the second
element the index 1, and so on.

If you want to select multiple items at once, you can simply indicate a range of index with this
format: [start:end]. Note that,
If you do not give a start value, Python will assume it is 0.
If you do not give an end, it will assume it is the end of the list.
Note that the result will include the start element but exclude the end element.

If you give a negative value as the end, Python will start by counting backward from the last
element of your list/array (-1 being the last element of your array).

You can slice a multi-dimensional array by separating each dimension with a comma.
Pandas
Pandas is one of the most used libraries in Python (it was created by Wes McKinney in 2008). The
name comes from panel data, because it helps to order data into tables. Think Excel-meets-
databases in Python. This library introduces a new data type: a DataFrame. If you’re a database
person, just think about a DataFrame as an SQL table. If you’re an Excel person, just imagine a
DataFrame as an Excel table. Actually, a DataFrame is a sort of data table where each column
would be a NumPy array with a specific name. That will come in pretty handy because we can
select each column of our DataFrame by its name.
There are many ways to create a DataFrame, let’s create our first one by using a list of our two
time series.

The convention is to import pandas as pdand to call our main DataFrame df. The output we get
is a DataFrame where we have 6 columns (named ’0’,’1’,’2’,’3’,’4’and ’5’) and 2 rows (actually,
they also have a name—or index—’0’and ’1’).
We can easily edit the column names:

Pandas comes with very simple and helpful official documentation.3When in doubt, do not
hesitate to look into it. Just as for NumPy, most of your Google searches will end up there.

Slicing DataFrames
There are many different techniques to slice a DataFrame to get the element or the part you want.
This might be confusing for beginners, but you’ll soon understand that each of these has its uses
and advantages. Do not worry if you get confused or overwhelmed: you won’t need to apply all of
these right now.
You can select a specific column by passing the name of this column directly to the
DataFrame either with df[’myColumn’] or even more directly with df.myColumn.
You can select a row based on its index value by simply typing df[myIndexValue].
If you want to select an element based on both its row and column, you can call the method
.loc on the DataFrame and give it the index value and the column name you want. You can
for example type df.loc[myIndexValue,’myColumn’]
You can also use the same slicing method as for lists and arrays based on the position of the
element you want to select. You then need to call the method .iloc to the DataFrame.
Typically, to select the first element (top left corner), you can type df.iloc[0,0].
As a recap, here are all the techniques you can use to select a column and/or a row:

Dictionaries
Another way to create a DataFrame is to construct it based on a dictionary of lists or arrays. A
dictionary is a collection of elements that links (unique) keys to values. You can create one by
including between {} a key and a value (both can be any Python object).

Here the key ’Small product’will give you the value ts, whereas the key ’Big product’will give
you ts2.

What is handy is that we can now create a DataFrame directly from this dictionary.
We now have a DataFrame where each product has its own column and where each row is a
separate period.

Other Libraries
We will also use other very well-known Python libraries. There are discussed below. We used the
usual import conventions for these libraries throughout the book. For the sake of clarity, we did
not show the import lines over and over in each code extract.
is a library used for all kinds of scientific computation, optimization, as well as statistical
computation (SciPy stands for Scientific Python). The documentation is available on
→docs.scipy.org/doc/scipy/reference but it is unfortunately not always as clear as we would wish
it to be. We mainly focus on the statistical tools and only import them as stats.

To make our code shorter, we will import some functions directly from scipy.statsin our
examples. We can import these as such:

is the library used for plotting graphs. Unfortunately, matplotlib is not the most user-friendly
library, and its documentation is only rarely helpful. If we want to make simple graphs we will
prefer using the .plot() method from pandas.

is another plotting library built on top of matplotlib. It is actually more user-friendly and
provides some refreshing visualization compared to matplotlib. You can check the official website
→seaborn.pydata.org as it provides both clear and inspiring examples.

We don’t use seaborn in this book. Nevertheless, I advise it as a good addition on top of
matplotlib.

B Proofs
B.1 Sum of a Random Number of Random Variables
A = B ⋅ C

The expected value of A is simply the expected value of B times the expected value of C.
E[A] = E[B] ⋅ E[C]

Let’s compute the variance of A. We will start from the definition of the variance of a random
variable X:

1
n (B.1)
2
V [X]= ∑ (x i − E[X])
n
x=1

n n
1 1 2
2
= ∑ xi + ∑ E[X]
n n
x=1 x=1

2 2
V [X]= E[X ] − E[X]

So that V [A] = E[A .


2 2
] − E[A]

As E[A] = E[B] ⋅ E[C] , we then have,


2 2 2 (B.2)
V [A] = E[A ] − E[B] E[C]

We know already E[B] and E[C] , we have still to estimate E[A ] . 2

If we fix the value of B as b we have,


2 2 2 (B.3)
V [A|b] = E[A |b] − b E[C]

where the conditional operator | means that we estimate a stochastic variable based on the
condition that another variable is known. So that V [A|b] is the conditional probability of V [A]
knowing that B is b.
Thus, since we fixed B as a constant b, A is now defined as a constant times a distribution:
A|b = b ⋅ C

⇒ V [A|b] = b ⋅ V [C]

We can then simplify →B.3 into


2 2 2
E[A |b] = b ⋅ V [C] − b E[C]

We can then solve our eq. →B.2.


2 2 2 (B.4)
V [A]= E[A ] − E[B] E[C]

2 2 2
= ∑(E[A |b] ⋅ p(B = b)) − E[B] E[C]

2 2 2 2
= ∑((b ⋅ V [C] − b E[C] ) ⋅ p B (b)) − E[B] E[C]

Where p B (b) is the probability that the variable B takes the value b.
Let’s simplify →B.4 by using these two relationships:

∑ b ⋅ V [C] ⋅ p B (b) = E[B]V [C]

2 2 2 2
∑ b E[C] ⋅ p B (b) = E[B ]E[C]

We obtain now,
2 2 2 2 (B.5)
V [A] = E[B]V [C] + E[B ]E[C] − E[B] E[C]

We can simplify this further as we know from →B.1 that E[B . So that we can
2 2
] = V [B] + E[B]

further simplify →B.5 as,


2 2 2 2
V [A]= E[B]V [C] + E[B ]E[C] − E[B] E[C]

2 2 2 2
= E[B]V [C] + (V [B] + E[B] )E[C] − E[B] E[C]

2
= E[B]V [C] + V [B]E[C]

B.2 Normal Loss function


We want to compute the loss function L (x) of our demand d that follows a normal distribution
N (μ, σ ) . The loss function is defined as:
2

L (x) = ∫ (d − x)f (d)

d=x

Where f (d) is the probability density function of the (normally distributed) demand. For the sake
of clarity, we abuse the PDF notation by using f (d) instead of f (d) , and the usual integral
D

notation and not finish them by dd , which would be confusing.


We can solve this by decomposing it into two separated integrals Int1 and Int2 .

L (x)= ∫ (d − x)f (d)

d=x

∞ ∞

= ∫ d ⋅ f (d) − x ∫ f (d)

d=x d=x

= Int1 − x ⋅ Int2

Let’s first solve Int2 .


By definition,
∞ d=x

∫ f (d) = 1 and ∫ f (d) = F (x)

−∞ −∞

So that,
∞ ∞ d=x

∫ f (d) = ∫ f (d) − ∫ f (d) = 1 − F (x)

d=x −∞ −∞

Let’s now solve Int1 .


We will use the definition of f (d) for a normal distribution:
1 −
(d−μ)
2
(B.6)
f (d) = e 2σ 2

√ 2πσ 2

So that

Int2= ∫ d ⋅ f (d)

d=x


2
d (d − μ)
= ∫ ⋅ exp(− )
2
√ 2πσ 2 2σ
d=x


2
1 (d − μ)
= ∫ d ⋅ exp(− )
2
√ 2πσ 2 2σ
d=x

We will integrate this by defining


d − μ 1
u = ; du = dd ⟺ d = uσ + μ ; dd = σdu
σ σ

So that,
∞ ∞
2 2
(d − μ) −(uσ)
∫ d ⋅ exp(− )= ∫ σ(uσ + μ) ⋅ exp( )
2 2
2σ 2σ
x−μ
d=x u=
σ


2
−u
= σ ∫ (uσ + μ) ⋅ exp( )
2
x−μ
u=
σ

∞ ∞
2 2
−u −u
2
= σ ∫ u ⋅ exp( ) + μσ ∫ ⋅exp( )
2 2
x−μ x−μ
u= u=
σ σ

2
= σ ⋅ Int2 1 + μ ⋅ Int2 2

Let’s solve the left part Int2 , 1


2
−u
Int2 1 = ∫ u ⋅ exp( )
2
x−μ
u=
σ

We will integrate by defining v as


2
−u
v = ; dv = −udu ⟺ u = √ −2v
2

The limits of the integral will change as


2
x − μ x − μ
u = ∞ ⇒ v = −∞ and u = ⇒ v = −( )
σ √ 2σ

So that we can transform our integral


−∞ −∞ (B.7)
2
−u v
∫ u ⋅ exp( )= − ∫ e
2
2 2
x−μ x−μ
v=−( ) v=−( )
√2σ √2σ

2
x−μ
−∞ −( )
√2σ
= −(e − e )

2
x−μ
−( )
√2σ
= e

Thanks to the definition of the normal density function (see eq. →B.6), we can transform →B.7
into
2 2
x − μ √ 2πσ 2 (x − μ)
) = √ 2πσ ⋅ f (x)
2
exp(−( ) ) = ⋅ exp(−
2
√ 2σ √ 2πσ 2 2σ

We finally solve Int2 :


1
Int2 1 = √ 2πσ ⋅ f (x)
2

Let’s now solve the right part Int2 , 2


2
−u
Int2 2 = σ ∫ exp( )
2
x−μ
u=
σ

We can revert to d instead of u and we obtain


∞ ∞
2 2
1 −(d − μ) −(d − μ)
) = √ 2πσ (1 − F (x))
2
σ ∫ ⋅ exp( ) = ∫ ⋅exp(
2 2
σ σ σ
d=x d=x

So that,

Int2 2 = √ 2πσ (1 − F (x))


2

We can finally solve Int2


Int2= ∫ d ⋅ f (d)

d=x


2
1 (d − μ)
= ∫ d ⋅ exp(− )
2
√ 2πσ 2 2σ
d=x

1
2
= (σ ⋅ Int2 1 + μ ⋅ Int2 2 )
√ 2πσ 2

1
2
⋅ √ 2πσ ⋅ f (x) + μ ⋅ √ 2πσ (1 − F (x)))
2 2
= (σ
√ 2πσ 2

2
= σ f (x) + μ(1 − F (x))

We can then solve our initial loss function:


L (x)= ∫ (d − x)f (d)

d=x

∞ ∞

= ∫ d ⋅ f (d) − x ∫ f (d)

d=x d=x

= Int1 − x ⋅ Int2

2
= σ f (x) + μ(1 − F (x)) − x(1 − F (x))

2
= σ f (x) + (μ − x)(1 − F (x))
B.3 Loss Function Derivative
We define the loss function as

By the Leibniz integral rule, we obtain:

dL (ι)


L (ι) = ∫

So that we have the following relationship:

B.4 Cost Optimization


B.4.1 (R,S) Policy

Cost Expression
We compute the cost per period as
= ∫

= ∫

= −

= −

dL (ι)


dι ⎝

⎜⎟
ι

We want to compute the derivative of the loss function:

dL (ι)
=
d ⎛


(x − ι)f (x) dx

∂ι

1 −

= −(1 − F (ι))

= F (ι) − 1
ι

ι

= F (ι) − 1
(x − ι)f (x) dx

(x − ι)f (x) dx

−f (x) dx

f (x) dx

−∞

which is independent of the demand distribution (normal, gamma, etc.).


ι

f (x) dx

(B.8)
k b Us
C period = h(C s + S s ) + +
R R

where h is the period unit holding cost (i. e., the cost of keeping one unit in stock for one period).
We also know that C = dR/2 . We will express the safety stock S based on ι the inventory level
s s

at the beginning of the risk-period (i. e., the policy parameter S):
S s = ι − μ x = ι − d(R + L)

So that we can express the costs per period as


dR k b L x (ι)
C = h( + ι − d(R + L)) + +
2 R R

k b L x (ι)
C = h(ι − d(R/2 + L)) + +
R R

where L x (ι) is the loss function of the demand over the risk-period computed at ι.
Remember that
∂L x (ι)
= F x (ι) − 1
∂ι

as proven in Section →B.3.

Cost Optimization
In order to compute the optimal service level, we can simply take the derivative of the cost
function based on ι and set it to zero.
∂C (z) ∂(ι − d(R/2 + L)) b ∂L x (ι)
= h + = 0
∂z ∂ι R ∂ι

hR + b (F x (ι) − 1) = 0

hR
+ F x (ι) − 1 = 0
b

hR
F x (ι) = 1 −
b

Because F x (ι) = α , we conclude that:


hR
Optimal cycle service cycle = α = 1 −
b

and

∗ −1
hR
ι = Fx (1 − )
b

B.4.2 (s,Q) Policy


Cost Expression
We compute the cost per year as
D D
C year = h(C s + S s ) + k + b Us
Q Q

where h is the yearly unit holding cost (i. e., the cost of keeping one unit in stock for one year). We
also know that C = Q/2 . We will express the safety stock S based on ι the inventory level at
s s

the beginning of the risk-period (i. e., the policy parameter S):
S s = ι − μ x = ι − dL

So that we can express the costs as


D D
C = h(Q/2 + ι − dL) + k + b L x (ι)
Q Q

D D
C = h(Q/2 + ι − dL) + k + b L x (ι)
Q Q

where L x (ι) is the loss function of the demand over the risk-period computed at ι.
Remember that
∂L x (ι)
= F x (ι) − 1
∂ι

as proven in Section →B.3.

Cost Optimization
In order to compute the optimal service level, we can simply take the derivative of the cost
function based on ι and set it to zero.
∂C (z) ∂(Q/2 + ι − dL) Db ∂L x (ι)
= h + = 0
∂z ∂ι Q ∂ι

bD
h + (F x (ι) − 1) = 0
Q

bD bD
h + F x (ι) − = 0
Q Q

hQ + bD F x (ι) − bD = 0

hQ
F x (ι) = 1 −
bD

Because F x (ι) = α , we conclude that:


hQ

Optimal cycle service cycle = α = 1 −
bD

and
∗ −1
hQ
ι = Fx (1 − )
bD

B.5 Discrete Newsvendor Optimization


In the newsvendor model, the general expression of the cost C as a function of the order
quantity Q is expressed as:
Q ∞ (B.9)
C (Q) = c o ∑ p(d)(Q − d) + c u ∑ p(d)(d − Q)

d=0 d=Q

where c and c are the overage and underage costs ( c includes the profits as the lost
o u u

opportunity costs), p(d) is the demand probability mass function in d.


As C (Q) is a concave function (i. e., it has a minimum) we want to increase the order quantity Q
until the expected cost of ordering one more unit C (Q + 1) is higher than the expected cost of
ordering Q units: C (Q) . In other words, we want to increase Q until we have (as shown in
→Figure B.1):
C (Q) ≤ C (Q + 1)

C (Q) − C (Q + 1) ≤ 0

Figure B.1 Optimal order quantity for the newsvendor model based on profits.

Let’s replace the expressions of C (Q) and C (Q + 1) by using eq. →B.9.


(B.10)
Q ∞ Q+1 ∞

c o ∑ p(d)(Q − d) + c u ∑ p(d)(d − Q) − c o ∑ p(d)(Q + 1 − d) − c u ∑ p(d)(d − Q − 1


d=0 d=Q d=0 d=Q+1

Q Q+1 ∞ ∞

c o ( ∑ p(d)(Q − d) − ∑ p(d)(Q + 1 − d)) + c u ( ∑ p(d)(d − Q) − ∑ p(d)(d − Q − 1


d=0 d=0 d=Q d=Q+1

We will use 2 similar tricks to simplify eq. →B.10:


Q+1 Q

∑ p(d)(Q + 1 − d)= ∑ p(d)(Q + 1 − d) + p(d = Q + 1)(Q + 1 − (Q + 1))



   
d=0 d=0
=0

= ∑ p(d)(Q + 1 − d)

d=0

and,
∞ ∞

∑ p(d)(d − Q)= ∑ p(d)(d − Q) + p(d = Q)(Q − Q)



   
d=Q d=Q+1
=0

= ∑ p(d)(d − Q)

d=Q+1

So that we have →B.10 is equal to:


Q Q ∞ ∞

c o ( ∑ p(d)(Q − d) − ∑ p(d)(Q + 1 − d)) + c u ( ∑ p(d)(d − Q) − ∑ p(d)(d − Q −


d=0 d=0 d=Q+1 d=Q+1

Q ∞

c o (∑ p(d)((Q − d) − (Q + 1 − d))) + c u ( ∑ p(d)((d − Q) − (d − Q − 1))) ≤ 0

d=0 d=Q+1

Q ∞

c o (∑ p(d)(−1)) + c u ( ∑ p(d)(1)) ≤ 0

d=0 d=Q+1

c o (−P (D ≤ Q)) + c u (P (D > Q)) ≤ 0

We know that P (D > Q) = 1 − P (D ≤ Q) , so that,


−c o P (D ≤ Q) + c u (1 − P (D ≤ Q)) ≤ 0

co
− P (D ≤ Q) + 1 − P (D ≤ Q) ≤ 0
cu
co
− P (D ≤ Q) − P (D ≤ Q) ≤ −1
cu
co
P (D ≤ Q) + P (D ≤ Q) ≥ 1
cu

co
P (D ≤ Q)( + 1) ≥ 1
cu

cu + co
P (D ≤ Q)( ) ≥ 1
cu

And finally we show that:


cu
P (D ≤ Q) ≥
cu + co

Remember, this means that if P (D ≤ Q) ≥ (c )/(c + c ) then C (Q) ≤ C (Q + 1) . In other


u u o

words, it means that ordering one more unit will increase the total costs as of when
P (D ≤ Q) ≥ (c )/(c + c ) . Since the cost function is concave, we conclude that, in order to
u u o

have the optimal Q , we have to pick the smallest order quantity Q that satisfies:

cu
P (D ≤ Q) ≥
cu + co

Bibliography
Aberdeen (2012). Inventory optimization – impact of a multi-echelon approach. Technical report,
Aberdeen. a, b
Andrade, A. and Sikorski, C. (2016). Numerical approximation of the inverse standardized loss
function for inventory control subject to uncertain demand. Paper presented at the Canadian
Operations Research Society Conference, Banff, Alberta. a, b
Andriolo, A., Battini, D., Grubbström, R. W., Persona, A., and Sgarbossa, F. (2014). A century of
evolution from Harris’s basic lot size model: survey and research agenda. International Journal of
Production Economics, 155:16–38. a, b
Axsäter, S. (2015). Inventory Control (International Series in Operations Research & Management
Science Book 225). Springer. a, b, c, d
Billington, C., Callioni, G., Crane, B., Ruark, J. D., Rapp, J. U., White, T., and Willems, S. P. (2004).
Accelerating the profitability of Hewlett-Packard’s supply chains. INFORMS Journal on Applied
Analytics, 34(1):59–72. a, b
Burgin, T. A. (1972). Inventory control with normal demand and gamma lead times. Operational
Research Quarterly (1970–1977), 23(1):73–80. a, b, c, d
Burgin, T. A. (1975). The gamma distribution and inventory control. Journal of the Operational
Research Society, 26(3):507–525. →
Burgin, T. A. and Wild, A. R. (1967). Stock control—experience and usable theory. Journal of the
Operational Research Society, 18(1):35–52. a, b
Cachon, G. (2018). Matching supply with demand: an introduction to operations management.
McGraw-Hill Education, New York, NY. a, b, c, d, e, f
Ciortan, M. (2018). Kernel density.
https://github.com/ciortanmadalina/modality_tests/blob/master/kernel_density.ipynb. Online;
accessed 05-September-2019. a, b
Clark, A. J. and Scarf, H. (1960). Optimal policies for a multi-echelon inventory problem.
Management Science, 6(4):475–490. a, b
Cobb, B. R., Rumí, R., and Salmerón, A. (2013). Inventory management with log-normal demand
per unit time. Computers & Operations Research, 40(7):1842–1851. a, b
Cooper, W. L., Homem-de Mello, T., and Kleywegt, A. J. (2006). Models of the spiral-down effect in
revenue management. Operations Research, 54(5):968–987. a, b
de Kok, T. (1991). Basics of inventory management (Part 2): The (R,S)-model, volume FEW 521 of
Research Memorandum FEW. Faculteit der Economische Wetenschappen.
de Kok, T. (2018). Inventory Management: Modeling Real-life Supply Chains and Empirical Validity.
Foundations and Trends(R) in Technology, Information and Operations Management, 11(2):343–437. a,
b
De Smet, N., Aghezzaf, E.-H., and Desmet, B. (2018). Optimising installation (R,Q) policies in
distribution networks with stochastic lead times: a comparative analysis of guaranteed- and
stochastic service models. International Journal of Production Research, pages 1–18. a, b
Duong, T. (2001). An introduction to kernel density estimation.
http://www.mvstat.net/tduong/research/seminars/seminar-2001-05/. Online; accessed 05-
September-2019. a, b
Edgeworth, F. (1888). The mathematical theory of banking. Journal of the Royal Statistical Society,
pages 113–127. a, b
Ehrhardt, R. (1979). The power approximation for computing (s, S) inventory policies. Management
Science, 25(8):777–786. a, b
Ellenberg, J. (2014). How not to be wrong: the power of mathematical thinking. The Penguin Press,
New York. a, b
Erlenkotter, D. (1990). Ford Whitman Harris and the economic order quantity model. Operations
Research, 38(6):937–946. a, b
Eruguz, A. S. (2014). Contributions to the multi-echelon inventory optimisation problem using the
guaranteed-service model approach. Theses, Ecole Centrale Paris. a, b
Eruguz, A. S., Sahin, E., Jemai, Z., and Dallery, Y. (2016). A comprehensive survey of guaranteed-
service models for multi-echelon inventory optimization. International Journal of Production
Economics, 172:110–125. a, b, c, d
Graves, S. C. and Willems, S. P. (2000). Optimizing strategic safety stock placement in supply
chains. Manufacturing & Service Operations Management, 2(1):68–83. a, b, c, d, e, f
Graves, S. C. and Willems, S. P. (2003). Supply chain design: Safety stock placement and supply
chain configuration. In Supply Chain Management: Design, Coordination and Operation, volume 11 of
Handbooks in Operations Research and Management Science, pages 95–132. Elsevier. a, b
Grubbström, R. W. and Erdem, A. (1999). The EOQ with backlogging derived without derivatives.
International Journal of Production Economics, 59(1):529–530. a, b, c, d
Hadley, G. and Whitin, T. M. (1963). Analysis of inventory systems. Prentice-Hall. a, b, c, d, e, f
Harris, F. W. (1913a). How many parts to make at once. Factory, The Magazine of Management,
10:135–136, 152. a, b
Harris, F. W. (1913b). How much stock to keep at hand. Factory, The Magazine of Management,
10:240–241, 281–284. →
Hill, A. (2017). The newsvendor problem.
www.clamshellbeachpress.com/downloads/newsvendor_problem.pdf. Online; accessed 24-April-
2020. a, b
Inderfurth, K. (1991). Safety stock optimization in multi-stage inventory systems. International
Journal of Production Economics, 24(1):103–113. a, b, c, d
Johansen, S. G. and Hill, R. M. (2000). The (r,Q) control of a periodic-review inventory system with
continuous demand and lost sales. International Journal of Production Economics, 68(3):279–286. a,
b
Kenneth, J. A., Harris, T., and Marschak, J. (1951). Optimal inventory policy. Econometrica, 19(3):250–
272. a, b
Kimball, G. (1988). General principles of inventory control. Journal of Manufacturing and Operations
Management, 1:119–130. a, b, c, d
Klosterhalfen, S. and Minner, S. (2010). Safety stock optimisation in distribution systems: a
comparison of two competing approaches. International Journal of Logistics Research and
Applications, 13(2):99–120. a, b
Lee, H. L., Padmanabhan, V., and Whang, S. (1997). The bullwhip effect in supply chains. Sloan
management review, 38:93–102. a, b
Lerner, M. (2013). Histograms and kernel density estimation kde 2.
https://mglerner.github.io/posts/histograms-and-kernel-density-estimation-kde-2.html. Online;
accessed 05-September-2019. a, b
Li, P. (2013). Optimization of (R, Q) policies for multi-echelon inventory systems with guaranteed service.
PhD thesis, Université de Technologie de Troyes. a, b
Maister, D. H. (1976). Centralisation of inventories and the “square root law”. International Journal
of Physical Distribution, 6(3):124–134. a, b
Maxwell, W. L. and Muckstadt, J. A. (1985). Establishing consistent and realistic reorder intervals in
production-distribution systems. Operations Research, 33(6):1316–1341. a, b
Moncayo-Martínez, L. A. and Ramirez, A. (2016). A tutorial to set safety stock under guaranteed-
service time by dynamic programming. International Journal of Industrial and Systems Engineering,
24:490–509. a, b, c, d
Murphy, R. A. (1975). Inventory control with gamma demand and gamma lead times. International
Journal of System Science, 6:81–85. a, b, c, d
Nahmias, S. (1979). Simple approximations for a variety of dynamic leadtime lost-sales inventory
models. Operations Research, 27(5):904–924. a, b, c, d
Nahmias, S. (1994). Demand estimation in lost sales inventory systems. Naval Research Logistics
(NRL), 41:739–757. a, b
Nahmias, S. (2015). Production and operations analysis: strategy, quality, analytics, application.
Waveland Press, Inc., Long Grove, Illinois. a, b
Oroojlooyjadid, A., Snyder, L. V., and Takáč, M. (2020). Applying deep learning to the newsvendor
problem. IISE Transactions, 52(4):444–463.
Qin, Y., Wang, R., Vakharia, A. J., Chen, Y., and Seref, M. M. (2011). The newsvendor problem:
Review and directions for future research. European Journal of Operational Research, 213(2):361–
374.
Robert, R., Gino, K., and Peter, C. (2004). The EOQ and EPQ models with shortages derived without
derivatives. International Journal of Production Economics, 92:197–200. a, b
Scott, D. W. (1992). Multivariate Density Estimation: Theory, Practice, and Visualization. Wiley. a, b
Silver, E. A., Pyke, D. F., and Thomas, D. J. (2016). Inventory and production management in supply
chains. CRC Press, Taylor & Francis Group, Boca Raton. a, b, c, d, e, f
Silverman, B. W. (1986). Density estimation for statistics and data analysis. Chapman and Hall,
London, New York. a, b
Simpson, K. F. (1958). In-process inventories. Operations Research, 6(6):863–873. a, b, c, d
Snyder, R. (1984). Inventory control with the gamma probability distribution. European Journal of
Operational Research, 17(3):373–381. a, b
Sterman, J. (1992). Teaching takes off: Flight simulators for management education. OR/MS Today,
19:40–44. a, b
Strijbosch, L. and Moors, J. (1999). Simple expressions for safety factors in inventory control.
Workingpaper, Econometrics. a, b, c, d, e, f
Syntetos, A., Babai, M., and Altay, N. (2012). On the demand distributions of spare parts.
International Journal of Production Research, 50(8):2101–2117.
Taft, E. W. (1918). The most economical production lot. Iron Age, 101:1410–1412. a, b, c, d
Tayur, S. (2007). Supply & demand chain executive. Supply & Demand Chain Executive. a, b
Tempelmeier, H. (2011). Inventory Management in Supply Networks. Norderstedt. a, b, c, d, e, f, g, h,
i, j, k, l
Thonemann, U. W. (2011). Benefits of multi-stage inventory planning in process industries.
https://api.semanticscholar.org/CorpusID:12077335. Online; accessed 24-April-2020. a, b, c, d, e, f
Tijms, H. C. (1994). Stochastic models: an algorithmic approach. Wiley, Chichester, New York. a, b
Tijms, H. C. and Groenevelt, H. (1984). Simple approximations for the reorder point in periodic and
continuous review (s, S) inventory systems with service level constraints. European Journal of
Operational Research, 17(2):175–190. a, b
Trapero, J. R., Cardós, M., and Kourentzes, N. (2019). Empirical safety stock estimation based on
kernel and garch models. Omega, 84:199–211. a, b
Trietsch, D. (1995). Revisiting ROQ: EOQ for company-wide ROI maximization. Journal of the
Operational Research Society, 46(4):507–515. a, b, c, d
Turrini, L. and Meissner, J. (2019). Spare parts inventory management: New evidence from
distribution fitting. European Journal of Operational Research, 273(1):118–130. a, b
Tyworth, J., Guo, Y., and Ganeshan, R. (1996). Inventory control under gamma demand and
random lead time. Journal of Business Logistics, 17:291–304.
U.S. Census Bureau (2019). 2019 census, business and industry, manufacturing & trade inventories
& sales. a, b, c, d
Vandeput, N. (2021). Data Science for Supply Chain Forecasting. De Gruyter. a, b
VanderPlas, J. (2013). Kernel density estimation in Python.
https://jakevdp.github.io/blog/2013/12/01/kernel-density-estimation/. Online; accessed 05-
September-2019. a, b
VanderPlas, J. (2016). In-depth: Kernel density estimation.
https://jakevdp.github.io/PythonDataScienceHandbook/05.13-kernel-density-estimation.html.
Online; accessed 05-September-2019. a, b
Veinott, A. F. and Wagner, H. M. (1965). Computing optimal (s, S) inventory policies. Management
Science, 11(5):525–552. a, b
Vermorel, J. (2018). The quantitative supply chain. https://www.blurb.com/b/8517792-the-
quantitative-supply-chain. Online; accessed 24-April-2020. a, b
Wang, P., Zinn, W., and Croxton, K. L. (2010). Sizing inventory when lead time and demand are
correlated. Production and Operations Management, 19(4):480–484. a, b
Wanke, P. (2009). Consolidation effects and inventory portfolios. Transportation Research Part E:
Logistics and Transportation Review, 45:107–124. a, b
Wanke, P., Ewbank, H., Leiva, V., and Rojas, F. (2016). Inventory management for new products
with triangularly distributed demand and lead-time. Computers & Operations Research, 69:97–108.
a, b
Ward, J., Oca, A., Zimmerman, M., Acar, K., Sonthalia, B., and Sun, Y. (2019). 30th Annual Council of
Supply Chain Management Professionals (CSCMP) State of Logistics Report. Technical report,
ATKearny. a, b
Whitin, T. M. (1953). The Theory of Inventory Management. Princeton University Press. a, b
Wilson, R. H. (1934). A scientific routine for stock control. Harvard Business Review, 13:116–128. a, b

Glossary
array Data structure defined in NumPy. It is a list or a matrix of numeric values. See page
262
backorders Backlog of orders that are not yet fulfilled. This happens when you do not have
enough on-hand inventory to fulfill the orders directly and when the orders are
not lost. See page 3
coefficient of variation ( CV ) Expresses the relative dispersion of a dataset compared to its
mean, CV = σ/μ . See page 59
correlation ( ρ ) Measures the dependence between two variables. It varies between −1
(straight negative correlation) and 1 (straight positive correlation). A correlation of
0 means no linear correlation. See page 62
cumulative distribution function ( F 𝓧(z) ) Is the probability that an occurrence of a random
distribution X is lower than or equal to a threshold z. We note Φ(z) the CDF of a
standard normal distribution. See page 51
cycle service level ( α ) Probability of not having a stock-out during an order cycle. In other
words, the probability that the inventory at the beginning of an order cycle will be
higher (or equal) than the demand during this cycle. Often called the “Type 1
service level.” See page 46
cycle stock
Cs Stock dedicated to the normal demand (or forecast) consumption. See page

12
DataFrame Table of data as defined by the pandas library. It is similar to a table in Excel or an
SQL database. See page 264
EOQ ( EOQ ) Economical order quantity that optimizes the supply chain costs. Also
called the optimal order quantity. See page 19
excess demand Demand that cannot be served directly from the on-hand inventory. See page 76
fill rate ( β ) Over the long term, the fraction of demand that is supplied directly from on-
hand inventory. Often called the “Type 2 service level,” we note it β. See page 47
Gaussian See standard normal distribution. See page 50
goodwill ( g ) In inventory models, any extra cost associated with the risk of losing a client.
We note it g. See page 214
holding costs Costs related to storing (or simply possessing) products. We note h the yearly
holding costs for one single product (generally expressed as a % of the product
cost). See page 13
in-transit inventory ( I s ) Inventory that is currently ordered from a supplier but not yet
available in our warehouse. See page 35
net inventory Inventory level including: available on-hand inventory and in-transit inventory,
minus backorders, orders not yet shipped, etc. See page 3
NumPy One of the most famous Python libraries. It is focused on numeric computation.
The basic data structure in NumPy is an array. See page 262
on-hand inventory Inventory available right away (“on-hand”) for a client to buy. See page 3
order cycle Time elapsed between two orders. In periodic replenishment policies the order
cycle is R, in continuous policies it is Q/D . See page 12
pandas Python library specializing in data formatting and manipulation. Allows the use of
DataFrames to store data in tables. See page 263
period service level ( αp ) Probability of not having a stock-out during one demand period (e. g.,
day, week). This can be similar or different than the cycle service level depending
on the length of an order cycle. See page 46
probability density function ( f 𝓧(z) ) The higher the probability density function (PDF) of
random distribution X is around a value x, the higher the probability that an
occurrence of this distribution is close to this value x. In other words, if the PDF of
a distribution is high around 1, it is likely that an occurrence of this distribution
would fall close to 1. The PDF of a standard normal distribution is noted φ(x) . See
page 50
probability mass function ( p(x) ) The probability that a discrete probability function is exactly
the integer x. It is the discrete equivalent to the probability density function. See
page 208
risk-period ( xτ ) Maximum amount of time you need to wait to receive an order (from your
supplier). During this period your inventory is at risk of being depleted. See page
66
Root Mean Square Error
∑ e2t See page 157
1
RM SE = √
n

salvage value ( sv ) Either the discounted price at which a product is sold when the inventory
needs to be cleared. Or the cost a company incurs to clear its inventory (e. g.,
recycling, waste disposal). See page 213
service level factor ( z ) A value that multiplies the demand deviation in order to compute the
needed safety stock for a certain service level. See page 56
skewness
( γ1 ) Measure of a distribution asymmetry. It is expressed by a number—just as
the mean or the standard deviation. A positive one means a right skew, and a
negative one means a left skew. See page 149
SKU A stock keeping unit refers to a specific material kept in a specific location. Two
different pieces of the same SKU are indistinguishable. See page 38
standard normal distribution A standard normal distribution with a variance of 1 and a mean
of 0: N (0, 1) . It is also known as a Gaussian distribution. See page 50
transaction costs ( k ) Costs triggered by an order (or a transaction). See page 15
undershoot ( U ) In an (R, s, Q) policy, the expected level of inventory below the reorder
point s that is reached at the review period R when an order is made. See page 70
unit short ( U s ) Number of units missed to entirely fulfill the demand. Equal to the excess
demand. See page 100
vendor managed inventory (VMI) A business model where the supplier of a product takes the
ownership of the stock that its client holds. In practice, it means that the supplier
is managing and responsible for its client’s inventory policy. In some cases the
supplier can also own the inventory held at its client’s premises, we call this
consignment. See page 176
work-in-progress Unfinished piece of inventory currently in the production process or waiting
between two consecutive steps of the production process. Also known as WIP and
work-in-process. See page 84

List of Symbols
Statistics
μX Mean of variable X
σX Standard deviation of variable X
ρ X,Y Correlation between X and Y
E[x] Expectation of variable x
V [x] Variance of variable x
f X (x) Probability density function of distribution X evaluated at threshold x
F X (x) Cumulative distribution function of distribution X evaluated at threshold x
p(x)
Probability for a discrete random variable to be equal to x
P (X ≤ x)
Probability for random discrete variable X to be smaller than or equal to x.
Equivalent of F (x) for a continuous distribution.
X

F
−1

X
(α) Inverse cumulative distribution function of distribution X evaluated at
probability α
L X (z) Loss Function of distribution X evaluated at threshold z
L
−1
(x) Inverse loss function of distribution X evaluated at probability x
X

Statistics – Normal distribution


N (μ, σ )
2
Normal distribution with mean μ and standard deviation σ
f N (x; μ, σ) Probability density function of the normal distribution N (μ, σ ) evaluated at x
2

φ(x) Standard normal probability density function evaluated at x


F N (x; μ, σ) Cumulative distribution function of the normal distribution N (μ, σ ) evaluated
2

at threshold x
Φ(x) Standard normal cumulative distribution function evaluated at threshold x
F
N
−1
(α; μ, σ) Inverse cumulative distribution function of the normal distribution N (μ, σ )
2

evaluated at probability α
Φ
−1
(α) Inverse standard normal cumulative distribution function evaluated at probability
α
L N (z; μ, σ) Loss function of the normal distribution N (μ, σ ) evaluated at threshold z
2

L N (z) Standard loss function evaluated at threshold z


L
N
−1
(x; μ, σ) Inverse loss function of the normal distribution N (μ, σ ) evaluated at
2

probability x
L
N
−1
(x) Inverse standard loss function evaluated at probability x

Statistics – Gamma distribution


Γ(k, θ) Gamma distribution with shape k and scale θ
f Γ (x; k, θ) Probability density function of the gamma distribution Γ(k, θ) evaluated at x
F Γ (x; k, θ) Cumulative distribution function of the gamma distribution Γ(k, θ) evaluated at
threshold x
F
Γ
−1
(α; k, θ) Inverse cumulative distribution function of the gamma distribution Γ(k, θ)
evaluated at probability α
L Γ (x; k, θ) Loss function of the gamma distribution Γ(k, θ) evaluated at threshold x
L
Γ
−1
(x; k, θ) Gamma inverse loss function of the gamma distribution Γ(k, θ) evaluated at
probability x

Inventory Policies
Q Order quantity
R Review period
s Reorder point
S Order up-to level

Deterministic Models
D Yearly demand
d Demand per period
dL Demand over the lead time
dR Demand over the review period
k Fixed transaction costs per transaction
cT Variable transaction costs per unit
h Holding costs per unit per period
Q Order quantity
C (Q) Total (holding and transactions) costs with regard to Q
Q

Optimal order quantity (or EOQ)
C

Optimal total costs
QB

Optimal order quantity with backorders B
B Maximal amount of backorders
bτ Backlog cost (cost per unit in the backlog per unit of time)
r Production throughput per period
ρ Throughput ratio ( ρ = 1 − d/r )


Optimal order quantity with production throughput ratio ρ
T Time between two consecutive orders
T
∗ Optimal time between two consecutive orders

Stochastic Models
Cs Cycle stock
Is In-transit stock
Ss Safety stock
Us Units short
α Cycle service level
αp Period service level
β Fill rate
z Service level factor
zα Service level factor for cycle service level α
zβ Service level factor for fill rate β
dc Expected demand over an order cycle
xτ Length of the risk-period
dx Demand distribution over the risk-period
μx Expected demand over the risk-period
σx Demand deviation over the risk-period
b Backorder cost (cost per unit backordered)
bτ Backlog cost (cost per unit in the backlog per unit of time)

Multi-echelon Models
Ss
i
Safety stock held at node i
S
i
Order up-to level at node i

i
Risk-period covered by node i
gs τ
i Guaranteed-service time at node i
hi
Holding cost at node i
Li
(Incoming) Lead time at node i
d(τ )
Demand over τ periods
ˆ )
Demand bound over τ periods
d(τ

Newsvendor
co Overage cost
cu Underage cost
c (Purchasing) Cost
p (Sales) Price
sv Salvage value
g Goodwill
h Holding cost
C (Q, D) Expected (total) costs based on Q and D
P(Q, D) Expected profits based on Q and D
Subject Index
0
(R, s, Q) policy 1, 2, 3
– heuristic 1, 2
– order quantity 1
– simulation optimization 1, 2
– undershoot 1
(R, s, S) policy 1
(R, S) policy 1
– compared to – – (s, Q) policy 1, 2
– cost optimization 1, 2
– cycle demand 1, 2
– fill rate 1, 2
– gamma demand 1
– heuristic 1
– loss function 1
– multi-echelon inventory optimization 1
– optimal cycle service level 1
– order quantity 1, 2
– order up-to level 1, 2
– periodic review 1, 2, 3
– review period 1
– safety stock 1
– simulation optimization 1
– stochastic lead time 1, 2
(s, Q) policy 1
– compared to – – (R, S) policy 1 see (R,S) policy, compared
to (s,Q) policy
– cost optimization 1, 2
– cycle demand 1, 2
– fill rate 1
– gamma demand 1
– loss function 1
– optimal cycle service level 1
– order quantity 1, 2, 3, 4
– safety stock 1, 2
– stochastic lead time 1, 2, 3

B
backlog 1 see backorder
– cost 1
– cost heuristic 1
– EOQ cost 1
backorder 1, 2
– cost 1, 2, 3, 4, 5, 6, 7, 8, 9
– EOQ 1, 2, 3
– excess demand 1, 2, 3, 4, 5, 6, 7
– KPI 1
– simulation 1, 2

E
EOQ 1, 2
– backorders 1 see backorders, EOQ
– costs 1
– equilibrium 1
– optimization 1, 2
– order quantity 1, 2, 3, 4
– sensitivity 1, 2
excess unit 1 see unit short
F
forecast 1, 2, 3, 4, 5, 6
– order forecasting 1
– unconstraining the demand 1
– with lost sales 1

G
gamma demand 1 see Chapter 9

H
holding cost 1, 2, 3, 4, 5
– EOQ 1 see EOQ
– periodic review 1

I
in-transit inventory 1, 2, 3, 4, 5, 6, 7

L
lost sale 1, 2, 3, 4, 5

M
multi-echelon inventory optimization
– guaranteed-service model 1, 2, 3, 4, 5, 6, 7
– bounded demand 1
– optimum 1 see Chapter 10
– risk-period framework 1
– stochastic-service model 1, 2

N
newsvendor 1, 2, 3
– cost 1, 2, 3
– optimum 1, 2, 3, 4, 5, 6, 7

O
overage cost 1, 2, 3, 4
– optimum 1 see newsvendor, optimum

P
purchasing cost 1, 2, 3, 4, 5, 6
– EOQ with discounts 1

S
service level 1, 2, 3, 4, 5, 6
– backorders 1
– cycle 1, 2, 3, 4, 5, 6, 7, 8
– cycle vs fill rate 1, 2, 3, 4, 5, 6
– factor 1, 2, 3
– fill rate 1, 2, 3, 4
– lost sales 1
– multi-echelon inventory optimization 1, 2
– optimum 1, 2, 3, 4, 5, 6 see Chapter 8
– period 1, 2, 3
– simulation 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
T
transaction cost 1, 2, 3, 4, 5
– EOQ 1 see EOQ
– periodic review 1, 2

U
underage cost 1, 2, 3, 4, 5, 6, 7
– optimum 1 see newsvendor, optimum
unit short 1, 2, 3, 4, 5, 6

V
vendor managed inventory 1, 2

W
work-in-progress 1
Notes
1 See Lokad TV episodes 30 and 33
→https://www.youtube.com/channel/UC5r43_A7T7qXAt
y-uvNuJ5Q
2 →Vermorel (→2018).
1 →Ward et al. (→2019).
2 Immanuel Kant (1724–1804), a German philosopher
during the Age of Enlightenment, prognosticated that,
“From such crooked wood as that which man is made of,
nothing straight can be fashioned.” Can we then really
expect our models to be perfect?
3 My friend François Grisay and I love to say at
conferences that “ 95% of the time, safety stock works
every time.”
4 →Ellenberg (→2014).
5 Stochastic is a fancy word for random. In a stochastic
model the outcome is not know in advance but can be
estimated by statistical distributions; whereas you
always know what will happen in a deterministic model.
6 Multi-echelon inventory policies refer to inventory
policies that deal with complex warehouse networks
with multiple layers (echelons) of stocking points.
7 →Silver et al. (→2016).
8 →Cachon (→2018).
9 →Axsäter (→2015).
10 →Tempelmeier (→2011).
11 →www.edx.org/course/supply-chain-fundamentals
12 →www.edx.orgns-and-manufacturing-systems-
planning-1
13 →www.edx.org/course/introduction-to-computer-
science-and-programming-7
1 We will discuss where to keep inventory in Chapter
→10.
2 MRP stands for Materials Requirements Planning, it is a
software/methodology that is used to plan the sourcing
and production of goods. DRP stands for Deployment
Requirement Planning, it is also a
software/methodology used to plan the delivery of
goods. Due to running time motives, these tools often
run daily or weekly, imposing therefore a periodic
review policy.
3 See →Tempelmeier (→2011), →Tijms (→1994) for more
information.
4 See →Veinott and Wagner (→1965), →Ehrhardt
(→1979), →Tijms and Groenevelt (→1984), →Strijbosch
and Moors (→1999) for detailed models.
5 Tractable is a fancy word that mathematicians use to
describe models or equations that are simple enough to
be used or solved.
1 Typically 10% ≤ h ≤ 25% depending on the industry.
2 Accountants often report it under the acronym COGS
(cost of goods sold).
3 Don’t hesitate to google “Single-minute exchange of
die” to learn more about these techniques.
4 For the sake of simplicity, we abuse the convention here
by discussing the “supply chain costs” whereas we keep
only the relevant costs to our analysis; putting aside
many other costs related to managing a supply chain
(for example, the purchasing costs).
5 The second derivative is positive—its computation is
outside the scope of the book—assuring that we are
looking at a minimum.
6 →Harris (→1913a,→b).
7 →Erlenkotter (→1990).
8 →Wilson (→1934).
9 →Andriolo et al. (→2014) for a thorough analysis.
10 →Taft (→1918).
11 →Hadley and Whitin (→1963).
12 →Grubbström and Erdem (→1999).
13 →Trietsch (→1995).
14 It is often called the Economical Production Quantity
model or EPQ.
15 →Hadley and Whitin (→1963).
16 See →Nahmias (→2015) for a complete overview of such
models.
17 →Trietsch (→1995).
1 We will discuss stochastic lead times later in Chapter
→6, “→Stochastic Lead Times.”
1 See →Strijbosch and Moors (→1999), →Tempelmeier
(→2011) for detailed models.
2 See →Vandeput (→2021).
3 We will discuss normality further in Chapter →9,
“→Beyond Normality.” Nevertheless, the exact
mathematics needed to test demand normality are
beyond the scope of this book, and unfortunately the
assumption of normality is frequently not strictly
respected. Nothing is normal in this world.
4 It is commonly accepted that Thomson Whitin (1923–
2013) introduced stochastic inventory optimization—
and the famous safety stock formula—with his book The
Theory of Inventory Management that he published in
1953 while he was working as a professor at the MIT.
See →Whitin (→1953).
5 See my previous book Data Science for Supply Chain
Forecasting for a detailed discussion about forecast
accuracy and bias.
6 A flat split means that you spread the monthly forecast
equally over each day in the month.
1 Remember, the net inventory level is the available on-
hand inventory and in-transit inventory, minus
backorders, orders not yet shipped, etc.
2 You can compute the probability that the demand
during one period is negative as F (0, μ , σ ) , which
N d d

can be computed in Excel with


=NORM.DIST(0,mu_d,sigma_d,TRUE).

3 See →Nahmias (→1979), →Silver et al. (→2016),


→Axsäter (→2015) for detailed lost sales models.
1 In practice, the lead time is often not normally
distributed. We will discuss gamma distribution in
Chapter →9, “→Beyond Normality,” and custom
distributions in Chapter →13, “→Simulation
Optimization.”
2 We suppose that its announced time of arrival, or
expected time of arrival, is its average lead time μ . If
L

this isn’t the case, your policy should account for a lead
time bias.
3 In most cases, the lead time variation can be assumed
to be independent of the demand variation. There are
exceptions of course. For example, during periods of
global high demand you could face a supply shortage.
→Wang et al. (→2010) provides mathematical
formulations for such cases.
4 Risk-period ( x ): maximum amount of time you need to
τ

wait to receive an order (from your supplier). During


this period your inventory is at risk of being depleted.
xτ = R + L in an (R, S) policy and xτ = L in an
(s, Q) policy. See Section →5.1.1.

5 →Hadley and Whitin (→1963).


1 Note that this is even different than a metric such as
“number of days without stocking out” because here we
are measuring the probability to be out-of-stock during
one week. The stock-out could happen on Friday or on
Wednesday, it still counts as one stocking out event.
2 During each inventory cycle you risk missing part of the
demand. Over the long term you will eventually
undershoot the average demand estimation—since you
missed some—resulting in a lower inventory target.
Less inventory means lower service level, resulting in
missing a greater part of the demand. And so on.
3 Revenue management is the field of management
science that optimizes price and revenue for service
industries such as hospitality and air traffic.
4 See →Cooper et al. (→2006).
5 See →Nahmias (→1994) for a discussion about
unconstraining normal demand in a lost sales
environment.
6 Risk-period ( x ): maximum amount of time you need to
τ

wait to receive an order (from your supplier). During


this period your inventory is at risk of being depleted.
x = R + L in an (R, S) policy and x = L in an
τ τ

(s, Q) policy. See Section →5.1.1.


7 See Section →4.2.1 for a refresher about probability
density functions.
8 This can be confusing but, in a periodic review policy,
the risk-period x = R + L is longer than the order
τ

cycle R. In a continuous review policy, we have x = L


τ

which can be shorter or longer than the order cycle


which is Q/D long. See Chapter →5, “→Inventory
Policies.”
9 →Andrade and Sikorski (→2016).
1 Technically, profit maximization and cost minimization
are equivalent only if the opportunity costs are included
in the cost minimization model. The intuition is the
following: you could easily achieve 0 costs by having no
inventory at all, but you would miss all the potential
profits. For the sake of simplicity, we will often go from
profit maximization to cost minimization.
2 Accountants often report the purchasing costs under
the acronym COGS (cost of goods sold).
3 We don’t need to include any opportunity cost here
because we assume that all excess demand will result in
backorders (and not in lost sales).
4 We will discuss in Chapter →9, “→Beyond Normality,”
the gamma distribution—which is strictly positive.
1 The dataset is published by the Opplysningsrådet for
Veitrafikken (OFV) a Norwegian organization in the
automotive industry. It was initially retrieved by Dmytro
Perepølkin and published on Kaggle. You can download
the dataset on →supchains.com/download.
2 As extra resources about non-normal demand
distributions, you can check →Strijbosch and Moors
(→1999), →Cobb et al. (→2013) for detailed models.
3 See →Wanke et al. (→2016) for more details.
4 →Burgin and Wild (→1967), →Burgin (→1972, →1975).
5 →Murphy (→1975), →Snyder (→1984).
6 See chi-square, Kolmogorov-Smirnov or Anderson–
Darling tests for more rigorous goodness-of-fit tests.
7 →Turrini and Meissner (→2019) discusses a goodness-
of-fit test that allocates more importance to the right
end of the distribution.
8 Risk-period ( x ): maximum amount of time you need to
τ

wait to receive an order (from your supplier). During


this period your inventory is at risk of being depleted.
x = R + L in an (R, S) policy and x = L in an
τ τ

(s, Q) policy. See Section →5.1.1.

9 Assuming that the demand is independent from one


period to another. Keep in mind that this is still a strong
assumption as discussed in Section →4.3.3.
10 This is called the central limit theorem.
11 See →Burgin (→1972) for an approximation of a normal
demand over a gamma lead time; and →Murphy
(→1975) for a gamma demand over a gamma lead time.
12 See →Silver et al. (→2016) for a proof.
1 See →de Kok (→2018).
2 An echelon is a layer of a supply chain, whereas a node
is just a stocking point.
3 This game describes a 4-echelon beer supply chain
where each player manages one node (without any
information about the final demand). The game
originates from the 1960s. It was initially developed by
Jay Forrester (from MIT) and was codified later in its
“modern” setup in →Sterman (→1992).
4 S&OP stands for Sales and Operations Planning. It is
used to align sales, marketing and supply chain teams
(production, logistics, inventory).
5 The cash-to-cash cycle is the time between when a
business pays its suppliers and collects payments from
its customers.
6 See →Thonemann (→2011).
7 See for example →Graves and Willems (→2003).
8 →Clark and Scarf (→1960).
9 See →Simpson (→1958) for the original paper. See
→Eruguz (→2014), →Li (→2013) for a more complete
literature review and an extensive GSM model
explanation. Both theses are available online on
→tel.archives-ouvertes.fr
10 The idea of inventory optimization assuming bounded
demand was initially developed in 1955 by Kimball (also
a consultant at Arthur D. Little) in an unpublished
article. It was reprinted later in →Kimball (→1988).
11 Guaranteed-service model takes the joke: “95% of the
time, it works every time,” literally.
12 Academics often use “guaranteed-service model”
(GSM). We can also call it “guaranteed-service time
model” and therefore use both terms interchangeably.
13 We assume that the demand is independent from one
period to another, see Section →4.3 for a discussion
about demand temporal aggregation and
independence.
14 Risk-period: maximum amount of time you need to wait
to receive an order (from your supplier). During this
period your inventory is at risk of being depleted.
15 We take 2 to the power of “nodes - 1” as the demand
nodes always need to have enough safety stock in order
to guarantee no waiting time to the final client.
16 See →Inderfurth (→1991).
17 See →Kimball (→1988), →Simpson (→1958).
18 See →Inderfurth (→1991).
19 See →Thonemann (→2011) for a in-depth (business)
review or →Eruguz et al. (→2016) for an academic
review.
20 See →Moncayo-Martínez and Ramirez (→2016) for an
implementation.
1 The name “newsvendor” comes from the fact that this
model is often used to describe the case of
newsvendors that have to replenish their stock of
newspapers every day. We will discuss this in detail in
Section →11.2.
2 →Edgeworth (→1888).
3 →Kenneth et al. (→1951).
4 Remember, units short can result in either backorders
or lost sales, when excess demand is backordered or
lost (respectively). We use then the concept of units
short to be more general.
5 We assume here that we express c and c as positive
o u

values if they describe a cost, and a negative value if


they describe an extra revenue. In some cases, as we
saw in the muffin example, it is possible that the
overage costs are actually an extra income thanks to a
positive salvage value.
6 See →Hill (→2017) for more details.
7 →Cachon (→2018).
1 We use the same dataset as in Chapter →9, “→Beyond
Normality,” with one exception: the sales of January
2007 are removed from the analysis (considered as an
outlier). The dataset is available for download on
→supchains.com/download.
2 See →Trapero et al. (→2019) for an application of kernel
density estimation to safety stock computation. It is
available on the blog of Nikos Kourentzes (professor at
Lancaster University):
→kourentzes.com/forecasting/wp-
content/uploads/2018/06/Trapero_empirical-safety-
stock.pdf
3 See the online resources →VanderPlas (→2013),
→Duong (→2001), →Lerner (→2013) for complementary
explanations and examples. See →VanderPlas (→2016)
for a detailed analysis of various implementation in
Python.
4 Normalized means that the sum of the total distribution
is 1. You can normalize the distribution by dividing it by
its own sum.
5 See →Silverman (→1986), →Scott (→1992).
6 See the online resource →Ciortan (→2018). It is
available here:
→github.com/ciortanmadalina/modality_tests/blob/ma
ster/kernel_density.ipynb
7 You can compute it in Excel with =NORM.S.DIST(-3,TRUE),
or in Python with norm.cdf(-3).
1 See →Nahmias (→1979).
2 We abuse the language here by calling it the optimal
policy. Whereas, due to the stochastic behavior of the
system, we should only say that this is a proper policy.
3 See Chapters →1 and →5, specifically Section →1.3 and
Figure →5.5.
4 See →Tempelmeier (→2011) for mathematical
expressions.
5 As explained in my previous book Data Science for Supply
Chain Forecasting, the wisdom of the crowd concept
states that the average opinion of a group of people is
going to be more precise, on average, that the opinion
of a single member of the group. So it is better to ask
the opinion of everyone and average them.
6 See →Tempelmeier (→2011).
7 We will treat this optimization function as a black box
since its optimization algorithm is out-of-scope of this
book.
8 See Section →x for a reminder about the bullwhip effect.
1 NumPy for Numeric Python.
2 →https://docs.scipy.org/doc/numpy/reference/
3 →https://pandas.pydata.org/pandas-docs/stable/

You might also like