[Quantproject-developers] QuantProject/b1_ADT/Optimizing/Genetic Genome.cs, 1.17, 1.18
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2007-06-29 15:18:27
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26958 Modified Files: Genome.cs Log Message: Fixed bug in Genome's Fitness property. Index: Genome.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/Genome.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Genome.cs 20 Jun 2007 14:56:59 -0000 1.17 --- Genome.cs 29 Jun 2007 15:18:21 -0000 1.18 *************** *** 61,64 **** --- 61,71 ---- } + private void setFitnessValue(double fitnessValue) + { + this.fitness = fitnessValue; + this.hasFitnessBeenAssigned = true; + } + + public double Fitness { *************** *** 70,78 **** if ( ! this.hasFitnessBeenAssigned ) // the genome's fitness has not been assigned yet ! { ! this.fitness = this.genomeManager.GetFitnessValue(this); ! this.hasFitnessBeenAssigned = true; ! } ! return this.fitness; } } --- 77,83 ---- if ( ! this.hasFitnessBeenAssigned ) // the genome's fitness has not been assigned yet ! this.setFitnessValue(this.genomeManager.GetFitnessValue(this)); ! ! return this.fitness; } } *************** *** 166,170 **** Genome returnValue = new Genome(this.genomeManager, this.geneticOptimizer); returnValue.CopyValuesInGenes(this.genes); ! returnValue.fitness = this.fitness; returnValue.meaning = this.meaning; returnValue.generation = this.Generation; --- 171,175 ---- Genome returnValue = new Genome(this.genomeManager, this.geneticOptimizer); returnValue.CopyValuesInGenes(this.genes); ! returnValue.setFitnessValue(this.fitness); returnValue.meaning = this.meaning; returnValue.generation = this.Generation; |