CSCI 230 -- Data Structures and Algorithms
Project 3 -- Jog Phone Company -- Examples

 

March 17, 1999

To get a better understanding of what the Job Phone Company simulation is supposed to do, let's look at some examples of it in action.

Here is the result of a short run of the program in verbose mode:

	jog 10 0.7 17 log

Number of events to process: 10
Connection probability: 0.7
Seed for random number generation: 17
Verbose mode...

At time 0.279 connected call from 8494827 to 9328592
At time 0.59 disconnected call between 8494827 and 9328592
   duration: 0.311
At time 0.722 connected call from 8960417 to 5733024
At time 0.85 connected call from 2815210 to 9043427
At time 0.871 disconnected call between 2815210 and 9043427
   duration: 0.0206
At time 0.902 connected call from 5846797 to 3488814
At time 1.02 disconnected call between 8960417 and 5733024
   duration: 0.296
At time 1.08 connected call from 6499893 to 2037842
At time 1.21 disconnected call between 5846797 and 3488814
   duration: 0.308
At time 1.31 connected call from 8045838 to 7677663
Completed 10 events.
There were 4 completed calls, in 1.31 hours (simulated time).
The average duration of a call was 0.234 hours (simulated time).
The average number of active connections was 2.6.

Time used: 0 seconds.
This program has extra code (not required, but a good idea for debugging) so that it can print out the connections table after each event. Let's look at the output below that it produces when this code is included. Notice that each connection causes two entries to be made in the table, one in which each of the two numbers involved is the key. This is done to allow the connection to be looked up efficiently regardless of which of the two numbers is used as the key.1
	jog 10 0.7 17 log

Number of events to process: 10
Connection probability: 0.7
Seed for random number generation: 17
Verbose mode...

At time 0.279 connected call from 8494827 to 9328592
Connections:
 Phone #      Phone #    Start time
 8494827      9328592     0.279199
 9328592      8494827     0.279199

At time 0.59 disconnected call between 8494827 and 9328592
   duration: 0.311
Connections:
 Phone #      Phone #    Start time

At time 0.722 connected call from 8960417 to 5733024
Connections:
 Phone #      Phone #    Start time
 5733024      8960417     0.721763
 8960417      5733024     0.721763

At time 0.85 connected call from 2815210 to 9043427
Connections:
 Phone #      Phone #    Start time
 2815210      9043427     0.850169
 5733024      8960417     0.721763
 8960417      5733024     0.721763
 9043427      2815210     0.850169

At time 0.871 disconnected call between 2815210 and 9043427
   duration: 0.0206
Connections:
 Phone #      Phone #    Start time
 5733024      8960417     0.721763
 8960417      5733024     0.721763

At time 0.902 connected call from 5846797 to 3488814
Connections:
 Phone #      Phone #    Start time
 3488814      5846797     0.902341
 5733024      8960417     0.721763
 5846797      3488814     0.902341
 8960417      5733024     0.721763

At time 1.02 disconnected call between 8960417 and 5733024
   duration: 0.296
Connections:
 Phone #      Phone #    Start time
 3488814      5846797     0.902341
 5846797      3488814     0.902341

At time 1.08 connected call from 6499893 to 2037842
Connections:
 Phone #      Phone #    Start time
 2037842      6499893     1.07544
 3488814      5846797     0.902341
 5846797      3488814     0.902341
 6499893      2037842     1.07544

At time 1.21 disconnected call between 5846797 and 3488814
   duration: 0.308
Connections:
 Phone #      Phone #    Start time
 2037842      6499893     1.07544
 6499893      2037842     1.07544

At time 1.31 connected call from 8045838 to 7677663
Connections:
 Phone #      Phone #    Start time
 2037842      6499893     1.07544
 6499893      2037842     1.07544
 7677663      8045838     1.31095
 8045838      7677663     1.31095

Completed 10 events.
There were 4 completed calls, in 1.31 hours (simulated time).
The average duration of a call was 0.234 hours (simulated time).
The average number of active connections was 2.6.

Time used: 0 seconds.
Here are a few more examples:
	jog 1000 0.7 17 nolog

Number of events to process: 1000
Connection probability: 0.7
Seed for random number generation: 17
Silent mode...

Completed 1000 events.
There were 435 completed calls, in 4.71 hours (simulated time).
The average duration of a call was 0.233 hours (simulated time).
The average number of active connections was 134.

Time used: 0.55 seconds.
With the same parameters except connection probability is 0.9:
	jog 1000 0.9 17 nolog

Number of events to process: 1000
Connection probability: 0.9
Seed for random number generation: 17
Silent mode...

Completed 1000 events.
There were 399 completed calls, in 3.72 hours (simulated time).
The average duration of a call was 0.204 hours (simulated time).
The average number of active connections was 202.

Time used: 0.27 seconds.
With 10,000 events:
	jog 10000 0.7 17 nolog

Number of events to process: 10000
Connection probability: 0.7
Seed for random number generation: 17
Silent mode...

Completed 10000 events.
There were 4395 completed calls, in 7.14 hours (simulated time).
The average duration of a call was 0.23 hours (simulated time).
The average number of active connections was 1177.

Time used: 3.79 seconds.

How about 100,000 events:

	jog 100000 0.7 17 nolog

Number of events to process: 100000
Connection probability: 0.7
Seed for random number generation: 17
Silent mode...

Completed 100000 events.
There were 43374 completed calls, in 10.4 hours (simulated time).
The average duration of a call was 0.211 hours (simulated time).
The average number of active connections was 1.091e+004.

Time used: 77.23 seconds.

There are compiled versions (for SUNs and Windows PCs) of a map version of the program in

  /dept/cs/cs230/public/projects/project3
called jog, which you can try out with various command-line parameters to give you still more information about what is expected.

Footnotes

 
(1)
Another, somewhat more efficient way of doing this would be to have a separate table in which the second number is the key and the first number is the associated data; it would be unnecessary to store the start time in this table. Such an auxiliary table is called a secondary index for the main table.