Changeset 14085 for branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Analyzers/CrowdingAnalyzer.cs
- Timestamp:
- 07/15/16 14:14:50 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Analyzers/CrowdingAnalyzer.cs
r14044 r14085 25 25 using HeuristicLab.Data; 26 26 using HeuristicLab.Optimization; 27 using HeuristicLab.Parameters; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 29 … … 31 32 [Item("CrowdingAnalyzer", "The mean crowding distance for each point of the Front (see Multi-Objective Performance Metrics - Shodhganga for more information)")] 32 33 public class CrowdingAnalyzer : MOTFAnalyzer { 34 35 public ILookupParameter<DoubleMatrix> BoundsParameter { 36 get { return (ILookupParameter<DoubleMatrix>)Parameters["Bounds"]; } 37 } 33 38 34 39 [StorableConstructor] … … 41 46 } 42 47 43 public CrowdingAnalyzer() { } 48 public CrowdingAnalyzer() { 49 Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", 50 "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.")); 51 } 44 52 45 53 public override IOperation Apply() { 46 54 var results = ResultsParameter.ActualValue; 47 55 var qualities = QualitiesParameter.ActualValue; 48 var testFunction = TestFunctionParameter.ActualValue; 49 int objectives = qualities[0].Length; 56 var bounds = BoundsParameter.ActualValue; 50 57 51 58 if (!results.ContainsKey("Crowding")) results.Add(new Result("Crowding", new DoubleValue())); 52 59 var resultValue = (DoubleValue)results["Crowding"].Value; 53 60 54 var crowdingDistance = Crowding.Calculate(qualities.Select(x => x.ToArray()), testFunction.Bounds(objectives));61 var crowdingDistance = Crowding.Calculate(qualities.Select(x => x.ToArray()), bounds.CloneAsMatrix()); 55 62 resultValue.Value = crowdingDistance; 56 63
Note: See TracChangeset
for help on using the changeset viewer.