- Timestamp:
- 10/09/15 16:54:53 (9 years ago)
- 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 104 104 get { return (IValueParameter<IntValue>)Parameters["AgeGap"]; } 105 105 } 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"]; } 111 108 } 112 109 private IValueParameter<IntArray> AgeLimitsParameter { … … 189 186 set { AgeGapParameter.Value = value; } 190 187 } 191 public EnumValue<AgeInheritance>AgeInheritance {188 public DoubleValue AgeInheritance { 192 189 get { return AgeInheritanceParameter.Value; } 193 190 set { AgeInheritanceParameter.Value = value; } 194 }195 private ReductionOperation AgeInheritanceReduction {196 get { return AgeInheritanceReductionParameter.Value; }197 set { AgeInheritanceReductionParameter.Value = value; }198 191 } 199 192 public IntArray AgeLimits { … … 306 299 Parameters.Add(new ValueParameter<EnumValue<AgingScheme>>("AgingScheme", "The aging scheme for setting the age-limits for the layers.", new EnumValue<AgingScheme>(ALPS.AgingScheme.Polynomial))); 307 300 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 }); 310 302 Parameters.Add(new ValueParameter<IntArray>("AgeLimits", new IntArray(new int[0])) { Hidden = true }); 311 303 … … 404 396 405 397 #region Parameterize 398 UpdateAnalyzers(); 406 399 ParameterizeAnalyzers(); 407 UpdateAnalyzers();408 400 409 401 ParameterizeSelectors(); … … 412 404 413 405 ParameterizeAgeLimits(); 414 ParameterizeAgeInheritanceReduction();415 406 #endregion 416 407 … … 518 509 private void NumberOfLayers_ValueChanged(object sender, EventArgs e) { 519 510 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();527 511 } 528 512 … … 564 548 AgingSchemeParameter.ValueChanged += AgingSchemeParameter_ValueChanged; 565 549 AgingScheme.ValueChanged += AgingScheme_ValueChanged; 566 AgeInheritanceParameter.ValueChanged += AgeInheritanceParameter_ValueChanged;567 AgeInheritance.ValueChanged += AgeInheritance_ValueChanged;568 550 569 551 qualityAnalyzer.CurrentBestQualityParameter.NameChanged += new EventHandler(QualityAnalyzer_CurrentBestQualityParameter_NameChanged); … … 635 617 } 636 618 } 637 private void ParameterizeAgeInheritanceReduction() {638 AgeInheritanceReduction.Value = GetAgeInheritanceReduction(AgeInheritance.Value);639 }640 619 private void ParameterizeAgeLimits() { 641 620 var scheme = AgingScheme.Value; … … 661 640 } 662 641 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 }671 642 #endregion 672 643 -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs
r12992 r12997 75 75 public AlpsGeneticAlgorithmMainLoop() 76 76 : 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 }); 78 78 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution.")); 79 79 Parameters.Add(new LookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations that the algorithm should process.")); … … 232 232 // Insert AgeCalculator between crossover and its successor 233 233 var crossoverSuccessor = crossover.Successor; 234 var ageCalculator = new DataReducer() { Name = "Calculate Age" };234 var ageCalculator = new WeightingReducer() { Name = "Calculate Age" }; 235 235 crossover.Successor = ageCalculator; 236 236 237 237 ageCalculator.ParameterToReduce.ActualName = "Age"; 238 238 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"; 242 240 ageCalculator.Successor = crossoverSuccessor; 243 241 -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/HeuristicLab.Algorithms.ALPS-3.3.csproj
r12996 r12997 132 132 </ItemGroup> 133 133 <ItemGroup> 134 <Compile Include=" AgeInheritance.cs" />134 <Compile Include="WeightingReducer.cs" /> 135 135 <Compile Include="Analyzers\OldestAverageYoungestAgeAnalyzer.cs" /> 136 136 <Compile Include="Analyzers\AgeDistributionAnalyzer.cs" />
Note: See TracChangeset
for help on using the changeset viewer.