Index: branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/HeuristicLab.Algorithms.LearningClassifierSystems-3.3.csproj
===================================================================
--- branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/HeuristicLab.Algorithms.LearningClassifierSystems-3.3.csproj	(revision 9110)
+++ branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/HeuristicLab.Algorithms.LearningClassifierSystems-3.3.csproj	(revision 9154)
@@ -41,4 +41,7 @@
       <Private>False</Private>
     </Reference>
+    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
     <Reference Include="HeuristicLab.Collections-3.3">
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
@@ -57,5 +60,7 @@
       <Private>False</Private>
     </Reference>
-    <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
+    <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
     <Reference Include="HeuristicLab.Operators-3.3">
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
@@ -86,5 +91,7 @@
       <Private>False</Private>
     </Reference>
-    <Reference Include="HeuristicLab.Selection-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
+    <Reference Include="HeuristicLab.Selection-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
@@ -111,12 +118,15 @@
       <Project>{CE7163C5-BFFE-45F0-9BD0-E10EF24E8BD2}</Project>
       <Name>HeuristicLab.Encodings.CombinedIntegerVectorEncoding-3.3</Name>
+      <Private>False</Private>
     </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Encodings.ConditionActionEncoding\3.3\HeuristicLab.Encodings.ConditionActionEncoding-3.3.csproj">
       <Project>{422FB262-0845-4969-8D16-12F057AA90B1}</Project>
       <Name>HeuristicLab.Encodings.ConditionActionEncoding-3.3</Name>
+      <Private>False</Private>
     </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Problems.ConditionActionClassification\3.3\HeuristicLab.Problems.ConditionActionClassification-3.3.csproj">
       <Project>{EA51D441-F6A3-41E1-9993-A2488E93C222}</Project>
       <Name>HeuristicLab.Problems.ConditionActionClassification-3.3</Name>
+      <Private>False</Private>
     </ProjectReference>
   </ItemGroup>
Index: branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LCSAdaptedGeneticAlgorithm.cs
===================================================================
--- branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LCSAdaptedGeneticAlgorithm.cs	(revision 9110)
+++ branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LCSAdaptedGeneticAlgorithm.cs	(revision 9154)
@@ -72,7 +72,4 @@
       get { return (ValueLookupParameter<VariableCollection>)Parameters["Results"]; }
     }
