Lecture 14 - Monte Carlo Simulation for Inventory Management

IIT Roorkee July 201
61 followers
4 Video Views·Jan 11, 2025
Welcome friends.
In our last session, we were discussing about very interesting prescriptive analytics tool
that is decision tree.
And we discussed that how if you are having some kind of a situation alternatives and
you have to take decision that which alternative is the best alternative.
So, in that case decision tree is also a possible solution.
Similarly, in many situations you are unable to think all possible outcomes and you may
not have enough faith on your historical data.
And it is very difficult to create any kind of mathematical model for that.
In that case, another very interesting tool which we are going to discuss in this particular
say class that is simulation activities can also be used for getting some kind of decision.
So, we will first take the problem which we were discussing in our last class about decision
tree.
You may recall that we had the decision tree which is coming like this, which is there
in the previous class also.
We had 2, 3 options.
If you recall, we have the options of all stock market or we have option of buildings
of capacity that is a captive capacity plus remaining from spot market.
If you recall, we were discussing that how spot market calculations were done in our
previous class.
And I gave you a task that I am planning to keep a captive capacity of 500 or 500 units
and remaining x will come from my spot market.
If I have requirement of 600 like in these cases, so 500 will come from my captive and
remaining 100 will come from my spot market.
In these cases, where your demand is going 720, 500 will come from your captive capacity
and 220 will come from spot market.
But downside is that if my demand is just 320 or 480, in these scenarios, I may not
be able to use entire captive capacity.
It will still be with me, but there will be underutilization of 20 units or 180 units
as the case may be because I have less demand and my captive capacity is more than that.
So, we need to see which option is better and for that purpose, we were planning to
have a decision tree.
How did we do the calculation?
We discussed the concept of expected profit for this was our time t0, this was time t1
and this was our time t2.
So, we calculated expected profit for t2 first and then we calculated present value of expected
profit for t1 plus expected profit for t1 that become the total profit of t1 and similarly,
we did the backward calculation for t0 also and there may be some initial investment and
then NPV of all cash flows at the beginning.
So, initial investment and NPV of all the, these are the two things.
The difference of that will give you estimation of profit or loss for a particular option.
So, that calculation we have completed for the spot market in our last class.
Now, as I say that we have considered a situation of captive capacity of 500 and the remaining
capacity coming from the spot market.
I have given you this task, but for helping you now we are actually coming with this readymade
calculation and here though you see that only 9 unique combinations of demand and prices
are there.
This is demand, this is price.
So, only 9 unique combinations are there in t2, but for the purpose of calculation of
present value and net present value, we have done that each of these node are emanating
four different branches, branch 1, branch 2, branch 3, branch 4.
It is a different matter that most of these branches are leading to common impact.
So, now we are going to have this calculation to show you that how we are going to proceed
with this option number 2, where we are keeping the capacity, captive capacity of 500 and
additional requirement will come from the spot market.
So, like you see in case when it is 720, 500 will come from the captive capacity and
remaining 220 will come from the spot market and though we have 9 unique combinations of
demand and price, but you see that for the sake of our calculations we have divided this
table into 16 groups, a group is of 4 items like this.
So, that if you see this is let us say node 1, node 2, node 3 and node 4.
So, these calculations are coming for node 1, this is for node 2, this is for node 3
because you may remember like we have to calculate the present value of future cash flows, present
value of future cash flows.
So, for calculating the total expected profit in year 1 at node 1, I require the total expected
profit from year 2 from all the possibilities and then their present value for node 1 of
year 1, you will understand all these things in a minutes time.
Now, if I see the first part of this table out of 720, 500 coming from the available
capacity, 220 coming from the spot market, the spot market price is 4.32, the revenue
if you remember is coming at the rate of 4 sale price.
So, that is the demand is 720, this is 720 multiplied by 4, so that is 2880 and the cost
is coming because of this 220 units will use the spot market which is available to
you at 4.32.
Now, in all those situations where your demand is less like here 480, 480 there is no need
of spot markets.
So, therefore, if these spot markets are 0, the cost will also be 0, you can check the
entire table.
Only when there is a requirement in the spot market, there will be a cost term, the revenue
is coming because of 2880, 2880, 480 multiplied by 4 and so on, this entire column is coming.
The profit is revenue minus cost, revenue minus cost, revenue minus cost, revenue minus
cost that is the profit.
Now, for getting this, this is the expected profit and this expected profit 2004 is basically
1926, 29.6 multiplied by the appropriate probability that is 0.25 and similarly, for all these
the probability is same.
So, you can actually do the sigma of this multiply by this to the 0.25, your expected
profit is coming to be 2004.
Now, this expected profit of 2004 is coming in year 2, in year 2 to calculate its present
value, we have to present value of year 2 profit in year 1 will be 2004 divided by 1
plus k that is the discount rate and this k is 10 percent we remember.
So, this 2004 divided by 1.1 comes out to be 1821.8 around and similarly, for this also
if the same way you will calculate for all these, it will be the present value in year
1 will be 1650.91, its present value will go to 1454 point something and this is also
1454.
So, as we have seen that these are the expected profits which we will be using for calculation
at our year number 1.
Now, for year number 1, we have this table where we have taken these profits using their
present values.
If I try to summarize how are we proceeding year t2, then t1 and then t0.
So, every year has some profit coming on that we are using its present value plus local
profit you can say and then its present value plus local profit, local means the profit
for that particular period only and in this order for year 1 when I am calculating these
are the demands which are available to us from this demand tree and the capacities which
I will be using from the spot market are 100 and 100 whenever the demands are going 600.
The spot market price will be like this.
So, you have 100 into 3.6 and 100 into 2.4 as the cost for these two situations, revenue
will come from the total demand and the selling price is 4 rupees like this.
So, your profit will be 2400 minus 360 and so on.
And this table is coming, this particular column is coming from our previous calculation
and this is the sigma of 2040 and 1821.
Now, the expected profit in year 1 is basically the sigma of profit multiplied by rather it
is not appropriate to say sigma because each of these demand possibilities and the price
possibility have the probability, all these combinations are having probability of 25
percent.
So, we actually are going to for expected profit, we are going to multiply probability
column with the profit column, final profit column, this column.
Incidentally, all the probabilities are of equal nature.
So, you can summarize it as 0.25 into sigma of profit 12 and that comes out to be 3445.
Since we have done this calculation in excel, so there are some digits after decimal also,
but for the sake of our convenience we can very easily ignore these points after the
decimals.
Now, let us go to this particular node t naught, where for period 0 because we are talking
of 3 period scenario t naught, t1 and t2 and there can be a captive capacity decision
also and we have done a lease agreement for the captive capacity that in the beginning
of this particular process I am shaking hand with you for a price of 2 rupees and 500 capacity.
So, for 1 year this is per year.
So, for 1 year the cost is coming 1000 rupees and for 3 years the cost will come at 3000
rupees.
The revenue, the demand in the first year is 500.
So, 500 into 4, the revenue will come to be 2000.
So, my revenue is less and I am incurring more cost in the beginning.
So, my profit is 2000 that is the revenue minus the cost is minus 1000 and whatever
discounted profit I am coming from period 1 that is the expected profits present value
and present value of expected profit of year 1 that will come out to be 3445 divided by
1 plus 0.1 and that is around 3132.
So, the expected net profit, expected net profit will be 3132 minus 1000 that is my
expected net profit 213 around that and if you can recall our previous class the expected
net profit when we are going to buy all the units from the spot market was 1367.
So, you can very conveniently make a decision that it is better to have a deal where you
are having a lease agreement of captive capacity for 3 years rather going for spot market purchase
every year because here the profit was 1367, here it is 2132 and more scenarios may give
you better opportunity that we have done this calculation with 500 as a lease agreement
and remaining from the market.
You can try and that will make slightly more complex calculation where you take a decision
of captive capacity you can say this is a homework captive capacity of 400 rest from
spot market and you can see that please check what will be the net expected profit and that
will give you more idea about the calculation process also and better decision making.
After completing this decision tree example then another very popular approach is simulation.
I hope most of us are aware what do we mean by simulation and there are different types
of simulations which are possible.
In this particular class, I will be focusing on Monte Carlo simulation which is very very
commonly used across the problems for decision making.
Inventory problems can be handled with Monte Carlo, service problems can also be handled.
If you go to operation research, queuing problems can also be handled with the help of this
Monte Carlo system.
So, there are wide variety of uses of Monte Carlo system where we are going to use a particular
kind of a system where every new incidence, every new event is happening in a random manner.
One customer is coming after how much difference another customer will come I do not have any
idea.
Generally, when you see in a petrol pump may be for 15 minutes there is no customer,
but all of a sudden 3 customers come and this is purely a random behavior.
So, trying to model that random behavior is our Monte Carlo simulation which is very powerful,
very useful and we will see in this particular session that how this Monte Carlo simulation
is possible in variety of situations where you have to done lot of approximation, stochastic
models are there where you are having some idea that how customers are going to come,
but it is very difficult to develop a mathematical model for these things.
For example, we are creating a situation so that we can explain you the use of and the
working of Monte Carlo system.
Now, in this particular case there are 3 types of demands for a particular product are there
and since we are talking of a small case I am considering only 3 levels of demand 3,
4 and 5.
Now, probabilities of these are 20 percent, 50 percent, 30 percent.
These probabilities we assign based on our past experience and in this case for every
type of let us say situation you have to see that the next event, the next customer will
have a demand of 3 units or 4 units and 5 units.
We follow a system which is known as system of random numbers and depending upon you can
take a number of random on 2 digits, 3 digits, 4 digits how much spread you have fine spread
of probability you have.
Like in this case we have 20 percent, 50 percent, 30 percent or you can say 0.20, 0.50 and 0.30
and then we are making cumulative probability column also 0.2, 0.7 and 1.00.
So, here we are using only 2 digits after the decimal so we can have only 2 digit random
number in our this particular situation.
So, since probability is up to 20 so I need 20 random numbers any 20 random numbers which
are coming for this particular first level.
So, these 20 numbers are between 0 to 90 then 70 is the probability sorry 50 is the probability
of 4.
So, I need 50 random numbers for designating the probability of 4 and these 50 numbers
are I have taken between 20 to 69 and then 5 is 30 random numbers are required and these
30 random numbers are coming between 70 to 99.
You see since we do not have practically all the possibilities of randomness so we
have given a particular block of random numbers to a particular level of demand.
Theoretically speaking in the most ideal situation these 20 random number should also be 20 different
numbers.
Now, I am considering only up to 0 to 19 a particular block of random number.
So, whenever we are going to use Monte Carlo simulation we actually do not have real random
numbers it is quasi random numbers with which we are going to operate.
But that is our practical limitation otherwise it is quite possible that I may have 1 random
number 1 and 79, 89, 50, 3, 4, 19, 20 such random numbers I put under 1 bin and that
will make my 3.
And similarly, but that will take huge amount of time and practically it is very difficult
to do that.
So, therefore, we take these kind of bin system where we have a block of random numbers representing
a particular level of event whether the demand will be 3, 4, 5.
These are the events.
So, next event will be a demand of 3 or 4 or 5 it is decided on the basis of random
number which I can generate either using our simple calculator or from the tables which
are available in books for random numbers using the computers also.
So, there are variety of ways through which you can generate the random number.
Even you see when you are throwing your dice whether 1 will come or 4 will come or 6 will
come that is also a kind of random number, but there you have only 6 random numbers.
Now, in this particular case when we have the theory of this particular Monte Carlo
system we have to run this system of inviting the events in a sequential manner may be some
number of time.
So, that the output starts stabilizing and for that purpose I will take you to the excel
demonstration which will help us that how the output stabilizes and we are deciding
what is going to happen with each new random number.
So, here we are having a small situation for which we are going to do this problem in the
excel sheet.
We have two situations one is the demand because it is a inventory problem.
So, demand can be 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 and these are associated probabilities
and the supplier may take either 2 days, 3 days, 4 days or 5 days.
In all our inventory models generally we used to consider fixed lead time, but practically
it is not going to be fixed lead time there may be different lead time.
So, the probabilities are 20 percent, 30 percent, 35 percent and 15 percent.
These are some of the cost available for the data available to us ordering cost is 80 rupees
per order, holding cost is 2 rupees per unit per day.
Generally you remember the data for holding cost which we used in our previous classes
is mostly for per year basis, but here it is per unit per day.
The shortage cost if the order is not fulfilled if demand is there and you are unable to fulfill
that is 20 rupees per unit, reorder point is 20 units whenever your inventory reduces
to 20 units you place a new order and the beginning inventory is 30 units and order
quantity every time you place the order that is U.
Let us see the performance of this particular system that how you will model this situation
you may find some very interesting outcome with the help of our simulation running.
So, we will go to the excel now.
So, now we are coming to this simulation excel sheet and we have generated all the required
information which is needed to develop this Monte Carlo simulation and now for that purpose
as you remember there can be different types of demands.
So, if I go to the demand table demand can vary from 3 to 12 these are the probabilities
which we already know we converted these probabilities into the cumulative probabilities and then
you have the random number ranges these are the random number range.
So, in fact, we will be needing these information when we will work on the simulation worksheet
similarly for the lead time also 2, 3, 4, 5 these are the possible lead times and similarly
random numbers are generated for different lead times also.
Now, going further for our simulation worksheet now we have started working on the simulation
for this day 0 our beginning inventory is 30 units beginning inventory is 30 units on
day 0 that is given to us in the problem day 1 I generate a random number may be using
my calculator the first random number now when you generate a random number the random
number may be very long for example, first random number which I press in my calculator
now it is showing me that is somewhere around 5, 3, 7, 8, 9 like this now depending upon
my requirement I may take 2 digits, 3 digits, 4 digits anything.
So, you can say that random number for me is 5 I am taking first digit of this now when
this 5 is there we can see that the demand is this 5 is falling in this 2 to 9 5 is in
this range. So, the demand is correspondingly 4 units. So, we go to this and we put demand
as 4 and when the demand is 4 you will have 26 units left with you will fulfill the demand
of 4 units now ordering cost the holding cost is 2 rupees per unit per day.
So, at the end of the first day you are left with 26 units. So, you will incur a holding
cost of 52 rupees 52 rupees at the rate of 26 into 2 next day you again generate a random
number between 0 to 100 the next random number is 5 sorry 0 and this 0 is corresponding to
demand of 3 units. So, 3 is the demand 26 minus 3 you are left with 5 units.
So, 23 and then 23 into 2 46 is your holding cost you will keep decreasing your inventory
till you reach the reorder level of 20. So, we will generate another random number then
this random number is corresponding to demand of 10 and when this correspond to demand of
10 23 minus 13 10 becomes 13 13 is less than 10. So, this is the demand of 10.
So, this is less than 20. So, you have to trigger one order here as per your policy
and order will be of 40 units that also you know. So, here you need to know after how
many days this order will come to you. So, you need to generate one more random number
now it is quite possible we have generated separate random numbers for the lead time,
but I may work because it is a random number. So, there is no mistake in that I may work
with this 79 also I may work with this separate random number I have generated for lead time
that is 91 also. So, if 91 is my number 91 will fall in 5 days lead time. So, this 5
day lead time means after 5 days I will come if this would have been 79 if I take this
79 as my lead random number for lead time this 79 will come under 4 lead time 4 days
lead time. So, in that case after 4 days I will get the
supply now since I have accepted 91 as my random number I will get after 5 days. So,
if it is 79 this would have been 4 days right now I am talking with 91 it is 5 days and
so right now my 13 units are there and the stock will get replenished after 5 days where
I will get a supply of 40 units and now when you have placed the order at this point you
will incur a cost of ordering also and only 13 units were there. So, cost of holding will
be 26 similarly next day comes random number is 60 demand is 8 13 minus 8 5 are left I
am running a holding cost of 10 units another day comes I have a demand of 3 units perfectly
fine I am able to serve then on the 6th day random number comes to be 10 sorry 84 and
corresponding demand is 10 and now I have only 2 units available with me.
So, I can fulfill the demand of 2, but I will not be able to fulfill the demand of 8. So,
in fact I have a balance of minus 8 here and for that purpose I will pay a shortage cost
of 8 into 20 rupees 160 rupees this is my shortage cost I am able to I have to pay on
this particular day because I do not have any item available with me and I have to pay
the shortage cost for this particular item. Then next day comes here I have another random
number of 18 and the corresponding demand is 5 since I do not have any item again for
this demand of 5 I have to pay a shortage cost of 100 rupees.
Now, on day 8 now I am getting the 5th day after placing my order the supply of 40 items
come to me, but the demand on this particular day is 7. So, immediately 7 items are lost
means sold from this. So, only 33 items are left with me and in this way continuously
I am updating for as many rounds as I want like we have done this particular solution
if I go to the bottom of this table for 40 particular days.
So, 40 is not a enough number we can do it for let us say 100 days 200 days because this
is just to be done on a paper. So, there is no cost associated for running the simulation
and after 80 let us say n number of days you can calculate that what is your total cost
of this particular model. So, total cost may include the cost of holding ordering plus
shortage. So, all these are the different types of cost some total of that is my this
particular thing. Now, in this case since the model is there
you can try this simulation model like our decision tree model by changing the policies.
Here my reorder point I am considering as 20 units you see that right now my shortage
cost ordering cost and holding cost should I decrease my reorder point may be from 20
to 15 or should I increase the reorder point from 20 to 30. You can just play this simulation
game again and again and with that new kind of alternative scenarios you will be able
to take a decision. So, that is also a good way of getting a decision out of means we
have created just one policy in this example, but you can create multiple policies and compare
your simulation result that which particular policy is giving me minimum cost of inventory
minimum cost of ordering holding shortage that is a good policy for my system.
So, with this I hope you can continue solving this particular problem using your own systems
with creating multiple ordering policies and accordingly you will be able to see which
policy is a more suitable policy or giving you the minimum cost of inventory with this
we come to end of this particular session. Thank you very much.
