public static boolean twoOpt(int[] tour,int[][] dist){
		
		boolean better=false;
		for(int current=0;current<tour.length;current++){
			
			int nextVerticeIndex=(current+1)%tour.length;
			int swapWith=(current+2)%tour.length;
			
			for(int iters=0;iters<tour.length-3;iters++){
				//check if edge to swapwith is better than edge from current to next
				if(dist[current][swapWith]<dist[current][nextVerticeIndex]){
//					System.out.println("before " +tourLength(dist,tour));
					//check if second swap really was better
					if(swapIfBetterTwoOpt(tour,dist,nextVerticeIndex,swapWith)){
						//it was better so complete the reversing
						int innerFrom=(nextVerticeIndex+1)%tour.length;
						int innerTo= swapWith==0 ? tour.length-1 : swapWith-1; 
						reverse(tour, innerFrom, innerTo);
//						System.out.println("after " +tourLength(dist,tour));
						better=true;
					}
					
					
				}
				
				
				swapWith++;if(swapWith>=tour.length){ swapWith=0; }
			}
		}
		return better;
	}