public override IOperation Apply()
        {
            var qualities      = QualitiesParameter.ActualValue;
            var testFunction   = TestFunctionParameter.ActualValue;
            int objectives     = qualities[0].Length;
            var referencePoint = ReferencePointParameter.ActualValue;

            double best = BestKnownHypervolumeResultParameter.ActualValue.Value;

            if (referencePoint.SequenceEqual(testFunction.ReferencePoint(objectives)))
            {
                best = Math.Max(best, testFunction.OptimalHypervolume(objectives));
            }

            IEnumerable <double[]> front = NonDominatedSelect.SelectNonDominatedVectors(qualities.Select(q => q.ToArray()), testFunction.Maximization(objectives), true);

            double hv = Hypervolume.Calculate(front, referencePoint.ToArray(), testFunction.Maximization(objectives));

            if (hv > best)
            {
                best = hv;
            }

            HypervolumeResultParameter.ActualValue.Value          = hv;
            BestKnownHypervolumeResultParameter.ActualValue.Value = best;
            HypervolumeDistanceResultParameter.ActualValue.Value  = best - hv;

            return(base.Apply());
        }
Esempio n. 2
0
 protected override double GetBestKnownHypervolume(int objectives)
 {
     return(Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives)));
 }