Skip to content

NoCrossover hardcodes n_parents and n_offspring as 1, but MixedVariableMating requires it to be 2 #740

@oxinabox

Description

@oxinabox

It is fairly common to do an genetic algorithm with no cross-over.
Especially if some of your variables have weird and unusual types that are not easy to describe how to combine.
For this reason I assume the NoCrossover class was provided.

However in MixedVariableMating it requires that the crossover have 2 children and 2 parents:

XOVER_N_PARENTS = 2
XOVER_N_OFFSPRINGS = 2

assert crossover.n_parents == XOVER_N_PARENTS and crossover.n_offsprings == XOVER_N_OFFSPRINGS

And NoCrossover specified that it has exactly 1 of each

super().__init__(1, 1, 0.0)

This means they can't be used together.

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