Class CouplerRandom

  • All Implemented Interfaces:
    Coupler

    public class CouplerRandom
    extends Object
    implements Coupler
    The CouplerRandom uses the set of parents and creates couples randomly from this set. In particular, there is no handling for duplicated Individuals in the parents list or in one couple.
    • Field Detail

      • random

        protected final Random random
    • Constructor Detail

      • CouplerRandom

        @Inject
        public CouplerRandom​(Rand random)
        Constructs a CouplerRandom with a given Rand random 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: Coupler
        Returns a list of Individual-groups (couples) that are designated to create offspring.
        Specified by:
        getCouples in interface Coupler
        Parameters:
        size - the number of couples to create
        parents - the parents
        Returns:
        the selected couples