Seventh Homework Assignment
Posted 7 Apr 2004 by herman
Due 21 April 2004 at 11:59pm.
Run a discrete-event simulation to compare serving
policies. To do this, modify the program
shoqave.py, which is a version of the
program I ran in class (that one was shoqGUI.py).
A description of the homework is in homework7.pdf.
There seems to be some confusion about the assignment,
particularly with "queues". I think about the situation
as there being one customer generator feeding into three
queues: a queue for S0, a queue for S2, and a queue for
S3 (actually, one could imagine there being a fourth
queue, one for X, but the service time on X is so short
that its queue is always empty --- because X is so fast
it finishes dealing with each customer instantly).
Probably the easiest way to change the simulator in
shoqave.py would be to put the logic for
selection (S0, S1 or S2) in the fire() method
of customerGenerate,
since that is the event of a new customer arriving to
the system. At the time the customer arrives, X chooses
which server should get the new customer, so it makes
sense to put this decision in fire(). Of course,
that means that you need to simulate the new customer
being sent to one of the servers. Study the logic
of customerServe, and how it simulates a queue of customers
for a single server. You'll actually need three queues, one
for each server.
Still confused? Please ask questions (send email).
Generally, the pattern is that the first method (random) is
inferior to the second method (round robin), and the third
method is worse than either of the others. Typical average
queue lengths would be approximately 1.5, 1.1, and 2.2.
Intuitively, the policy of the third method (choose the
least busy server) should be best, but because it samples
queue lengths only periodically --- as driven by the
visualizer --- the information is "out of date" and it
will repeat assigning to one server (the least busy at
the last sampling period); this causes one server queue
to build up, hence the higher average for this case.
|