COM3360 PROJECT ************************************************************************* Name : Cengiz Gok Account Number: cgok@ccs.neu.edu Project: Implementation of "BusRoute Problem" in a more adaptive way for demeterjava. Host: N/A (The original program was written by Binoy Samuel, I used some of the his implementation. ) ************************************************************************** Problem Description: There is a circular Bus route.It has several bus stop on it.There are buses on this route.There are people waiting at the bus stops.Each bus stop has unique StopId, each person has a destination which is another stop on the same Bus Route.Buses travel from one stop to others in one way (in a circular way).While travelling, it stops at each stop and takes waiting people as many as bus capacity.Initially, bus is at the first stop with no passengers on it. After some simulation time, bus finishes its travel with final state. The Original program written in demjava has more than 540 lines behavior file + 75 lines class dictionary file.(Totally around 610 lines) My new adaptive program has 350 lines behavior file + 50 lines class dictionary file (totally around 400 lines). Although my program is not most adaptive one, it's size is much less than that of the original program. I don't use any visitor class in my program unlike the original program.I removed all visitor classes from program. Important Files: Readme file( this file) README-PROJECT Program file : program.beh Class Dictionary file: program.cd Input files: program.input1 and program.input2 Output files program.out1 and program.out2 Directory: /proj/demsys/com3360/f97/cgok/ The # of files of original program : 610 (program.cd +program.beh) The # of lines written : 400 (program.beh + program.cd) The # of lines generated (in ./gen) : 8650 ( only *.java files) NOTICE : Program.input2 and program.out2 are in the directory test2 ************************************************************************** Credits: I used idea and problem analysis of Binoy Samuel. Prof. gave the original program.I didn't contact the Host, I just worked on program. ************************************************************************* Class dictionary: Program.cd //program.cd //Name: Cengiz GOK //Account name: cgok //Original program written by Binoy Samuel //rewritten by Cengiz GOK in a more adaptive way for demjava 12/04/97 BusRoute = "BusRoute:" RouteName "total" "route" "length" ":" RouteLen "consisting" "of" "bus" "stops" ":" BusStop_List "with" "assigned" "busses" ":" Bus_List. BusStop = StopId "at:" RouteLoc // clockwise dist. from origin "with" "waiting" "list" ":" Person_List. Bus : NaturalGasBus | GasolineBus | DieselBus *common* BusId "at:" RouteLoc // clockwise dist. from origin [ "currently" "at" "stop" ":" StopId] "driver:"DriverName "capacity:" BusCapac "speed:" BusSpeed "carrying" "passenger(s)" ":" Person_List. NaturalGasBus = "*N*". GasolineBus="*G*". DieselBus="*D*". Person = PersonId "destination:" StopId. // id of the dest. stop BusStop_List ~ "(" { BusStop } ")". Bus_List ~ "(" { Bus } ")". Person_List ~ "(" { Person } ")". RouteName = String. DriverName= String. RouteLen = Integer "ft". RouteLoc = Integer "ft". BusCapac = Integer "passengers". BusSpeed = Integer "ft/min". StopId = Ident. BusId = Ident. PersonId = Ident. Main =. *********************************************************************** Project: Bus Route Problem implementation in a more adaptive way with demeterjava Your name: Cengiz GOK Since I did the project myself (no other team member),I will give grade at least (B+).Because I worked alone on the project (no additional helping, except for Prof.Lieberherr ). ********************************************************************** >Parts of your project which you would have developed further if >you had more time. The most important improvement would be adding "Visualization" (GUI). Since this project might be used for demonstration purposes,Visualization of Simulation would be a great improvement.In the visualized version, user may construct BusStop, BusRoute,and select # of users, simulation time, # of buses etc. I also used previous printing method, "g_print", it can be redefined in a most efficient way. // Here is a sample BusRoute object: BusRoute: "MIT / Oak Grove" total route length : 7000 ft consisting of bus stops : ( Stop0 at: 0 ft with waiting list : ( Person1 destination: Stop1 Person2 destination: Stop1 Person3 destination: Stop2 Person4 destination: Stop1 Person5 destination: Stop3 Person6 destination: Stop2 ) Stop1 at: 2500 ft with waiting list : ( Person7 destination: Stop0 Person8 destination: Stop3 Person9 destination: Stop3 Person10 destination: Stop2 Person11 destination: Stop2 ) Stop2 at: 5000 ft with waiting list : ( Person12 destination: Stop3 Person13 destination: Stop1 Person14 destination: Stop3 Person15 destination: Stop1 Person16 destination: Stop1 Person17 destination: Stop0 ) Stop3 at: 6500 ft with waiting list : ( Person18 destination: Stop2 Person19 destination: Stop0 Person20 destination: Stop1 ) ) with assigned busses : ( *G* Bus1 at: 0 ft currently at stop : Stop0 driver: "Alex Thomson" capacity: 7 passengers speed: 800 ft/min carrying passenger(s) : () ) //Here is corresponding output CLASSPATH=./gen:$CLASSPATH java Main < program.input Initial state of the input bus route : BusRoute: MIT / Oak Grove total route length: 7000 ft consisting of bus stops: ( Stop0 at: 0 ft with waiting list: ( Person1 destination: Stop1 Person2 destination: Stop1 Person3 destination: Stop2 Person4 destination: Stop1 Person5 destination: Stop3 Person6 destination: Stop2 ) Stop1 at: 2500 ft with waiting list: ( Person7 destination: Stop0 Person8 destination: Stop3 Person9 destination: Stop3 Person10 destination: Stop2 Person11 destination: Stop2 ) Stop2 at: 5000 ft with waiting list: ( Person12 destination: Stop3 Person13 destination: Stop1 Person14 destination: Stop3 Person15 destination: Stop1 Person16 destination: Stop1 Person17 destination: Stop0 ) Stop3 at: 6500 ft with waiting list: ( Person18 destination: Stop2 Person19 destination: Stop0 Person20 destination: Stop1 ) ) with assigned busses: ( Bus1 at: 0 ft currently at stop: Stop0 Dirver: Alex Thomson capacity: 7 passengers speed: 800 ft/min carrying passenger(s): () ) Next state (after 1 minutes) : BusRoute: MIT / Oak Grove total route length: 7000 ft consisting of bus stops: ( Stop0 at: 0 ft with waiting list: () Stop1 at: 2500 ft with waiting list: ( Person7 destination: Stop0 Person8 destination: Stop3 Person9 destination: Stop3 Person10 destination: Stop2 Person11 destination: Stop2 ) Stop2 at: 5000 ft with waiting list: ( Person12 destination: Stop3 Person13 destination: Stop1 Person14 destination: Stop3 Person15 destination: Stop1 Person16 destination: Stop1 Person17 destination: Stop0 ) Stop3 at: 6500 ft with waiting list: ( Person18 destination: Stop2 Person19 destination: Stop0 Person20 destination: Stop1 ) ) with assigned busses: ( Bus1 at: 0 ft Dirver: Alex Thomson capacity: 7 passengers speed: 800 ft/min carrying passenger(s): ( Person6 destination: Stop2 Person5 destination: Stop3 Person4 destination: Stop1 Person3 destination: Stop2 Person2 destination: Stop1 Person1 destination: Stop1 ) ) . . . . . . . . There are many states here. . . . . . . . . Next state (after 10 minutes) : BusRoute: MIT / Oak Grove total route length: 7000 ft consisting of bus stops: ( Stop0 at: 0 ft with waiting list: () Stop1 at: 2500 ft with waiting list: ( Person11 destination: Stop2 ) Stop2 at: 5000 ft with waiting list: ( Person12 destination: Stop3 Person13 destination: Stop1 Person14 destination: Stop3 Person15 destination: Stop1 Person16 destination: Stop1 Person17 destination: Stop0 ) Stop3 at: 6500 ft with waiting list: ( Person18 destination: Stop2 Person19 destination: Stop0 Person20 destination: Stop1 ) ) with assigned busses: ( Bus1 at: 5000 ft currently at stop: Stop2 Dirver: Alex Thomson capacity: 7 passengers speed: 800 ft/min carrying passenger(s): ( Person3 destination: Stop2 Person5 destination: Stop3 Person6 destination: Stop2 ) ) . . . . . . . . There are many states here. . . . . . . . . Final state of the input bus route (after 20 minutes) : BusRoute: MIT / Oak Grove total route length: 7000 ft consisting of bus stops: ( Stop0 at: 0 ft with waiting list: () Stop1 at: 2500 ft with waiting list: ( Person11 destination: Stop2 ) Stop2 at: 5000 ft with waiting list: () Stop3 at: 6500 ft with waiting list: () ) with assigned busses: ( Bus1 at: 2500 ft currently at stop: Stop1 Dirver: Alex Thomson capacity: 7 passengers speed: 800 ft/min carrying passenger(s): ( Person18 destination: Stop2 Person20 destination: Stop1 ) ) *** FINISHED *** ***************************************************************************** >Please answer the following questions: >Did you change the generated Java code? No. >If you had the priviledge to have one of my graduate students as host or >if you had interactions with the teaching assistant, No. *****************************************************************************