Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/18/16 15:50:10 (8 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/CrowdingAnalyzer.cs

    r14085 r14097  
    3737    }
    3838
     39    public IResultParameter<DoubleValue> CrowdingResultParameter {
     40      get { return (IResultParameter<DoubleValue>)Parameters["Crowding"]; }
     41    }
     42
    3943    [StorableConstructor]
    4044    protected CrowdingAnalyzer(bool deserializing) : base(deserializing) { }
     
    4953      Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds",
    5054        "The bounds of the solution given as either one line for all variables or a line for each variable. The first column specifies lower bound, the second upper bound."));
     55      Parameters.Add(new ResultParameter<DoubleValue>("Crowding", "The average corwding value of all points (excluding infinities)"));
     56      CrowdingResultParameter.DefaultValue = new DoubleValue(double.NaN);
     57
    5158    }
    5259
    5360    public override IOperation Apply() {
    54       var results = ResultsParameter.ActualValue;
    5561      var qualities = QualitiesParameter.ActualValue;
    5662      var bounds = BoundsParameter.ActualValue;
    5763
    58       if (!results.ContainsKey("Crowding")) results.Add(new Result("Crowding", new DoubleValue()));
    59       var resultValue = (DoubleValue)results["Crowding"].Value;
    60 
    6164      var crowdingDistance = Crowding.Calculate(qualities.Select(x => x.ToArray()), bounds.CloneAsMatrix());
    62       resultValue.Value = crowdingDistance;
     65      CrowdingResultParameter.ActualValue.Value = crowdingDistance;
    6366
    6467      return base.Apply();
Note: See TracChangeset for help on using the changeset viewer.