|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.epochx.op.selection.TournamentSelector<TYPE>
public class TournamentSelector<TYPE>
Tournament selection provides both program and pool selection. In tournament selection, x programs are randomly selected from the population to enter a 'tournament'. The program with the best fitness in the tournament then becomes the selected program. The tournament size, x, is given as an argument to the constructor.
| Constructor Summary | |
|---|---|
TournamentSelector(GPModel<TYPE> model,
int tournamentSize)
Construct a tournament selector with the specified tournament size. |
|
| Method Summary | |
|---|---|
java.util.List<CandidateProgram<TYPE>> |
getPool(java.util.List<CandidateProgram<TYPE>> pop,
int poolSize)
Constructs a pool of programs from the population, choosing each one with the program selection element of TournamentSelector. |
CandidateProgram<TYPE> |
getProgram()
Randomly creates a tournament, then selects the candidate program with the best fitness from that tournament. |
void |
setSelectionPool(java.util.List<CandidateProgram<TYPE>> pop)
Store the population for creating tournaments from. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TournamentSelector(GPModel<TYPE> model,
int tournamentSize)
tournamentSize - the number of programs in each tournament.| Method Detail |
|---|
public void setSelectionPool(java.util.List<CandidateProgram<TYPE>> pop)
setSelectionPool in interface ProgramSelector<TYPE>pop - the current population for this generation.public CandidateProgram<TYPE> getProgram()
getProgram in interface ProgramSelector<TYPE>
public java.util.List<CandidateProgram<TYPE>> getPool(java.util.List<CandidateProgram<TYPE>> pop,
int poolSize)
getPool in interface PoolSelector<TYPE>pop - the population of CandidatePrograms from which the programs
in the pool should be chosen.poolSize - the number of programs that should be selected from the
population to form the pool. If poolSize is zero or less
then no selection takes place and the given population
is returned unaltered.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||