public static Program compete ( List < Program > programs , Program current , Program candidate , LGP manager , RandEngine randEngine ) { if ( manager . getReplacementStrategy ( ) == LGPReplacementStrategy . DirectCompetition ) { if ( CollectionUtils . isBetterThan ( candidate , current ) ) { int index = programs . indexOf ( current ) ; programs . set ( index , candidate ) ; return current ; } else { return candidate ; } } else { if ( randEngine . uniform ( ) <= manager . getReplacementProbability ( ) ) { int index = programs . indexOf ( current ) ; programs . set ( index , candidate ) ; return current ; } else { return candidate ; } } }
this method returns the pointer to the loser in the competition for survival ;