-    public ValueLookupParameter<IOperator> AnalyzerParameter {
-      get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; }
-    }
     public ValueLookupParameter<IntValue> EvaluatedSolutionsParameter {
       get { return (ValueLookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
@@ -118,5 +115,4 @@
       Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
       Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
-      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each generation."));
       Parameters.Add(new ValueLookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
       Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population."));
@@ -128,5 +124,4 @@
       VariableCreator variableCreator = new VariableCreator();
       ResultsCollector resultsCollector1 = new ResultsCollector();
-      Placeholder analyzer1 = new Placeholder();
       Placeholder selector = new Placeholder();
       SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
@@ -141,5 +136,4 @@
       IntCounter intCounter = new IntCounter();
       Comparator comparator = new Comparator();
-      Placeholder analyzer2 = new Placeholder();
       ConditionalBranch conditionalBranch = new ConditionalBranch();
 
@@ -157,9 +151,6 @@
       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class GeneticAlgorithm expects this to be called Generations
 
-      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
+      //resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
       resultsCollector1.ResultsParameter.ActualName = "Results";
-
-      analyzer1.Name = "Analyzer";
-      analyzer1.OperatorParameter.ActualName = "Analyzer";
 
       tempIdAssigner.LeftSideParameter.ActualName = TEMPID;
@@ -220,7 +211,4 @@
       comparator.RightSideParameter.ActualName = "MaximumGenerations";
 
-      analyzer2.Name = "Analyzer";
-      analyzer2.OperatorParameter.ActualName = "Analyzer";
-
       conditionalBranch.ConditionParameter.ActualName = "Terminate";
       #endregion
@@ -229,6 +217,5 @@
       OperatorGraph.InitialOperator = variableCreator;
       variableCreator.Successor = resultsCollector1;
-      resultsCollector1.Successor = analyzer1;
-      analyzer1.Successor = tempIdAssigner;
+      resultsCollector1.Successor = tempIdAssigner;
       tempIdAssigner.Successor = setSubsumptionFalseSubScopesProcessor;
       setSubsumptionFalseSubScopesProcessor.Operator = setSubsumpByAssigner;
@@ -259,6 +246,5 @@
       doGASubsumptionBranch2.Successor = intCounter;
       intCounter.Successor = comparator;
-      comparator.Successor = analyzer2;
-      analyzer2.Successor = conditionalBranch;
+      comparator.Successor = conditionalBranch;
       conditionalBranch.FalseBranch = selector;
       conditionalBranch.TrueBranch = null;
Index: branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystem.cs
===================================================================
--- branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystem.cs	(revision 9110)
+++ branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystem.cs	(revision 9154)
@@ -21,9 +21,13 @@
 
 using System;
+using System.Linq;
+using HeuristicLab.Analysis;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
 using HeuristicLab.Encodings.ConditionActionEncoding;
+using HeuristicLab.Operators;
 using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Operators;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -105,4 +109,10 @@
       get { return (ValueParameter<BoolValue>)Parameters["DoActionSetSubsumption"]; }
     }
+    private ValueParameter<MultiAnalyzer> AnalyzerParameter {
+      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
+    }
+    private ValueParameter<IntValue> MaxIterationsParameter {
+      get { return (ValueParameter<IntValue>)Parameters["MaxIterations"]; }
+    }
     #endregion
 
@@ -180,9 +190,17 @@
       set { DoActionSetSubsumptionParameter.Value = value; }
     }
+    public IntValue MaxIterations {
+      get { return MaxIterationsParameter.Value; }
+      set { MaxIterationsParameter.Value = value; }
+    }
+    public MultiAnalyzer Analyzer {
+      get { return AnalyzerParameter.Value; }
+      set { AnalyzerParameter.Value = value; }
+    }
     private RandomCreator RandomCreator {
       get { return (RandomCreator)OperatorGraph.InitialOperator; }
     }
     public LearningClassifierSystemMainLoop MainLoop {
-      get { return (LearningClassifierSystemMainLoop)RandomCreator.Successor; }
+      get { return FindMainLoop(RandomCreator.Successor); }
     }
     #endregion
@@ -209,4 +227,6 @@
       Parameters.Add(new ValueParameter<BoolValue>("DoGASubsumption", "Specifies if offsprings are tested for possible logical subsumption by parents.", new BoolValue(true)));
       Parameters.Add(new ValueParameter<BoolValue>("DoActionSetSubsumption", "Specifies if action set is tested for subsuming classifiers.", new BoolValue(true)));
+      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
+      Parameters.Add(new ValueParameter<IntValue>("MaxIterations", "The maximum number of iterations.", new IntValue(1000)));
       #endregion
 
@@ -214,5 +234,5 @@
       RandomCreator randomCreator = new RandomCreator();
 
-      //ResultsCollector resultsCollector = new ResultsCollector();
+      ResultsCollector resultsCollector = new ResultsCollector();
       LearningClassifierSystemMainLoop mainLoop = new LearningClassifierSystemMainLoop();
 
@@ -222,10 +242,18 @@
       randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
       randomCreator.SetSeedRandomlyParameter.Value = null;
+
+      resultsCollector.ResultsParameter.ActualName = "Results";
+
+      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
+      mainLoop.MaxIterationsParameter.ActualName = MaxIterationsParameter.Name;
       #endregion
 
       #region Create operator graph
       OperatorGraph.InitialOperator = randomCreator;
-      randomCreator.Successor = mainLoop;
+      randomCreator.Successor = resultsCollector;
+      resultsCollector.Successor = mainLoop;
       #endregion
+
+      UpdateAnalyzers();
     }
     private LearningClassifierSystem(LearningClassifierSystem original, Cloner cloner)
@@ -242,4 +270,5 @@
         ParameterizeEvaluator(Problem.Evaluator);
         MainLoop.SetCurrentProblem(Problem);
+        UpdateAnalyzers();
       }
       base.OnProblemChanged();
@@ -253,4 +282,8 @@
       MainLoop.SetCurrentProblem(Problem);
       base.Problem_SolutionCreatorChanged(sender, e);
+    }
+    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
+      UpdateAnalyzers();
+      base.Problem_OperatorsChanged(sender, e);
     }
 
@@ -262,4 +295,21 @@
       evaluator.ErrorZeroParameter.ActualName = ErrorZeroParameter.Name;
     }
+
+    private void UpdateAnalyzers() {
+      Analyzer.Operators.Clear();
+      if (Problem != null) {
+        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>()) {
+          Analyzer.Operators.Add(analyzer, analyzer.EnabledByDefault);
+        }
+      }
+    }
+
+    private LearningClassifierSystemMainLoop FindMainLoop(IOperator start) {
+      IOperator mainLoop = start;
+      while (mainLoop != null && !(mainLoop is LearningClassifierSystemMainLoop))
+        mainLoop = ((SingleSuccessorOperator)mainLoop).Successor;
+      if (mainLoop == null) return null;
+      else return (LearningClassifierSystemMainLoop)mainLoop;
+    }
   }
 }
