converting 2 opt swap to 3 opt swap
<p>I'm writing a 3-opt algorithm for the travelling salesman problem, i already got 2-opt working and im trying to convert it to 3-opt.
I don't get how to swap the 3 points, can anyone help me?</p>

<p>my code:</p>

<pre><code>private void ThreeOptSwap(int i, int k, int l) {
    int size = route.size();
    new_Route = new ArrayList&lt;Point&gt;();
    new_Route.addAll(route);
    // 1. take route[0] to route[i-1] and add them in order to new_route
    for ( int c = 0; c &lt;= i - 1; c++ )
    {
        new_Route.set(c, route.get(c) );
    }

    // 2. take route[i] to route[k] and add them in reverse order to new_route
    int dec = 0;
    for ( int c = i; c &lt;= k; c++ )
    {
        new_Route.set( c, route.get( k - dec ) );
        dec++;
    }

    // 3. take route[k+1] to end and add them in order to new_route
    for ( int c = k + 1; c &lt; size; c++ )
    {
        new_Route.set( c, route.get( c ) );
    }
}
</code></pre>