OpenTS Tutorial
Main Program
Displaying the Solution

By this point the Tabu Search has finished all its iterations, and we're ready to display the answer. We'll create a few handy methods for printing the solution to System.out in a way that we can plot the answer in a spreadsheet program.

import org.coinor.opents.*;

public class Main
{

    public static void main( String[] args )
    {
        ...

        // Show solution
MySolution best = (MySolution)tabuSearch.getBestSolution(); System.out.println( "Best Solution:\n" + best ); int[] tour = best.tour; for( int i = 0; i < tour.length; i++ ) System.out.println( customers[tour[i]][0] + "\t" + customers[tour[i]][1] );
... } // end main ... } // end class Main

There's not too much code here in the Main program, suggesting how nice it can be to integrate a tabu search into a larger program.

In the next section we'll actually look at the Tabu Search objects that we created in support of this main program.