Index: branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystemMainLoop.cs
===================================================================
--- branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystemMainLoop.cs	(revision 9110)
+++ branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystemMainLoop.cs	(revision 9154)
@@ -55,4 +55,10 @@
       get { return (IConstrainedValueParameter<IOperator>)Parameters["AfterCrossover"]; }
     }
+    public LookupParameter<IntValue> MaxIterationsParameter {
+      get { return (LookupParameter<IntValue>)Parameters["MaxIterations"]; }
+    }
+    public ValueLookupParameter<IOperator> AnalyzerParameter {
+      get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; }
+    }
     #endregion
 
@@ -97,11 +103,25 @@
       XCSAfterCrossoverOperator afterCrossover = new XCSAfterCrossoverOperator();
       Parameters.Add(new ConstrainedValueParameter<IOperator>("AfterCrossover", "The operator used to select solutions for reproduction.", new ItemSet<IOperator>() { new XCSAfterCrossoverOperator() }, afterCrossover));
+      Parameters.Add(new LookupParameter<IntValue>("MaxIterations", "The maximum number of iterations the algorithm will do."));
+      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each generation."));
       #endregion
+
+
+      //test
+      DataReducer testReducer = new DataReducer();
+      testReducer.TargetParameter.ActualName = "TestCurrentPopulation";
+      testReducer.ParameterToReduce.ActualName = "Numerosity";
+      testReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum);
+      testReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign);
 
       #region Create operators
       VariableCreator variableCreator = new VariableCreator();
+      ResultsCollector resultsCollector = new ResultsCollector();
+      Placeholder finalAnalyzer = new Placeholder();
       ConditionalBranch initialPopulationConditionalBranch = new ConditionalBranch();
       initialSolutionsCreator = new SolutionsCreator();
       Assigner initialPopulationSizeAssigner = new Assigner();
+      Comparator maxIterationsComparator = new Comparator();
+      ConditionalBranch terminationConditionalBranch1 = new ConditionalBranch();
       IntCounter iterationCounter = new IntCounter();
       UniformSubScopesProcessor matchCondtionSubScopesProcessor = new UniformSubScopesProcessor();
@@ -159,4 +179,10 @@
       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("CurrentPopulationSize", new IntValue(0)));
 
+      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iteration"));
+      resultsCollector.ResultsParameter.ActualName = "Results";
+
+      finalAnalyzer.Name = "Analyzer";
+      finalAnalyzer.OperatorParameter.ActualName = "Analyzer";
+
       initialPopulationConditionalBranch.ConditionParameter.ActualName = "CreateInitialPopulation";
 
@@ -165,4 +191,11 @@
       initialPopulationSizeAssigner.LeftSideParameter.ActualName = "CurrentPopulationSize";
       initialPopulationSizeAssigner.RightSideParameter.ActualName = "N";
+
+      maxIterationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
+      maxIterationsComparator.LeftSideParameter.ActualName = "Iteration";
+      maxIterationsComparator.RightSideParameter.ActualName = MaxIterationsParameter.ActualName;
+      maxIterationsComparator.ResultParameter.ActualName = "TerminateMaxIterations";
+
+      terminationConditionalBranch1.ConditionParameter.ActualName = "TerminateMaxIterations";
 
       iterationCounter.ValueParameter.ActualName = "Iteration";
@@ -311,9 +344,13 @@
       OperatorGraph.InitialOperator = variableCreator;
 
-      variableCreator.Successor = initialPopulationConditionalBranch;
+      variableCreator.Successor = resultsCollector;
+      resultsCollector.Successor = initialPopulationConditionalBranch;
       initialPopulationConditionalBranch.TrueBranch = initialSolutionsCreator;
       initialSolutionsCreator.Successor = initialPopulationSizeAssigner;
       initialPopulationConditionalBranch.FalseBranch = new EmptyOperator();
-      initialPopulationConditionalBranch.Successor = classifierFetcher;
+      initialPopulationConditionalBranch.Successor = maxIterationsComparator;
+      maxIterationsComparator.Successor = terminationConditionalBranch1;
+      terminationConditionalBranch1.TrueBranch = finalAnalyzer;
+      terminationConditionalBranch1.FalseBranch = classifierFetcher;
       classifierFetcher.Successor = matchCondtionSubScopesProcessor;
       matchCondtionSubScopesProcessor.Operator = matchConditionOperator;
@@ -371,5 +408,8 @@
       deletionSelectorAfterGA.Successor = leftReducerAfterGA;
       leftReducerAfterGA.Successor = iterationCounter;
-      iterationCounter.Successor = classifierFetcher;
+      //iterationCounter.Successor = maxIterationsComparator;
+
+      iterationCounter.Successor = testReducer;
+      testReducer.Successor = maxIterationsComparator;
       #endregion
     }
