[Quantproject-developers] QuantProject/b4_Business/a2_Strategies/InSample GeneticChooser.cs, 1.8,
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2008-03-09 21:42:27
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30434 Modified Files: GeneticChooser.cs Log Message: Fixed bug in AnalyzeInSample method: now a new TestingPositions object is returnes Index: GeneticChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample/GeneticChooser.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GeneticChooser.cs 7 Mar 2008 23:27:13 -0000 1.8 --- GeneticChooser.cs 9 Mar 2008 21:42:21 -0000 1.9 *************** *** 55,59 **** //the method that returns the hash code for genome //is virtual) ! protected TestingPositions[] bestTestingPositions; protected Benchmark benchmark; protected IDecoderForTestingPositions decoderForTestingPositions; --- 55,59 ---- //the method that returns the hash code for genome //is virtual) ! // protected TestingPositions[] bestTestingPositions; protected Benchmark benchmark; protected IDecoderForTestingPositions decoderForTestingPositions; *************** *** 104,110 **** this.numberOfPortfolioPositions = numberOfPortfolioPositions; this.numberOfBestTestingPositionsToBeReturned = numberOfBestTestingPositionsToBeReturned; - // this.choosePositionsWithAtLeastOneDifferentTicker = - // choosePositionsWithAtLeastOneDifferentTicker; - this.bestTestingPositions = new TestingPositions[numberOfBestTestingPositionsToBeReturned]; this.benchmark = benchmark; this.decoderForTestingPositions = decoderForTestingPositions; --- 104,107 ---- *************** *** 186,191 **** ! private void setBestTestingPositions() { GeneticOptimizer GO = this.geneticOptimizer; int addedTestingPositions = 0; --- 183,189 ---- ! private TestingPositions[] getBestTestingPositionsInSample_getTestingPositionsActually() { + TestingPositions[] bestTestingPositions = new TestingPositions[numberOfBestTestingPositionsToBeReturned]; GeneticOptimizer GO = this.geneticOptimizer; int addedTestingPositions = 0; *************** *** 201,209 **** if( counter == 0 || !genomesCollector.ContainsKey(currentGenomeHashcode) ) { ! this.bestTestingPositions[addedTestingPositions] = (TestingPositions)currentGenome.Meaning; ! ((TestingPositions)this.bestTestingPositions[addedTestingPositions]).FitnessInSample = currentGenome.Fitness; ! ((IGeneticallyOptimizable)this.bestTestingPositions[addedTestingPositions]).Generation = currentGenome.Generation; genomesCollector.Add(currentGenomeHashcode, null); --- 199,207 ---- if( counter == 0 || !genomesCollector.ContainsKey(currentGenomeHashcode) ) { ! bestTestingPositions[addedTestingPositions] = (TestingPositions)currentGenome.Meaning; ! ((TestingPositions)bestTestingPositions[addedTestingPositions]).FitnessInSample = currentGenome.Fitness; ! ((IGeneticallyOptimizable)bestTestingPositions[addedTestingPositions]).Generation = currentGenome.Generation; genomesCollector.Add(currentGenomeHashcode, null); *************** *** 211,215 **** } counter ++ ; ! } } --- 209,214 ---- } counter ++ ; ! } ! return bestTestingPositions; } *************** *** 235,241 **** new NewGenerationEventHandler( this.newGenerationEventHandler ); this.geneticOptimizer.Run( false ); ! this.setBestTestingPositions(); ! ! return this.bestTestingPositions; } --- 234,239 ---- new NewGenerationEventHandler( this.newGenerationEventHandler ); this.geneticOptimizer.Run( false ); ! ! return this.getBestTestingPositionsInSample_getTestingPositionsActually(); } |