Changeset 12412 for branches/TerminationCriteria
- Timestamp:
- 06/01/15 17:04:25 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/TerminationCriteria/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs
r12411 r12412 99 99 get { return (IConstrainedValueParameter<IDiscreteDoubleValueModifier>)Parameters["ComparisonFactorModifier"]; } 100 100 } 101 private ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {102 get { return ( ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }101 private IFixedValueParameter<DoubleValue> MaximumSelectionPressureParameter { 102 get { return (IFixedValueParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; } 103 103 } 104 104 private ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter { … … 110 110 private ValueParameter<MultiAnalyzer> AnalyzerParameter { 111 111 get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; } 112 }113 private IFixedValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {114 get { return (IFixedValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }115 112 } 116 113 private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter { … … 179 176 set { ComparisonFactorModifierParameter.Value = value; } 180 177 } 181 public DoubleValue MaximumSelectionPressure {182 get { return MaximumSelectionPressureParameter.Value ; }183 set { MaximumSelectionPressureParameter.Value = value; }178 public double MaximumSelectionPressure { 179 get { return MaximumSelectionPressureParameter.Value.Value; } 180 set { MaximumSelectionPressureParameter.Value.Value = value; } 184 181 } 185 182 public BoolValue OffspringSelectionBeforeMutation { … … 194 191 get { return AnalyzerParameter.Value; } 195 192 set { AnalyzerParameter.Value = value; } 196 }197 public int MaximumEvaluatedSolutions {198 get { return MaximumEvaluatedSolutionsParameter.Value.Value; }199 set { MaximumEvaluatedSolutionsParameter.Value.Value = value; }200 193 } 201 194 public bool FillPopulationWithParents { … … 281 274 Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorUpperBound", "The upper bound of the comparison factor (end).", new DoubleValue(1))); 282 275 Parameters.Add(new OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier>("ComparisonFactorModifier", "The operator used to modify the comparison factor.", new ItemSet<IDiscreteDoubleValueModifier>(new IDiscreteDoubleValueModifier[] { new LinearDiscreteDoubleValueModifier() }), new LinearDiscreteDoubleValueModifier())); 283 Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.", new DoubleValue(100)));276 Parameters.Add(new FixedValueParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.", new DoubleValue(100))); 284 277 Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.", new BoolValue(false))); 285 278 Parameters.Add(new ValueLookupParameter<IntValue>("SelectedParents", "How much parents should be selected each time the offspring selection step is performed until the population is filled. This parameter should be about the same or twice the size of PopulationSize for smaller problems, and less for large problems.", new IntValue(200))); 286 279 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer())); 287 Parameters.Add(new FixedValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue)));288 280 Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(false)) { Hidden = true }); 289 281 Parameters.Add(new ValueParameter<MultiTerminator>("Termination", "The termination criteria which sould be checked.", new MultiTerminator())); … … 352 344 353 345 generationsTerminator = new ComparisonTerminator<IntValue>("Generations", ComparisonType.Less, MaximumGenerationsParameter) { Name = "Generations" }; 354 evaluationsTerminator = new ComparisonTerminator<IntValue>("EvaluatedSolutions", ComparisonType.Less, MaximumEvaluatedSolutionsParameter) { Name = "Evaluations" };355 selectionPressureTerminator = new ComparisonTerminator<DoubleValue>("SelectionPressure", ComparisonType.Less, MaximumSelectionPressure) { Name = "Selection Pressure" };346 selectionPressureTerminator = new ComparisonTerminator<DoubleValue>("SelectionPressure", ComparisonType.Less, MaximumSelectionPressureParameter) { Name = "Selection Pressure" }; 347 evaluationsTerminator = new ComparisonTerminator<IntValue>("EvaluatedSolutions", ComparisonType.Less, new IntValue(int.MaxValue)) { Name = "Evaluations" }; 356 348 qualityTerminator = new SingleObjectiveQualityTerminator() { Name = "Quality" }; 357 349 executionTimeTerminator = new ExecutionTimeTerminator(this, new TimeSpanValue(TimeSpan.FromMinutes(5)));
Note: See TracChangeset
for help on using the changeset viewer.