public class CouplerRandom extends java.lang.Object implements Coupler
CouplerRandom
uses the set of parents and creates couples
randomly from this set. In particular, there is no handling for duplicated
Individual
s in the parents list or in one couple.Modifier and Type | Field and Description |
---|---|
protected java.util.Random |
random |
Constructor and Description |
---|
CouplerRandom(org.opt4j.core.common.random.Rand random)
Constructs a
CouplerRandom with a given Rand random
number generator. |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<org.opt4j.operators.crossover.Pair<org.opt4j.core.Individual>> |
getCouples(int size,
java.util.List<org.opt4j.core.Individual> parents)
Returns a list of
Individual -groups (couples) that are designated
to create offspring. |
@Inject public CouplerRandom(org.opt4j.core.common.random.Rand random)
CouplerRandom
with a given Rand
random
number generator.random
- the random number generatorpublic java.util.Collection<org.opt4j.operators.crossover.Pair<org.opt4j.core.Individual>> getCouples(int size, java.util.List<org.opt4j.core.Individual> parents)
Coupler
Individual
-groups (couples) that are designated
to create offspring.getCouples
in interface Coupler
size
- the number of couples to createparents
- the parents