Operation/User’s Manual

Loading the Applet

To load the applet, first ensure you have the latest version of the java SDK installed on your computer. The latest version can always be downloaded from Sun’s web site. As of December 2008, the latest version is Version 6 Update 10, and this manual will assume the reader has installed this version.

Next, open a browser window, and go to my applet site. After Java loads, the applet will appear. I will assume the reader is using Internet Explorer for the remainder of these instructures because it is (unfortunately) the most common browser in the world today. I have tested the applet using the Firefox and Chrome browsers, too, and found that the applet works well despite browser differences.

Once loaded, your window will look something like this:

no-graph-loaded.jpg

Executing the Applet

The applet consists of eight major user interface elements, and this section will describe each briefly. Refer to the following figure or follow along with the applet as each part is described.

legend.jpg

Applet Status

This label will display status regarding the applet. For example, when the applet starts, it will display “Ready to optimize graphs...” It will also flash errors or status, such as “Access denied to URL” or “Solved.”

Some graphs require a long time to solve. In these cases, the applet status area will display the percentage complete, the elapsed time, and the approximated time remaining before the solution is found.

Graph Box

This box displays the graph and its solution. The vertices are displayed using colors that represent their weights (priorities). “Heavy” weights are shown reddish, and “light” weights are shown blueish. The entire set of vertices are drawn scaled so that they fit the available space of the graph box.

Dotted gray lines connect most of the vertices, and these represent the possible edges of the graph, i.e. the possible paths the Roomba may travel. When the graph is solved, the edges that are in the solution are drawn with a thick, bright red line. A solid gray line is used to display the path the Roomba takes to and from the base while it is travelling but not cleaning.

The root node is displayed with a circle around it as it can be seen in the figure above in which the vertex at location (3,1) is the root. Obstacles are not drawn explicitly, but they are outlined in a solid gray line with rounded corners.

Scale of Priorities

The scale shown on the right of the Graph Box displays the range of weights in the graph. The vertices with the largest weights are shown in red, and the vertices with the smallest weights are shown in blue. The remaining weights are shown in a color somewhere between these two extremes. The largest and smallest weights are displayed at the top and the bottom of the scale, respectively.

Solution Information

This area of the Graph Box displays information about the graph and its solution. It displays the size of the mesh graph, the initial battery capacity, and the location of the base. When the graph is solved, it displays the sum of the priorities of the visited vertices.

To the left of the solution information is an icon, info.png, and when it is clicked, a popup window will appear that provides even greater detailabout the graph. In the popup window, shown below, all information about the graph and its solution are displayed in a text box.

graph-details.jpg

URL Text Box

This text box is used to enter a URL for a graph to download. It is important to know that the URL must be valid, and the URL must be accessible by the java applet. Java applets run with several restrictions, and one is that the graph specified by the URL must exist on the same server as the applet. This means the applet cannot download a graph from another server like http://www.google.com.

Download Button

When clicked, the download button will start a background thread that will download the URL specified in the URL Text Box. If the URL is valid, the graph will be solved and displayed in the Graph Box. If the URL is invalid, the graph is inaccessible, or the graph is corrupt, an error message will appear for a few seconds in the Applet Status.

While the graph is downloaded and solved, the URL Text Box, the Download Button, and the Randomize Button will be disabled. Once the graph is solved, they are re-enabled. Similarly, while the graph is downloaded and solved, the Cancel Button becomes enabled.

Randomize Button

When clicked, the randomize button will start a background thread that solves a (pseudo) randomly generated graph. The graph and its solution will be displayed in the Graph Box. The graph generated will have a width and height between 1x1 and 9x9, the priorities will be set to random values between 1 and 99, and a random number of obstacles will assigned (25% of the available space). The initial battery capacity is set to a random number between 0 and the sum of the priorities in the graph.

While the graph is being solved, the URL Text Box, the Download Button, and the Randomize Button will be disabled. Once the graph is solved, they are re-enabled. Similarly, while the graph is downloaded and solved, the Cancel Button becomes enabled.

Cancel Button

The cancel button becomes available when a graph is being solved. Some graphs require a long time to solve, and the purpose of this button is to abort the calculation when the time is longer than it is desirable.

Advanced Function

It is possible to automatically load and solve a graph by specifying a parameter in the URL for the applet. The applet looks at the “url” HTML “get” parameter, and if it is present, it uses its value as the default URL. If the URL is not present, it defaults to point to a sample graph on my site.

For example, specifying a URL like the following will automatically download and solve a graph named sample.graph from my ics311/hw3/graphs directory.

http://www.jade-cheng.com/uh/coursework/ics-311/assignment-3/implementation/applet?url=http://www.jade-cheng.com/uh/coursework/ics-311/assignment-3/implementation/graphs/sample.graph

This feature is especially useful when testing the applet. More of this is discussed in my testing documentation.

Another special feature of the applet is animation. As the graphs are solved, the best solution found at a given time is displayed in the Graph Box. This can be seen in the following movie.

You need Flash Player 9 and a browser with javascript to view this video.

Links

Valid HTML 4.01 Valid CSS