Project: Transportation (Part I)

Sustainable Transportation Networks

Transportation – the movement of people and goods over some distance – often involves the consumption of fuel and the production of pollutants. As the world becomes increasingly interconnected, this problem will only become worse as a transportation growth triggers greater use of fuel, more cars and trucks, more roads, and other side effects.  Consequently, an emphasis has been placed on devising sustainable transportation methods and mechanisms, using renewable energies where possible and methods which accomplish the necessary movement while minimizing environmental impact.

Take a moment to watch and listen to this video describing sustainable transportation networks, including the driving forces and impacts:

Creating a sustainable transportation network requires both a change in methodology as well as a change in transport vehicles. In the United States alone there are more than 250 million vehicles on the road – and those are only the registered vehicles. Local governments have been proactive in modeling sustainable mass transportation, helping to decrease the environmental footprints of mass transit systems, cut fuel costs, and provide examples of positive behavior for citizens. Examples include Chattanooga and Chicago, both of which integrate electric bus service into their routes. This video from the Department of Energy discusses how communities across the U.S. are implementing sustainable mass transit:

What’s a Network?

The concept of a network – a group of things that are interconnected – is a fundamental concept in our society. Everything from roads to utility networks to social arrangements are grouped into networks. Computers are grouped into networks (such as the Internet) to allow people to communicate and transfer information between sites, sometimes over great distances. As a result, finding optimal arrangements and use patterns for networks is a major area of computing research.

In computing, networks are often represented as mathematical graphs. A graph is a fundamental data structure in Computer Science. A graph is nothing more than two sets: A set of vertices and a set of edges. Each edge can thought of as a pair of vertices. In an undirected graph, the edge pairs are considered unordered since the “line” representing the edge has no direction (it is a bidirectional pathway). The two elements of the pair are considered adjacent elements; a pathway can be constructed from one to the other. For example:

transport1

A graph with numbers of the edges is called a weighted graph. The length of the path between two vertices is the sum of the weights of the edges making up the path. For example, the following graph represents an abstraction of the Detroit metropolitan area, showing an interconnected set of towns and roads:

transport2

If we were asked to find the shortest tour by which each city could be visited by a regional bus service, starting from Detroit and returning to Detroit, there are a few known algorithms from which we can choose. However, all of them tend to be very slow – indeed, the problem itself is deemed to be extremely complex in mathematical circles.

In this project we will begin the process of constructing a program to solve this problem. We will begin by creating some fundamental classes to model the concept of a network (graph). We will extend this work in the next project.

Java Project: Modeling a Network

This project will provide you with an introduction to the fundamentals of object-oriented development in Java. The focus of this project is on how to solve simple problems using Java classes. At the end of this project, you will…

  • Develop Java classes based on user descriptions.
  • Develop Javadoc documentation for user-defined classes.
  • Implement Java interfaces.
  • Perform unit testing on user-defined classes.
  • Integrate user-defined classes into a large, predefined program.

Exercise #1: Create a class file called Vertex.java. This class will provide an abstraction of a graph vertex with one data property (name, a String object). Your class must NOT have a main method. You will also implement the Comparable interface; use the Vertex names as the basis for comparison. The Element interface will also be implemented by your class. Use the instructor-provided Javadoc as a guide to how to construct your class.

Use the instructor-provided VertexUnitTest.java unit test to test your class (You must not modify this code).

Exercise #2: Create a class file called Edge.java. This class will provide an abstraction of a graph edge with two data properties (two Vertex objects). Your class must NOT have a main method. The Element interface will be implemented by your class. Use the instructor-provided Javadoc as a guide to how to construct your class, and use the instructor-provided EdgeUnitTest.java unit test to test your class (You must not modify this code).

Exercise #3: Download the Transportation.zip provided by the instructor. This zip file contains a Java class to run (Transportation.java) and a supporting class file (Graph.class). This program is an integrated program which allows the user to build a graph of vertices and edges dynamically, using the classes you created in the previous exercises. You must not modify this code. The code is provided to allow you to test your Vertex and Edge classes integrated into a larger program.

The program provides the user with a menu of options, as follows:

  • Add a Vertex – add a vertex to the graph, making sure that no duplicates are added
  • Add an Edge – add an edge to the graph, making sure that no duplicates are added
  • Display Adjacent List – display the adjacent vertices for the graph
  • Quit – end the program

The program provides this menu to the user, allows the user to make a selection, executes the selection, and then repeats the process until the user chooses Quit.

Besides the data shown in the “Detroit” graph, here is a minimal test plan you can use to test your program:

  1. Add vertices, one at a time: A B C D E
  2. Display the adjacent list
  3. Add edges, one at a time: (A,B) (A,C) (A,D) (A,E) (A,F)
  4. Display the adjacent list
  5. Add edges, one at a time: (A,B) (B,C) (B,E) (C,D) (C,E) (E,A)
  6. Display the adjacent list
  7. Add vertices, one at a time: F G
  8. Display the adjacent list
  9. Add edges, one at a time: (A,B) (A,C) (A,F) (C,F) (A,G)
  10. Display the adjacent list

Deliverables

See the instructor for submission instructions and due date(s).

Powered by WordPress. Designed by WooThemes

Skip to toolbar