public SMPSO(Problem problem, string trueParetoFront)
            : base(problem)
        {
            hy = new HyperVolume();
            MetricsUtil mu = new MetricsUtil();

            trueFront       = mu.ReadNonDominatedSolutionSet(trueParetoFront);
            trueHypervolume = hy.Hypervolume(trueFront.WriteObjectivesToMatrix(),
                                             trueFront.WriteObjectivesToMatrix(),
                                             problem.NumberOfObjectives);

            // Default configuration
            r1Max  = 1.0;
            r1Min  = 0.0;
            r2Max  = 1.0;
            r2Min  = 0.0;
            C1Max  = 2.5;
            C1Min  = 1.5;
            C2Max  = 2.5;
            C2Min  = 1.5;
            WMax   = 0.1;
            WMin   = 0.1;
            ChVel1 = -1;
            ChVel2 = -1;
        }
        public SMPSO(Problem problem,
                     List <double> variables,
                     string trueParetoFront)
            : base(problem)
        {
            r1Max  = variables[0];
            r1Min  = variables[1];
            r2Max  = variables[2];
            r2Min  = variables[3];
            C1Max  = variables[4];
            C1Min  = variables[5];
            C2Max  = variables[6];
            C2Min  = variables[7];
            WMax   = variables[8];
            WMin   = variables[9];
            ChVel1 = variables[10];
            ChVel2 = variables[11];

            hy = new HyperVolume();
            MetricsUtil mu = new MetricsUtil();

            trueFront       = mu.ReadNonDominatedSolutionSet(trueParetoFront);
            trueHypervolume = hy.Hypervolume(trueFront.WriteObjectivesToMatrix(),
                                             trueFront.WriteObjectivesToMatrix(),
                                             problem.NumberOfObjectives);
        }
Esempio n. 3
0
        public IDictionary <string, IDictionary <string, IDictionary <string, List <double> > > > GetIndicators()
        {
            GenerateReferenceParetoFronts();

            var         indicators = new Dictionary <string, IDictionary <string, IDictionary <string, List <double> > > >();
            MetricsUtil utils      = new MetricsUtil();

            for (int i = 0, li = experiment.QualityIndicators.Count; i < li; i++)
            {
                string indicatorString = experiment.QualityIndicators[i].ToUpper();
                double value           = 0;

                var problems = new Dictionary <string, IDictionary <string, List <double> > >();
                indicators.Add(indicatorString, problems);

                foreach (var problem in experiment.ExperimentProblems)
                {
                    var algorithm = new Dictionary <string, List <double> >();
                    problems.Add(problem.Alias, algorithm);

                    var trueFront = utils.ReadFront(problem.ParetoFront);

                    foreach (var algorithmDictionary in problem.AlgorithmDictionary)
                    {
                        var indicator = new List <double>();

                        algorithm.Add(algorithmDictionary.Key, indicator);

                        foreach (var alg in algorithmDictionary.Value)
                        {
                            var solutionFront = alg.Result.GetObjectives();

                            switch (indicatorString)
                            {
                            case "HV":
                                HyperVolume hv = new HyperVolume();
                                value = hv.Hypervolume(solutionFront, trueFront, trueFront[0].Length);
                                break;

                            case "SPREAD":
                                Spread spread = new Spread();
                                value = spread.CalculateSpread(solutionFront, trueFront, trueFront[0].Length);
                                break;

                            case "IGD":
                                InvertedGenerationalDistance igd = new InvertedGenerationalDistance();
                                value = igd.CalculateInvertedGenerationalDistance(solutionFront, trueFront, trueFront[0].Length);
                                break;

                            case "EPSILON":
                                Epsilon epsilon = new Epsilon();
                                value = epsilon.CalcualteEpsilon(solutionFront, trueFront, trueFront[0].Length);
                                break;
                            }

                            indicator.Add(value);
                        }
                    }
                }
            }
            return(indicators);
        }