compute the gain if we exchange edge path cityindex1 , path cityindex1 +1 and path cityindex2 , path cityindex2 +1 with path cityindex1 +1 , path cityindex2 +1 and path cityindex1 , path cityindex2 concode_field_sep int[][] distanceMatrix concode_elem_sep int[] path concode_elem_sep Tool tool concode_field_sep void twoOpt concode_elem_sep int[] getPath concode_elem_sep void setPath concode_elem_sep void exchange
int function ( final int arg0 , final int arg1 ) { int loc0 = path [ arg0 ] ; int loc1 = path [ arg1 ] ; int loc2 = tool . getDestination ( path , arg0 ) ; int loc3 = tool . getDestination ( path , arg1 ) ; return ( ( distanceMatrix [ loc0 ] [ loc1 ] + distanceMatrix [ loc2 ] [ loc3 ] ) - ( distanceMatrix [ loc0 ] [ loc2 ] + distanceMatrix [ loc1 ] [ loc3 ] ) ) ; }