Order of Event Processing
Elevator and Passenger Movement
there is no init command for an elevator, then Rule 1 will apply. It is
likely, but not guaranteed, that test files will include an init command for
A. There won't be any. All init
commands will come immediately after the header specifying the start time,
number of elevators and floors, etc.
After. See the following item for more info.
A. When the simulation clock "ticks":
Thus, display and stats commands will show the state of the system AFTER the elevators have updated, but calls, failures and fixes will take place BEFORE the elevators have updated.
A. Yes. For example, suppose there is an outstanding call on floor 5, and no other calls. Suppose that Elevator 0 arrives on floor 5 to service the call at 02:05:14. Suppose that Elevator 3 is carrying a passenger who wants to get off on floor 5 and Elevator 3 also reaches floor 5 at 02:05:14. Then Elevator 0 would handle the call (since it is updated first), but Elevator 3 would stop anyway because it's carrying a passenger who wants that floor.
A. The "first one to stop", which will be the elevator with the lower number. Note: this is NOT saying the elevator with the lower number of passengers!
A. OK, that's a hole in the spec. In this case, an elevator should choose the closest floor (in the correct direction)
A. Assuming the elevator is in working order, the passenger who made the call would enter that elevator immediately (so the call would be served immediately).
Q. In the situation above, would the elevator reset its delay (wait another 10 seconds)?
A. Yes. So, if an elevator acquires a passenger while it is waiting on a floor, it would begin another 10-second wait cycle. (It's actually somewhat easier to do it this way, I believe.)
Q. In the situation above, what if there are multiple elevators stopped on the floor?
A. The passenger would enter the one with the lowest number.
A. When an elevator fails, no one can either enter or leave it. So if there's an outstanding call for that floor, it will still be outstanding, and if there are any passengers on that elevator, they're stuck there until the elevator is fixed (or the simulation ends).
Please send comments and suggestions to Mike Parks at firstname.lastname@example.org