- Timestamp:
- 07/05/19 10:26:41 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Selectors/DiversitySelector.cs
r16839 r17076 66 66 } 67 67 68 public bool StrictSimilarity { get { return StrictSimilarityParameter.Value.Value; } } 69 70 public double SimilarityWeight { get { return SimilarityWeightParameter.Value.Value; } } 68 public bool StrictSimilarity { 69 get { return StrictSimilarityParameter.Value.Value; } 70 set { StrictSimilarityParameter.Value.Value = value; } 71 } 72 73 public double SimilarityWeight { 74 get { return SimilarityWeightParameter.Value.Value; } 75 set { SimilarityWeightParameter.Value.Value = value; } 76 } 71 77 72 78 public DiversitySelector() : base() { … … 74 80 Parameters.Add(new FixedValueParameter<DoubleValue>(SimilarityWeightParameterName, "Weight of the diversity term.", new DoubleValue(1))); 75 81 Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression trees that should be analyzed.")); 76 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(DiversityParameterName));77 82 Parameters.Add(new ValueParameter<ISingleObjectiveSelector>(SelectorParameterName, "The inner selection operator to select the parents.", new TournamentSelector())); 83 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(DiversityParameterName, "The diversity value calcuated by the operator (output). The inner selector uses this value.")); 78 84 79 85 RegisterParameterEventHandlers(); … … 81 87 82 88 [StorableConstructor] 83 private DiversitySelector(StorableConstructorFlag deserializing) : base(deserializing) { }89 private DiversitySelector(StorableConstructorFlag _) : base(_) { } 84 90 85 91 private DiversitySelector(DiversitySelector original, Cloner cloner) : base(original, cloner) { } … … 91 97 [StorableHook(HookType.AfterDeserialization)] 92 98 private void AfterDeserialization() { 93 RegisterParameterEventHandlers();94 95 99 if (!Parameters.ContainsKey(DiversityParameterName)) { 96 100 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(DiversityParameterName)); 97 101 } 102 103 RegisterParameterEventHandlers(); 98 104 } 99 105 … … 103 109 CopySelectedParameter.ValueChanged += CopySelectedParameter_ValueChanged; 104 110 CopySelected.ValueChanged += CopySelected_ValueChanged; 105 } 111 112 MaximizationParameter.NameChanged += MaximizationParameter_NameChanged; 113 QualityParameter.NameChanged += QualityParameter_NameChanged; 114 RandomParameter.NameChanged += RandomParameter_NameChanged; 115 } 116 117 private void RandomParameter_NameChanged(object sender, EventArgs e) { ParameterizeSelector(Selector); } 118 private void QualityParameter_NameChanged(object sender, EventArgs e) { ParameterizeSelector(Selector); } 119 private void MaximizationParameter_NameChanged(object sender, EventArgs e) { ParameterizeSelector(Selector); } 106 120 107 121 private void CopySelectedParameter_ValueChanged(object sender, EventArgs e) { … … 127 141 if (w.IsAlmost(0)) { 128 142 ApplyInnerSelector(); 129 return CurrentScope.SubScopes[1].SubScopes.ToArray(); 143 return CurrentScope.SubScopes[1].SubScopes.ToArray(); // return selected individuals (selectors create two sub-scopes with remaining and selected) 130 144 } 131 145
Note: See TracChangeset
for help on using the changeset viewer.