Ignore:
Timestamp:
10/09/15 16:54:53 (7 years ago)
Author:
pfleck
Message:

#2269

  • Removed AgeInheritance enum and used a double [0-1] instead.
  • Added a WeightingReducer that uses the new double-weight for weighting between the lower and higher value.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs

    r12996 r12997  
    104104      get { return (IValueParameter<IntValue>)Parameters["AgeGap"]; }
    105105    }
    106     private IValueParameter<EnumValue<AgeInheritance>> AgeInheritanceParameter {
    107       get { return (IValueParameter<EnumValue<AgeInheritance>>)Parameters["AgeInheritance"]; }
    108     }
    109     private IValueParameter<ReductionOperation> AgeInheritanceReductionParameter {
    110       get { return (IValueParameter<ReductionOperation>)Parameters["AgeInheritanceReduction"]; }
     106    private IValueParameter<DoubleValue> AgeInheritanceParameter {
     107      get { return (IValueParameter<DoubleValue>)Parameters["AgeInheritance"]; }
    111108    }
    112109    private IValueParameter<IntArray> AgeLimitsParameter {
     
    189186      set { AgeGapParameter.Value = value; }
    190187    }
    191     public EnumValue<AgeInheritance> AgeInheritance {
     188    public DoubleValue AgeInheritance {
    192189      get { return AgeInheritanceParameter.Value; }
    193190      set { AgeInheritanceParameter.Value = value; }
    194     }
    195     private ReductionOperation AgeInheritanceReduction {
    196       get { return AgeInheritanceReductionParameter.Value; }
    197       set { AgeInheritanceReductionParameter.Value = value; }
    198191    }
    199192    public IntArray AgeLimits {
     
    306299      Parameters.Add(new ValueParameter<EnumValue<AgingScheme>>("AgingScheme", "The aging scheme for setting the age-limits for the layers.", new EnumValue<AgingScheme>(ALPS.AgingScheme.Polynomial)));
    307300      Parameters.Add(new ValueParameter<IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers", new IntValue(20)));
    308       Parameters.Add(new ValueParameter<EnumValue<AgeInheritance>>("AgeInheritance", "The operator for determining the age of an offspring based the parents' age.", new EnumValue<AgeInheritance>(ALPS.AgeInheritance.Older)));
    309       Parameters.Add(new ValueParameter<ReductionOperation>("AgeInheritanceReduction") { Hidden = true });
     301      Parameters.Add(new ValueParameter<DoubleValue>("AgeInheritance", "A weight that determines the age of a child after crossover based on the older (1.0) and younger (0.0) parent.", new DoubleValue(1.0)) { Hidden = true });
    310302      Parameters.Add(new ValueParameter<IntArray>("AgeLimits", new IntArray(new int[0])) { Hidden = true });
    311303
     
    404396
    405397      #region Parameterize
     398      UpdateAnalyzers();
    406399      ParameterizeAnalyzers();
    407       UpdateAnalyzers();
    408400
    409401      ParameterizeSelectors();
     
    412404
    413405      ParameterizeAgeLimits();
    414       ParameterizeAgeInheritanceReduction();
    415406      #endregion
    416407
     
    518509    private void NumberOfLayers_ValueChanged(object sender, EventArgs e) {
    519510      ParameterizeAgeLimits();
    520     }
    521     private void AgeInheritanceParameter_ValueChanged(object sender, EventArgs e) {
    522       AgeInheritance.ValueChanged += AgeInheritance_ValueChanged;
    523       ParameterizeAgeInheritanceReduction();
    524     }
    525     private void AgeInheritance_ValueChanged(object sender, EventArgs e) {
    526       ParameterizeAgeInheritanceReduction();
    527511    }
    528512
     
    564548      AgingSchemeParameter.ValueChanged += AgingSchemeParameter_ValueChanged;
    565549      AgingScheme.ValueChanged += AgingScheme_ValueChanged;
    566       AgeInheritanceParameter.ValueChanged += AgeInheritanceParameter_ValueChanged;
    567       AgeInheritance.ValueChanged += AgeInheritance_ValueChanged;
    568550
    569551      qualityAnalyzer.CurrentBestQualityParameter.NameChanged += new EventHandler(QualityAnalyzer_CurrentBestQualityParameter_NameChanged);
     
    635617      }
    636618    }
    637     private void ParameterizeAgeInheritanceReduction() {
    638       AgeInheritanceReduction.Value = GetAgeInheritanceReduction(AgeInheritance.Value);
    639     }
    640619    private void ParameterizeAgeLimits() {
    641620      var scheme = AgingScheme.Value;
     
    661640    }
    662641
    663     private ReductionOperations GetAgeInheritanceReduction(AgeInheritance ageInheritance) {
    664       switch (ageInheritance) {
    665         case ALPS.AgeInheritance.Older: return ReductionOperations.Max;
    666         case ALPS.AgeInheritance.Agerage: return ReductionOperations.Avg;
    667         case ALPS.AgeInheritance.Younger: return ReductionOperations.Min;
    668         default: throw new NotSupportedException("AgeInheritance " + ageInheritance + " is not supported.");
    669       }
    670     }
    671642    #endregion
    672643
Note: See TracChangeset for help on using the changeset viewer.