Changeset 17614 for branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Problem.cs
- Timestamp:
- 06/19/20 17:53:36 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/Problem.cs
r17612 r17614 37 37 where TEvaluator : class, IEvaluator { 38 38 39 [Storable] protected ConstrainedValueParameter<ISolutionCreator> SolutionCreatorParameter { get; private set; } 39 40 40 41 //TODO remove parameter for encoding? … … 52 53 } 53 54 54 55 ISolutionCreator IHeuristicOptimizationProblem.SolutionCreator { 56 get { return Encoding.SolutionCreator; } 57 } 58 IParameter IHeuristicOptimizationProblem.SolutionCreatorParameter { 59 get { return Encoding.SolutionCreatorParameter; } 60 } 55 ISolutionCreator IHeuristicOptimizationProblem.SolutionCreator { get => SolutionCreatorParameter.Value; } 56 IParameter IHeuristicOptimizationProblem.SolutionCreatorParameter { get => SolutionCreatorParameter; } 57 61 58 event EventHandler IHeuristicOptimizationProblem.SolutionCreatorChanged { 62 59 add { 63 if (Encoding != null) Encoding.SolutionCreatorChanged += value;60 SolutionCreatorParameter.ValueChanged += value; 64 61 } 65 62 remove { 66 if (Encoding != null) Encoding.SolutionCreatorChanged -= value;63 SolutionCreatorParameter.ValueChanged -= value; 67 64 } 68 65 } … … 106 103 Parameters.Add(new ValueParameter<TEncoding>("Encoding", "Describes the configuration of the encoding, what the variables are called, what type they are and their bounds if any.", encoding) { Hidden = true }); 107 104 Parameters.Add(new ValueParameter<TEvaluator>("Evaluator", "The operator used to evaluate a solution.") { Hidden = true }); 105 Parameters.Add(SolutionCreatorParameter = new ConstrainedValueParameter<ISolutionCreator>("SolutionCreator", "The operator used to create a solution.")); 108 106 109 107 oldEncoding = Encoding; … … 116 114 : base(original, cloner) { 117 115 oldEncoding = cloner.Clone(original.oldEncoding); 116 SolutionCreatorParameter = cloner.Clone(original.SolutionCreatorParameter); 118 117 RegisterEvents(); 119 118 } … … 124 123 private void AfterDeserialization() { 125 124 oldEncoding = Encoding; 125 // TODO: remove below 126 if (SolutionCreatorParameter == null) Parameters.Add(SolutionCreatorParameter = new ConstrainedValueParameter<ISolutionCreator>("SolutionCreator", "The operator used to create a solution.")); 127 126 128 RegisterEvents(); 127 129 } … … 157 159 158 160 Encoding.ConfigureOperators(Operators); 161 162 SolutionCreatorParameter.Repopulate(GetOperators()); 159 163 //var multiEncoding = Encoding as MultiEncoding; 160 164 //if (multiEncoding != null) multiEncoding.EncodingsChanged += MultiEncodingOnEncodingsChanged;
Note: See TracChangeset
for help on using the changeset viewer.