Hello.
Le lun. 22 nov. 2021 à 13:49, Avijit Basak <[email protected]> a écrit :
>
> Hi All
>
> I would like to request everyone to share their opinion regarding
> use and customization of RNG functionality in the Genetic Algorithm
> library.
> In current design RNG functionality has been used internally by the
> RandomProviderManager class. This class encapsulates a predefined instance
> of RandomSource and utilizes the same for all random number generation
> requirements. This makes the API cleaner and easy to use for users.
> However, during the review an alternate thought has been proposed
> related to customization of RandomSource by users. According to the new
> proposal the users will be able to provide a RandomSource instance of their
> choice to the crossover and mutation operators and other places like
> ChromosomeRepresentationUtils. The drawback of this customization could be
> increased complexity of the API.
Please provide an usage example of both (showing that the alternative
would actually increase the API complexity).
Thanks,
Gilles
> We need to decide here whether we really need this kind of
> customization by users and if yes the method of doing so. Here two options
> have been proposed.
> *Option1:*
> ---CUT---
> public interface MutationPolicy<P> {
> Chromosome<P> mutate(Chromosome<P> original, double mutationRate);
>
> interface Factory<P> {
> /**
> * Creates an instance with a dedicated source of randomness.
> *
> * @param rng RNG algorithm.
> * @param seed Seed.
> * @return an instance that must <em>not</em> be shared among
> threads.
> */
> MutationPolicy<P> create(RandomSource rng, Object seed);
>
> default MutationPolicy<P> create(RandomSource rng) {
> return create(rng, null);
> }
> default MutationPolicy<P> create() {
> return create(RandomSource.SPLIT_MIX_64);
> }
> }
> }
> ---CUT---
>
> *Option 2:*
> Use of an optional constructor argument for all crossover and mutation
> operators. Users will be providing a RandomSource instance of their choice
> or use the default one configured while instantiating the operators.
>
> Thanks & Regards
> -- Avijit Basak
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]