- Timestamp:
- 11/26/14 11:06:38 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersEmigrator.cs
r11585 r11586 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 32 33 [Item("EldersEmigrator", "Moves Individuals which are too old for its current layer up to the next layer.")] 33 34 [StorableClass] 34 public class EldersEmigrator : AlgorithmOperator { 35 public sealed class EldersEmigrator : AlgorithmOperator { 36 37 public IValueLookupParameter<BoolValue> MaximizationParameter { 38 get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; } 39 } 40 public IScopeTreeLookupParameter<DoubleValue> QualityParameter { 41 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; } 42 } 43 44 public SolutionsCreator SolutionsCreator { 45 get { return OperatorGraph.Iterate().OfType<SolutionsCreator>().First(); } 46 } 35 47 36 48 [StorableConstructor] … … 44 56 public EldersEmigrator() 45 57 : base() { 58 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false.")); 59 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution.")); 60 46 61 var selectorProsessor = new UniformSubScopesProcessor(); 47 62 var eldersSelector = new EldersSelector(); … … 50 65 var mergingReducer = new MergingReducer(); 51 66 var subScopesCounter = new SubScopesCounter(); 52 var countCalculator = new ExpressionCalculator() { Name = "Count = Min(NumSubScopes, PopulationSize)" }; 67 // TODO: if expression calculator supports int, use expression calculator 68 var countCalculator = new MergingReducerCalculator() { Name = "NumSubScopes = Min(NumSubScopes, PopulationSize)" }; 69 //var countCalculator = new ExpressionCalculator() { Name = "NumSubScopes = Min(NumSubScopes, PopulationSize)" }; 53 70 var bestSelector = new BestSelector(); 54 71 var rightReducer = new RightReducer(); … … 73 90 subScopesCounter.Successor = countCalculator; 74 91 75 countCalculator.CollectedValues.Add(new LookupParameter<IntValue>("PopulationSize"));76 countCalculator.CollectedValues.Add(new LookupParameter<IntValue>("NumSubScopes"));77 countCalculator.ExpressionParameter.Value = new StringValue("NumSubScopes PopulationSize NumSubScopes < PopulationSizeif");78 countCalculator.ExpressionResultParameter.ActualName = "Count";92 //countCalculator.CollectedValues.Add(new LookupParameter<IntValue>("PopulationSize")); 93 //countCalculator.CollectedValues.Add(new LookupParameter<IntValue>("NumSubScopes")); 94 //countCalculator.ExpressionParameter.Value = new StringValue("NumSubScopes PopulationSize NumSubScopes PopulationSize < if"); 95 //countCalculator.ExpressionResultParameter.ActualName = "NumSubScopes"; 79 96 countCalculator.Successor = bestSelector; 80 97 81 bestSelector.NumberOfSelectedSubScopesParameter.ActualName = "Count"; 98 bestSelector.NumberOfSelectedSubScopesParameter.ActualName = "NumSubScopes"; 99 bestSelector.QualityParameter.ActualName = QualityParameter.Name; 100 bestSelector.MaximizationParameter.ActualName = MaximizationParameter.Name; 82 101 bestSelector.Successor = rightReducer; 83 102
Note: See TracChangeset
for help on using the changeset viewer.