Programming Assignment #2


CS2390 Spring '97 Programming Assignment #2

Discuss at PA2 Collaboration Space. Due on August 12 in class.

The Problem

In this project, you will design routes for a subway, trading off costs between laying track and buying trains. Your goal is to optimize (a) maximally the number of people you can get through your system and (b) minimally the average total time people are in the system.

The city you are building for is built on a grid. There are five stations to be placed on this grid:

Grid picture

Step One: Design the Subway System

Your total budget for designing the subway system is $600,000.

Your first task is to lay track to connect these stations. You may only lay tracks along the grid lines! This means that you may not directly connect (1,1) and (2,2). Instead, you must lay track (1,1) to (1,2) to (2,2). Each segment of track includes two lines for bi-directional travel on that segment. Each segment of track costs you $15,000.

Your second task is to buy trains. Each train costs you $60,000.

Step Two: Design the Routes

Once you lay out your subway system, you can open for business! (In other words, you cannot dynamically lay track once people have started arriving!)

Each train holds 30 people. You may define whatever route you would like for your trains (though, of course, they can only travel on the track you've laid!). A train can start on any track. The train takes (Normal mean: 2 deviation: 1) minutes to travel each segment of track. The train takes a random amount of time at a station, on a probability distribution of (Normal mean: 5 deviation: 2). (You don't have to worry about more than one train on a segment of track at a time - each segment is actually multiple lines and the linespeople make sure that the trains don't crash.)

Every five minutes, ten people arrive into your subway system. They arrive at a random station drawn from the SampleSpace: #('TimesSquare' 'TimesSquare' 'Midtown' 'Midtown' 'Midtown' 'Rosslyn' 'Kendall' 'Oakland' 'CentralSquare' 'CentralSquare' 'CentralSquare') . They want to go to a random station drawn from the SampleSpace (but subtracting off the arrival station!): #('TimesSquare' 'Midtown' 'Rosslyn' 'Rosslyn' 'Kendall' 'Oakland' 'Oakland' 'CentralSquare' 'CentralSquare') .

When the train gets to the station, it can load up to 30 people. (If more people arrive while the train is at the station, you can load them in, too!) The train cannot wait until filled with 30 people. You can have at most two trains in a station at a time. (Other trains wanting to enter the station must wait until a train berth is avaialable in the station.)

It's perfectly reasonable to allow passengers to transfer at a station, but wait time accrues at the station.

Your Goal: Get as many people to their destinations in six (simulation) hours of running your system, and do it in as little as time as possible.

The Assignment

You are to work in a team of students (two to four members per team) to create a solution to this problem in two weeks. You must work in a team. Teams offer the opportunity to get the problem done easier through collaboration, but you have to collaborate well for that to work. Teams offer the opportunity for better learning through discussion, but you have to meet to discuss. You create your own teams. When you hand me a piece of paper with the names, email, and student numbers of all the members of your team, I hand you a document which extends the simulation information already available on the Web (i.e., parts of two chapters xeroxed from Adele Goldberg & Dave Robson's Smalltalk-80: The Language (Addison-Wesley: 1989).

We will call you program by executing:

	SubwaySimulation demo

Your simulation should then (a) lay out the subway (you don't have to compute where to lay track -- you can figure it out by hand -- but it's okay if you want to do the planning algorithm yourself) and (b) run the simulated subway system for six hours of simulation time. At the end of that time, you should output (and hand in!). NOTE! YOU MUST HAND IN PIECES OF PAPER WITH ALL OF THESE PIECES EXPLICIT! "It's in the code" IS NOT AN ACCEPTABLE RESPONSE!

  1. Where you laid track, how many trains you purchased, and the total cost of your subway. (Hint: It should be less than $600,000.)
  2. The route of each of the trains. List all the segments on which you've laid track.
  3. The number of people who got to their stations in the six hours.
  4. The average time of those who got to their stations from entering the subway system to arriving at their station ("system time").
  5. The histogram of system time.
  6. A histogram for each train of the train's system time (i.e., the system time for each passenger who arrives at his/her final destination on the given train -- Note: In the case of transfers, the passenger's system time only applies to the final train).

Graphical User Interface

Displaying a graphical user interface during the simulation is problematic. As you'll discover when using the SimPkg, individual simulation object's tasks are in separate processes. When things are working, it's hard for the display process to keep up with all that's happening. (Related note: If you ever get an error box with nothing in it while using the SimPkg, hit Control-C. That will stop the current process, and it will allow the display process an opportunity to draw the error box.)

But you can provide a user interface to review the system performance after the run! Provide a user interface that allows the user to review the performance of each of the trains. Clicking on a train's button should display the histogram of that train's system time.

GUI picture

Resources and Details


News Page | CS2390 Sum'97 Home Page | MMC-CaMILE | STABLE
Questions/comments/concerns to guzdial@cc.gatech.edu
Page last updated 7/25/97; 2:20:22 PM