Managing Elevators II
Here are the links to the API's for the most recent versions of Java:
The Documentation for the various simulation classes
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.
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.
- Set up the elevator simulation to use 8 elevators, 25 floors, and up to 8 passengers per elevator.
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 Cell 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.
Download the High Volume data set to your
working directory. Run the ElevatorSimulation using the following
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.
- Change the way the elevators and/or passengers display in a creative way (more than just changing colors).
- Modify the keyboard controls (the Control class) in some useful way, or do something else with the display using Swing controls or Java events.
- Make good use of data structures or algorithms in the elevator control code.
- C ome up with multiple elevator control algorithms and compare them.
- Model some aspect of real world elevators (e.g. express elevators or maximum load limits). These could either help your timings or be separate from the timing.
Your writeup should follow the standard format and focus on your implementation of your new elevator strategy. Give it the label cs231f14project7
Remember to include a list of people you worked with, including TAs, and professors. Include in that list anyone whose code you may have seen, such as those of friends who have taken the course in a previous semester.
Put your working simulation with your new control strategy in your private folder on Courses.