Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12997 for branches


Ignore:
Timestamp:
10/09/15 16:54:53 (9 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.
Location:
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
Files:
1 added
1 deleted
3 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
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs

    r12992 r12997  
    7575    public AlpsGeneticAlgorithmMainLoop()
    7676      : base() {
    77       Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
     77      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false.") { Hidden = true });
    7878      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
    7979      Parameters.Add(new LookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations that the algorithm should process."));
     
    232232      // Insert AgeCalculator between crossover and its successor
    233233      var crossoverSuccessor = crossover.Successor;
    234       var ageCalculator = new DataReducer() { Name = "Calculate Age" };
     234      var ageCalculator = new WeightingReducer() { Name = "Calculate Age" };
    235235      crossover.Successor = ageCalculator;
    236236
    237237      ageCalculator.ParameterToReduce.ActualName = "Age";
    238238      ageCalculator.TargetParameter.ActualName = "Age";
    239       ageCalculator.ReductionOperation.Value = null;
    240       ageCalculator.ReductionOperation.ActualName = "AgeInheritanceReduction";
    241       ageCalculator.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign);
     239      ageCalculator.WeightParameter.ActualName = "AgeInheritance";
    242240      ageCalculator.Successor = crossoverSuccessor;
    243241
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/HeuristicLab.Algorithms.ALPS-3.3.csproj

    r12996 r12997  
    132132  </ItemGroup>
    133133  <ItemGroup>
    134     <Compile Include="AgeInheritance.cs" />
     134    <Compile Include="WeightingReducer.cs" />
    135135    <Compile Include="Analyzers\OldestAverageYoungestAgeAnalyzer.cs" />
    136136    <Compile Include="Analyzers\AgeDistributionAnalyzer.cs" />
Note: See TracChangeset for help on using the changeset viewer.