Changeset 1238
- Timestamp:
- 03/02/09 17:23:05 (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
r1236 r1238 244 244 BestAverageWorstQualityCalculator qualityCalculator = new BestAverageWorstQualityCalculator(); 245 245 BestAverageWorstQualityCalculator validationQualityCalculator = new BestAverageWorstQualityCalculator(); 246 validationQualityCalculator.Name = " ValidationQualityCalculator";246 validationQualityCalculator.Name = "BestAverageWorstValidationQualityCalculator"; 247 247 validationQualityCalculator.GetVariableInfo("Quality").ActualName = "ValidationQuality"; 248 248 validationQualityCalculator.GetVariableInfo("BestQuality").ActualName = "BestValidationQuality"; 249 249 validationQualityCalculator.GetVariableInfo("AverageQuality").ActualName = "AverageValidationQuality"; 250 250 validationQualityCalculator.GetVariableInfo("WorstQuality").ActualName = "WorstValidationQuality"; 251 DataCollector collector = new DataCollector(); 252 ItemList<StringData> names = collector.GetVariable("VariableNames").GetValue<ItemList<StringData>>(); 253 names.Add(new StringData("BestQuality")); 254 names.Add(new StringData("AverageQuality")); 255 names.Add(new StringData("WorstQuality")); 256 names.Add(new StringData("BestValidationQuality")); 257 names.Add(new StringData("AverageValidationQuality")); 258 names.Add(new StringData("WorstValidationQuality")); 259 LinechartInjector lineChartInjector = new LinechartInjector(); 260 lineChartInjector.GetVariableInfo("Linechart").ActualName = "Quality Linechart"; 261 lineChartInjector.GetVariable("NumberOfLines").GetValue<IntData>().Data = 6; 262 QualityLogger qualityLogger = new QualityLogger(); 263 QualityLogger validationQualityLogger = new QualityLogger(); 264 validationQualityLogger.Name = "ValidationQualityLogger"; 265 validationQualityLogger.GetVariableInfo("Quality").ActualName = "ValidationQuality"; 266 validationQualityLogger.GetVariableInfo("QualityLog").ActualName = "ValidationQualityLog"; 251 IOperator loggingOperator = CreateLoggingOperator(); 267 252 Counter counter = new Counter(); 268 253 counter.GetVariableInfo("Value").ActualName = "Generations"; 254 IOperator loopCondition = CreateLoopCondition(seq); 255 256 seq.AddSubOperator(childCreater); 257 seq.AddSubOperator(replacement); 258 seq.AddSubOperator(solutionStorer); 259 seq.AddSubOperator(qualityCalculator); 260 seq.AddSubOperator(validationQualityCalculator); 261 seq.AddSubOperator(loggingOperator); 262 seq.AddSubOperator(counter); 263 seq.AddSubOperator(loopCondition); 264 265 main.OperatorGraph.AddOperator(seq); 266 main.OperatorGraph.InitialOperator = seq; 267 return main; 268 } 269 270 internal virtual IOperator CreateLoggingOperator() { 271 return new EmptyOperator(); 272 } 273 274 internal virtual IOperator CreateLoopCondition(IOperator loop) { 275 SequentialProcessor seq = new SequentialProcessor(); 276 seq.Name = "Loop Condition"; 269 277 LessThanComparator comparator = new LessThanComparator(); 270 278 comparator.GetVariableInfo("LeftSide").ActualName = "Generations"; … … 274 282 cond.GetVariableInfo("Condition").ActualName = "GenerationsCondition"; 275 283 276 seq.AddSubOperator(childCreater);277 seq.AddSubOperator(replacement);278 seq.AddSubOperator(solutionStorer);279 seq.AddSubOperator(qualityCalculator);280 seq.AddSubOperator(validationQualityCalculator);281 seq.AddSubOperator(collector);282 seq.AddSubOperator(lineChartInjector);283 seq.AddSubOperator(qualityLogger);284 seq.AddSubOperator(validationQualityLogger);285 seq.AddSubOperator(counter);286 284 seq.AddSubOperator(comparator); 287 285 seq.AddSubOperator(cond); 288 cond.AddSubOperator(seq); 289 290 main.OperatorGraph.AddOperator(seq); 291 main.OperatorGraph.InitialOperator = seq; 292 return main; 286 287 cond.AddSubOperator(loop); 288 return seq; 293 289 } 294 290 -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/OffspringSelectionGP.cs
r1236 r1238 179 179 } 180 180 181 internal override IOperator CreateLoopCondition(IOperator loop) { 182 SequentialProcessor seq = new SequentialProcessor(); 183 seq.Name = "Loop Condition"; 184 LessThanComparator generationsComparator = new LessThanComparator(); 185 generationsComparator.GetVariableInfo("LeftSide").ActualName = "Generations"; 186 generationsComparator.GetVariableInfo("RightSide").ActualName = "MaxGenerations"; 187 generationsComparator.GetVariableInfo("Result").ActualName = "GenerationsCondition"; 188 189 LessThanComparator selPresComparator = new LessThanComparator(); 190 selPresComparator.GetVariableInfo("LeftSide").ActualName = "SelectionPressure"; 191 selPresComparator.GetVariableInfo("RightSide").ActualName = "SelectionPressureLimit"; 192 selPresComparator.GetVariableInfo("Result").ActualName = "SelectionPressureCondition"; 193 194 ConditionalBranch generationsCond = new ConditionalBranch(); 195 generationsCond.GetVariableInfo("Condition").ActualName = "GenerationsCondition"; 196 197 ConditionalBranch selPresCond = new ConditionalBranch(); 198 selPresCond.GetVariableInfo("Condition").ActualName = "SelectionPressureCondition"; 199 200 seq.AddSubOperator(generationsComparator); 201 seq.AddSubOperator(selPresComparator); 202 seq.AddSubOperator(generationsCond); 203 generationsCond.AddSubOperator(selPresCond); 204 selPresCond.AddSubOperator(loop); 205 206 return seq; 207 } 208 209 internal override IOperator CreateLoggingOperator() { 210 CombinedOperator loggingOperator = new CombinedOperator(); 211 loggingOperator.Name = "Logging"; 212 SequentialProcessor seq = new SequentialProcessor(); 213 214 DataCollector collector = new DataCollector(); 215 ItemList<StringData> names = collector.GetVariable("VariableNames").GetValue<ItemList<StringData>>(); 216 names.Add(new StringData("BestQuality")); 217 names.Add(new StringData("AverageQuality")); 218 names.Add(new StringData("WorstQuality")); 219 names.Add(new StringData("BestValidationQuality")); 220 names.Add(new StringData("AverageValidationQuality")); 221 names.Add(new StringData("WorstValidationQuality")); 222 names.Add(new StringData("EvaluatedSolutions")); 223 names.Add(new StringData("SelectionPressure")); 224 QualityLogger qualityLogger = new QualityLogger(); 225 QualityLogger validationQualityLogger = new QualityLogger(); 226 validationQualityLogger.Name = "ValidationQualityLogger"; 227 validationQualityLogger.GetVariableInfo("Quality").ActualName = "ValidationQuality"; 228 validationQualityLogger.GetVariableInfo("QualityLog").ActualName = "ValidationQualityLog"; 229 230 seq.AddSubOperator(collector); 231 seq.AddSubOperator(qualityLogger); 232 seq.AddSubOperator(validationQualityLogger); 233 234 loggingOperator.OperatorGraph.AddOperator(seq); 235 loggingOperator.OperatorGraph.InitialOperator = seq; 236 return loggingOperator; 237 } 238 239 181 240 public override IEditor CreateEditor() { 182 241 return new OffspringSelectionGpEditor(this); -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/StandardGP.cs
r1235 r1238 194 194 } 195 195 196 internal override IOperator CreateLoggingOperator() { 197 CombinedOperator loggingOperator = new CombinedOperator(); 198 loggingOperator.Name = "Logging"; 199 SequentialProcessor seq = new SequentialProcessor(); 200 201 DataCollector collector = new DataCollector(); 202 ItemList<StringData> names = collector.GetVariable("VariableNames").GetValue<ItemList<StringData>>(); 203 names.Add(new StringData("BestQuality")); 204 names.Add(new StringData("AverageQuality")); 205 names.Add(new StringData("WorstQuality")); 206 names.Add(new StringData("BestValidationQuality")); 207 names.Add(new StringData("AverageValidationQuality")); 208 names.Add(new StringData("WorstValidationQuality")); 209 LinechartInjector lineChartInjector = new LinechartInjector(); 210 lineChartInjector.GetVariableInfo("Linechart").ActualName = "Quality Linechart"; 211 lineChartInjector.GetVariable("NumberOfLines").GetValue<IntData>().Data = 6; 212 QualityLogger qualityLogger = new QualityLogger(); 213 QualityLogger validationQualityLogger = new QualityLogger(); 214 validationQualityLogger.Name = "ValidationQualityLogger"; 215 validationQualityLogger.GetVariableInfo("Quality").ActualName = "ValidationQuality"; 216 validationQualityLogger.GetVariableInfo("QualityLog").ActualName = "ValidationQualityLog"; 217 218 seq.AddSubOperator(collector); 219 seq.AddSubOperator(lineChartInjector); 220 seq.AddSubOperator(qualityLogger); 221 seq.AddSubOperator(validationQualityLogger); 222 223 loggingOperator.OperatorGraph.AddOperator(seq); 224 loggingOperator.OperatorGraph.InitialOperator = seq; 225 return loggingOperator; 226 } 227 196 228 public virtual IEditor CreateEditor() { 197 229 return new StandardGpEditor(this);
Note: See TracChangeset
for help on using the changeset viewer.