For this assignment you are allowed to work with one other classmate in your section. Each group will submit only one homework. Be sure to include the names and EECS User IDs of both students in the header of every every source code file. Your program is also to output the names and EECS User IDs of both students when the program first starts executing. Note: Groups cannot include more than two students. Students are not required (but are encouraged) to work with another student.
This assignment will have you create and maintain an information network using an undirected graph. You are to use an adjacency list data structure similar to what is discussed on page 285 in the Weiss text to store your graph. The graph will have twenty vertices, numbered 1 through 20. For ten points extra credit, you can implement your graph using the multi-list structure that was discussed in class instead of the adjacency list data strucure.
For the information network, we will want to make data transfers between two nodes in the network (each node will be a vertex in the graph). Each connection in the network (or edge in the graph) has a maximum amount of data it can transfer at any one time. Thus an edge can only support a specified amount of data transfers at any one time. As each edge in the graph is created, the maximum amount of simultaneous data transfers will need to be given (this is the bandwidth of the edge).
We a data transfer request is made, the shortest path will need to be found between the two node in the graph (we will assume that the connection is bidirectional, so the order of the two nodes does not matter) whose edges have not already been "maxed-out" with data. To keep things simple, we will assume that each data transfer sends one unit of data between the node and the bandwidth of the edge will always be an integer amount greater than one. If no such path exists because these is at least one edge that is maxed-out, the data transfer request must wait until such a path becomes available.
For example, assume there is a connection (i.e. edge) between node 1 and node 2 that has bandwidth of one. Also there is a connection (i.e. edge) between node 1 and node 3 that has bandwidth of three. Also there is a connection (i.e. edge) between node 2 and node 3 that has bandwidth of two. Now:
Your program will have to keep track of the current time, because requests will know when they start and when they end. Again to keep things simple, the time in your program will start with time zero and will increament in integer units of time. You may assume that each unit is a second, but we will NOT be using real time in our programs. When each request is made, it will need to specify the time the request is made and how long the data transfer will take. A request cannot be made for a previous time (i.e. if your program has the "current time" as 23, a request cannot be made at time 15). More information on the time will be given below.
The program is to be interactive. The commands will be similar to what was used in MP5. The prompt used in the program must include the current time. We will implement the following operations:
The start time T must be greater or equal to the current time. If the start time T is less than the current time, print out an error message and ignore the request. The duration value D must be greater than or equal to one. If the duration is zero or less, print out an error message and ignore the request. When the start time is greater than the current time, the current time is advanced to the indicated start time. This may result in the completion of other data transfers, which may then cause the starting of waiting data transfer requests. Only after these other data transfer requests have been handled does the current data transfer request get processed. This idea was discussed in class on Friday 11/17/2000.
When a data transfer finishes, a message is to be printed stating the message number and the current time. (15 pts)
The input for the program will be given through standard input. Each line of input will have one and only one operation. Each operation will fit on one line of input. You may assume that each line is no more than 100 characters long. The first non-white space character will be the character for the operation. If an unknown character is given, print out an error message such as Operation X is not known and ignore the rest of the the input line. White space characters are the space an tab characters.
Since this program is to be interactive, your program is to prompt the user for each command. This prompt must include the current time.
Time: 0> a 1 2 1 Time: 0> a 1 3 3 Time: 0> a 2 3 2 Time: 0> t 1 Transitive Closure (all edges): 1, 2, 3 Transitive Closure (available edges): 1, 2, 3 Time: 0> r 1 2 0 2 Data Transfer #1 started at time 0 on path: (1,2) Time: 0> r 2 3 0 4 Data Transfer #2 started at time 0 on path: (2,3) Time: 0> l 1 Edge (1,2) Bandwidth: 1, In Use: 1 Edge (1,3) Bandwidth: 3, In Use: 0 Time: 0> l 2 Edge (1,2) Bandwidth: 1, In Use: 1 Edge (2,3) Bandwidth: 2, In Use: 1 Time: 0> t 1 Transitive Closure (all edges): 1, 2, 3 Transitive Closure (available edges): 2, 3 Time: 0> r 1 2 0 5 Data Transfer #3 started at time 0 on path: (1,3),(3,2) Time: 0> t 1 Transitive Closure (all edges): 1, 2, 3 Transitive Closure (available edges): 3 Time: 0> r 2 3 1 5 Data Transfer #4, Waiting Time: 1> r 3 1 1 7 Data Transfer #5 started at time 1 on path: (1,3) Time: 1> r 2 3 1 2 Data Transfer #6, Waiting Time: 1> r 2 3 1 2 Data Transfer #7, Waiting Time: 1> w Data Transfer #4 From 2 to 3 waiting, Duration 5 Data Transfer #6 From 2 to 3 waiting, Duration 2 Data Transfer #7 From 2 to 3 waiting, Duration 2 Time: 1> p 1 Data Transfer #1, Start time: 0, Duration: 2, End time: 2 Path: (1,2) Time: 1> p 4 Data Transfer #4 From 2 to 3 waiting, Duration 5 Time: 1> c 4 Data Transfer #1 ends at time 2 Data Transfer #4 started at time 2 on path: (2,1),(1,3) Data Transfer #2 ends at time 4 Data Transfer #6 started at time 4 on path: (2,3) Time: 4> p 1 Data Transfer #1 unknown Time: 4> p 4 Data Transfer #4, Start time: 2, Duration: 5, End time: 7 Path: (2,1),(1,3) Time: 4> c 7 Data Transfer #3 ends at time 5 Data Transfer #7 started at time 5 on path: (1,3) Data Transfer #6 ends at time 6 Data Transfer #4 ends at time 7 Data Transfer #7 ends at time 7 Time: 7> c 10 Data Transfer #5 ends at time 8 Time: 10>
Your program must be written in good programming style (4 pts). This includes (but is not limited to) meaningful identifier names, a file header at the beginning of each source code file, a function header at the beginning of the function, proper use of blank lines and indentation to aide in the reading of your code, explanatory "value-added" in-line comments, etc.
The work you turn in must be 100% done by your own group. You are not allowed to share code with any other groups (inside this class or not). You may discuss the project with other groups; however, you may not show any code you write to another group nor may you look at any other group's written code.
You are to submit this project using the EECS Department's UNIX machine's turnin command. The project name for this assignment is mp6. Be sure to submit all source code and header files and makefile. Failure to turnin all required pieces will result in a lower grade for the assignment. The turnin command for this assignment is:
turnin -c eecs360a -p mp6 <file list>where <file list> is the names of all files that you will submit for this program. You can use the turnin command multiple times; however, ever time you must submit all files needed for the program. To see which files you have submitted to turnin use the -v option with the turnin command as follows:
turnin -c eecs360a -p mp6 -v