0% found this document useful (0 votes)
145 views54 pages

4.discrete Event Simulation 2

Materi pembelajaran yang menjelaskan tentang Descrete Event Simulation. Materi ini bisa untuk jurusan Informatika.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
145 views54 pages

4.discrete Event Simulation 2

Materi pembelajaran yang menjelaskan tentang Descrete Event Simulation. Materi ini bisa untuk jurusan Informatika.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 54

CSH3H2

DASAR PEMODELAN DAN SIMULASI

Materi:
Spreadsheet DES
Simple DES Examples
Presents several examples of simulations that
can be performed by devising a simulation
table either manually or with a spreadsheet
In real world, simulation are rather large, and
the amount of data stored and manipulated is
vast, so such runs are usually conducted with
the aid of a computer
We try to gain insight how DES works in small
scale using spreadsheet

CSH3H2-Dasar Pemodelan dan


2 1/6/2017
Simulasi
Simulation using spreadsheet
1. Determine the characteristics of each of the
inputs to the simulation. Quite often, these are
modeled as probability distributions, either
continuous or discrete
2. Construct a simulation table. Each simulation
table is different, for each is developed for the
problem at hand
3. For each repetition i, generate a value for
each of the inputs, and evaluate the function,
calculating a value of the response
CSH3H2-Dasar Pemodelan dan
3 1/6/2017
Simulasi
Table
The simulation table provides a
systematic method for tracking
system state overInput
s
time. Respons
e
Repetitio Xi1 Xi2 Xij Xip yi
ns
1

CSH3H2-Dasar Pemodelan dan


4 1/6/2017
Simulasi
EXAMPLE 1

CSH3H2-Dasar Pemodelan dan


5 1/6/2017
Simulasi
Example 2.1 Single-Channel Queue
Arrival Departure

Checkout Counter
Assumptions
Only one checkout counter.
Customers arrive at this checkout counter at random
from 1 to 8 minutes apart. Each possible value of
interarrival time has the same probability of
occurrence, as shown in Table 2.6.
The service times vary from 1 to 6 minutes with the
probabilities shown in Table 2.7.
The problem is to analyze the system by simulating the
arrival and service of 20 customers.
CSH3H2-Dasar Pemodelan dan
7 1/6/2017
Simulasi
Example 2.1 (Cont.)
A simulation of a grocery store that starts with an empty
system is not realistic unless the intention is to model the
system from startup or to model until steady-state operation
is reached.
A set of uniformly distributed random numbers is needed to
generate the arrivals at the checkout counter. Random
numbers have the following properties:
The set of random numbers is uniformly distributed between 0
and 1.
Successive random numbers are independent.
Random digits are converted to random numbers by placing
a decimal point appropriately.
Table A.1 in Appendix or RAND() in Excel.
The rightmost two columns of Tables 2.6 and 2.7 are used to
generate random arrivals and random service times.
Example 2.1 (Cont.) Table 2.8
The first random digits are 913. To obtain
the corresponding time between arrivals,
enter the fourth column of Table 2.6 and
read 8 minutes from the first column of the
table.
Example 2.1 (Cont.) Table 2.9
The first customer's service time is 4 minutes
because the random digits 84 fall in the
bracket 61-85
Example 2.1 (Cont.)
The essence of a manual simulation is the simulation
table.
The simulation table for the single-channel queue,
shown in Table 2.10, is an extension of the type of table
already seen in Table 2.4.
Statistical measures of performance can be obtained
form the simulation table such as Table 2.10.
Statistical measures of performance in this example.
Each customer's time in the system
The server's idle time
In order to compute summary statistics, totals are
formed as shown for service times, time customers
spend in the system, idle time of the server, and time
the customers wait in the queue.
Example 2.1 (Cont.)
The average waiting time for a customer : 2.8 minutes
total time customers wait in queue 56
average waitng time 2.8 (min)
total numbers of customers 20
The probability that a customer has to wait in the queue : 0.65
number of customers who wait 13
probabilit y ( wait ) 0.65
total numbers of customers 20
The fraction of idle time of the server : 0.21
total idle time of server 18
probabilit y of idle server 0.21
total run time of simulation 86
The probability of the server being busy: 0.79 (=1-0.21)
Example 2.1 (Cont.)
The average service time : 3.4 minutes
total service time 68
average service time 3.4 (min)
total numbers of customers 20
This result can be compared with the expected service time by finding the
mean of the service-time distribution using the equation in table 2.7.

E ( S ) sp ( s )
s 0

