How to set a unique chromosome in a initial population in JGAP?

132 views Asked by At

I'm trying to do the following: I have a N size chromosome whose type is IntegerGene. I'm interested in that unique chromosome being evaluated following the crossover operator so I use:

            Configuration configuration = new DefaultConfiguration ();
            Configuracion.getGeneticOperators (). Clear ();
            CrossoverOperator crossover = new CrossoverOperator (configuration);
            Configuracion.addGeneticOperator (crossover);
            ...
            Genotype poblacion = Genotype.randomInitialGenotype(configuracion);

For example, I want to use a single chromosome to create the following populations, this chromosome would be | 9 | 5 | 10 | 0 | And therefore I initialize it:

 Gene [] genes = new Gene [4];

 genes [0] = new IntegerGene (configuration, 9,9);
 genes [1] = new IntegerGene (configuration, 5,5);
 genes [2] = new IntegerGene (configuration, 10,10);
 genes [3] = new IntegerGene (configuration, 0,0);

When I run the program the output (the chromosome solution) is always the same (| 9 | 5 | 10 | 0 |), it does not perform the crossover operator ....

Run:
Population Size: 10

...
 9 5 10 0
Punctuation = 12.5
 9 5 10 0
Punctuation = 12.5
 9 5 10 0
Punctuation = 12.5
 9 5 10 0
Punctuation = 12.5

 Chromosome Solution [0] = 9
 Chromosome Solution [1] = 5
 Chromosome Solution [2] = 10
 Chromosome Solution [3] = 0

Thank you.

0

There are 0 answers