@ SuppressWarnings ( "unchecked" ) protected void updateNeighborhood ( S individual , int subProblemId , NeighborType neighborType ) throws JMetalException { int size ; int time ; time = 0 ; if ( neighborType == NeighborType . NEIGHBOR ) { size = neighborhood [ subProblemId ] . length ; } else { size = population . size ( ) ; } int [ ] perm = new int [ size ] ; MOEADUtils . randomPermutation ( perm , size ) ; for ( int i = 0 ; i < size ; i ++ ) { int k ; if ( neighborType == NeighborType . NEIGHBOR ) { k = neighborhood [ subProblemId ] [ perm [ i ] ] ; } else { k = perm [ i ] ; } double f1 , f2 ; f1 = fitnessFunction ( population . get ( k ) , lambda [ k ] ) ; f2 = fitnessFunction ( individual , lambda [ k ] ) ; if ( f2 < f1 ) { population . set ( k , ( S ) individual . copy ( ) ) ; time ++ ; } if ( time >= maximumNumberOfReplacedSolutions ) { return ; } } }
Update neighborhood method