E ( S ) 1(0.10) 2(0.20) 3(0.30) 4(0.25) 5(1.10) 6(0.05) 3.2 (min)

The expected service time is slightly lower than the average service time in
the simulation. The longer the simulation, the closer the average will be to
E (S )
Example 2.1 (Cont.)
The average time between arrivals : 4.3 minutes

sum of all times between arrivals 82


average time between arrivals 4.3 (min)
numbers of arrivals 1 19
This result can be compared to the expected time between arrivals by finding
the mean of the discrete uniform distribution whose endpoints are a=1 and
b=8.
a b 1 8
E ( A) 4.5 (min)
2 2
The longer the simulation, the closer the average will be to E (A)
The average waiting time of those who wait : 4.3 minutes
total time customers wait in queue 56
average waiting time of those who wait 4.3 (min)
total numbers of customers who wiat 13
Example 2.1 (Cont.)
The average time a customer spends in the system : 6.2
minutes total time customers spend in system 124
average time customer spends in the system 6.2 (min)
total numbers of customers 20

average time average time average time


customer spends = customer spends + customer spends
in the system waiting in the queue in service

average time customer spends in the system = 2.8 + 3.4 = 6.2 (min)
EXAMPLE 2

CSH3H2-Dasar Pemodelan dan


17 1/6/2017
Simulasi
Example 2.2 The Able Baker Carhop Problem

Able

Baker

A drive-in restaurant where carhops take orders and bring food to the car.
Assumptions
Cars arrive in the manner shown in Table 2.11.
Two carhops Able and Baker - Able is better able to do the job and works a
bit faster than Baker.
The distribution of their service times is shown in Tables 2.12 and 2.13.
Example 2.2 (Cont.)
A simplifying rule is that
Able gets the customer if
both carhops are idle.
If both are busy, the
customer begins service
with the first server to
become free.
To estimate the system
measures of performance,
a simulation of 1 hour of
operation is made.
The problem is to find how
well the current
arrangement is working.
Example 2.2 (cont.)
The row for the first customer is filled in manually, with the random-
number function RAND() in case of Excel or another random function
replacing the random digits.

After the first customer, the cells for the other customers must be
based on logic and formulas. For example, the Clock Time of Arrival
(column D) in the row for the second customer is computed as follows:
D2 = D1 + C2

The logic to computer who gets a given customer can use the Excel
macro function IF(), which returns one of two values depending on
whether a condition is true or false.
IF( condition, value if true, value if false)
clock = 0
Is there the service
Is it time of arrival? Increment clock
N completed? N
o o
Ye
s
Ye
s
Store clock time (column H or K)
Generate random digit for
Is Able idle?
Ye service (column E)
s
Convert random digit to random
number for service time
(column G)
N
o
Able service begin (column F)
Generate random digit for
Is Baker idle?
Ye service (column E)
s
N Convert random digit to random
o
number for service time
(column J)
Nothing Baker service begin (column I)
Example 2.2 (cont.)
The logic requires that we compute when Able and Baker will
become free, for which we use the built-in Excel function for
maximum over a range, MAX().

F10 IF ( D10 MAX ( H $1 : H 9), D10, IF ( D10 MAX ( K $1 : K 9), "" ,


MIN ( MAX ( H $1 : H 9), MAX ( K $1 : K 9))))

If the first condition (Able idle when customer 10 arrives) is true, then the
customer begins immediately at the arrival time in D10. Otherwise, a second
IF() function is evaluated, which says if Baker is idle, put nothing (..) in the
cell. Otherwise, the function returns the time that Able or Baker becomes
idle, whichever is first [the minimum or MIN() of their respective completion
times].

A similar formula applies to cell I10 for Time Service Begins for Baker.
Example 2.2 (Cont.)
For service times for Able, you could use another IF() function to
make the cell blank or have a value:
G10 = IF(F10 > 0,new service time, "")
H10 = IF(F10 > 0, F10+G10, "")
The analysis of Table 2.14 results in the following:
Over the 62-minute period Able was busy 90% of the time.
Baker was busy only 69% of the time. The seniority rule keeps
Baker less busy (and gives Able more tips).
Nine of the 26 arrivals (about 35%) had to wait. The average
waiting time for all customers was only about 0.42 minute (25
seconds), which is very small.
Those nine who did have to wait only waited an average of
1.22 minutes, which is quite low.
In summary, this system seems well balanced. One server
cannot handle all the diners, and three servers would probably
be too many. Adding an additional server would surely reduce
the waiting time to nearly zero. However, the cost of waiting
would have to be quite high to justify an additional server.
EXAMPLE 3: INVENTORY

