Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
Column
width300px
Page Tree
root15DOTs60ia13:Tutorial
Column

Solver Input

The problem data is organized and passed to the solver in an instance of the class TspInstance<V,E>. Note the use of generics. Here V is the type of the objects that will correspond to vertices and E is the type of the objects that will correspond to edges. The point of generics is that our code will not really depend on what the types of our nodes and edges are. Lets take a quick look at the highlights of the public interface to this class.

Code Block

public UndirectedGraph<V, E> getGraph() {
	...
}
public Function<E, Integer> getEdgeWeights() {
	...
}

The UndirectedGraph<V,E> returned by getGraph() is from the JUNG library. You can view the complete documentation here (this page might be more helpful), but some important highlights are

Name

Return Type

Arguments

Description

addVertex

boolean

V vertex

Adds vertex to this graph. Fails if vertex is null or already in the graph.

Solver Interface

Open the file src/solver/TspIpSolver.java by double clicking it from the Project Explorer. This is the file we will be primarily editing. It should contain the following (after the imports):

Toggle Cloak
idTspIpSolverStart
Toggle TspIpSolver.java

Cloak
visibletrue
idTspIpSolverStart