Ejemplo n.º 1
0
        /// <summary>
        /// Write fitness-trace to a TextWriter stream.
        /// </summary>
        public override void Write(TextWriter writer)
        {
            writer.WriteLine("# Iteration\tMin\tQ1\tMedian\tQ3\tMax");
            writer.WriteLine();

            for (int i = 0; i < Trace.Length; i++)
            {
                Quartiles quartiles = new Quartiles();

                double[] traceArray = Trace[i].ToArray();

                if (traceArray.Length > 0)
                {
                    quartiles.ComputeUnsortedInplace(traceArray);

                    writer.WriteLine("{0} {1} {2} {3} {4} {5}", Iteration(i), Tools.FormatNumber(quartiles.Min),
                        Tools.FormatNumber(quartiles.Q1), Tools.FormatNumber(quartiles.Median),
                        Tools.FormatNumber(quartiles.Q3), Tools.FormatNumber(quartiles.Max));
                }
                else
                {
                    break;
                }
            }

            writer.Close();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Compute the statistics. Call this after all
        /// optimization runs have executed.
        /// </summary>
        public void Compute()
        {
            FitnessQuartiles    = new Quartiles();
            IterationsQuartiles = new Quartiles();

            if (Results.Count > 0)
            {
                // Fitness quartiles.
                double[] fitnessArray = Results.Select(o => o.Fitness).ToArray();
                FitnessQuartiles.ComputeUnsortedInplace(fitnessArray);

                // Iterations quartiles.
                double[] iterationsArray = Results.Select(o => o.Iterations).ToArray();
                IterationsQuartiles.ComputeUnsortedInplace(iterationsArray);

                // Fitness mean and stddev.
                FitnessMean   = Results.Average(o => o.Fitness);
                FitnessStdDev = Results.StdDev(o => o.Fitness);

                // Iterations mean and stddev.
                IterationsMean   = Results.Average(o => o.Iterations);
                IterationsStdDev = Results.StdDev(o => o.Iterations);
            }
            else
            {
                // Fitness mean and stddev.
                FitnessMean   = null;
                FitnessStdDev = null;

                // Iterations mean and stddev.
                IterationsMean   = null;
                IterationsStdDev = null;
            }

            // Best results.
            BestResults = Results.Where(o => o.Fitness == FitnessMin);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Write fitness-trace to a TextWriter stream.
        /// </summary>
        public override void Write(TextWriter writer)
        {
            writer.WriteLine("# Iteration\tMin\tQ1\tMedian\tQ3\tMax");
            writer.WriteLine();

            for (int i = 0; i < Trace.Length; i++)
            {
                Quartiles quartiles = new Quartiles();

                double[] traceArray = Trace[i].ToArray();

                if (traceArray.Length > 0)
                {
                    quartiles.ComputeUnsortedInplace(traceArray);

                    writer.WriteLine(
                        "{0} {1} {2} {3} {4} {5}",
                        Iteration(i),
                        Tools.FormatNumber(quartiles.Min),
                        Tools.FormatNumber(quartiles.Q1),
                        Tools.FormatNumber(quartiles.Median),
                        Tools.FormatNumber(quartiles.Q3),
                        Tools.FormatNumber(quartiles.Max));
                }
                else
                {
                    break;
                }
            }

            writer.Close();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Compute the statistics. Call this after all
        /// optimization runs have executed.
        /// </summary>
        public void Compute()
        {
            FitnessQuartiles = new Quartiles();
            IterationsQuartiles = new Quartiles();

            if (Results.Count > 0)
            {
                // Fitness quartiles.
                double[] fitnessArray = Results.Select(o => o.Fitness).ToArray();
                FitnessQuartiles.ComputeUnsortedInplace(fitnessArray);

                // Iterations quartiles.
                double[] iterationsArray = Results.Select(o => o.Iterations).ToArray();
                IterationsQuartiles.ComputeUnsortedInplace(iterationsArray);

                // Fitness mean and stddev.
                FitnessMean = Results.Average(o => o.Fitness);
                FitnessStdDev = Results.StdDev(o => o.Fitness);

                // Iterations mean and stddev.
                IterationsMean = Results.Average(o => o.Iterations);
                IterationsStdDev = Results.StdDev(o => o.Iterations);
            }
            else
            {
                // Fitness mean and stddev.
                FitnessMean = null;
                FitnessStdDev = null;

                // Iterations mean and stddev.
                IterationsMean = null;
                IterationsStdDev = null;
            }

            // Best results.
            BestResults = Results.Where(o => o.Fitness == FitnessMin);
        }