- Timestamp:
- 10/21/15 17:42:18 (9 years ago)
- Location:
- branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/AgeDistributionAnalyzer.cs
r12046 r13046 37 37 38 38 #region Parameter Properties 39 public IScopeTreeLookupParameter< IntValue> AgeParameter {40 get { return (IScopeTreeLookupParameter< IntValue>)Parameters["Age"]; }39 public IScopeTreeLookupParameter<DoubleValue> AgeParameter { 40 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Age"]; } 41 41 } 42 42 public ValueLookupParameter<ResultCollection> ResultsParameter { … … 78 78 public AgeDistributionAnalyzer() 79 79 : base() { 80 Parameters.Add(new ScopeTreeLookupParameter< IntValue>("Age", "The value which represents the age of a solution."));80 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Age", "The value which represents the age of a solution.")); 81 81 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection where the analysis values should be stored.")); 82 82 Parameters.Add(new FixedValueParameter<StringValue>("HistogramName", "The name of the histogram that gets injected in to the results collection.", new StringValue("Age Distribution"))); … … 110 110 } 111 111 var ages = AgeParameter.ActualValue; 112 row.Values.Replace(ages.Select(x => (double)x.Value));112 row.Values.Replace(ages.Select(x => x.Value)); 113 113 114 114 if (StoreHistory) { -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/OldestAverageYoungestAgeAnalyzer.cs
r12996 r13046 36 36 public sealed class OldestAverageYoungestAgeAnalyzer : AlgorithmOperator, IAnalyzer { 37 37 #region Parameter properties 38 public IScopeTreeLookupParameter< IntValue> AgeParameter {39 get { return (IScopeTreeLookupParameter< IntValue>)Parameters["Age"]; }38 public IScopeTreeLookupParameter<DoubleValue> AgeParameter { 39 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Age"]; } 40 40 } 41 public IValueLookupParameter< IntValue> CurrentOldestAgeParameter {42 get { return (IValueLookupParameter< IntValue>)Parameters["CurrentOldestAge"]; }41 public IValueLookupParameter<DoubleValue> CurrentOldestAgeParameter { 42 get { return (IValueLookupParameter<DoubleValue>)Parameters["CurrentOldestAge"]; } 43 43 } 44 public IValueLookupParameter< IntValue> CurrentAverageAgeParameter {45 get { return (IValueLookupParameter< IntValue>)Parameters["CurrentAverageAge"]; }44 public IValueLookupParameter<DoubleValue> CurrentAverageAgeParameter { 45 get { return (IValueLookupParameter<DoubleValue>)Parameters["CurrentAverageAge"]; } 46 46 } 47 public IValueLookupParameter< IntValue> CurrentYoungestAgeParameter {48 get { return (IValueLookupParameter< IntValue>)Parameters["CurrentYoungestAge"]; }47 public IValueLookupParameter<DoubleValue> CurrentYoungestAgeParameter { 48 get { return (IValueLookupParameter<DoubleValue>)Parameters["CurrentYoungestAge"]; } 49 49 } 50 50 public IValueLookupParameter<DataTable> AgesParameter { … … 79 79 : base() { 80 80 #region Create parameters 81 Parameters.Add(new ScopeTreeLookupParameter< IntValue>("Age", "The value which represents the age of a solution."));82 Parameters.Add(new ValueLookupParameter< IntValue>("CurrentOldestAge", "The oldest age value found in the current population."));83 Parameters.Add(new ValueLookupParameter< IntValue>("CurrentAverageAge", "The average age value of all solutions in the current population."));84 Parameters.Add(new ValueLookupParameter< IntValue>("CurrentYoungestAge", "The youngest age value found in the current population."));81 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Age", "The value which represents the age of a solution.")); 82 Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentOldestAge", "The oldest age value found in the current population.")); 83 Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentAverageAge", "The average age value of all solutions in the current population.")); 84 Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentYoungestAge", "The youngest age value found in the current population.")); 85 85 Parameters.Add(new ValueLookupParameter<DataTable>("Ages", "The data table to store the current oldest, current average, current youngest age value.")); 86 86 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection where the analysis values should be stored.")); … … 103 103 oldestAverageYoungestAgeCalculator.YoungestAgeParameter.ActualName = CurrentYoungestAgeParameter.Name; 104 104 105 dataTableValuesCollector.CollectedValues.Add(new LookupParameter< IntValue>("CurrentOldestAge", null, CurrentOldestAgeParameter.Name));106 dataTableValuesCollector.CollectedValues.Add(new LookupParameter< IntValue>("CurrentAverageAge", null, CurrentAverageAgeParameter.Name));107 dataTableValuesCollector.CollectedValues.Add(new LookupParameter< IntValue>("CurrentYoungestAge", null, CurrentYoungestAgeParameter.Name));105 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentOldestAge", null, CurrentOldestAgeParameter.Name)); 106 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentAverageAge", null, CurrentAverageAgeParameter.Name)); 107 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentYoungestAge", null, CurrentYoungestAgeParameter.Name)); 108 108 dataTableValuesCollector.DataTableParameter.ActualName = AgesParameter.Name; 109 109 110 //resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("CurrentOldestAge", null, CurrentOldestAgeParameter.Name));111 //resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("CurrentAverageAge", null, CurrentAverageAgeParameter.Name));112 //resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("CurrentYoungestAge", null, CurrentYoungestAgeParameter.Name));113 110 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(AgesParameter.Name)); 114 111 resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name; -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/OldestAverageYoungestAgeCalculator.cs
r12570 r13046 31 31 [StorableClass] 32 32 public sealed class OldestAverageYoungestAgeCalculator : SingleSuccessorOperator { 33 public IScopeTreeLookupParameter< IntValue> AgeParameter {34 get { return (IScopeTreeLookupParameter< IntValue>)Parameters["Age"]; }33 public IScopeTreeLookupParameter<DoubleValue> AgeParameter { 34 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Age"]; } 35 35 } 36 public IValueLookupParameter< IntValue> OldestAgeParameter {37 get { return (IValueLookupParameter< IntValue>)Parameters["OldestAge"]; }36 public IValueLookupParameter<DoubleValue> OldestAgeParameter { 37 get { return (IValueLookupParameter<DoubleValue>)Parameters["OldestAge"]; } 38 38 } 39 public IValueLookupParameter< IntValue> AverageAgeParameter {40 get { return (IValueLookupParameter< IntValue>)Parameters["AverageAge"]; }39 public IValueLookupParameter<DoubleValue> AverageAgeParameter { 40 get { return (IValueLookupParameter<DoubleValue>)Parameters["AverageAge"]; } 41 41 } 42 public IValueLookupParameter< IntValue> YoungestAgeParameter {43 get { return (IValueLookupParameter< IntValue>)Parameters["YoungestAge"]; }42 public IValueLookupParameter<DoubleValue> YoungestAgeParameter { 43 get { return (IValueLookupParameter<DoubleValue>)Parameters["YoungestAge"]; } 44 44 } 45 45 … … 55 55 public OldestAverageYoungestAgeCalculator() 56 56 : base() { 57 Parameters.Add(new ScopeTreeLookupParameter< IntValue>("Age", "The value contained in the scope tree which represents the solution age."));58 Parameters.Add(new ValueLookupParameter< IntValue>("OldestAge", "The age value of the oldest solution."));59 Parameters.Add(new ValueLookupParameter< IntValue>("AverageAge", "The average age of all solutions."));60 Parameters.Add(new ValueLookupParameter< IntValue>("YoungestAge", "The age value of the youngest solution."));57 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Age", "The value contained in the scope tree which represents the solution age.")); 58 Parameters.Add(new ValueLookupParameter<DoubleValue>("OldestAge", "The age value of the oldest solution.")); 59 Parameters.Add(new ValueLookupParameter<DoubleValue>("AverageAge", "The average age of all solutions.")); 60 Parameters.Add(new ValueLookupParameter<DoubleValue>("YoungestAge", "The age value of the youngest solution.")); 61 61 62 62 OldestAgeParameter.Hidden = true; … … 69 69 70 70 if (ages.Length > 0) { 71 int min = int.MaxValue, max = int.MinValue, sum = 0;71 double min = double.MaxValue, max = double.MinValue, sum = 0; 72 72 for (int i = 0; i < ages.Length; i++) { 73 73 if (ages[i].Value < min) min = ages[i].Value; … … 77 77 78 78 var oldest = OldestAgeParameter.ActualValue; 79 if (oldest == null) OldestAgeParameter.ActualValue = new IntValue(max);79 if (oldest == null) OldestAgeParameter.ActualValue = new DoubleValue(max); 80 80 else oldest.Value = max; 81 81 var average = AverageAgeParameter.ActualValue; 82 if (average == null) AverageAgeParameter.ActualValue = new IntValue(sum / ages.Length);82 if (average == null) AverageAgeParameter.ActualValue = new DoubleValue(sum / ages.Length); 83 83 else average.Value = sum / ages.Length; 84 84 var youngest = YoungestAgeParameter.ActualValue; 85 if (youngest == null) YoungestAgeParameter.ActualValue = new IntValue(min);85 if (youngest == null) YoungestAgeParameter.ActualValue = new DoubleValue(min); 86 86 else youngest.Value = min; 87 87 }
Note: See TracChangeset
for help on using the changeset viewer.