CSH3H2-Dasar Pemodelan dan


26 1/6/2017
Simulasi
This inventory system has a
periodic review of length N, at
which time the inventory level
is checked.
An order is made to bring the
inventory up to the level M.
In this inventory system the
lead time (i.e., the length of
time between the placement
and receipt of an order) is
zero.
Demand is shown as being
uniform over the time period
Notice that in the second cycle, the amount in inventory drops
below zero, indicating a shortage.
Two way to avoid shortages
Carrying stock in inventory
: cost - the interest paid on the funds borrowed to buy the items,
renting of storage space, hiring guards, and so on.
Making more frequent reviews, and consequently, more frequent
purchases or replenishments
: the ordering cost
The total cost of an inventory system is the measure of
performance.
The decision maker can control the maximum inventory level, M,
and the length of the cycle, N.
In an (M,N) inventory system, the events that may occur are: the
demand for items in the inventory, the review of the inventory
position, and the receipt of an order at the end of each review
period.
Example 2.3 The Newspaper Sellers Problem
A classical inventory problem concerns the purchase and sale
of newspapers.
The paper seller buys the papers for 33 cents each and sells
them for 50 cents each. (The lost profit from excess demand is
17 cents for each paper demanded that could not be provided.)
Newspapers not sold at the end of the day are sold as scrap for
5 cents each. (the salvage value of scrap papers)
Newspapers can be purchased in bundles of 10. Thus, the
paper seller can buy 50, 60, and so on.
There are three types of newsdays, good, fair, and poor,
with probabilities of 0.35, 0.45, and 0.20, respectively.
Example 2.3 (Cont.)
The problem is to determine the optimal number of papers
the newspaper seller should purchase.
This will be accomplished by simulating demands for 20
days and recording profits from sales each day.
The profits are given by the following relationship:

revenue cost of lost profit from salvage from sale


Pofit
from sales newspapers excess demand of scrap papers

The distribution of papers demanded on each of these days is given


in Table 2.15.
Tables 2.16 and 2.17 provide the random-digit assignments for the
types of newsdays and the demands for those newsdays.
Example 2.3 (Cont.)
The simulation table for the decision to purchase 70 newspapers is
shown in Table 2.18.
The profit for the first day is determined as follows:
Profit = $30.00 - $23.10 - 0 + $.50 = $7.40
On day 1 the demand is for 60 newspapers. The revenue from the sale of
60 newspapers is $30.00.
Ten newspapers are left over at the end of the day.
The salvage value at 5 cents each is 50 cents.
The profit for the 20-day period is the sum of the daily profits,
$174.90. It can also be computed from the totals for the 20 days of
the simulation as follows:
Total profit = $645.00 - $462.00 - $13.60 + $5.50 = $174.90
The policy (number of newspapers purchased) is changed to other
values and the simulation repeated until the best value is found.
EXAMPLE 4

CSH3H2-Dasar Pemodelan dan


34 1/6/2017
Simulasi
Example 2.4 Simulation of an (M,N) Inventory System
This example follows the pattern of the probabilistic order-
level inventory system shown in Figure 2.7.
Suppose that the maximum inventory level, M, is11 units and
the review period, N, is 5 days. The problem is to estimate,
by simulation, the average ending units in inventory and the
number of days when a shortage condition occurs.
The distribution of the number of units demanded per day is
shown in Table 2.19.
In this example, lead time is a random variable, as shown in
Table 2.20.
Assume that orders are placed at the close of business and
are received for inventory at the beginning of business as
determined by the lead time.
Example 2.4 (Cont.)
For purposes of this example, only five cycles will be
shown.
The random-digit assignments for daily demand and lead
time are shown in the rightmost columns of Tables 2.19
and 2.20.
Example 2.4 (Cont.)
The simulation has been started with the inventory level at
3 units and an order of 8 units scheduled to arrive in 2
days' time.
Beginning Inventory of = Ending Inventory of 2 + new order
Third day day in first cycle
The lead time for this order was 1 day.
Notice that the beginning inventory on the second day of the third cycle was
zero. An order for 2 units on that day led to a shortage condition. The units
were backordered on that day and the next day also. On the morning of day
4 of cycle 3 there was a beginning inventory of 9 units. The 4 units that were
backordered and the 1 unit demanded that day reduced the ending inventory
to 4 units.
Based on five cycles of simulation, the average ending inventory is
approximately 3.5 (88 25) units. On 2 of 25 days a shortage condition
existed.
EXAMPLE 5

