Package org.opt4j.optimizer.ea
Class CouplerRandom
- java.lang.Object
-
- org.opt4j.optimizer.ea.CouplerRandom
-
- All Implemented Interfaces:
Coupler
public class CouplerRandom extends Object implements Coupler
TheCouplerRandomuses the set of parents and creates couples randomly from this set. In particular, there is no handling for duplicatedIndividuals in the parents list or in one couple.
-
-
Constructor Summary
Constructors Constructor Description CouplerRandom(Rand random)Constructs aCouplerRandomwith a givenRandrandom number generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<Pair<Individual>>getCouples(int size, List<Individual> parents)Returns a list ofIndividual-groups (couples) that are designated to create offspring.
-
-
-
Field Detail
-
random
protected final Random random
-
-
Constructor Detail
-
CouplerRandom
@Inject public CouplerRandom(Rand random)
Constructs aCouplerRandomwith a givenRandrandom number generator.- Parameters:
random- the random number generator
-
-
Method Detail
-
getCouples
public Collection<Pair<Individual>> getCouples(int size, List<Individual> parents)
Description copied from interface:CouplerReturns a list ofIndividual-groups (couples) that are designated to create offspring.- Specified by:
getCouplesin interfaceCoupler- Parameters:
size- the number of couples to createparents- the parents- Returns:
- the selected couples
-
-