Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
This repository was archived by the owner on Nov 19, 2020. It is now read-only.

DoubleArrayChromosome CreateNew ignores Balancer properties #676

@lmrobins

Description

@lmrobins

In DoubleArrayChromosome.cs, the CreateNew function is used when initializing a genetic algorithm Population object, or when performing selection on an existing Population. The CreateNew function just creates a new instance of a DoubleArrayChromosome using the founding chromosome generator settings. Unfortunately it ignores the founding chromosome's CrossoverBalancer and MutationBalancer settings, so the entire population (and newly selected members of the population) will have the wrong Crossover and Mutation balancer settings.

The fix is easy (just update the CreateNew function), but I'm new to this project and keep getting an authorization error when trying to create a new branch for the change, so I thought I'd post about it here instead.

The CreateNew function should look like:

public override IChromosome CreateNew( )
        {
            var chromosome = new DoubleArrayChromosome( chromosomeGenerator, mutationMultiplierGenerator, mutationAdditionGenerator, length );
            chromosome.CrossoverBalancer = this.CrossoverBalancer;
            chromosome.MutationBalancer = this.MutationBalancer;

            return chromosome;
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions