[Quantproject-developers] QuantProject/b1_ADT/Optimizing/Genetic GeneticOptimizer.cs,1.13,1.14
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2006-05-07 22:15:26
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23425 Modified Files: GeneticOptimizer.cs Log Message: Fixed minor bugs: - now the best genome of the previous generation is inherited automatically by the next generation (even when elitism rate is set to 0); - best and worst genomes are now always clones (also at the first population's creation). Index: GeneticOptimizer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/GeneticOptimizer.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GeneticOptimizer.cs 8 Nov 2005 18:32:25 -0000 1.13 --- GeneticOptimizer.cs 7 May 2006 22:15:22 -0000 1.14 *************** *** 412,416 **** for(int i = populationSize - 1; ! i >=(populationSize - this.elitismRate*this.populationSize); i--) { --- 412,416 ---- for(int i = populationSize - 1; ! i >=(populationSize - this.elitismRate*this.populationSize - 1); i--) { *************** *** 521,526 **** private void setInitialBestAndWorstGenomes() { ! this.bestGenome = (Genome)this.currentGeneration[this.populationSize-1]; ! this.worstGenome = (Genome)this.currentGeneration[0]; } --- 521,526 ---- private void setInitialBestAndWorstGenomes() { ! this.bestGenome = ((Genome)this.currentGeneration[this.populationSize-1]).Clone(); ! this.worstGenome = ((Genome)this.currentGeneration[0]).Clone(); } |