private static boolean bestPermutation (Tour tour, int a, int b, int c, int d, int e, int f) {
    	City A = tour.getCity(a);
    	City B = tour.getCity(b);
    	City C = tour.getCity(c);
    	City D = tour.getCity(d);
    	City E = tour.getCity(e);
    	City F = tour.getCity(f);
    	double[] dist = new double[8];
    	dist[0] = A.distanceTo(B) + C.distanceTo(E) + D.distanceTo(F);
    	dist[1] = A.distanceTo(C) + B.distanceTo(D) + E.distanceTo(F);
    	dist[2] = A.distanceTo(C) + B.distanceTo(E) + D.distanceTo(F);
    	dist[3] = A.distanceTo(D) + E.distanceTo(B) + C.distanceTo(F);
    	dist[4] = A.distanceTo(D) + E.distanceTo(C) + B.distanceTo(F);
    	dist[5] = A.distanceTo(E) + D.distanceTo(B) + C.distanceTo(F);
    	dist[6] = A.distanceTo(E) + D.distanceTo(C) + B.distanceTo(F);
    	dist[7] = A.distanceTo(B) + C.distanceTo(D) + E.distanceTo(F);
    	int index = 0;
    	double min = Double.MAX_VALUE;
    	for (int i = 0; i < dist.length; i++)
    		if (dist[i] < min) {
    			index = i;
    			min = dist[i];
    		}
    	if (index == 0) {
    		tour.setCity(d, E);
    		tour.setCity(e, D);
    		exchange(tour, c+2, e-1);
    		return false;
    	} else if (index == 1) {
    		tour.setCity(b, C);
    		tour.setCity(c, B);
    		exchange(tour, a+2, c-1);
    		return false;
    	} else if (index == 2) {
    		tour.setCity(b, C);
    		tour.setCity(c, B);
    		tour.setCity(d, E);
    		tour.setCity(e, D);
    		exchange(tour, a+2,c-1);
            exchange(tour, c+2,e-1);
            return false;
    	} else if (index == 3) {
    		tour.setCity(b, D);
    		tour.setCity(c, E);
    		tour.setCity(d, B);
    		tour.setCity(e, C);
    		exchange(tour, a+2,e-1);
    		exchange(tour, a+2,c-1);
            exchange(tour, c+2,e-1);
    		return false;
    	} else if (index == 4) {
    		tour.setCity(b, D);
    		tour.setCity(c, E);
    		tour.setCity(d, C);
    		tour.setCity(e, B);
    		exchange(tour, c+2,e-1);
            exchange(tour, a+2,e-1);
    		return false;
    	} else if (index == 5) {
    		tour.setCity(b, E);
    		tour.setCity(c, D);
    		tour.setCity(d, B);
    		tour.setCity(e, C);
    		exchange(tour, a+2,c-1);
            exchange(tour, a+2,e-1);
    		return false;
    	} else if (index == 6) {
    		tour.setCity(b, E);
    		tour.setCity(e, B);
    		exchange(tour, a+2,e-1);
    		return false;
    	} else {
    		return true;
    	}
    }