Changeset 1236
- Timestamp:
- 03/02/09 16:31:55 (16 years ago)
- Location:
- branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/AlgorithmBase.cs
r1231 r1236 245 245 BestAverageWorstQualityCalculator validationQualityCalculator = new BestAverageWorstQualityCalculator(); 246 246 validationQualityCalculator.Name = "ValidationQualityCalculator"; 247 validationQualityCalculator.GetVariableInfo("Quality").ActualName = "ValidationQuality"; 247 248 validationQualityCalculator.GetVariableInfo("BestQuality").ActualName = "BestValidationQuality"; 248 249 validationQualityCalculator.GetVariableInfo("AverageQuality").ActualName = "AverageValidationQuality"; … … 261 262 QualityLogger qualityLogger = new QualityLogger(); 262 263 QualityLogger validationQualityLogger = new QualityLogger(); 263 validationQuality Calculator.Name = "ValidationQualityLogger";264 validationQualityLogger.Name = "ValidationQualityLogger"; 264 265 validationQualityLogger.GetVariableInfo("Quality").ActualName = "ValidationQuality"; 265 266 validationQualityLogger.GetVariableInfo("QualityLog").ActualName = "ValidationQualityLog"; … … 330 331 } 331 332 332 internal 333 internal virtual IOperator CreateChildCreater() { 333 334 CombinedOperator childCreater = new CombinedOperator(); 334 335 childCreater.Name = "Create children"; -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/OffSpringSelectionGpEditor.cs
r1202 r1236 129 129 executeButton.Enabled = true; 130 130 abortButton.Enabled = false; 131 resetButton.Enabled = true; 131 132 } 132 133 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/OffspringSelectionGP.cs
r1235 r1236 39 39 public class OffspringSelectionGP : StandardGP { 40 40 41 private IntData maxEvaluatedSolutions = new IntData();42 public int MaxEvaluatedSolutions {43 get { return maxEvaluatedSolutions.Data; }44 set { maxEvaluatedSolutions.Data = value; }45 }46 47 41 private DoubleData selectionPressureLimit = new DoubleData(); 48 42 public double SelectionPressureLimit { … … 66 60 PopulationSize = 1000; 67 61 Parents = 20; 68 Max EvaluatedSolutions = 1000000;62 MaxGenerations = 300; 69 63 SelectionPressureLimit = 300; 70 64 ComparisonFactor = 1.0; … … 75 69 VariableInjector injector = (VariableInjector)base.CreateGlobalInjector(); 76 70 injector.RemoveVariable("TournamentSize"); 77 injector.RemoveVariable("MaxGenerations");78 injector.AddVariable(new HeuristicLab.Core.Variable("MaxEvaluatedSolutions", maxEvaluatedSolutions));79 71 injector.AddVariable(new HeuristicLab.Core.Variable("ComparisonFactor", comparisonFactor)); 80 72 injector.AddVariable(new HeuristicLab.Core.Variable("SelectionPressureLimit", selectionPressureLimit)); … … 113 105 } 114 106 115 internal override IOperator CreateMainLoop() { 116 CombinedOperator main = new CombinedOperator(); 107 internal override IOperator CreateChildCreater() { 108 CombinedOperator childCreater = new CombinedOperator(); 109 childCreater.Name = "Create children"; 117 110 SequentialProcessor seq = new SequentialProcessor(); 118 111 SequentialProcessor offspringSelectionSeq = new SequentialProcessor(); 119 SequentialSubScopesProcessor subScopesProc = new SequentialSubScopesProcessor();120 EmptyOperator emptyOp = new EmptyOperator();121 OffspringSelector offspringSelector = new OffspringSelector();122 123 112 OperatorExtractor selector = new OperatorExtractor(); 124 113 selector.Name = "Selector (extr.)"; 125 114 selector.GetVariableInfo("Operator").ActualName = "Selector"; 126 127 IOperator childCreater = CreateChildCreater(); 128 childCreater.Name = "Create children"; 129 IOperator replacement = CreateReplacement(); 130 replacement.Name = "Replacement"; 131 IOperator solutionStorer = CreateBestSolutionProcessor(); 132 BestAverageWorstQualityCalculator qualityCalculator = new BestAverageWorstQualityCalculator(); 133 BestAverageWorstQualityCalculator validationQualityCalculator = new BestAverageWorstQualityCalculator(); 134 validationQualityCalculator.Name = "ValidationQualityCalculator"; 135 validationQualityCalculator.GetVariableInfo("BestQuality").ActualName = "BestValidationQuality"; 136 validationQualityCalculator.GetVariableInfo("AverageQuality").ActualName = "AverageValidationQuality"; 137 validationQualityCalculator.GetVariableInfo("WorstQuality").ActualName = "WorstValidationQuality"; 138 DataCollector collector = new DataCollector(); 139 ItemList<StringData> names = collector.GetVariable("VariableNames").GetValue<ItemList<StringData>>(); 140 names.Add(new StringData("BestQuality")); 141 names.Add(new StringData("AverageQuality")); 142 names.Add(new StringData("WorstQuality")); 143 names.Add(new StringData("BestValidationQuality")); 144 names.Add(new StringData("AverageValidationQuality")); 145 names.Add(new StringData("WorstValidationQuality")); 146 LinechartInjector lineChartInjector = new LinechartInjector(); 147 lineChartInjector.GetVariableInfo("Linechart").ActualName = "Quality Linechart"; 148 lineChartInjector.GetVariable("NumberOfLines").GetValue<IntData>().Data = 6; 149 QualityLogger qualityLogger = new QualityLogger(); 150 QualityLogger validationQualityLogger = new QualityLogger(); 151 validationQualityCalculator.Name = "ValidationQualityLogger"; 152 validationQualityLogger.GetVariableInfo("Quality").ActualName = "ValidationQuality"; 153 validationQualityLogger.GetVariableInfo("QualityLog").ActualName = "ValidationQualityLog"; 154 Counter counter = new Counter(); 155 counter.GetVariableInfo("Value").ActualName = "Generations"; 156 LessThanComparator selPresComparator = new LessThanComparator(); 157 selPresComparator.GetVariableInfo("LeftSide").ActualName = "SelectionPressure"; 158 selPresComparator.GetVariableInfo("RightSide").ActualName = "SelectionPressureLimit"; 159 selPresComparator.GetVariableInfo("Result").ActualName = "SelectionPressureCondition"; 160 LessThanComparator generationsComparator = new LessThanComparator(); 161 generationsComparator.GetVariableInfo("LeftSide").ActualName = "EvaluatedSolutions"; 162 generationsComparator.GetVariableInfo("RightSide").ActualName = "MaxEvaluatedSolutions"; 163 generationsComparator.GetVariableInfo("Result").ActualName = "EvaluatedSolutionsCondition"; 164 ConditionalBranch selPresCondition = new ConditionalBranch(); 165 selPresCondition.GetVariableInfo("Condition").ActualName = "SelectionPressureCondition"; 166 ConditionalBranch generationsCondition = new ConditionalBranch(); 167 generationsCondition.GetVariableInfo("Condition").ActualName = "EvaluatedSolutionsCondition"; 168 169 subScopesProc.AddSubOperator(emptyOp); 170 subScopesProc.AddSubOperator(childCreater); 171 115 SequentialSubScopesProcessor seqSubScopesProc = new SequentialSubScopesProcessor(); 116 EmptyOperator emptyOp = new EmptyOperator(); 117 OffspringSelector offspringSelector = new OffspringSelector(); 118 OffspringAnalyzer offspringAnalyzer = new OffspringAnalyzer(); 119 SequentialProcessor selectedProc = new SequentialProcessor(); 120 OperatorExtractor crossover = new OperatorExtractor(); 121 crossover.Name = "Crossover (extr.)"; 122 crossover.GetVariableInfo("Operator").ActualName = "Crossover"; 123 UniformSequentialSubScopesProcessor individualProc = new UniformSequentialSubScopesProcessor(); 124 SequentialProcessor individualSeqProc = new SequentialProcessor(); 125 StochasticBranch cond = new StochasticBranch(); 126 cond.GetVariableInfo("Probability").ActualName = "MutationRate"; 127 OperatorExtractor manipulator = new OperatorExtractor(); 128 manipulator.Name = "Manipulator (extr.)"; 129 manipulator.GetVariableInfo("Operator").ActualName = "Manipulator"; 130 OperatorExtractor evaluator = new OperatorExtractor(); 131 evaluator.Name = "Evaluator (extr.)"; 132 evaluator.GetVariableInfo("Operator").ActualName = "Evaluator"; 133 Counter evalCounter = new Counter(); 134 evalCounter.GetVariableInfo("Value").ActualName = "EvaluatedSolutions"; 135 136 Sorter sorter = new Sorter(); 137 sorter.GetVariableInfo("Descending").ActualName = "Maximization"; 138 sorter.GetVariableInfo("Value").ActualName = "Quality"; 139 140 UniformSequentialSubScopesProcessor validationEvaluator = new UniformSequentialSubScopesProcessor(); 141 MeanSquaredErrorEvaluator validationQualityEvaluator = new MeanSquaredErrorEvaluator(); 142 validationQualityEvaluator.Name = "ValidationMeanSquaredErrorEvaluator"; 143 validationQualityEvaluator.GetVariableInfo("MSE").ActualName = "ValidationQuality"; 144 validationQualityEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart"; 145 validationQualityEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd"; 146 147 seqSubScopesProc.AddSubOperator(emptyOp); 148 seqSubScopesProc.AddSubOperator(offspringAnalyzer); 149 150 seq.AddSubOperator(offspringSelectionSeq); 151 offspringSelectionSeq.AddSubOperator(selector); 152 offspringSelectionSeq.AddSubOperator(seqSubScopesProc); 153 offspringSelectionSeq.AddSubOperator(offspringSelector); 172 154 offspringSelector.AddSubOperator(offspringSelectionSeq); 173 155 174 offspring SelectionSeq.AddSubOperator(selector);175 offspringSelectionSeq.AddSubOperator(subScopesProc);176 offspringSelectionSeq.AddSubOperator(offspringSelector);177 178 seq.AddSubOperator(offspringSelectionSeq);179 seq.AddSubOperator(replacement);180 seq.AddSubOperator(solutionStorer);181 seq.AddSubOperator(qualityCalculator);182 seq.AddSubOperator(validationQualityCalculator); 183 seq.AddSubOperator(collector);184 seq.AddSubOperator( lineChartInjector);185 seq .AddSubOperator(qualityLogger);186 seq.AddSubOperator(validationQualityLogger); 187 seq.AddSubOperator(counter);188 seq.AddSubOperator(selPresComparator);189 seq.AddSubOperator(generationsComparator);190 seq .AddSubOperator(selPresCondition);191 selPresCondition.AddSubOperator(generationsCondition); 192 generationsCondition.AddSubOperator(seq);193 194 main.OperatorGraph.AddOperator(seq);195 main.OperatorGraph.InitialOperator = seq;196 return main;156 offspringAnalyzer.AddSubOperator(selectedProc); 157 selectedProc.AddSubOperator(crossover); 158 selectedProc.AddSubOperator(individualProc); 159 individualProc.AddSubOperator(individualSeqProc); 160 individualSeqProc.AddSubOperator(cond); 161 cond.AddSubOperator(manipulator); 162 individualSeqProc.AddSubOperator(evaluator); 163 individualSeqProc.AddSubOperator(evalCounter); 164 165 SequentialSubScopesProcessor seqSubScopesProc2 = new SequentialSubScopesProcessor(); 166 seq.AddSubOperator(seqSubScopesProc2); 167 seqSubScopesProc2.AddSubOperator(emptyOp); 168 169 SequentialProcessor newGenProc = new SequentialProcessor(); 170 newGenProc.AddSubOperator(sorter); 171 newGenProc.AddSubOperator(validationEvaluator); 172 seqSubScopesProc2.AddSubOperator(newGenProc); 173 174 validationEvaluator.AddSubOperator(validationQualityEvaluator); 175 176 childCreater.OperatorGraph.AddOperator(seq); 177 childCreater.OperatorGraph.InitialOperator = seq; 178 return childCreater; 197 179 } 198 180 … … 223 205 // VariableInjector 224 206 VariableInjector vi = (VariableInjector)algorithm.SubOperators[2]; 225 maxEvaluatedSolutions = vi.GetVariable("MaxEvaluatedSolutions").GetValue<IntData>();226 207 selectionPressureLimit = vi.GetVariable("SelectionPressureLimit").GetValue<DoubleData>(); 227 208 successRatioLimit = vi.GetVariable("SuccessRatioLimit").GetValue<DoubleData>();
Note: See TracChangeset
for help on using the changeset viewer.