Skip to content

The setComparator method in GeneticAlgorithm does not change the comparator in selection #394

@chaoyi-studio

Description

@chaoyi-studio

Hello, developers of MOEAFramework. I really like your framework and thank you for your contributions.

Recently I use GeneticAlgorithm, and when the setComparator method is called, the selection of comparators in the algorithm does not change. I believe this feature can be misunderstood by developers, such as the following example.

    GeneticAlgorithm algorithm = new GeneticAlgorithm(concurrentProblem);
    algorithm.setInitialization(new InjectedInitialization(concurrentProblem, initializedSolutions));
    algorithm.setInitialPopulationSize(populationSize);
    algorithm.setComparator(new LinearObjectiveComparator(weights));
    algorithm.setVariation(new CompoundVariation(
        new UniformCrossover(crossoverRate),
        new UM(mutatorRate)
    ));

In fact, the comparator in the algorithm runtime selection for this example is the default when the algorithm is initialized. Rather than LinearObjectiveComparator.

My debugging results are attached here:

image

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