Package org.moeaframework.core.selection
Class TournamentSelection
java.lang.Object
org.moeaframework.core.selection.TournamentSelection
- All Implemented Interfaces:
Selection
Deterministic tournament selection operator. The tournament size specifies the number of candidate solutions
selected randomly from a population. The winner of a tournament is the best solution in the pool. Unlike
probabilistic tournament selection, the best solution is always returned in deterministic tournament selection.
If two or more solutions are the best in the pool, one solution is randomly selected with equal probability as the
tournament winner.
Binary tournament selection exhibits the same selection pressure as linear ranking but without the computational overhead required for ranking. Larger tournament sizes result in greedier selection. Solutions are selected with replacement.
-
Constructor Summary
ConstructorDescriptionConstructs a binary tournament selection operator using Pareto dominance.TournamentSelection
(int size) Constructs a tournament selection operator of the specified size using Pareto dominance.TournamentSelection
(int size, DominanceComparator comparator) Constructs a tournament selection operator of the specified size and using the specified dominance comparator.TournamentSelection
(DominanceComparator comparator) Constructs a binary tournament selection operator using the specified dominance comparator. -
Method Summary
Modifier and TypeMethodDescriptionstatic Solution
binaryTournament
(Solution solution1, Solution solution2) Performs binary tournament selection with Pareto dominance.static Solution
binaryTournament
(Solution solution1, Solution solution2, DominanceComparator comparator) Performs binary tournament selection.Returns the dominance comparator used to determine the tournament winner.int
getSize()
Returns the tournament size.Solution[]
select
(int arity, Population population) Returns an array of lengtharity
of solutions selected from the specified population.void
setSize
(int size) Sets the tournament size.
-
Constructor Details
-
TournamentSelection
public TournamentSelection()Constructs a binary tournament selection operator using Pareto dominance. -
TournamentSelection
Constructs a binary tournament selection operator using the specified dominance comparator.- Parameters:
comparator
- the comparator used to determine the tournament winner
-
TournamentSelection
public TournamentSelection(int size) Constructs a tournament selection operator of the specified size using Pareto dominance.- Parameters:
size
- the tournament size
-
TournamentSelection
Constructs a tournament selection operator of the specified size and using the specified dominance comparator.- Parameters:
size
- the tournament sizecomparator
- the comparator used to determine the tournament winner
-
-
Method Details
-
getSize
public int getSize()Returns the tournament size.- Returns:
- the tournament size
-
setSize
public void setSize(int size) Sets the tournament size.- Parameters:
size
- the new tournament size
-
getComparator
Returns the dominance comparator used to determine the tournament winner.- Returns:
- the comparator used to determine the tournament winner
-
select
Description copied from interface:Selection
Returns an array of lengtharity
of solutions selected from the specified population. -
binaryTournament
public static Solution binaryTournament(Solution solution1, Solution solution2, DominanceComparator comparator) Performs binary tournament selection.- Parameters:
solution1
- the first solutionsolution2
- the second solutioncomparator
- the comparison operator- Returns:
- the solution that wins the tournament
-
binaryTournament
Performs binary tournament selection with Pareto dominance.- Parameters:
solution1
- the first solutionsolution2
- the second solution- Returns:
- the solution that wins the tournament
-