Skip to content

IUDataStructuresCourse/wire-routing-the-mediocre-coder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C343 Project - Routing Wires on a Chip

##Group Solution Summary For this project, a Breadth First Search is the main algorithm used for finding paths between two points. BFS itself wont exactly find the path however, the path can be obtained from the BFS results. In order to accommodate for obstacles, and points that cannot be used for a path, the preconditions for a BFS method will simply be changed.

For example, the BFS method takes a board and two coordinates as start and finish with the Board b, there is enough information to decide which points are obstacles from within that Board object. A BFS will be run on that Board starting at the start node. Once the finish node is found in that search, then the algorithm will stop, because you have reached the destination.

BFS itself produces a list of 'paths'. Think of BFS as ripples in a pond. Preforming the search, there will be paths produced (lists of Coords) all within one ArrayList. These paths are not all needed. The only path needed is the path that reaches from the start node to the finish. That path is THE path for two Coords. Helper functions obtain this path for the final output of paths in a given board.

Further explaination for helper functions is given in comments for the Routing class.

Project Description

In this project you will implement a Java program that places wires on a computer chip. For purposes of this project, a computer chip will be abstractly represented as a grid of vertices, where each vertex is connected to the four neighboring vertices (in the directions north, south, east, and west). To complicate matters, parts of the chip are already allocated for other uses and may not be used for running wires. These already-in-use parts are called obstacles. Each obstacle is a rectangular region of the grid. You will be given a list of pairs of coordinates and your task is to connect each pair with a wire. A coordinate is a pair of integers, with the first being the horizontal distance from the left edge of the grid, and the second being the vertical distance from the top edge of the grid. A wire is a list of grid points. Wires may not cross one another. In addition to connecting all the pairs, your goal is to minimize the aggregate lengths of all the wires and to minimize the execution time of your program.

The format of the input file is described as follows. The first line is the height of the grid, given as an integer. The second line is the width of the grid, also given as an integer. The third line is the number of obstacles o. The next o lines are the obstacles. Each line has four integers, separated by spaces. The first two integers give the upper left coordinate of the obstacle and the second two integers give the lower right coordinate of the obstacle. After the obstacles, there is a line that gives the number of pairs that need to be connected. The remaining lines in the file are pairs of space-separated coordinates, where each coordinate is a pair of space-separated integers.

We have given you the code that reads the input file and creates the grid with obstacles laid out and the source and destination points specified. The obstacles are marked with grid cells with value -1. The start and end points of a wire/path are marked with a number assigned to that path. All the other cells contain the value 0.

Your function findPaths in the Routing class should use this grid to connect a source and a destination with a path. You should mark the grid once a path has been found for a pair of points, thus preventing overlapping of paths. Also all the points that lie on an obstacle should be avoided. The checkCorrectness function in the Drive class checks for these conditions to verify the correctness of your solution.

Note that a path can have the same source and destination points.

Your Task

We need you to implement the findPaths method. It takes the board and the points to be connected as arguments and returns a list of paths. The board represents the entire chip. Each path represents the wire used to connect components represented by points. Each path connects a pair of points in the points array; avoiding obstacles and other paths while minimizing the total path length required to connect all points. If two points cannot be connected, then the path should be null.

Think of a simple way to minimize the path length. You can use the grid to mark the points that lie on a path. You might want to use auxiliary data structures to keep track of the intermediate points that lie on the path.

After finding a correct solution, you can look for heuristics to reduce the aggregate length further.

Describe your solution at the top of this README.md.

About

wire-routing-the-mediocre-coder created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages