CS 231: Assignment #7B

Managing Elevators II

Documentation for Java 1.6 is located at: Java 1.6 SE API

The Documentation for the various simulation classes

Problem Description

The task this week is to implement one or more new strategies for the elevator set, attempting to reduce the overall average wait time.

So what needs fixing? If you run the simulation with all the default parameters, you may notice a few things.

Empty elevators currently just move in one direction. For example, if an empty elevator is headed up, but there is a waiting passenger one floor below, it may make sense for the elevator to reverse direction.

Another problem is that empty elevators pick up passengers as soon as they can. For example, if there are two passengers waiting to go down on two different floors and an empty elevator below both these passengers, the elevator will rise to pick up the lower passenger and take it to its target floor. A better solution might be to send idle elevators to pick up passengers that are waiting further away, and then pick up the other passengers on the return trip.

Elevators with passengers on board do not stop to pick up waiting passengers as they move past. A better solution may be to pick up passengers while the elevator is moving past them. However, opening the doors too much may also increase the overall average simulation time.

Currently, the elevator strategies are completely static; the simulation will operate in the same way every time it is run on the same data. Introducing some amount of randomness may actually improve the overall performance of the control code!

This is by no means an exhaustive list, and you might find many other issues by watching the simulation or looking through the code.


Tasks

  1. Set up the elevator simulation to use 8 elevators, 25 floors, and up to 8 passengers per elevator.
  2. You will need to implement at least one different control algorithm and describe it in your write up, even if it does not improve passenger wait times.

    So, how do you start modifying the control code? First, think about the problem you want to address. What sort of information do you need to collect to address the issue?

    For example, some of the problems mentioned above stem from the fact that each elevator operates independently and makes a new movement decision at each iteration based on the current state of the simulation. If you wanted to add a more centralized control and a memory to the elevators, you might want to add some data or functionality to the ElevatorBank class. Maybe make ElevatorBank extend SimObject and add it to the landscape. Include in the ElevatorBank.updateState() method a computation that determines where each Elevator in the bank should try to move to. The Elevator.updateState() method would then just move the elevator in that direction, if possible.

    Or, you could adopt a completely different strategy. Have the elevators each take trips up and down the entire set of floors, picking up passengers as they go.

    Note that some control strategies could use data structures and algorithms discussed in this course. You are welcome to use any of the Java collections classes (java.util) or build your own. Make note of what you do in your write up—using data structures and algorithms well will count as extensions.

  3. Download the High Volume data set to your working directory. Run the ElevatorSimulation using the following command.

    java ElevatorSimulation -i eldata-high.txt

    Running the simulation with a dataset file means the same passengers appear each time you run it. That lets you make direct comparisons between strategies. Try to minimize the average time on this data.

    Running this file on the standard simulation should produce an average wait time of just over 71 time steps.


Extensions


Handin

Your writeup should follow the standard format and focus on your implementation of your new elevator strategy. Give it the label cs231f12project7

Put your working simulation with your new control strategy in your private handin folder on Courses.