CS341, Spring 1996
LISP Assignment #2
Assigned 4/16, due 4/26.
This assignment will involve modifying the elevator simulation
code, which is located in the directory ~c341/code/psl2.
You might start by looking at the file loader.lisp, which contains
a list of what's in the other files. You can load that file, execute
the function (load-simulator) then the function (simulate)
to watch it run. You can pass an optional argument to simulate
saying how many iterations you want it to run. The default is 100.
To keep track of the total waiting time per floor:
floor structure keeping
track of the total number of passenger minutes waited. (I'm
using ``minute'' as shorthand for ``simulator time units.'')
Make sure these are initialized to zeros.
summarize-simulation to report the total
waiting time for each floor. It probably makes sense to divide
this number by the number of minutes in the simulation, otherwise
longer simulations will look worse.
To compute the average waiting time per passenger,
you can add two numbers to the sim data structure:
the total number of minutes waited, and the total number
of passengers in the simulation. Every iteration through
the simulation, you can increment total minutes waited by
the number of passengers currently waiting at floors.
Every time a passenger is added to the simulation, you
can increment the total number of passengers. Then
modify summarize-simulation to report on the average
waiting time per passenger.
elevator structure that stores the
floor (other than 0) it can stop at. You should put this
information in a parameter like the elevator capacities are done.
See parameters.lisp.
speed parameter of these express elevators
to be twice as fast as the others.
iterate.lisp
to assure (1) that an elevator never stops at a floor it
is not allowed to stop at, and (2) that an elevator never takes
on a passenger whose destination is a floor that it cannot
stop at.
Fix both these oddities. One idea for doing so is implementing some sort of ``call button'' idea. When a passenger arrives at a floor, a particular elevator gets ``called'' to service that floor. An elevator at floor 1 servicing a call on floor 9 could also answer a call on floor 5 on its way, but it would never reverse its direction to answer the call.
You don't have to stick to this scheme: just try to figure out a ``smarter'' way of sending elevators to floors, and implement it.