Changeset 9154 for branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystemMainLoop.cs
- Timestamp:
- 01/14/13 15:23:17 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystemMainLoop.cs
r9110 r9154 55 55 get { return (IConstrainedValueParameter<IOperator>)Parameters["AfterCrossover"]; } 56 56 } 57 public LookupParameter<IntValue> MaxIterationsParameter { 58 get { return (LookupParameter<IntValue>)Parameters["MaxIterations"]; } 59 } 60 public ValueLookupParameter<IOperator> AnalyzerParameter { 61 get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; } 62 } 57 63 #endregion 58 64 … … 97 103 XCSAfterCrossoverOperator afterCrossover = new XCSAfterCrossoverOperator(); 98 104 Parameters.Add(new ConstrainedValueParameter<IOperator>("AfterCrossover", "The operator used to select solutions for reproduction.", new ItemSet<IOperator>() { new XCSAfterCrossoverOperator() }, afterCrossover)); 105 Parameters.Add(new LookupParameter<IntValue>("MaxIterations", "The maximum number of iterations the algorithm will do.")); 106 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each generation.")); 99 107 #endregion 108 109 110 //test 111 DataReducer testReducer = new DataReducer(); 112 testReducer.TargetParameter.ActualName = "TestCurrentPopulation"; 113 testReducer.ParameterToReduce.ActualName = "Numerosity"; 114 testReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum); 115 testReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign); 100 116 101 117 #region Create operators 102 118 VariableCreator variableCreator = new VariableCreator(); 119 ResultsCollector resultsCollector = new ResultsCollector(); 120 Placeholder finalAnalyzer = new Placeholder(); 103 121 ConditionalBranch initialPopulationConditionalBranch = new ConditionalBranch(); 104 122 initialSolutionsCreator = new SolutionsCreator(); 105 123 Assigner initialPopulationSizeAssigner = new Assigner(); 124 Comparator maxIterationsComparator = new Comparator(); 125 ConditionalBranch terminationConditionalBranch1 = new ConditionalBranch(); 106 126 IntCounter iterationCounter = new IntCounter(); 107 127 UniformSubScopesProcessor matchCondtionSubScopesProcessor = new UniformSubScopesProcessor(); … … 159 179 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("CurrentPopulationSize", new IntValue(0))); 160 180 181 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iteration")); 182 resultsCollector.ResultsParameter.ActualName = "Results"; 183 184 finalAnalyzer.Name = "Analyzer"; 185 finalAnalyzer.OperatorParameter.ActualName = "Analyzer"; 186 161 187 initialPopulationConditionalBranch.ConditionParameter.ActualName = "CreateInitialPopulation"; 162 188 … … 165 191 initialPopulationSizeAssigner.LeftSideParameter.ActualName = "CurrentPopulationSize"; 166 192 initialPopulationSizeAssigner.RightSideParameter.ActualName = "N"; 193 194 maxIterationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual); 195 maxIterationsComparator.LeftSideParameter.ActualName = "Iteration"; 196 maxIterationsComparator.RightSideParameter.ActualName = MaxIterationsParameter.ActualName; 197 maxIterationsComparator.ResultParameter.ActualName = "TerminateMaxIterations"; 198 199 terminationConditionalBranch1.ConditionParameter.ActualName = "TerminateMaxIterations"; 167 200 168 201 iterationCounter.ValueParameter.ActualName = "Iteration"; … … 311 344 OperatorGraph.InitialOperator = variableCreator; 312 345 313 variableCreator.Successor = initialPopulationConditionalBranch; 346 variableCreator.Successor = resultsCollector; 347 resultsCollector.Successor = initialPopulationConditionalBranch; 314 348 initialPopulationConditionalBranch.TrueBranch = initialSolutionsCreator; 315 349 initialSolutionsCreator.Successor = initialPopulationSizeAssigner; 316 350 initialPopulationConditionalBranch.FalseBranch = new EmptyOperator(); 317 initialPopulationConditionalBranch.Successor = classifierFetcher; 351 initialPopulationConditionalBranch.Successor = maxIterationsComparator; 352 maxIterationsComparator.Successor = terminationConditionalBranch1; 353 terminationConditionalBranch1.TrueBranch = finalAnalyzer; 354 terminationConditionalBranch1.FalseBranch = classifierFetcher; 318 355 classifierFetcher.Successor = matchCondtionSubScopesProcessor; 319 356 matchCondtionSubScopesProcessor.Operator = matchConditionOperator; … … 371 408 deletionSelectorAfterGA.Successor = leftReducerAfterGA; 372 409 leftReducerAfterGA.Successor = iterationCounter; 373 iterationCounter.Successor = classifierFetcher; 410 //iterationCounter.Successor = maxIterationsComparator; 411 412 iterationCounter.Successor = testReducer; 413 testReducer.Successor = maxIterationsComparator; 374 414 #endregion 375 415 }
Note: See TracChangeset
for help on using the changeset viewer.