public List < List < DoubleSolution > > generatePairsFromSolutionList ( List < DoubleSolution > solutionList ) { List < List < DoubleSolution >> subset = new ArrayList <> ( ) ; for ( int i = 0 ; i < solutionList . size ( ) ; i ++ ) { DoubleSolution solution1 = solutionList . get ( i ) ; for ( int j = i + 1 ; j < solutionList . size ( ) ; j ++ ) { DoubleSolution solution2 = solutionList . get ( j ) ; if ( ! marked . getAttribute ( solution1 ) || ! marked . getAttribute ( solution2 ) ) { List < DoubleSolution > pair = new ArrayList <> ( 2 ) ; pair . add ( solution1 ) ; pair . add ( solution2 ) ; subset . add ( pair ) ; marked . setAttribute ( solutionList . get ( i ) , true ) ; marked . setAttribute ( solutionList . get ( j ) , true ) ; } } } return subset ; }
Generate all pair combinations of the referenceSet1