[Quantproject-developers] QuantProject/b3_Data/Selectors/ByLinearIndipendence GenomeManagerForMaxL
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2006-08-07 21:03:30
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors/ByLinearIndipendence In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22618/b3_Data/Selectors/ByLinearIndipendence Modified Files: GenomeManagerForMaxLinearIndipendenceSelector.cs Log Message: Changed IGenomeManager interface. Now, properties MinValueForGenes and MaxValueForGenes have been replaced by GetMinValueForGenes(int genePosition) and GetMaxValueForGenes(int genePosition) methods. Property CurrentGeneticOptimizer has been deleted from the interface. Modified the constructor of Genome class: now a GeneticOptimizer object is necessary for a creating a new instance of Genome. Some useless code has been deleted through out the classes used for genetic optimization. Index: GenomeManagerForMaxLinearIndipendenceSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/ByLinearIndipendence/GenomeManagerForMaxLinearIndipendenceSelector.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GenomeManagerForMaxLinearIndipendenceSelector.cs 2 Jul 2006 19:17:20 -0000 1.1 --- GenomeManagerForMaxLinearIndipendenceSelector.cs 7 Aug 2006 21:03:24 -0000 1.2 *************** *** 46,50 **** private int minValueForGenes; private int maxValueForGenes; - private GeneticOptimizer currentGeneticOptimizer; private double[,] correlationMatrix; --- 46,49 ---- *************** *** 55,73 **** } - public int MinValueForGenes - { - get{return this.minValueForGenes;} - } - - public int MaxValueForGenes - { - get{return this.maxValueForGenes;} - } - - public GeneticOptimizer CurrentGeneticOptimizer - { - get{return this.currentGeneticOptimizer;} - set{this.currentGeneticOptimizer = value;} - } //end of interface implementation for properties --- 54,57 ---- *************** *** 86,89 **** --- 70,83 ---- } + public int GetMinValueForGenes(int genePosition) + { + return this.minValueForGenes; + } + + public int GetMaxValueForGenes(int genePosition) + { + return this.maxValueForGenes; + } + private void setMinAndMaxValueForGenes() { *************** *** 135,145 **** public int GetNewGeneValue(Genome genome, int genePosition) { ! int returnValue = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); while( genome.HasGene(returnValue) ) //the genome to be examined shouldn't have a duplicate { ! returnValue = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); } return returnValue; --- 129,139 ---- public int GetNewGeneValue(Genome genome, int genePosition) { ! int returnValue = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1); while( genome.HasGene(returnValue) ) //the genome to be examined shouldn't have a duplicate { ! returnValue = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePosition), ! genome.GetMaxValueForGenes(genePosition) + 1); } return returnValue; *************** *** 148,159 **** public void Mutate(Genome genome, double mutationRate) { ! int newValueForGene = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes +1); ! int genePositionToBeMutated = GenomeManagement.RandomGenerator.Next(genome.Size); while( genome.HasGene(newValueForGene) ) //genome shouldn't have a duplicated gene { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.MinValueForGenes, ! genome.MaxValueForGenes + 1); } GenomeManagement.MutateOneGene(genome, mutationRate, --- 142,154 ---- public void Mutate(Genome genome, double mutationRate) { ! ! int genePositionToBeMutated = GenomeManagement.RandomGenerator.Next(genome.Size); ! int newValueForGene = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePositionToBeMutated), ! genome.GetMaxValueForGenes(genePositionToBeMutated) + 1); while( genome.HasGene(newValueForGene) ) //genome shouldn't have a duplicated gene { ! newValueForGene = GenomeManagement.RandomGenerator.Next(genome.GetMinValueForGenes(genePositionToBeMutated), ! genome.GetMaxValueForGenes(genePositionToBeMutated) + 1); } GenomeManagement.MutateOneGene(genome, mutationRate, |