Hi, I'm trying to use the Genotype.getFittestChromosomes(int n) method for, after finish the evolves method, get the best half of the initial population and begin a evolution again... when a try to reset the Configuration object like this:
...
Configuration conf = new Configuration(name, id);
... set the configuration attributes
// Evolve
Genotype population = null;
Population bestChromosomes;
while (populationSize > 3) {
Configuration.reset();
conf = new Configuration(name, id);
... re-set the configuration attributes
conf.setPopulationSize(populationSize);
if (population == null) {
// Creating the initial random population
population = Genotype.randomInitialGenotype(conf);
} else {
// Creating the population based on half of the last population
bestChromosomes = new Population(conf, (IChromosome[]) population.getFittestChromosomes(populationSize).toArray());
population = new Genotype(conf, bestChromosomes);
}
population.evolve(2);
populationSize = populationSize / 2;
}
After I get the error:
Exception in thread "main" java.lang.RuntimeException: Fitness evaluator has already been set differently.
If you want to set or construct a configuration multiple times, please call static method Configuration.reset() before each setting!
at org.jgap.Configuration.checkProperty(Configuration.java:549)
at org.jgap.Configuration.setFitnessEvaluator(Configuration.java:1257)
at br.ufjf.quimica.gfqsi.sst.ga.adsorbateposition.AdsorbatePositionGA.setConfiguration(AdsorbatePositionGA.java:230)
at br.ufjf.quimica.gfqsi.sst.ga.adsorbateposition.AdsorbatePositionGA.beginGeneticAlgorithm(AdsorbatePositionGA.java:267)
at br.ufjf.quimica.gfqsi.sst.ga.adsorbateposition.AdsorbatePositionGA.run(AdsorbatePositionGA.java:214)
at br.ufjf.quimica.gfqsi.sst.SSTApp.main(SSTApp.java:215)
What is the best way to create a configuration multiple times?
Thanks very much!
Ary Junior
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php_______________________________________________
jgap-users mailing list
jgap-users@...
https://lists.sourceforge.net/lists/listinfo/jgap-users