[Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTesting MeaningForGenome.cs,NONE,1.
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-10-21 18:14:12
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20797/b7_Scripts/TickerSelectionTesting Modified Files: GenomeManagerForEfficientPortfolio.cs Added Files: MeaningForGenome.cs Log Message: Added MeaningForGenome class, to be used inside the TickerSelectionTesting namespace. Decode implementation in GenomeManagerForEfficientPortfolio (and so the Meaning property for the correlated Genome) has been changed. --- NEW FILE: MeaningForGenome.cs --- /* QuantProject - Quantitative Finance Library MeaningForGenome.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using System.Collections; using QuantProject.ADT.Statistics; using QuantProject.ADT.Optimizing.Genetic; using QuantProject.Data; using QuantProject.Data.DataTables; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; namespace QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios { /// <summary> /// This is the class representing the meaning for genome /// </summary> [Serializable] public class MeaningForGenome { private string[] tickers; private double returnAtLastDayInSample; private double averageReturnInSample; private double varianceReturnInSample; public string[] Tickers { get{return this.tickers;} } public double ReturnAtLastDayInSample { get{return this.returnAtLastDayInSample;} } public double AverageReturnInSample { get{return this.averageReturnInSample;} } public double VarianceReturnInSample { get{return this.varianceReturnInSample;} } public MeaningForGenome(string[] tickers) { this.tickers = tickers; } public MeaningForGenome(string[] tickers, double returnAtLastDayInSample, double averageReturnInSample, double varianceReturnInSample) { this.tickers = tickers; this.returnAtLastDayInSample = returnAtLastDayInSample; this.averageReturnInSample = averageReturnInSample; this.varianceReturnInSample = varianceReturnInSample; } } } Index: GenomeManagerForEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientPortfolio.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** GenomeManagerForEfficientPortfolio.cs 10 Aug 2005 16:47:59 -0000 1.18 --- GenomeManagerForEfficientPortfolio.cs 21 Oct 2005 18:14:04 -0000 1.19 *************** *** 105,108 **** --- 105,112 ---- set{this.currentGeneticOptimizer = value;} } + public double[] PortfolioRatesOfReturn + { + get{return this.portfolioRatesOfReturn;} + } //setOfInitialTickers has to contain the *************** *** 279,283 **** public virtual object Decode(Genome genome) { ! string[] arrayOfTickers = new string[genome.Genes().Length]; int indexOfTicker; for(int index = 0; index < genome.Genes().Length; index++) --- 283,288 ---- public virtual object Decode(Genome genome) { ! ! string[] arrayOfTickers = new string[genome.Genes().Length]; int indexOfTicker; for(int index = 0; index < genome.Genes().Length; index++) *************** *** 286,290 **** arrayOfTickers[index] = this.decode_getTickerCodeForLongOrShortTrade(indexOfTicker); } ! return arrayOfTickers; } --- 291,299 ---- arrayOfTickers[index] = this.decode_getTickerCodeForLongOrShortTrade(indexOfTicker); } ! MeaningForGenome meaning = new MeaningForGenome(arrayOfTickers, ! this.PortfolioRatesOfReturn[this.portfolioRatesOfReturn.Length - 1], ! this.RateOfReturn, ! this.Variance); ! return meaning; } |