private int hammingDistance ( BinarySolution solutionOne , BinarySolution solutionTwo ) { int distance = 0 ; for ( int i = 0 ; i < problem . getNumberOfVariables ( ) ; i ++ ) { distance += hammingDistance ( solutionOne . getVariableValue ( i ) , solutionTwo . getVariableValue ( i ) ) ; } return distance ; }
Calculate the hamming distance between two solutions