100 aGPSS Models: Cases and Exercises: Ingolf Ståhl, Stockholm School of Economics, 2018
100 aGPSS Models: Cases and Exercises: Ingolf Ståhl, Stockholm School of Economics, 2018
We present many manufacturing examples (e.g. 63, 67, 75, 82, 83),
but also examples of logistics with trucks (100), shipping (77, 78)
and taxi operations (72). Some examples are from services like
restaurants (94), gas stations (62) and libraries (74). Among other
examples we have an IT-exhibition (81), systems with elevators (79,
80), administration of secretarial work (86), software development
(93), car maintenance (95), super market retail operations (54, 59,
89) and partner selection (71). There are also examples of oligopoly
theory models (85, 90) and of coordination of production, inventory
and pricing policy to improve the company’s cash flow. (87, 91).
7. Alter Model19 to allow for two lathes and two grinders. The
average processing times for the machines are now doubled, but
the half-widths are unchanged. (11)
4
Compare the results of this new program with those of the old
program. (12)
9. A student owns two cars. Each day, he uses a car to get to school
and back. Car 1 is old and has probability 0.79 of starting on any
day, while car 2, even older, starts with probability 0.71. For either
car, once it is started, the chance that it completes a trip to or from
school is 0.95. Compute the probability that he will make it to
school and back on any particular day. First do the calculation
manually, then write a GPSS program to do it. (13)
5
Simulate a day of five hours. The output should include data on
average time spent in the cafeteria, the maximum number of people
at any time and average waiting time in front of the cashier. (13)
13. We simulate a simple bicycle store for 250 days of 8 hours. The
store has space for 15 bikes in stock. The stock is replenished with
six bicycles every 10th day. If there is no space in the inventory
room, the delivery of the bike has to wait until there is such space.
Customers wanting to buy a bike arrive every x hours. Test with x =
10 and 20 to see if deliveries of new bikes are delayed or if
customers have to wait for a bike. (17)
6
0.6, 1.6, 1.8, 3.4, 3.8, 5.2, 7.1, 9.3, 10.1,
12.8, 14, 16, 19.5, 24.9, 25.1, 29.2, 34.8,
35.6, 39.3, 39.8, 40.8, 45.1, 46.2, 46.3, 51.2,
52.4, 55.3, 57, 57.6, 62.3, 63.8, 64.9,70.1,
70.2, 72, 76.5, 77.7, 80.9, 81.6, 82.7, 85, 89.2,
89.4, 90.3, 91.7, 94.2, 95.1, 96.8, 99.4
On the basis of these numbers one can calculate the time between
the arrivals and then distribute them into six bins for 0 - 1, 1 – 2, .. ,
5 - 6 minutes etc.
Next one can formulate an empirical IAT function and use this
function in the model. Simulate the operations of the store for 10
hours. (20)
16. In a store, sales only refer to one product, but with different
prices for two types of customers, arriving 18 + 6 minutes apart:
Members, accounting for 60 percent, pay $ 20, but the rest must pay
$ 30. If there are no units in stock, when a customer arrives, the
customer waits until new stocks arrive. Every day 25 new units are
delivered provided at least one customer is waiting and the store has
enough cash to pay $ 15 for each unit. When we start, the company
has 400 in cash. Simulate an operation of 30 days of 8 hours. (22)
Build a model of this simple system, then use the model to observe
system behavior for the alternatives of one, two and three waiting
spaces. For each configuration, simulate for one eight-hour day of
operation. Basing your answer on model output, estimate the
fraction of potential customers who actually remain at the car wash
to be served. (23)
22. A shop buys and sells antiques. Persons selling antiques arrive
at the shop according to the exponential distribution with an average
IAT of 2 hours. The price paid for an antique item is on average $
100, but the prices vary according to a normal distribution with a
standard deviation of $ 20. The shop always pays cash. The buyers
arrive at the shop also according to the exponential distribution, but
with an average of 5 hours. The shop sells antique items for $ 150
on average, but prices vary according to a normal distribution with a
standard deviation of $ 25. The customers obtain credit for 4 days,
but the actual times until payment follow an Erlang distribution
with n = 3 and with an average time of 6 days.
The store is open between 9.00 a.m. and 5.00 p.m. each day, also
Sundays. When the store is closed at 5.00, all customers leave. At
simulation start the inventories are valued at $ 10,000 and there is $
50,000 in cash. How much cash will the shop have and what is its
inventory worth after a month of 30 days? Every item in the
inventory is valued at $ 100, irrespective of the purchase price. (26)
29. Modify Model21 so that one of the two salespeople (or barbers)
only works part time - for three hours a day, starting at noon and
stopping at 3.00 p.m. The store opens at 9.00 a.m. and closes at 5.00
p.m. Only statistics on waiting time are required. (36)
13
36. At an attraction at an amusement park, with a capacity for 8
children, 50 per cent of the children, who have taken a ride, want to
repeat the ride. Those who already have taken the ride have to wait
in line after those who have not yet taken the ride. Hence, a child
will have a higher priority, when newly arrived, than when having
already taken the ride. Model this for the case that the children
arrive 10 + 2 seconds apart and a ride takes 50 seconds. Simulate
for a time of 5 minutes. (37)
14
4. a) Unload the finished casting from the machine.
b) Store the finished casting.
c) Fetch the next rough casting from the storage area.
d) Load this rough casting onto the machine.
5. Return to step 1 above.
An overhead crane is needed at each step involving movement of
the casting, i.e. steps 2 and 4 above. Whenever a crane is not being
used for one of these steps, it is in an idle state. The finishing
machine goes repeatedly through a single closed cycle consisting of
the four steps listed above. The crane, on the other hand, can go
through each of two distinct cycles, depending on whether it is
being used for step 2 or step 4. The times (in minutes) required to
perform steps 1 and 3 in the finishing process are as follows:
Time for Cumulative Time for Cumulative
process 1 frequency process 2 frequency
< 60 0.00 < 80 0.00
70 0.12 90 0.24
80 0.48 100 0.73
90 0.83 110 1.00
100 1.00
15
40. Customers come to a store with two salespeople on average
every 10 minutes following an exponential distribution. The
average service time is 15 minutes. Hardly any customer takes less
than five minutes or more than half an hour. It appears that the
triangular distribution could be a convenient approximation of
service times. Simulate for a day of nine hours. (39)
41. Run Exercise 24 above again for 500 customers, but now with
a print-out after every 100th customer. Hint: The decimal fraction
of n/100 is = 0 for every such customer. Use FN$dec. (39)
42. Modify Model22 in such a way that each worker finishes work
for the day and goes home as soon as he has produced 14 pots. (40)
43. A party of 100 people has gone to a football game in four buses,
each with a capacity of 25 people. When the game is over, each
person returns independently to the bus that brought him to the
game. The time taken to reach a bus is normally distributed with
mean values of 10, 12, 15 and 18 minutes for the four buses. In each
case the standard deviation is 2 minutes. When a bus is full, it
leaves, and arrives home after a drive that is normally distributed
with a mean of 80 and a standard deviation of 5 minutes. Begin a
simulation from the time the game finishes and find the time at
which the last bus arrives home. (40)
16
The probability of going down any particular aisle, the time
required to shop an aisle, and the number of items put into the
basket in each aisle are as follows:
Probability of going Seconds to go Number of
Aisle down the aisle down the aisle items selected
1 0.75 120 + 60 3+1
2 0.55 150 + 30 4+1
3 0.82 120 + 45 5+1
When shopping is complete, customers queue up first-come, first-
served at the checkout counter. Here, each customer puts an
additional 2 + 1 “impulse items” into the basket. The checkout time
is 3 seconds per item in the basket. After checking out, the customer
leaves the basket and departs. Simulate the store for an 8-hour day.
Measure the utilization of the checkout counter and the maximum
length here. Determine the maximum number of baskets in use. (41)
17
Compare the waiting times for parts when one, two or three
machines work in parallel, where each machine processes any type
of part, one part at a time. Simulate for one hour. (42)
53. Motorists wishing to cross the strait between the mainland and a
small island have to use a ferry. The ferry is moored on the
mainland overnight and starts work promptly each day at 7 a.m. It
shuttles to and fro between the mainland and the island until
approximately 10 p.m. when the service closes down for the night.
The ferry has a capacity limit of six cars.
20
When the ferry arrives at a quay, the cars on the ferry are driven off,
and then any waiting cars (up to the maximum of six) are driven on.
When the ferry is fully loaded, or the quay queue is empty, the ferry
leaves that side of the strait and starts another crossing, When the
ferry has completed a round trip and deposited any passengers on
the mainland, the captain checks the time. If it is 9.45 p.m. or later,
he closes down the service for the night.
Both on the mainland and the island, cars arrive on average at a rate
of nine per hour, following an exponential distribution. Crossing
times follow the normal distribution with a mean of 8 minutes and a
standard deviation of 0.5. It takes a car 0.5 minutes to drive on or
drive off the ferry.
Run the model for one working day on which there are three cars
waiting on the mainland and one on the island at 7.00 a.m. Produce
a table of the number of cars on the ferry at each crossing. (47)
54. In a retail store, the daily demand for a given item is normally
distributed with a mean and standard deviation of 10 and 2 units,
respectively. Whenever the retailer's stock-on-hand drops to or
beneath a predetermined point, called the re-order point, he places a
stock-replenishment order with his supplier regarding a specific
replenishment amount, called the re-order quantity, provided there
is no unfilled order.
21
Lead time Relative
(days) frequency
6 0.05
7 0.25
8 0.30
9 0.22
10 0.18
Demand that arises when the retailers is out of stock is lost, since
customers whose demand cannot be satisfied immediately go
elsewhere to carry out their business. Initially there are 100 units in
stock. The retailer wants to know how his experience of stocking
the item will vary, depending on where he sets the re-order point.
Build a model for the retailer's situation. Design the model to obtain
a table over ‘lost daily sales’ and ‘number of units carried in
inventory’. Run the model to estimate these two distributions, when
the re-order quantity is 100 and the reorder point is 80. Shut off the
model after a simulation of 1000 days. Ignore any weekend
problems, by assuming that the retailer does business seven days a
week and that a replenishment order continues to proceed also on
Saturdays and Sundays. (47)
57. Modify Model60, so that it, for one order quantity, produces a
report in a matrix table for each quarter (every 62.5 working days)
on direct sales, delayed sales, inventory costs, ordering costs and
profits. For simplicity, we use the size of the storage at the end of
the quarter as the average contents of the storage of the quarter. (49)
23
58. An oil storage depot distributes three grades of fuel: home
heating oil, light industrial fuel oil, and diesel fuel for road vehicles.
There is one pump for each grade of fuel, and the demand for each
is the same. Orders for fuel oil vary between 3000 and 5000 gallons,
in increments of 10 gallons, evenly distributed. The time required to
fill fuel trucks is a function of the pumping rate (6, 5 and 7 minutes
per 1000 gallons respectively), the order size, the number of
vehicles in the depot (30 seconds extra per vehicle) and the setup
time, which is a fixed time of two minutes. The depot can hold a
maximum of twelve trucks. The mean arrival rate of trucks is 18
minutes, modified by the following data:
59. A super market has three checkout counters at its northern exit
and two checkout counters at its southern exit. Customers arrive
every 0.7 minutes, following an exponential distribution. 45 per
cent of them go to the southern exit. At each exit, the customers go
to the checkout counter which is free and, if all are busy, to the one
with the shortest waiting line. They here spend 2.6 – 3.4 minutes.
The manager wants to determine how the longest of all the waiting
lines at the five counters varies over the day. He wants a report on
this every ten minutes during the eight hour day.
62. The InterArrival Times of cars approaching a gas station and the
service times are distributed as follows:
Interarrival Time Cumulative Service time Cumulative
(in seconds) frequency (in seconds) frequency
0 0.00 100 0.00
100 0.25 200 0.06
200 0.48 300 0.21
300 0.69 400 0.48
400 0.81 500 0.77
500 0.90 600 0.93
600 1.00 700 1.00
A car stops for service only if the number of cars already waiting
for service is less than or equal to the number of cars currently
being served. Cars that do not stop go to another gas station. The
gas station is open from 7 a.m. until 7 p.m. Cars arriving later than 7
p.m. are not allowed in, but cars already waiting at 7 p.m. are served
before the attendants leave for the night. It is estimated that the
profit per car served averages $2.00, excluding attendants' salaries
and other fixed costs.
25
Attendants earn $6.50 per hour and are paid only for a 12-hour day,
even if they stay beyond 7 p.m. Other fixed costs amount to $75 per
day. The station's owner wants to determine how many attendants
(1 - 4) he should hire to maximize his daily profit. Build a model of
the operation of the station. Simulate with each configuration for
five different days.
The question is how the two halves can signal to each other. Since
several signals, all for different customers, might exist at the same
time in the system, each customer must have its own signal. Hence
we must have a parameter, e.g. p$cust that gets the values 1, 2, 3,
etc. for the different customers.
It sets up the policy 100 days in advance for a flight. It knows that
the expected number of passengers wanting to fly on a specific day
will increase dependent on the distance from this start date. The
closer one comes to the flight on day 100, the more passengers will
want to fly. The average time between two bookings is estimated to
be 1-CL/200, where CL is the number of days since the simulation
28
start 100 days before the flight. A great variation, day from day, is
however likely, so that the sampled date between two bookings is
estimated to follow the negative exponential distribution.
The airline’s main decision is the last date of booking flights at the
economy price, since one does not want to turn away business
passengers. Calculate and print the profit as income minus total
costs.
1 Casting units 14
2 Lathes 5
3 Planers 4
4 Drill presses 8
5 Shapers 10
6 Polishing machines 4
29
Three different types of job, Type 1, Type 2 and Type 3, move
through the production shop. Each job-type requires that operations
be performed in a specified sequence, as shown below.
The operation times are all exponentially distributed, with the mean
time given above.
Simulate the production shop for five 40 hour weeks. At the end of
each week, print the average time in shop for each job type for this
week.
30
68. The establishment of optimal equipment life is important in
managerial economics, accounting (e.g. for determining the
depreciation rate) and finance. A company does not want to spend
too much on new expensive equipment, but, on the other hand, it
does not want to have obsolete equipment leading to high costs.
One method for determining optimal equipment life is the MAPI
method, which determines equipment life taking technical
development into consideration. Its critical assumption is that new
equipment leads to lower production costs than old equipment. A
machine that is new this year leads to inFact lower costs than a
machine that was new last year. Hence, a machine that is 5 years
old has 5*inFact higher costs than a machine that is new. Hence, for
a machine with the age cl, the extra cost, xcost, this year, due to not
having the latest machine model, is cl*inFact.
One next calculates the present value, prVal, of this extra cost as
xcost*pvFact, where pvFact is the present value of getting one
dollar y years from now. When we have an annual interest rate
irate, we can, using discounting, define the present value factor
pvFact as 1/(1+irate)^y. For a machine that is kept y years, this
value is next summed up for all years, going from 1 to y. To this
total sum of present values sumPrV of the extra cost of having the
equipment, we also add the initial investment payment invest.
On the basis of this total cost of having the machine for y years, we
next calculate the annual cost annui by multiplying this sumPrV
with the annuity factor anFact needed to distribute the cost over y
years. This calculation of the annual cost makes it possible to
compare machines with different lengths of life. The annuity factor
anFact is 1 divided by the sum of present value factor smPvFa, i.e.
anFact = 1/smPvFa, where smPvFa, in turn, is (1-pvFact)/irate.
31
In order to be able to investigate also the stochastic case when the
inferiority factor is not fixed, we assume that it varies following the
normal distribution. We hence set infact = infaAv+fn$snorm*stDev.
In order to have the lowest cost as a maximum we use a minus sign
for the annuity.
32
A typical student view is that the expected value of T to its current
owner is $ 50 and that is worth 50 % more to A and that A should
bid in the interval of $ 50 to $ 75. Investigate what would be a
suitable price, by building a model that calculates the expected
value for A for a given price offer. Finally, use EXPERI to
determine the optimal price bid to be made by A.
The lack of a specific block allowing for waiting with regard to any
SNAs implies that one in some cases must add a logical SEIZE
block to allow for waiting. We shall exemplify this by modifying
Model44. Instead of every customer buying just one item, a
customer buys 1, 2 or 3 items; 40 percent buy 1 item, 35 percent 2
items and 25 percent 3 items. This number is thus sampled from a
random function and then stored in a parameter, e.g. called
P$number. If this number of items is not in stock at arrival, the
buyer will not buy any items directly, but go into a waiting line at
the address NODIR until this number is available.
If this is not the case, there is a new shortage and the customer is
sent back, e.g. to an address LACK, where he again puts the logical
facility SHORT into use. The customer then goes back into the
waiting line. In order to assure that he remains at the first place in
the waiting line, he is assigned the highest possible priority, e.g.
through a block LET Priority=250-CL, before going back to LACK.
He will now have to wait at LACK for another delivery of goods.
34
One decision rule is now that he, after meeting y ladies, determines
that the critical score is the highest score this far. He then selects
the next lady that he gives a higher score than this critical value. If
he after having met all x ladies, has not found anyone with a higher
score than the critical value, he will remain single, leading to a
score of 0. What is the optimal value of y for a given value of x?
Write a program to try to answer this question for different values
of x, choosing one of the three distributions mentioned above.
35
73. We shall in this model use aGPSS for a type of very simple
continuous simulation. Even if aGPSS is a tool for discrete events
simulation, one can in certain cases, e.g. when we make forecasts
over many years, but at most a century, and look at each year as a
whole, use aGPSS for a basic type of continuous simulation.
37
74. At a certain library, anyone wanting a book must present a
checkout slip to a clerk working behind the checkout desk. This
clerk then goes into the stacks to find the book and returns to the
desk with it. Build a model of the checkout procedure under the
following conditions:
Like the A parts, the B parts can be repaired and then reused. The
lifetime of B parts is normally distributed, with a mean of 450 and a
standard deviation of 90 hours. It takes 4 hours to remove a failed B
part from the machine and 6 hours to install a replacement part. The
time required to repair a B part follows the distribution below.
Except for the added feature of the B parts, the conditions under
which the machine operates are identical to those in Exercise 63.
Use the modified model to estimate the utilization of the machine as
a function of the number of A and B spare parts in the system.
Simulate the system for each combination in which 0, 1 or 2 spares
of each type of parts are provided. Run each simulation for 5 years
of 40 weeks each.
39
76. Up to four barbers work in a barber shop. Intervals between
successive customers are exponential, with an average of one every
10 minutes during time 0 - 120 and 225 - 390 (minutes after
opening) and one every 5 minutes during time 120 - 225. No
customers are generated after 390, but customers already in the
system are served until ten hours after opening time. Lunch hour is
as follows: The first barber goes to lunch at time 60 for a lunch of
30 minutes. The other barbers can then go to lunch, also for 30
minutes, one after the other. A barber goes for lunch first when he is
idle, e.g. when he has finished serving the customer.
40
Run the simulation for 1000 continuous hours with the five shore
tanks. Initially, two shore tanks are empty and free; one is currently
discharging and will be free after 8 hours, and the other two are
currently being loaded and will be freed after 12 hours (with 45 K
tons contents) and 3.5 hours (with 25 K tons contents) respectively.
78. A port in Africa is used to load tankers with crude oil for
overwater shipment. The port has facilities for including as many as
three tankers simultaneously. The tankers, which arrive at the port
every 11 + 7 hours, are of three different types. The relative
frequency of the three types and their loading-times are as follows:
Type Relative frequency Load time (hr.)
1 0.25 18 + 2
2 0.55 24 + 3
3 0.20 36 + 4
There is one tug at the port. Tankers of all types require the services
of this tug to move into a berth, and later to move out of the berth.
The area experiences frequent storms, and no berthing or deberthing
can take place when a storm is in progress. When storms occur, they
last 4 + 2 hours. The time between the end of one storm and the
start of the next one follows the exponential distribution with a
mean of 48 hours. When a tug is available and no storm is in
progress, berthing or de-berthing takes 1 hour.
41
Simulate the operation of the port if this plan goes through for one
year. Measure the distribution of the in-port residence time of the
proposed additional tankers, as well as of the three types of tankers
that already use the port.
79. A small elevator has space for only one person and goes
between two levels. People wanting to go up arrive at the rate of
one every 10 minutes, following an exponential distribution, while
people wanting to go down arrive only every 20 minutes (also
following an exponential distribution), since many prefer to walk
down the stairs. The elevator takes 2 minutes in each direction.
42
The serving of the trucks and vans takes place on the second floor
in the depot. An elevator is used to get there. This elevator has
space for one truck or one van. The time to transport a vehicle up or
down varies between 1.5 and 2.5 minutes, equally distributed. This
time includes driving the vehicle in and out of the elevator. If the
elevator travels empty, it takes exactly 1 minute up or down.
The following rules are used to control the traffic: The trucks have
priority over vans, both when waiting at the elevator and at the
bays. The vehicles wait in two lines at the elevator, one for trucks,
one for vans, until there is a bay free for the particular type of
vehicle. They are then brought upstairs to the bay. (This time is
included in the 1.5 - 2.5 minutes for the elevator.) The vehicle
might then have to wait until a team is free to give service. The
elevator goes up or down empty if there is some vehicle waiting on
the other floor.
The main entrance, towards a busy street, will be open each day
between 10.00 a.m. and 4.00 p.m. During this time, visitors are
expected to arrive in a random fashion with InterArrival Times
distributed according to the negative exponential distribution. At
4.00 p.m. this entrance door will be locked, but those already inside
will allowed to stay until they are content and all attractions will run
until the last visitor has left the exhibition.
In case there are already 120 persons in the real exhibition area, no
new visitors will be allowed to enter this area through an inner
entrance, where visitors pay the entrance fee. They can then wait
e.g. in a cafeteria inside of the entrance to the street, but outside of
the actual exhibition area.
The guided tour starts with a walk through the Hall of Introduction,
which takes exactly 10 minutes. For those who are on their own this
visit to the Hall of Introduction will take between 3 and 11 minutes,
with all times equally likely.
If some computers are being used, while others are free, a newly
arrived visitor will self-evidently go to one which is free. In case all
computers are being used, a visitor will go the computer that has the
shortest waiting line in front of it. The persons in a guided tour will
in each waiting line always be allowed to go ahead of the persons
who walk on their own. They are, however, not permitted to
interrupt someone who has already started running a program.
After all members of the guided tour are finished with the
multimedia program, the guided tour is over and a new one can
start. The main tour is at this stage also over for the persons going
on their own.
45
Before leaving the exhibition visitors will, however, spend between
2 and 6 minutes (with all times uniformly distributed) browsing in
an IT-shop. At the end of this time 60 percent of the visitors will
buy a heavily discounted computer diskette for 100 SEK.
There are two types of program diskettes, one for young people and
one for adults. 40 percent of the diskette buyers will choose the
youth diskette. It is not certain that there is a ready-made diskette
available when a customer asks for it. One person works full time
copying diskettes and a customer will have to wait until there is a
copy of the desired diskette available. After this the customer leaves
the exhibition.
The person producing the diskettes starts with this work at 10.00
a.m. and follows the principle that he will at each instance produce
the diskette of which there at the moment is the smallest stock. In
the case of equally large stocks, he will produce the adult diskette. It
takes him between 2 and 4 minutes (uniformly distributed) to
produce a diskette, independently of the type. When he has finished
with one diskette he starts to produce the next one. He continues in
this way until the last visitor has left the exhibition. Diskettes
remaining at the end of the day are sent to another shop. Hence,
there are no diskettes of any type at the start of the day.
46
82. A corporation faces the following demand on the market as
regards expected annual sales of a certain product at different prices
of the product:
Price in Annual sales
$ 1000 in units
10 310
20 110
30 60
40 40
50 30
This sales quantity per year determines the average number of days
between each order. The real times between each order will,
however, follow the (negative) exponential distribution.
47
At the start of the production of one unit, costs of $ 4,000 are
incurred. The costs also lead to an immediate corresponding
decrease in cash position. The time needed for the production of one
unit follows the normal distribution and is such that in 95 percent of
all cases the time will be between 2 and 3 hours. After this, the
products are put into inventory. The person handling the machine
receives a total of $ 4,000 per month at the end of each month.
A problem can arise as regards production due to the fact that the
machine, now fairly old, will break down on average once a month,
i.e. once every 200 hours. The actual time will, however, follow the
exponential distribution. At machine break-down the production of
the unit is stopped. The production of the unit is restarted when the
machine has been repaired. The time to repair the machine is
between 2 and 4 hours (uniformly distributed). The firm doing the
repair charges $1000 per hour.
Assume that there are no other costs than repair costs as regards the
machine. The cash position should be followed in a graph, covering
all changes, while the report on the total contribution should come
at the end of the year for which the simulation is to be done. The
program should have both price and monthly production read from
the keyboard.
48
83. We study a machine shop where work is done on parts that are
purchased for $ 15,000 per batch of 10 units. The work is done in a
machine of which one can have several working in parallel. The
work is done in the following steps, in which one worker follows
the product the whole time:
(1) The worker carries out process 1 in a machine that is idle. The
machine is then used according to the following time distribution:
Minutes Percent
60 5
70 7
80 36
90 35
100 13
110 4
(2) The worker moves the product with the aid of a crane, as soon
as the crane is free, to a chemical bath and then back again to the
machine. This will in 95 per cent of the cases take between 10 and
20 minutes, with all times following the normal distribution.
(3) The worker next starts carrying out process 2 in a machine,
provided it is idle. The machine is then used according to the
following distribution:
Minutes Percent
80 2
90 7
100 28
110 33
120 24
130 6
49
(4) The worker moves the product with the aid of a crane, as soon
as the crane is free, to a container. This takes between 25 and 35
minutes, with the times uniformly distributed.
After step 4, the product is ready and the worker can go back and
start with step 1 again. In case step 2 and step 4 compete for the
crane, step 2 shall have priority. When the crane has taken care of a
product, the machine is free to be used for another product, handled
by another worker.
We next calculate the cost of producing this unit. This cost will,
thanks to learning, decrease exponentially with a factor learn (set to
0.001) and the total number of produced units, so that the actual
cost per unit accost is cost0*exp(-totpro*learn). cost0 is a constant,
set to 20, representing production cost per unit, when no unit has yet
been produced. exp represents the exponential function FN$EXP.
We next increase total costs and decrease cash by unit cost acost
Cash is at simulation start set to 4000.
51
We check that cash does not become negative. In such a case the
simulation run is interrupted.
Sales activity. There are two types of sales: New sales, i.e. sales to
first time customers, and repeated sales. As regards new sales we
distinguish between two types of customer: innovators and
imitators.
Both cash and profits shall be increased at the end of the year, due
to the firm obtaining a payment of interest, calculated as 5 percent
of the lowest value of cash during the year.
85. We study a market for identical products, e.g. wheat. There are
two producers. Demand can be described by a linear demand
function p=a-bQ, where Q=q1+q2. Both producers have the same
constant variable unit cost c.
54
V1'(q1)= A - 2 q1 - q2. = 0 and V2'(q2)= A - q1 - 2q2. = 0
-> 2 q1+q2. = A = q1+2q2 -> q1 = q2
-> A-3q1=0 -> q1= q2=A/3.
We now want to simulate a market, where the two firms know
neither demand nor costs, but only their own profits and own
quantities offered in each period. In experiments, one has found
that, under certain conditions, the Cournot solution will be obtained
after some time also under these assumptions of no knowledge
about demand and costs. The question is under what general
conditions this can occur. In order to investigate this, a simulation
model is necessary, since one in contrast to costly experiments can
afford to test a great number of conditions by inexpensive
simulations.
For each of the two firms we first input two starting quantities
oneOld, oneNew, twoOld and twoNew. We also input the intercept
of the linear demand function aVal and a change factor chg. We set
the initial value of size to 1
A first single event is generated at time 0. This puts the starting
quantities of the two firms, oneOld and oneNew, into a graph. Next
we calculate the initial changes in quantity, qch1 and qch2, where
e.g. qCh1 = oneOld – OneNew. Another single event is then
generated, at time 1, which puts oneNew into the graph at time 1.
55
For firm 1’s periods we start by calculating firm 1’s old profit oldP1
based on the most recent quantities, oneOld and twoOld. We next
calculate the new quantity for firm 1, oneNew, by adding qch1, to
oneOld. On the basis of oneNew and twoOld we next calculate the
profit of firm 1 in this period. If this new profit is higher than the
previous profit, we let the new change for firm 1, qch1, be in the
same direction as the old change, namely as (oneNew-oneOld)*size.
If the new profit is lower than the previous profit, we let the next
change be in the opposite direction of the old change, namely as
(oneOld-oneNew)*size. In case of equal, i.e. unchanged profits, we
go with 50 percent probability to repeat the change and with 50
percent probability reverse the change.
Before we move into the next period, we give the value of oneNew
to oneOld. We also update the value of size by multiplying it with
the change factor chg, e.g. 0.995, so that size constantly decreases.
For firm2’s decisions in periods 3, 5, 7, etc., we have a similar
segment to determine a sequence of values on qCh2, twoNew and
twoOld.
Build a model for this Cournot process. The model should produce
a graph, by inputting every new quantity for each party when it has
been computed.
When a user runs this model, aGPSS will first ask for the values of
oneOld, oneNew, twoOld, twoNew, aval and chg. Let us exemplify
with the values 1, 2, 20, 19, 24 and 0.995. In this case, with the
initial values of q1 and q2 fairly far apart, we will after around 40
periods get a convergence on the quantity 8. In this case with aval =
A = 24, this is equivalent to the theoretical Cournot equilibrium of
24/3 = 8. If we input other values, convergence might not be so fast
and in several cases there will not be any convergence.
56
86. The issue is the administration of secretarial work in a company.
At present, the president has a secretary, called PSEC, who does
tasks only for him and no other jobs. The secretarial tasks of the
other employees are handled by three secretaries, who work in a
secretarial pool. Hence all these general tasks go to this pool and are
handled by the first secretary available in the pool.
The present situation has led to some problems. While there is often
a long waiting line for the general tasks at the secretarial pool, the
utilization of the president's secretary is not very high (less than 50
percent). A consultant has therefore suggested an arrangement,
whereby also PSEC can to some extent be connected to the pool to
do general tasks, when idle. Furthermore, the president should be
able to use the pool, if PSEC is busy.
57
The inter-arrival times for the president's tasks vary between 20 and
50 minutes, while the IATs for the general tasks vary between 6 and
18 minutes. The president's tasks take between 15 and 25 minutes,
when done by PSEC, and between 16 and 30 minutes, when done
by someone in the pool, since the secretaries in the pool are less
experienced. The general tasks take between 20 and 40 minutes
when done in the pool and between 17 and 33 minutes when done
by PSEC. All times follow the uniform distribution.
Simulate both the present system and the proposed system for a day
of 400 minutes with 50 runs to see which system is best with regard
to the time needed to finish the president’s jobs.
After inputting price, unit cost and cash, we input replenishing level
and order quantity, i.e. when to reorder and how much to reorder
each time. The inventory segment is similar to that of Model44, but
for each replenishment purchase we calculate the total purchase
expenditure as the ordered quantity times the purchasing cost per
59
unit. This value is the borrowed amount and we increase debts by
this amount.
The company's pays the supplier after 50 days. The company pays
an interest on the borrowed amount. The daily interest rate is
20/36000, i.e. 20 percent annually. The first 20 days are, however,
interest free. These interest costs of a particular purchase are
deducted from the net interest results. At the same time the total
cumulative cash out-flows decrease by these interest costs. Finally
as the borrowed amount is paid back, debts decrease and cumulative
cash outflows increase by this amount.
The program should generate a report every 90th day, i.e., at the end
of each of six quarters. In this report segment, the number of the
quarter should first be increased by 1 and written. Net cash-flows is
calculated as cash inflows – cash outflows and added to total cash.
The value of inventories = the number of units in store times
purchasing cost per unit. The month's closing balance of assets is
cash + accounts receivable + inventories and profits are sales - total
costs + net interests.
60
88. We shall here study a problem that is of importance for the
managing of many retail operations dealing with perishable
products, like milk, fruit and meat. The manager of a local
supermarket has a single, deep shelf for cottage cheese. A customer
who comes to buy a container of cottage cheese will always grab
the one at the front of this deep shelf. In order to avoid spoilage, and
hence monetary loss or loss of reputation to the supermarket, how
should the stock boy be instructed to place newly arriving
containers of cottage cheese? Should he place them at the front of
the shelf so that customers will grab them first, or should he place
them at the back of the shelf, behind containers that have not yet
been sold?
The shelf can hold 20 containers of cottage cheese. Every 3.5 days
(Monday morning and Thursday afternoon) new cottage cheese
containers arrive from the distributor. The distributor leaves just
enough containers to fill the shelf (e.g., if there were five containers
on the shelf when the distributor arrived, she would leave 15 new
containers). Customer arrivals are exponentially distributed with an
average of one day apart. A container is considered spoiled if it has
been on the shelf for more than 10 days when it is sold.
We simulate one year (365 days) and provide for statistics on the
number of containers that were sold in a spoiled state for the two
different methods for stocking the shelf.
Use a WAITIF block, so that the container in the front of the shelf
must first wait if and as long as a customer is not in the store and
another WATIIF block to have it wait, while a customer is actually
picking the container from the front of the shelf. Use a QTABLE
statement with only 2 classes and a class width of 10, so that any
times greater than 10 minutes will be tallied as an overflow,
representing cottage cheese containers sold in a spoiled state.
62
The arrival rate of customers is exponentially distributed, starting at
600 per hour for half an hour, then 900 per hour for one hour, then
450 per hour for another hour and finally 300 per hour thereafter.
Run the simulation for 3 hours and determine the transit time of
customers, as well as the utilization of the parking lot, carts baskets
and checkouts.
The model should have two main segments. In the first one we
generate a report and decision event each week of 7 days, starting at
63
time 0. We here first print the number of the week and then the
profits made this far, as well as the number of units in stock of each
firm.
Next we check if firm 1 has no stocks. If so, the price has been too
low and price1 is increased by priAdd. If not, i.e. stocks are not
empty, price has been too high and we decrease price1 by priLow
times the number of units in stock, so that price is lowered more if
the stocks are large. The price may, however, not be lower than unit
cost. In that case price1 is set to cost1. The changes in price done by
firm 2 are similar.
In this first segment we also deal with production. Each firm sets its
production quantity equal to the amount it sold in the preceding
period. After a potential production period of proTim days, the
products are ready to be put into inventory to be available for sales.
However, if a firm’s stock is already larger than its planned
production, then no production takes place this week. We also
determine what is now the lower price of price1 and price2, and set
this as lowrPr.
At the address sell1 we might first have to wait until there is some
unit in firm 1’s stocks. We then take one unit out of firm 1’s stocks
and increase the number of sold units this week by 1 as well as firm
1’s revenues by the price of the product. We also increase firm 1’s
costs of goods sold by the unit cost of the product. At the address
sell2 the corresponding happens to firm 2.
Karl will use his business plan to obtain € 200,000 initial capital (in
cash) from an investor. In case more cash is necessary at some point
for operations, the company can take a loan of up to € 0.5 million
from the bank. At the end of each month interest must be paid, 1%
of outstanding loan (12% annually). The principal is not repaid
during the first two years; only the interest is paid.
65
In case the loan has reached the maximum amount and more cash is
still necessary, bankruptcy is declared and the simulation stops.
Bankruptcy is also declared if the equity (assets minus liabilities) on
the quarterly balance sheet is negative.
Each order is made for a single container and Karl can choose any
quantity of sets between 1 and 5. (Both the reordering level and the
quantity of sets will be kept fixed throughout the simulation.) It
takes between 24 and 30 working days for a container to arrive,
each real value in the interval being equally likely. The invoice
must be paid within 15 workdays after an order is received.
66
Number Average
of workers assembly time
2 15
3 11
4 10
5 9
Once a plane is ready, it is sent to the airport and parked, ready for
customers. The parking space can be considered unlimited, but the
company has to pay a parking fee. The fee, to be paid at the end of
each month (of 20 working days), is € 1000 for each parked plane at
that moment.
Model the physical processes described above and also keep track
of the underlying accounting and cashflows. The produced output
should contain a plot of cash & loan, quarterly printouts of the
profit & loss statement and the balance sheet. All accounts should
be in thousands of €, without decimals.
68
One can next determine what decision would be made, if one is not
able to forecast what event will take place, but only which decision
would maximize expected profits. The value of perfect information
is then the difference in profit between the case with perfect
information and the case with uncertainty.
Each unit ordered leads to a cost of $ 8, while each unit sold leads
to an income of $ 10. If one has ordered fewer units than those
demanded, sales only amount to the number ordered.
We test for the ordering of 25, 26, 27 or 28 units. This can for all
aGPSS versions be done by first running 400 times, the first 100
runs with the order quantity of 25, the next 100 runs with 26, the
next 100 runs with 27 and finally runs 301 – 400 with 28. For each
of these four batches of 100 runs, we add up the profits and
calculate the average profit for each such batch.
At the end of the 400th run, we determine which value of the order,
25 - 28, has given the highest average profit. This value then
becomes the value of “non-perfect information”.
For runs 401 – 500 we set the order quantity equal to the sampled
demand value and calculate the average profit for the case when we
in advance know what demand value will be sampled.
69
At the end of the 500th run we calculate the difference between this
average value and the value of “non-perfect information” and print
this value as the Value of Perfect information.
The product can only be put on the market once the development is
finished. The expected value of the finishing time varies with the
number of developers according to the following estimate:
No. of Average
developers development
time
1 1000
2 500
3 280
4 240
5 200
6 180
7 165
8 155
9 150
There is a daily cost per developer of $ 1600. If the software has not
been developed within three years, development is stopped. The
development cost is to be paid at the end of each month. Once the
development is ready, sales start in the immediately following
month. Average sales are expected to be 2000 units per month.
70
Actual sales vary according to a normal distribution with a standard
deviation of 400 units. The price of the software system is $ 299.
The unit cost of production, incl. packaging with manuals, is $ 50.
1 0.2
2 0.24
3 0.1
4 0.2
5 0.1
6 0.16
There are six tables in the restaurant; four tables for four people and
two for six people. Each group waits until there is a table free to
accommodate all in the group. If there are already three groups
waiting, the whole arriving group goes to another restaurant.
71
For the number of drinks in each group, the time to consume these
drinks, the time of each group to choose and next to order the food,
the time to eat the food, and finally the time to pay and the time
spent after paying, you are free to decide on what the values
(possibly following distributions or functions of other factors) that
you find most suitable. The same refers to the time for the barman
to prepare the drinks, the cook to prepare the food, the time of one
of the two waiters to serve and finally to clean the table.
96. This simulation deals with beer drinking. The program should
start by asking the user: “Want to drink Swedish beer in 40 cl
glasses? Y/N”, with hopefully Y as the answer.
It then asks for the average time between sips in minutes and next
for the average size of a sip in cl. Finally it should ask for how
much beer in cl. you have left in your glass, when you order a new
glass.
72
Then the simulation starts. The real time between sips follows the
negative exponential distribution of the average input time. We
assume that the true sip varies according to the normal distribution
with the input average and with a standard deviation of 10 percent.
The new glass of beer comes 10 minutes after the order, but varying
with the normal distribution with a standard deviation of 2 minutes.
The drinking activity is recorded with a log with the following types
of output lines:
For running the model, we first study the case when the starting price
is 100, the exercise price is also 100, the annual volatility is 25 and
the interest rate is 5 percent. For the case that we have constant
volatility, we can compare the value obtained from the simulation
with that obtained from Black&Scholes formula calculators.
We run the simulation a great many times. Since, for example, 400
times is the maximum allowed for experiments for the extended
student version of aGPSS, we write the model so that we in the same
run can obtain results for more than 400 runs.
74
We hence need one segment that goes from month 1 to month 12 for
each run and one segment that starts every 12 months and then sets
the start values for each year, i.e. for the number of the month and
the initial volatility. Finally we need a segment that stops the
simulation after m months, where m is the number of runs *12.
At the end of each run, we add the present value of the option value
in this run to the sum of such present values in the earlier runs. In the
last run we divide this sum with the number of runs to obtain the
expected value of the option.
The model should allow for input of the starting price, the exercise
price, the interest rate, the initial volatility, the monthly change in
volatility, the standard deviation of this change and the number of
runs.
98. Our next model is a simple version of the models that our
students have built for a Swedish company selling corporate
switchboards. The company originally used an analytic queue
theory model, but early simulation models showed that the
analytical models lead to errors, e.g. regarding waiting times and
lost customers, of up to 20 percent.
9 – 11 30
11 – 13 50
13 – 14 20
14 – 16 25
16 – 18 30
After 18 30
The switch board opens at 9 a.m.. After 6 p.m., no new calls are
admitted into the system, but the calls having arrived before that are
kept in the system until 7 p.m., when the system is closed down.
The calls first come to the switch board. If all trunk lines are busy,
the caller has the choice of either calling back later or calling
another insurance company, implying a lost customer. 70 percent
prefer to call back later. They will then wait 10 minutes on average,
with a standard deviation of 2 minutes. They then call back, but if
there is still no free agent, they call another insurance company,
implying another lost customer.
Those calls that are admitted into the system might still have to wait
for a free agent. The time needed by the system for finding a free
agent is 20 seconds. If all agents are busy, the caller is put on hold
until an agent is free.
The caller then spends a certain time with the agent. To model this
time, we assume an average of 4 minutes.
76
In order to have this reflect the risk of some lengthy calls, we
assume a basic time with an average of 3 minutes, following the
normal distribution with a standard deviation of 30 seconds. To this
basic time we add an average of 1 minute, following the negative
exponential distribution. After this total time, the call is completed
and the agent and the trunk line are free for other calls.
As start values we input the daily cost of an agent (e.g. 100), the
daily cost of a trunk line (e.g. 50) and the cost of a lost customer
(e.g. 200).
99. We shall here make a simulation of the value of a new high tech
company. We shall do this by making a forecast of various factors
such as sales, profits, dividends, year by year, for a great many
years up to a horizon year T.
77
We shall start with the forecast of the development of the market for
the main product of the company. As a first step, we forecast the
total market for the product that the corporation is about to sell. We
shall first forecast the total market in terms of a constant economy.
We shall for the forecast of this total market assume that the
development of the sales of the firm's product follows the familiar
pattern of the logistic curve, used in Exercise 73.
We also allow the total demand for the firm's product to grow in
proportion to the expansion of the total economy, e.g. with
population growth, i.e. a growth of a fixed percent each year in an
exponential fashion. We shall here forecast an index-like value for
the whole economy, the GNP, with a value of 100 for the first year,
and then increasing by a constant growth rate of 3 percent. The total
market for the product is then be defined as the earlier forecasted
”economy-independent” market multiplied by value for the total
economy.
Having defined the total market, our next step is to determine the
sales of our specific corporation. This will depend on the
development of the market share of the corporation, starting at 10
percent. We assume that the market share s will develop over time,
eventually gradually reaching a maximum market share of 25
percent. Thus the change in the market share st from period t to year
t+1 is gs(smax - st), where gs is set to 0.15. Multiplying the total
78
market in each year with the market share, we get the total sales of
the studied corporation.
The next step is to determine how the annual profit develops over
time. We assume that profit is dependent on the profit margin. This
percentage will also develop over time. We assume that the profit
margin m develops gradually over time from its starting value m1,
set to 10, to gradually approach a final value, mmax, of 20. The
change in the profit margin from year t to year t+1 is gm(mmax - mt),
where gm is a growth rate for the profit margin, of 2 percent.
In order to take also the dividends after the horizon year T into
account, we first assume that all dividends after T are the same as
the dividend at year T. We can next calculate the lump sum value at
year T of all dividends after the year T as the present value of all
dividends from the horizon T to infinite time, i.e. equal to the
dividend in year T divided by the discount rate. We add the present
value of this lump sum to the total value of the corporation.
79
We also have to include the effect of the profits not distributed as
dividends, i.e. for each year the profit minus the dividend. We
assume that these amounts are invested into a special reinvestment
account carrying an annual interest, different from the discount rate,
of only 7 percent. We allow this reinvestment account to grow each
year until the horizon year T. In this year we calculate the present
value of this reinvestment account and add it to the total value of
the corporation.
The demand for this paint is dependent on when and where the cars
are produced. One opens a barrel with paint and fills the painting
machine when one has a whole batch of 100 cars ready for painting.
Before this, one has to clean the spraying nozzles. On average one
has to open a new barrel with paint every 7.5 hours on Hisingen,
every 8 hours in Antwerp and every 9 hours in Paris, but the times
between these barrel openings vary and seem to follow the negative
exponential distribution.
In case that one does not have any barrels with this paint, one has to
wait with painting the 100 cars until paint barrels arrive. The delay
of a series of 100 cars costs 500 € (i.e. 5 € per car) for each hour of
delay for all three production units.
Torino 18 28 16
The actual time needed for each truck will, however, vary,
seemingly according to the normal distribution, so that 95 percent
of the times will lie between 60 and 140 percent of the average
time. There is, however, also a lower limit on the time needed,
given in the following table:
Antwerp Hisingen Paris
Düsseldorf 6 16 9
Esbjerg 13 9 14
Torino 12 20 11
82
All times shown above include both loading and unloading, which
is not very time consuming. When a truck has arrived at the car
production plant, one unloads the 10 barrels. The truck is then ready
to go back to one of the three paint producers. It will go to the color
producer that has the largest number of barrels in stock. If no
producer has any stocks, it will go to Düsseldorf. The times for the
return travels are the same as the times going to the car producers.
Since the trucks are expensive and the trucks are manned by
specially trained persons, one calculates with a cost of € 1000 per
hour of truck travelling time. When the trucks are only waiting,
there is an hourly cost of € 700 per hour.
After the trucks have returned to the color plants, they load 10
barrels, provided 10 are in stock; else they wait until 10 have come
into stock. They next again determine which car factory has the
longest line of waiting unpainted cars and go there. In this way, the
trucks go back and forth between the color and car plants.
We simulate for 100 days of 24 hours. Both the car plants and the
color plants work in many shifts around the clock. We want to
calculate and print the total costs for the trucks plus the cost of
production having to wait.
We want to simulate both for the present case of 3 trucks and the
case of one additional truck, starting in Düsseldorf. Make enough
runs to determine if it is worthwhile getting an extra truck.
83