- Timestamp:
- 05/28/20 16:26:46 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Encoding.cs
r17567 r17570 118 118 public virtual void ConfigureOperators(IEnumerable<IItem> operators) { 119 119 ConfigureSingleObjectiveImprovementOperators(operators.OfType<ISingleObjectiveImprovementOperator>()); 120 ConfigureSingleObjectivePathRelinker(operators.OfType<ISingleObjectivePathRelinker>()); 120 121 } 121 122 … … 123 124 foreach (var op in operators) { 124 125 op.SolutionParameter.ActualName = Name; 126 op.SolutionParameter.Hidden = true; 127 } 128 } 129 130 protected virtual void ConfigureSingleObjectivePathRelinker(IEnumerable<ISingleObjectivePathRelinker> operators) { 131 foreach (var op in operators.OfType<ISingleObjectivePathRelinker>()) { 132 op.ParentsParameter.ActualName = Name; 133 op.ParentsParameter.Hidden = true; 125 134 } 126 135 } -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Problem.cs
r17513 r17570 138 138 139 139 private void RegisterEvents() { 140 EncodingParameter.ValueChanged += (o, e) => OnEncodingChanged();141 EvaluatorParameter.ValueChanged += (o, e) => OnEvaluatorChanged();140 EncodingParameter.ValueChanged += (o, e) => { ParameterizeOperators(); OnEncodingChanged(); }; 141 EvaluatorParameter.ValueChanged += (o, e) => { ParameterizeOperators(); OnEvaluatorChanged(); }; 142 142 //var multiEncoding = Encoding as MultiEncoding; 143 143 //if (multiEncoding != null) multiEncoding.EncodingsChanged += MultiEncodingOnEncodingsChanged; 144 144 } 145 145 146 protected override void ParameterizeOperators() { 147 base.ParameterizeOperators(); 148 Parameterize(); 149 } 150 146 151 protected virtual void OnEncodingChanged() { 147 Parameterize();148 149 152 OnOperatorsChanged(); 150 153 OnReset(); … … 163 166 op.EncodingParameter.ActualName = EncodingParameter.Name; 164 167 168 Encoding.ConfigureOperators(Operators); 165 169 //var multiEncoding = Encoding as MultiEncoding; 166 170 //if (multiEncoding != null) multiEncoding.EncodingsChanged += MultiEncodingOnEncodingsChanged; -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/SingleObjectiveProblem.cs
r17567 r17570 72 72 BestKnownQualityParameter = cloner.Clone(original.BestKnownQualityParameter); 73 73 MaximizationParameter = cloner.Clone(original.MaximizationParameter); 74 Parameterize Operators();74 Parameterize(); 75 75 RegisterEventHandlers(); 76 76 } … … 90 90 Operators.Add(new SingleObjectiveMoveMaker<TEncodedSolution>()); 91 91 92 Parameterize Operators();92 Parameterize(); 93 93 RegisterEventHandlers(); 94 94 } … … 105 105 Operators.Add(new SingleObjectiveMoveMaker<TEncodedSolution>()); 106 106 107 Parameterize Operators();107 Parameterize(); 108 108 RegisterEventHandlers(); 109 109 } … … 111 111 [StorableHook(HookType.AfterDeserialization)] 112 112 private void AfterDeserialization() { 113 Parameterize Operators();113 Parameterize(); 114 114 RegisterEventHandlers(); 115 115 } … … 190 190 protected override void OnEvaluatorChanged() { 191 191 base.OnEvaluatorChanged(); 192 Evaluator.QualityParameter.ActualNameChanged += QualityParameterOnActualNameChanged; 193 } 194 195 protected virtual void QualityParameterOnActualNameChanged(object sender, EventArgs e) { 192 196 ParameterizeOperators(); 193 197 } 194 198 195 private void ParameterizeOperators() { 199 protected override void ParameterizeOperators() { 200 base.ParameterizeOperators(); 201 Parameterize(); 202 } 203 204 private void Parameterize() { 196 205 foreach (var op in Operators.OfType<ISingleObjectiveEvaluationOperator<TEncodedSolution>>()) 197 206 op.Evaluate = Evaluate; … … 200 209 foreach (var op in Operators.OfType<INeighborBasedOperator<TEncodedSolution>>()) 201 210 op.GetNeighbors = GetNeighbors; 211 foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) { 212 op.SolutionVariableName = Encoding.Name; 213 op.QualityVariableName = Evaluator.QualityParameter.ActualName; 214 } 202 215 } 203 216 -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/Problems/Problem.cs
r17513 r17570 157 157 158 158 159 protected virtual void ParameterizeOperators() { 160 161 } 162 159 163 160 164 #region events 161 165 private void Operators_Changed(object sender, EventArgs e) { 162 166 OnOperatorsChanged(); 167 ParameterizeOperators(); 163 168 } 164 169 public event EventHandler OperatorsChanged;
Note: See TracChangeset
for help on using the changeset viewer.