Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/18/16 15:50:10 (6 years ago)
Author:
bwerth
Message:

#1087 refactored Analyzers to use ResultParameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Analyzers/GenerationalDistanceAnalyzer.cs

    r14085 r14097  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using HeuristicLab.Common;
     
    4344    }
    4445
     46    public IResultParameter<DoubleValue> GenerationalDistanceResultParameter {
     47      get { return (IResultParameter<DoubleValue>)Parameters["Generational Distance"]; }
     48    }
     49
    4550    [StorableConstructor]
    4651    protected GenerationalDistanceAnalyzer(bool deserializing) : base(deserializing) { }
     
    5257    public GenerationalDistanceAnalyzer() {
    5358      Parameters.Add(new FixedValueParameter<DoubleValue>("Dampening", "", new DoubleValue(1)));
     59      Parameters.Add(new ResultParameter<DoubleValue>("Generational Distance", "The genrational distance between the current front and the optimal front"));
     60      GenerationalDistanceResultParameter.DefaultValue = new DoubleValue(double.NaN);
     61
    5462    }
    5563
    5664    public override IOperation Apply() {
    57       var results = ResultsParameter.ActualValue;
    5865      var qualities = QualitiesParameter.ActualValue;
    5966      int objectives = qualities[0].Length;
     
    6269      if (optimalfront == null) return base.Apply();
    6370
    64       if (!results.ContainsKey("GenerationalDistance")) results.Add(new Result("GenerationalDistance", new DoubleValue()));
    65       var resultValue = (DoubleValue)results["GenerationalDistance"].Value;
    66 
    6771      var distance = GenerationalDistance.Calculate(qualities.Select(x => x.CloneAsArray()), optimalfront, Dampening);
    68       resultValue.Value = distance;
     72      GenerationalDistanceResultParameter.ActualValue.Value = distance;
    6973
    7074      return base.Apply();
Note: See TracChangeset for help on using the changeset viewer.