Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/21/15 17:42:18 (9 years ago)
Author:
pfleck
Message:

#2269

  • Changed the age type from int to double.
  • Changed EldersSelector to make use of a ScopeTreeLookupParameter.
  • Removed unused operators in LayerUpdator.
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  
    3737
    3838    #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"]; }
    4141    }
    4242    public ValueLookupParameter<ResultCollection> ResultsParameter {
     
    7878    public AgeDistributionAnalyzer()
    7979      : 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."));
    8181      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection where the analysis values should be stored."));
    8282      Parameters.Add(new FixedValueParameter<StringValue>("HistogramName", "The name of the histogram that gets injected in to the results collection.", new StringValue("Age Distribution")));
     
    110110      }
    111111      var ages = AgeParameter.ActualValue;
    112       row.Values.Replace(ages.Select(x => (double)x.Value));
     112      row.Values.Replace(ages.Select(x => x.Value));
    113113
    114114      if (StoreHistory) {
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/OldestAverageYoungestAgeAnalyzer.cs

    r12996 r13046  
    3636  public sealed class OldestAverageYoungestAgeAnalyzer : AlgorithmOperator, IAnalyzer {
    3737    #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"]; }
    4040    }
    41     public IValueLookupParameter<IntValue> CurrentOldestAgeParameter {
    42       get { return (IValueLookupParameter<IntValue>)Parameters["CurrentOldestAge"]; }
     41    public IValueLookupParameter<DoubleValue> CurrentOldestAgeParameter {
     42      get { return (IValueLookupParameter<DoubleValue>)Parameters["CurrentOldestAge"]; }
    4343    }
    44     public IValueLookupParameter<IntValue> CurrentAverageAgeParameter {
    45       get { return (IValueLookupParameter<IntValue>)Parameters["CurrentAverageAge"]; }
     44    public IValueLookupParameter<DoubleValue> CurrentAverageAgeParameter {
     45      get { return (IValueLookupParameter<DoubleValue>)Parameters["CurrentAverageAge"]; }
    4646    }
    47     public IValueLookupParameter<IntValue> CurrentYoungestAgeParameter {
    48       get { return (IValueLookupParameter<IntValue>)Parameters["CurrentYoungestAge"]; }
     47    public IValueLookupParameter<DoubleValue> CurrentYoungestAgeParameter {
     48      get { return (IValueLookupParameter<DoubleValue>)Parameters["CurrentYoungestAge"]; }
    4949    }
    5050    public IValueLookupParameter<DataTable> AgesParameter {
     
    7979      : base() {
    8080      #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."));
    8585      Parameters.Add(new ValueLookupParameter<DataTable>("Ages", "The data table to store the current oldest, current average, current youngest age value."));
    8686      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection where the analysis values should be stored."));
     
    103103      oldestAverageYoungestAgeCalculator.YoungestAgeParameter.ActualName = CurrentYoungestAgeParameter.Name;
    104104
    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));
    108108      dataTableValuesCollector.DataTableParameter.ActualName = AgesParameter.Name;
    109109
    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));
    113110      resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(AgesParameter.Name));
    114111      resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name;
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/OldestAverageYoungestAgeCalculator.cs

    r12570 r13046  
    3131  [StorableClass]
    3232  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"]; }
    3535    }
    36     public IValueLookupParameter<IntValue> OldestAgeParameter {
    37       get { return (IValueLookupParameter<IntValue>)Parameters["OldestAge"]; }
     36    public IValueLookupParameter<DoubleValue> OldestAgeParameter {
     37      get { return (IValueLookupParameter<DoubleValue>)Parameters["OldestAge"]; }
    3838    }
    39     public IValueLookupParameter<IntValue> AverageAgeParameter {
    40       get { return (IValueLookupParameter<IntValue>)Parameters["AverageAge"]; }
     39    public IValueLookupParameter<DoubleValue> AverageAgeParameter {
     40      get { return (IValueLookupParameter<DoubleValue>)Parameters["AverageAge"]; }
    4141    }
    42     public IValueLookupParameter<IntValue> YoungestAgeParameter {
    43       get { return (IValueLookupParameter<IntValue>)Parameters["YoungestAge"]; }
     42    public IValueLookupParameter<DoubleValue> YoungestAgeParameter {
     43      get { return (IValueLookupParameter<DoubleValue>)Parameters["YoungestAge"]; }
    4444    }
    4545
     
    5555    public OldestAverageYoungestAgeCalculator()
    5656      : 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."));
    6161
    6262      OldestAgeParameter.Hidden = true;
     
    6969
    7070      if (ages.Length > 0) {
    71         int min = int.MaxValue, max = int.MinValue, sum = 0;
     71        double min = double.MaxValue, max = double.MinValue, sum = 0;
    7272        for (int i = 0; i < ages.Length; i++) {
    7373          if (ages[i].Value < min) min = ages[i].Value;
     
    7777
    7878        var oldest = OldestAgeParameter.ActualValue;
    79         if (oldest == null) OldestAgeParameter.ActualValue = new IntValue(max);
     79        if (oldest == null) OldestAgeParameter.ActualValue = new DoubleValue(max);
    8080        else oldest.Value = max;
    8181        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);
    8383        else average.Value = sum / ages.Length;
    8484        var youngest = YoungestAgeParameter.ActualValue;
    85         if (youngest == null) YoungestAgeParameter.ActualValue = new IntValue(min);
     85        if (youngest == null) YoungestAgeParameter.ActualValue = new DoubleValue(min);
    8686        else youngest.Value = min;
    8787      }
Note: See TracChangeset for help on using the changeset viewer.