OpenTS Tutorial
Main Program
Starting the Tabu Search

With just a couple of lines we'll get this Tabu Search started on its way.

import org.coinor.opents.*;

public class Main
{

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

        // Start tabu search
tabuSearch.setIterationsToGo( 100 ); tabuSearch.startSolving();
... } // end main ... } // end class Main

We've chosen to solve for one hundred iterations. Is this too much? Too little? There's no way to know with tabu search in general except by experimenting.

Because we've chosen to use the SingleThreadedTabuSearch object, the startSolving() method blocks until all iterations have been executed. In a more complicated (and proper) application, you should use the MultiThreadedTabuSearch object which returns control immediately after calling startSolving() leaving your application to await an appropriate event to know when the Tabu Search has stopped.

Finally let's see how we get the answer and display it.