Changeset 9172 for branches/DataAnalysis.IslandAlgorithms
- Timestamp:
- 01/17/13 10:51:01 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.DataAnalysis.Symbolic/3.3/SymbolicDataAnalysisIslandGeneticAlgorithm.cs
r9077 r9172 111 111 Parameters.Add(new LookupParameter<ISingleObjectiveEvaluator>(ProblemEvaluatorParameterName, "Internal parameter for name translation", "Evaluator")); 112 112 113 Elites.Value = 0; 114 ElitesParameter.Hidden = true; 115 113 116 ScopeTreeAssigner<IntRange> fixedSamplesPartitionCreator = new ScopeTreeAssigner<IntRange>(); 114 117 fixedSamplesPartitionCreator.LeftSideParameter.ActualName = FixedSamplesPartitionParameterName; … … 121 124 RegisterParameterEvents(); 122 125 RecalculateFixedSamplesPartitions(); 126 } 127 128 private void RegisterParameterEvents() { 129 if (Problem != null) Problem.FitnessCalculationPartition.ValueChanged += Problem_Reset; 130 NumberOfIslandsParameter.ValueChanged += NumberOfIslandsParameter_ValueChanged; 131 NumberOfIslandsParameter.Value.ValueChanged += (o, ev) => RecalculateFixedSamplesPartitions(); 132 FixedSamplesParameter.Value.ValueChanged += (o, e) => RecalculateFixedSamplesPartitions(); 133 Analyzer.Operators.PropertyChanged += (o, e) => ParameterizeAnalyzers(); 123 134 } 124 135 … … 150 161 } 151 162 152 private void RegisterParameterEvents() { 153 NumberOfIslandsParameter.ValueChanged += NumberOfIslandsParameter_ValueChanged; 154 NumberOfIslandsParameter.Value.ValueChanged += (o, ev) => RecalculateFixedSamplesPartitions(); 155 FixedSamplesParameter.Value.ValueChanged += (o, e) => RecalculateFixedSamplesPartitions(); 163 164 private void ParameterizeAnalyzers() { 165 foreach (var analyzer in Analyzer.Operators.OfType<ISymbolicDataAnalysisAnalyzer>()) { 166 IParameter evaluatorParameter; 167 if (analyzer.Parameters.TryGetValue("Evaluator", out evaluatorParameter)) { 168 ILookupParameter param = evaluatorParameter as ILookupParameter; 169 if (evaluatorParameter != null) param.ActualName = ProblemEvaluatorParameterName; 170 } 171 } 156 172 } 157 173 … … 162 178 163 179 protected override void Problem_Reset(object sender, EventArgs e) { 180 FixedSamples = Problem.FitnessCalculationPartition.Size / NumberOfIslands.Value; 181 RandomSamples = Problem.FitnessCalculationPartition.Size / NumberOfIslands.Value; 164 182 RecalculateFixedSamplesPartitions(); 165 183 ParameterizeProblemEvaluator(); … … 168 186 169 187 protected override void OnProblemChanged() { 170 Problem.FitnessCalculationPartition.ValueChanged += (o, e) => RecalculateFixedSamplesPartitions(); 171 172 ParameterizeProblemEvaluator(); 188 Problem.FitnessCalculationPartition.ValueChanged += Problem_Reset; 189 FixedSamples = Problem.FitnessCalculationPartition.Size / NumberOfIslands.Value; 190 RandomSamples = Problem.FitnessCalculationPartition.Size / NumberOfIslands.Value; 191 173 192 if (Problem is IRegressionProblem) { 174 193 var evaluator = new SymbolicDataAnalysisIslandGAEvaluator<IRegressionProblemData>(); … … 184 203 EvaluatorParameter.Value = null; 185 204 205 ParameterizeProblemEvaluator(); 186 206 ParameterizeStochasticOperatorForIsland(EvaluatorParameter.Value); 187 207
Note: See TracChangeset
for help on using the changeset viewer.