See the assignment turn-in page (last modified on 11 September 2001) for instructions on turning in your assignment.
The architectural firm for which you work has a generic elevator simulator it uses to develop elevator banks for the buildings it designs, and they would like you to write a generic simulator for the elevator scheduler software. The behavior of the elevator scheduler is for you to decide, but the overall objectives of the scheduler are to minimize the wait times of the passengers trying to get on the elevator and minimize the travel times of the passengers riding the elevator.
The firm's generic simulator provides two interfaces: one to represent the building in which the elevators will be placed, and the other to represent the behavior of the elevators under the control of your scheduler. The generic simulator provides the code for the building representation; you must provide the code for the scheduler.
The prototypes for the two functions you must provide to the simulator are given in the file
/export/home/class/cs-509/pa6/ebs.h
You may implement any other functions you feel are necessary, but you must
implement ebs_initialize()
and ebs_run()
.
The building in which the elevators operate is represented by an instance of
class Building
, the interface for which is given in the file
/export/home/class/cs-509/pa6/building.h
The elevator simulator works by first calling ebs_initialize()
to set up
the simulation and then calling ebs_run()
to do the simulation. When
ebs_run()
returns, the simulation is assumed to be over.
g++ -c -I
/export/home/class/cs-509/pa6
other-options-here your-.cc-file-here
The simulator library was built using g++
, and I've had problems mixing
object files created by g++
and CC
. I can create a CC version of the
library if anybody wants it.
Once you've created all your object files, you can link them together with the simulator library using the command
g++ -o eb-sim
your-.o-files-here /export/home/class/cs-509/pa6/libebs.a
You can call the executable anything you like; here it's called eb-sim
.
The simulator library provides a main()
routine, you should not provide
one of your own.
Once you've created an executable, you can run it by typing
eb-sim
[ -c
n ] [ -e
n ] [ -f
n ] [ -p
n ] [ -s
n ]
where [ a
] indicates that a
is optional.
The command-line options are
-c
n - Each elevator car has a capacity of n people maximum; 1 <=
n <= 35. Default is n = 15.
-e
n - There are n elevators in the elevator bank, 1 <= n <=
5. The default is n = 1.
-f
n - The building has n floors, 2 <= n <= 20. The default is
n = 10.
-p
n - Run the simulation for a total of n passengers, 0 <= n.
The default is n = 100.
-s
n - Seed the random-number generator with the integer n; each
particular value of n produces the same sequence of random numbers. The
default uses the process id as the seed (n = getpid()
).
This page last modified on 30 November 2001.