/// <summary>
        /// Calculates fitness by given metric (fitness score).
        /// </summary>
        /// <remarks></remarks>
        /// <param name="result">Full results dictionary</param>
        /// <param name="fitScore">Existing score of effectivness of an algorithm</param>
        /// <param name="filterEnabled">Indicates whether need to filter the results</param>
        /// <returns></returns>
        public static decimal CalculateFitness(Dictionary <string, decimal> result, FitnessScore fitScore, bool filterEnabled)
        {
            // Calculate fitness using the chosen fitness finction
            decimal fitness;

            switch (fitScore)
            {
            case FitnessScore.SharpeRatio:
                fitness = result["SharpeRatio"];
                break;

            case FitnessScore.TotalNetProfit:
                fitness = result["TotalNetProfit"];
                break;

            default:
                throw new ArgumentOutOfRangeException(fitScore.ToString(), "StatisticsAdapter.CalculateFitness() : default");
            }

            // apply filter if enabled
            if (filterEnabled)
            {
                if (!FitnessFilter.IsSuccess(result) || fitness < 0)
                {
                    fitness = FitnessFilter.ErrorValue;
                }
            }

            return(fitness);
        }
 public override string ToString()
 {
     return("Id#" + m_network.Id + ", F=" + FitnessScore.ToString("F3"));
 }
Esempio n. 3
0
 public override string MakeFitnessScore()
 {
     FitnessScore = HelperFunctions.ReflFitnessScore(ReflData.Instance.GetReflData, ReflectivityMap, HighQOffset, LowQOffset, ParamSize());
     return(FitnessScore.ToString("#.### E-0"));
 }
Esempio n. 4
0
 public override string MakeFitnessScore()
 {
     FitnessScore = HelperFunctions.EDFitnessScore(RealRho, ElectronDensityArray, 0, 0, ParamSize());
     return(FitnessScore.ToString("##.### E-0"));
 }