Your Job with ACME-Networking

As your instructor said it in class, there are many situations when you'll have to use your knowledge about graphs to solve `real' problems. Here you go, you've been hired by ACME-Networking to work as a contractor on a project you have to finish soon and which could save the company serious money in time. As of now it's not clear whether you'll be sharing that profit or not. Also it's not clear whether the money they offer you corresponds to a decent hourly wage, you'll have to figure it out based on the time you work on the project.

Two memos are included with this document, one is from the president of ACME-Networking and is directed to the CIO (Chief Informations Officer) of the company, and another one from the CIO to you describing the project.


What you'll turn in

  1. A well commented listing of your program. Note that grading, as described below, considers both the functionality and the readability of your code. You may also want to have a look at a grading sheet used in the past for a similar assignment. If you are unsure about what the documentation of a program means, then you may want to read this document.
  2. A floppy disk (3.5") which contains the source file(s) for your program, the executable and a README file indicating what the program does, how to build the executable, the platform it's been tested on, and how to run it, plus any other information you consider useful - like the name of the author, etc. Also include a sample input file (use the extension .din for the name) and the output file (with the extension .out) your program generates using the included input file.
  3. A memo describing your work. You will indicate what you have looked for and how you solved the problem. Direct the memo to the president of ACME-Networking. A hardcopy of the program and a paper which introduces the necessary theoretical background will be attached to the memo. Also attach the tables/spreadsheets where you have recorded running times of your program with input of different sizes.

Grading

  1. A mark between 0 and 10 for functionality. The mark basically indicates in what measure your program works properly and how well you have followed the initial specification.
  2. A mark between 0 and 10 for readability. This mark indicates how well documented your program is; it also considers the general appearance of your final report.
  3. Multiply the above two marks to get the mark for this programming assignment.

ACME-Networking: Office of the President

DATE: September 16, 1996
TO: John Cash - CIO
FROM: Mary Lee - President
SUBJECT: New Employee

I just interviewed a student from Illinois Institute of Technology who would be willing to work as a consultant for us. I was impressed with his programming skills and his sound theoretical background. It's quite clear that people in their Computer Science and Applied Mathematics Department do excellent at preparing these kids for the real life.

The person has agreed to work on that networking project for a flat amount of $500.

Please inform the person about the specifics of the project and have him start as soon as possible. As you know, since we don't have an algorithm to tell us what is the minimum cable length we need for a project, we estimate we lose somewhere between $50,000 and $100,000 every year for this reason alone.

Your help in this matter is highly appreciated.


ACME-Networking

DATE: September 17, 1996
TO: Our new employee
FROM: John Cash - CIO
SUBJECT: Project Description

ACME-Networking has specialized in linear computer networks: we have a solid base of clients which are more concerned with the price of a network than with its performance. In a linear network the computers are chained together so that each is connected to exactly two others except for the two computers on the ends of the chain which are connected to only one other computer.

For various reasons (the price comes first to one's mind ) it is desirable to minimize the length of cable used. Your problem is to determine how the computers should be connected into such a chain as to minimize the total amount of cable needed. In the installation being constructed, the cabling will run beneath the floor, so the amount of cable used to join 2 adjacent computers on the network will be equal to the distance between the computers plus 10 additional feet of cable to connect from the floor to the computers and provide some slack for ease of installation. In the picture below you can see a network that consists of four computers in the final configuration (the red lines). Distances between computers are indicated in feet and the total cable length is:

(20+10) + (30+10)+(35+10) = 115 feet

We ask you to write a program that will minimize the amount of cable we use for some job. Here is a description for the input and the output of your program.

Input

The first line in the input file indicaes the number of computers in the network. Each network has at least 2 and at most 8 computers. Each additional line in the file will give the coordinates of a computer in the network; the first integer is the x coordinate and the second is the y coordinate of the computer. These coordinates will be integers in the range 0 to 1023, and they indicate distances from origin in some arbitrary Cartesian system (usually the origin is at one corner of the building). No two computers are at identical locations and each computer will be listed once.

Output

The output will contain one line for each length of cable to be cut to connect each adjacent pair of computers in the network; the output line contains the coordinates of the nodes to connect, followed by the length of the cable. The final line should be a sentence indicating the total amount of cable used. In listing the lengths of cable to be cut, traverse the network from one end to the other; it makes no difference at which end you start. Use two decimal places to indicate the length of the cable to be cut. Here is a line from an output file:

(10, 11)    (40, 51)     60.00

The default name of the input file should be net.din and the default name of the output file net.out. Of course we expect your program to be able to allow the use of a different name for the input and output files. A formal description for the command line that launches your program could be:

net [ -i input_file_name ]   [ -o output_file_name]   [-h]

Varia

As you can see your program should be dealing with networks that have up to 8 nodes. We wonder however what would be the running time of your program if there were let's say 32 nodes, and we ask you to provide an estimate based on the running times you obtain with smaller networks.

Should there be any questions on this asignment, please feel free to contact me.

Sincerely,


References

The ACM programming contest, 1992.


(c) 1996, Virgil Bistriceanu - virgil@csam.iit.edu
Posted: September 14, 1996
Last update: September 17, 1996