[Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTesting GenomeManagerForWeightedE
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2006-06-02 18:58:14
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv19211/b7_Scripts/TickerSelectionTesting Modified Files: GenomeManagerForWeightedEfficientPortfolio.cs Log Message: getTickerWeight method has been simplified and a bug has been fixed Index: GenomeManagerForWeightedEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForWeightedEfficientPortfolio.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GenomeManagerForWeightedEfficientPortfolio.cs 17 Nov 2005 21:37:19 -0000 1.2 --- GenomeManagerForWeightedEfficientPortfolio.cs 2 Jun 2006 18:58:09 -0000 1.3 *************** *** 62,77 **** protected override double getTickerWeight(int[] genes, int tickerPositionInGenes) { ! double totalReturnedByWeights = ! (1.0-ConstantsProvider.MinimumPortfolioWeightForTicker*genes.Length/2)/ConstantsProvider.MinimumPortfolioWeightForTicker; ! int totalOfAbsoluteValuesForWeightsInGenes = 0; for(int j = 0; j<genes.Length; j++) { if(j%2==0) //ticker weight is contained in genes at even position ! totalOfAbsoluteValuesForWeightsInGenes += (int)Math.Abs(genes[j]); } ! double min = ConstantsProvider.MinimumPortfolioWeightForTicker; ! ! return min*(1.0 + totalReturnedByWeights * Math.Abs(genes[tickerPositionInGenes-1])/totalOfAbsoluteValuesForWeightsInGenes); } --- 62,76 ---- protected override double getTickerWeight(int[] genes, int tickerPositionInGenes) { ! double minimumWeight = ConstantsProvider.MinimumPortfolioWeightForTicker; ! double totalOfValuesForWeightsInGenes = 0.0; for(int j = 0; j<genes.Length; j++) { if(j%2==0) //ticker weight is contained in genes at even position ! totalOfValuesForWeightsInGenes += Math.Abs(genes[j]) + 1.0; ! //0 has to be avoided ! } ! double freeWeight = (Math.Abs(genes[tickerPositionInGenes-1]) + 1.0)/totalOfValuesForWeightsInGenes; ! return minimumWeight + freeWeight * (1.0 - minimumWeight * genes.Length / 2); } |