public void deleteCrowdIndiv_same ( int crowdIdx , int nicheCount , double indivFitness , S indiv ) { // find the solution indices within this crowdIdx subregion ArrayList < Integer > indList = new ArrayList <> ( ) ; for ( int i = 0 ; i < populationSize ; i ++ ) { if ( subregionIdx [ crowdIdx ] [ i ] == 1 ) { indList . add ( i ) ; } } // find the solution with the worst fitness value int listSize = indList . size ( ) ; int worstIdx = indList . get ( 0 ) ; double maxFitness = fitnessFunction ( population . get ( worstIdx ) , lambda [ crowdIdx ] ) ; for ( int i = 1 ; i < listSize ; i ++ ) { int curIdx = indList . get ( i ) ; double curFitness = fitnessFunction ( population . get ( curIdx ) , lambda [ crowdIdx ] ) ; if ( curFitness > maxFitness ) { worstIdx = curIdx ; maxFitness = curFitness ; } } // if indiv has a better fitness, use indiv to replace the worst one if ( indivFitness < maxFitness ) { replace ( worstIdx , indiv ) ; } }
delete one solution from the most crowded subregion which is indiv s subregion . Compare indiv s fitness value and the worst one in this subregion