SIMULATION EXAMPLES
Monte-Carlo (Static) Simulation Estimating profit on a sale promotion Estimating profit on a sale promotion Estimating profit on a sale promotion Estimating profit on a sale promotion Newsvendor Problem Newsvendor Problem Newsvendor Problem Newsvendor Problem Estimating the value of Estimating the value of Approximating Integrals Approximating Integrals Dynamic System Simulation Queueing systems Queueing systems M/U/1 G/G/1 Inventory systems Inventory systems Periodic Review, Order-up-to-Level inventory control Simulation Examples
Estimating value X, Y ~ uniform (0,1) Estimate value by simulation
Convergence to
Consider the integral Making the substitution we get where Approximating Integrals
Let Y ~ uniform(0,1) Approximate the integral by simulation Approximating Integrals
Queueing systems Calling Population Server …… Waiting Line (Queue) Entities Finite vs Infinite One line vs Multiple lines One server vs multiple server
Queueing examples System Entity Server Hospital Patient Doctor, Nurse Manufacturing Customer order Machine Food Store Purchased grocery Cashier Bank Client Clerk Computer Job CPU or disk Communication Link Data Package Data Channel
Characteristics Interarrival and Service Times Exponential (M) Exponential (M) Deterministic (D) Deterministic (D) Erlang (E) Erlang (E) General (G) General (G) Queue discipline First Come/In First Served/Out (FCFS/FIFO) First Come/In First Served/Out (FCFS/FIFO) Last Come/In First Served/Out (LCFS/LIFO) Last Come/In First Served/Out (LCFS/LIFO) Earliest Due Date (EDD) Earliest Due Date (EDD) System Capacity Number of Servers
Analysis Methods Queueing Theory (Analytical) Simulation Performance Measures Average Waiting Time Average Waiting Time Maximum Waiting Time Maximum Waiting Time Average Number of Entities in the System Average Number of Entities in the System Maximum Number of Entities in the System Maximum Number of Entities in the System Server Utilization Server Utilization Average System Time Average System Time Maximum System Time Maximum System Time
Events Arrival Event – entry of a unit into the system Departure Event – completion of service on a unit Failure Event – server failure Repair Event – server repair
Arrival Event Arrival event Schedule next arrival Increase number in the system Set service time & schedule departure Increase entity number in queue Make server busy Is server busy? NOYES L(t)=L(t)+1 Q(t)=Q(t)+1 B(t)=1
Service Completion Event Departure event Decrease number in system Set service time & scheduled departure for entity in service Make server idle Decrease number in queue Is queue empty? NOYES L(t)=L(t)-1 Q(t)=Q(t)-1 B(t)=0
Simulation by Hand Run simulation for 20 minutes to find Average Waiting Time Average Queue Length Average Utilization
t = 0.00, Initialize
t = 0.00, Arrival of Part 1 t = 0.00, Arrival of Part 1 1
t = 1.73, Arrival of Part 2 t = 1.73, Arrival of Part 2 12
t = 2.90, Departure of Part 1 2
t = 3.08, Arrival of Part 3 t = 3.08, Arrival of Part 3 23
t = 3.79, Arrival of Part 4 t = 3.79, Arrival of Part 4 234
t = 4.41, Arrival of Part 5 t = 4.41, Arrival of Part
t = 4.66, Departure of Part 2 t = 4.66, Departure of Part 2 345
t = 8.05, Departure of Part 3 t = 8.05, Departure of Part 3 45
t = 12.57, Departure of Part 4 t = 12.57, Departure of Part 4 5
t = 17.03, Departure of Part 5 t = 17.03, Departure of Part 5
t = 18.69, Arrival of Part 6 t = 18.69, Arrival of Part 6 6
t = 19.39, Arrival of Part 7 t = 19.39, Arrival of Part 7 67
t = 20.00, The End t = 20.00, The End 67
Finishing Up Average waiting time in queue: Time-average number in queue: Utilization of drill press:
Complete Record of the Hand Simulation
Inventory systems When to order? How much to order? Costs Holding Cost Holding Cost Ordering Cost Ordering Cost Shortage Cost Shortage Cost Performance Measures Total Cost Total Cost Total Profit Total Profit
Elements of Inventory Systems Entity Commodity CommodityEvents Demand Demand Inventory Review Inventory Review Order Arrival (Replenishment) Order Arrival (Replenishment) Occur simultaneously when lead time is zero
Elements of Inventory Systems State Variables Inventory level Inventory level Time to next review Time to next review Time to next replenishment Time to next replenishmentInput Demand Demand Lead Times Lead Times Cost Info (holding, shortage, and ordering costs) Cost Info (holding, shortage, and ordering costs) Inventory Policy Parameters (Decision Variables) Inventory Policy Parameters (Decision Variables)Output Total Costs Total Costs Average Inventory Average Inventory Number of Shortages Number of Shortages
Demand Event Generate demand size Decrement inventory Schedule the next demand event I(t) = I(t) - D(t) D(t)
Order Arrival Event Order Arrival Event Order Arrival Event Increment Inventory I(t) = I(t) + Q
Inventory Review Event Inventory Review Event Inventory review event Determine Q Determine lead-time Schedule the next order arrival & review events
Order-Up-To-Level, Periodic Review (M,N) Policy M is fixed, N is fixed, Q varies M is fixed, N is fixed, Q varies
(M,N) Policy Example Review period N=5 days, Order-up-to level M=11 units Beginning inventory = 3 units 8 units scheduled to arrive in two days Holding cost h = $1 per unit per day Shortage cost s = $2 per unit per day Ordering cost K = $10 per order t 123 Order arrival Question: based on 5 cycles of simulation, calculate Average ending units in inventory Average ending units in inventory The number of days shortage condition existed The number of days shortage condition existed Total cost Total cost
INPUT DATA 1. Demand Distribution 2. Lead Time Distribution
Simulation Table
HOW TO OPTIMIZE (M & N?) Z N M Z = objective function = f (cost, end. Inv.,...) TRY DIFFERENT M, N VALUES ZMNZ1*Z2 *ZMNZ1*Z2 * Simulation Optimization