CSH3H2-Dasar Pemodelan dan


39 1/6/2017
Simulasi
Example 2.5 A Reliability Problem

Milling Machine

Bearing Bearing Bearing

Repairperson

Downtime for the mill is estimated at $5 per minute.


The direct on-site cost of the repairperson is $15 per hour.
It takes 20 minutes to change one bearing, 30 minutes to change two
bearings, and 40 minutes to change three bearings.
The bearings cost $16 each.
A proposal has been made to replace all three bearings whenever a
bearing fails.
Example 2.5 (Cont.)

The delay time of the


repairperson's arriving at the
milling machine is also a
random variable, with the
distribution given in Table 2.23.

The cumulative distribution function of


the life of each bearing is identical, as
shown in Table 2.22.
Example 2.5 (Cont.)
Table 2.24 represents a simulation of 20,000 hours of
operation under the current method of operation.
Note that there are instances where more than one bearing
fails at the same time.
This is unlikely to occur in practice and is due to using a
rather coarse grid of 100 hours.
It will be assumed in this example that the times are never
exactly the same, and thus no more than one bearing is
changed at any breakdown. Sixteen bearing changes were
made for bearings 1 and 2, but only 14 bearing changes
were required for bearing 3.
Example 2.5 (Cont.)
The cost of the current system is estimated as follows:
Cost of bearings = 46 bearings $16/bearing = $736
Cost of delay time = (110 + 125 + 95) minutes $5/minute =
$1650
Cost of downtime during repair =
46 bearings 20 minutes/bearing $5/minute =
$4600
Cost of repairpersons =
46 bearings 20 minutes/bearing $15/60 minutes =
$230
Total cost = $736 + $1650 + $4600 + $230 = $7216
Table 2.25 is a simulation using the proposed method.
Notice that bearing life is taken from Table 2.24, so that for
as many bearings as were used in the current method, the
bearing life is identical for both methods.
Example 2.5 (Cont.)
Since the proposed method uses more bearings than the current
method, the second simulation uses new random digits for generating
the additional lifetimes.
The random digits that lead to the lives of the additional bearings are
shown above the slashed line beginning with the 15th replacement of
bearing 3.
The total cost of the new policy :
Cost of bearings = 54 bearings $16/bearing = $864
Cost of delay time = 125 minutes $5/minute = $625
Cost of downtime during repairs = 18 sets 40 minutes/set $5/minute =
$3600
Cost of repairpersons = 18 sets 40 minutes/set $15/60 minutes = $180
Total cost = $864 + $625 + $3600 + $180 = $5269
The new policy generates a savings of $1947 over a 20,000-hour
simulation. If the machine runs continuously, the simulated time is
about 2 1/4 years. Thus, the savings are about $865 per year.
EXAMPLE 6

CSH3H2-Dasar Pemodelan dan


47 1/6/2017
Simulasi
Example 2.6 Lead-Time Demand
Lead-time demand may occur in an inventory system.
The lead time is the time from placement of an order until the
order is received.
In a realistic situation, lead time is a random variable.
During the lead time, demands also occur at random. Lead-
time demand is thus a random variable defined as the sum of
the demands over the lead time, or

T
i 0
Di

where i is the time period of the lead time, i = 0, 1, 2, , Di is


the demand during the ith time period; and T is the lead time.
The distribution of lead-time demand is determined by
simulating many cycles of lead time and building a histogram
based on the results.
Example 2.6 (Cont.)

The daily demand is given by


the following probability
distribution:

The lead time is a random


variable given by the following
distribution:
Example 2.6 (Cont.)
The incomplete simulation
table is shown in Table 2.29.

The random digits for the first


cycle were 57. This generates
a lead time of 2 days.

Thus, two pairs of random


digits must be generated for
the daily demand.
Example 2.6 (Cont.)

The histogram might appear as


shown in Figure 2.9.

This example illustrates how


simulation can be used to study an
unknown distribution by generating
a random sample from the
distribution.
Exercise
The daily demand for a product is found
to follow the distribution as

Determine the total demand for the next


100 days
CSH3H2-Dasar Pemodelan dan
52 1/6/2017
Simulasi
Exercise
Bagels sell for $8.40 per dozen. They cost $5.80
per dozen to make. All bagels not sold at the end
of the day are sold at half-price to a local grocery
store. Based on 5 days of simulation, how many
dozen (to the nearest 5 dozen) bagels should be
baked each day?

CSH3H2-Dasar Pemodelan dan


53 1/6/2017
Simulasi
THANK YOU

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy