0

I used the JGAp java genetic algorithm library. and when I evaluated the chromosomes , I had duplication of chromosomes in the population sample run :

evaluation 0
A B C
A D F
S F W
evaluation 1:
A B C
A D F
A D F
evaluation 2:
A D F
A D F
A D F

and the configurations I have used are:

conf.setKeepPopulationSizeConstant(true);
 conf.setRandomGenerator(new StockRandomGenerator());
conf.verifyStateIsValid();

is there any configuration that I can used in order to get unique chromosomes?

Abrial
  • 421
  • 1
  • 5
  • 20
  • What genetic operators do you use? Could it be that the population size is too small combined with conservative genetic operators and a fitness function that quickly identified the fittest individual and reproduced that one (without mutation or combinations)? – erikxiv May 06 '12 at 19:24
  • I used Swapping operater using this Configurations conf.getGeneticOperators().clear(); MutationOperator swapper = new SwappingMutationOperator(conf); conf.addGeneticOperator(swapper); and I try to make population size 500 the same problem is there! any idea please – Abrial May 07 '12 at 06:26

1 Answers1

1

You can make sure only to use NaturalSelectors that does not allow duplicates. Example code:

conf.getNaturalSelectors(false).clear();
BestChromosomesSelector bcs = new BestChromosomesSelector(conf, 1.0d);
bcs.setDoubletteChromosomesAllowed(false);
conf.addNaturalSelector(bcs, false);

Please note that only using SwappingMutationOperator will probably starve the ingenuity of the population. A test modifying the MinimizingMakeChange example from JGAP, but using only the SwappingMutationOperator, shows that the population quickly stops producing individuals that have not been seen before.

erikxiv
  • 3,965
  • 1
  • 23
  • 22
  • yes it works :) thank you so much for your replay. I used your configurations and delete the Swapping operator and it's work exactly like what I want. thanks a lot. – Abrial May 08 '12 at 04:53