- Timestamp:
- 05/19/20 15:01:59 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/BinaryVectorEncoding.cs
r17545 r17546 76 76 77 77 private void RegisterEventHandlers() { 78 LengthParameter.ValueChanged += (_, __) => { 79 if (!LengthParameter.Value.ReadOnly) LengthParameter.Value.ValueChanged += (___, ____) => OnPropertyChanged(nameof(Length)); 80 OnPropertyChanged(nameof(Length)); 81 }; 78 IntValueParameterChangeHandler.Create(LengthParameter, () => OnPropertyChanged(nameof(Length))); 82 79 } 83 80 -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/SingleObjectiveProblem.cs
r17522 r17546 62 62 if (Maximization == value) return; 63 63 MaximizationParameter.ForceValue(new BoolValue(value, @readonly: true)); 64 OnMaximizationChanged();65 64 } 66 65 } … … 74 73 MaximizationParameter = cloner.Clone(original.MaximizationParameter); 75 74 ParameterizeOperators(); 75 RegisterEventHandlers(); 76 76 } 77 77 78 78 protected SingleObjectiveProblem() : base() { 79 80 79 MaximizationParameter = new ValueParameter<BoolValue>("Maximization", "Whether the problem should be maximized (True) or minimized (False).", new BoolValue(false).AsReadOnly()) { Hidden = true, ReadOnly = true }; 81 80 BestKnownQualityParameter = new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this problem."); … … 92 91 93 92 ParameterizeOperators(); 93 RegisterEventHandlers(); 94 94 } 95 95 … … 106 106 107 107 ParameterizeOperators(); 108 RegisterEventHandlers(); 108 109 } 109 110 … … 111 112 private void AfterDeserialization() { 112 113 ParameterizeOperators(); 114 RegisterEventHandlers(); 113 115 } 114 116 … … 200 202 } 201 203 204 private void RegisterEventHandlers() { 205 BoolValueParameterChangeHandler.Create(MaximizationParameter, OnMaximizationChanged); 206 } 207 202 208 #region ISingleObjectiveHeuristicOptimizationProblem Members 203 209 IParameter ISingleObjectiveHeuristicOptimizationProblem.MaximizationParameter { -
branches/2521_ProblemRefactoring/HeuristicLab.Parameters/3.3/HeuristicLab.Parameters-3.3.csproj
r17532 r17546 126 126 <Compile Include="FixedValueParameter.cs" /> 127 127 <Compile Include="OptionalConstrainedValueParameter.cs" /> 128 <Compile Include="ParameterChangeHandler.cs" /> 128 129 <Compile Include="Plugin.cs" /> 129 130 <Compile Include="ReferenceParameter.cs" /> … … 161 162 <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project> 162 163 <Name>HeuristicLab.Core-3.3</Name> 164 <Private>False</Private> 165 </ProjectReference> 166 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 167 <Project>{bbab9df5-5ef3-4ba8-ade9-b36e82114937}</Project> 168 <Name>HeuristicLab.Data-3.3</Name> 163 169 <Private>False</Private> 164 170 </ProjectReference> -
branches/2521_ProblemRefactoring/HeuristicLab.Parameters/3.3/Plugin.cs.frame
r17226 r17546 32 32 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] 33 33 [PluginDependency("HeuristicLab.Core", "3.3")] 34 [PluginDependency("HeuristicLab.Data", "3.3")] 34 35 [PluginDependency("HeuristicLab.Attic", "1.0")] 35 36 public class HeuristicLabParametersPlugin : PluginBase { -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/DeceptiveStepTrapProblem.cs
r17544 r17546 22 22 #endregion 23 23 24 using System;25 24 using HEAL.Attic; 26 25 using HeuristicLab.Common; … … 45 44 public DeceptiveStepTrapProblem() : base() { 46 45 Parameters.Add(StepSizeParameter = new FixedValueParameter<IntValue>("Step Size", "", new IntValue(2))); 47 offset = (TrapSize - StepSize) % StepSize;46 CalculateOffset(); 48 47 49 48 RegisterParameterEvents(); … … 79 78 80 79 private void RegisterParameterEvents() { 81 StepSizeParameter.Value.ValueChanged += StepSizeOnChanged;80 IntValueParameterChangeHandler.Create(StepSizeParameter, CalculateOffset); 82 81 } 83 82 84 protected override void TrapSizeOnChanged( object sender, EventArgs e) {85 base.TrapSizeOnChanged( sender, e);86 offset = (TrapSize - StepSize) % StepSize;83 protected override void TrapSizeOnChanged() { 84 base.TrapSizeOnChanged(); 85 CalculateOffset(); 87 86 } 88 87 89 private void StepSizeOnChanged(object sender, EventArgs e) {88 private void CalculateOffset() { 90 89 offset = (TrapSize - StepSize) % StepSize; 91 90 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/DeceptiveTrapProblem.cs
r17545 r17546 107 107 108 108 private void RegisterEventHandlers() { 109 TrapSizeParameter.Value.ValueChanged += TrapSizeOnChanged;110 NumberOfTrapsParameter.Value.ValueChanged += NumberOfTrapsOnChanged;109 IntValueParameterChangeHandler.Create(TrapSizeParameter, TrapSizeOnChanged); 110 IntValueParameterChangeHandler.Create(NumberOfTrapsParameter, NumberOfTrapsOnChanged); 111 111 } 112 112 113 protected virtual void TrapSizeOnChanged( object sender, EventArgs e) {113 protected virtual void TrapSizeOnChanged() { 114 114 Dimension = TrapSize * NumberOfTraps; 115 115 } 116 116 117 private void NumberOfTrapsOnChanged( object sender, EventArgs e) {117 private void NumberOfTrapsOnChanged() { 118 118 Dimension = TrapSize * NumberOfTraps; 119 119 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.4/SingleObjectiveExternalEvaluationProblem.cs
r17382 r17546 93 93 public ExternalEvaluationProblem(TEncoding encoding) 94 94 : base(encoding) { 95 MaximizationParameter.ReadOnly = false; 96 MaximizationParameter.Value = new BoolValue(); // is a read-only bool value in base class 97 MaximizationParameter.ReadOnly = true; 95 MaximizationParameter.ForceValue(new BoolValue()); // is a read-only bool value in base class 98 96 Parameters.Add(new OptionalValueParameter<EvaluationCache>("Cache", "Cache of previously evaluated solutions.")); 99 97 Parameters.Add(new ValueParameter<CheckedItemCollection<IEvaluationServiceClient>>("Clients", "The clients that are used to communicate with the external application.", new CheckedItemCollection<IEvaluationServiceClient>() { new EvaluationServiceClient() }));
Note: See TracChangeset
for help on using the changeset viewer.