@ Override public List < SubsetMove > getAllMoves ( SubsetSolution solution ) { // check size limit if ( maxSizeReached ( solution ) ) { return Collections . emptyList ( ) ; } // get set of candidate IDs for addition (possibly fixed IDs are discarded) Set < Integer > addCandidates = getAddCandidates ( solution ) ; // check if there are any candidates to be added if ( addCandidates . isEmpty ( ) ) { return Collections . emptyList ( ) ; } // create addition move for all add candidates return addCandidates . stream ( ) . map ( add -> new AdditionMove ( add ) ) . collect ( Collectors . toList ( ) ) ; }
Generates a list of all possible addition moves that add a single ID to the selection of a given subset solution . Possible fixed IDs are not considered to be added and the maximum subset size is taken into account . May return an empty list if no addition moves can be generated .