Index: branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/ConditionActionClassificationProblem.cs
===================================================================
--- branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/ConditionActionClassificationProblem.cs	(revision 9226)
+++ branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/ConditionActionClassificationProblem.cs	(revision 9226)
@@ -0,0 +1,222 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.ConditionActionEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.Instances;
+
+namespace HeuristicLab.Problems.ConditionActionClassification {
+  [StorableClass]
+  public abstract class ConditionActionClassificationProblem<T, U, V> : HeuristicOptimizationProblem<XCSEvaluator, T>, IConditionActionProblem,
+  IProblemInstanceConsumer<V>
+    where T : class, ISolutionCreator
+    where U : class, IClassifierComparer
+    where V : class, IConditionActionProblemData {
+    private const string ClassifierFetcherParameterName = "ClassifierFetcher";
+    private const string ActionExecuterParameterName = "ActionExecuter";
+    private const string ActionSetSubsumptionOperatorParameterName = "ActionSetSubsumption";
+
+    public abstract string ChildName { get; }
+
+    IXCSEvaluator IConditionActionProblem.Evaluator {
+      get { return Evaluator; }
+    }
+
+    #region parameter properties
+    public IValueParameter<V> ProblemDataParameter {
+      get { return (IValueParameter<V>)Parameters["ProblemData"]; }
+    }
+    public IValueParameter<ICoveringSolutionCreator> CoveringSolutionCreatorParameter {
+      get { return (IValueParameter<ICoveringSolutionCreator>)Parameters["CoveringSolutionCreator"]; }
+    }
+    public IFixedValueParameter<PercentValue> ChangeSymbolProbabilityInCoveringParameter {
+      get { return (IFixedValueParameter<PercentValue>)Parameters["ChangeSymbolProbabilityInCovering"]; }
+    }
+    public IFixedValueParameter<DoubleValue> PositiveRewardParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters["PositiveReward"]; }
+    }
+    public IFixedValueParameter<DoubleValue> NegativeRewardParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters["NegativeReward"]; }
+    }
+    public IFixedValueParameter<DoubleValue> InitialPredictionParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters["InitialPrediction"]; }
+    }
+    public IFixedValueParameter<DoubleValue> InitialErrorParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters["InitialError"]; }
+    }
+    public IFixedValueParameter<DoubleValue> InitialFitnessParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters["InitialFitness"]; }
+    }
+    public IFixedValueParameter<ItemSet<IAction>> PossibleActionsParameter {
+      get { return (IFixedValueParameter<ItemSet<IAction>>)Parameters["PossibleActions"]; }
+    }
+    public IFixedValueParameter<IntValue> ThetaMinimalNumberOfActionsParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters["ThetaMinimalNumberOfActions"]; }
+    }
+    #endregion
+
+    #region properties
+    IParameter IConditionActionProblem.ProblemDataParameter {
+      get { return ProblemDataParameter; }
+    }
+    IConditionActionProblemData IConditionActionProblem.ProblemData {
+      get { return ProblemData; }
+    }
+    public virtual V ProblemData {
+      get { return ProblemDataParameter.Value; }
+      protected set {
+        ProblemDataParameter.Value = value;
+      }
+    }
+    IParameter IConditionActionProblem.PossibleActionsParameter {
+      get { return PossibleActionsParameter; }
+    }
+    public ItemSet<IAction> PossibleActions {
+      get { return PossibleActionsParameter.Value; }
+    }
+    public IActionExecuter ActionExecuter {
+      get { return ActionExecuterParameter.Value; }
+    }
+    public ValueParameter<IActionExecuter> ActionExecuterParameter {
+      get { return (ValueParameter<IActionExecuter>)Parameters[ActionExecuterParameterName]; }
+    }
+    IParameter IConditionActionProblem.ActionExecuterParameter { get { return ActionExecuterParameter; } }
+    public ClassifierFetcher ClassifierFetcher {
+      get { return ClassifierFetcherParameter.Value; }
+    }
+    public ValueParameter<ClassifierFetcher> ClassifierFetcherParameter {
+      get { return (ValueParameter<ClassifierFetcher>)Parameters[ClassifierFetcherParameterName]; }
+    }
+    IClassifierFetcher IConditionActionProblem.ClassifierFetcher { get { return ClassifierFetcher; } }
+    IParameter IConditionActionProblem.ClassifierFetcherParameter { get { return ClassifierFetcherParameter; } }
+    public ActionSetSubsumptionOperator ActionSetSubsumptionOperator {
+      get { return ActionSetSubsumptionOperatorParameter.Value; }
+    }
+    public ValueParameter<ActionSetSubsumptionOperator> ActionSetSubsumptionOperatorParameter {
+      get { return (ValueParameter<ActionSetSubsumptionOperator>)Parameters[ActionSetSubsumptionOperatorParameterName]; }
+    }
+    IActionSetSubsumption IConditionActionProblem.ActionSetSubsumptionOperator { get { return ActionSetSubsumptionOperator; } }
+    IParameter IConditionActionProblem.ActionSetSubsumptionOperatorParameter { get { return ActionSetSubsumptionOperatorParameter; } }
+
+    protected IntValue ThetaMinimalNumberOfActions {
+      get { return ThetaMinimalNumberOfActionsParameter.Value; }
+    }
+    IParameter IConditionActionProblem.ThetaMinimalNumberOfActionsParameter {
+      get { return ThetaMinimalNumberOfActionsParameter; }
+    }
+    public ICoveringSolutionCreator CoveringSolutionCreator {
+      get { return CoveringSolutionCreatorParameter.Value; }
+    }
+    IParameter IConditionActionProblem.CoveringSolutionCreatorParameter {
+      get { return CoveringSolutionCreatorParameter; }
+    }
+    IParameter IConditionActionProblem.ClassifierComparerParameter {
+      get { return ClassifierComparerParameter; }
+    }
+
+    public abstract IFixedValueParameter<U> ClassifierComparerParameter { get; }
+    #endregion
+
+    [StorableConstructor]
+    protected ConditionActionClassificationProblem(bool deserializing) : base(deserializing) { }
+    protected ConditionActionClassificationProblem(ConditionActionClassificationProblem<T, U, V> original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public ConditionActionClassificationProblem(V problemData, XCSEvaluator evaluator, T solutionCreator, ICoveringSolutionCreator coveringSolutionCreator)
+      : base(evaluator, solutionCreator) {
+      Parameters.Add(new ValueParameter<V>("ProblemData", "", problemData));
+      Parameters.Add(new FixedValueParameter<DoubleValue>("PositiveReward", "", new DoubleValue(1000)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>("NegativeReward", "", new DoubleValue(0)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>("InitialPrediction", "Initial Presiction", new DoubleValue(0)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>("InitialError", "Initial Error", new DoubleValue(0)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>("InitialFitness", "Initial Fitness", new DoubleValue(0)));
+
+      Parameters.Add(new ValueParameter<IActionExecuter>(ActionExecuterParameterName, "", new ActionExecuter()));
+      Parameters.Add(new ValueParameter<ClassifierFetcher>(ClassifierFetcherParameterName, "", new ClassifierFetcher()));
+      Parameters.Add(new FixedValueParameter<IntValue>("ThetaMinimalNumberOfActions", "Minimal number of actions, which have to be present in the match set, or else covering will occure.", new IntValue(1)));
+
+      Parameters.Add(new ValueParameter<ICoveringSolutionCreator>("CoveringSolutionCreator", "", coveringSolutionCreator));
+      Parameters.Add(new FixedValueParameter<PercentValue>("ChangeSymbolProbabilityInCovering", "", new PercentValue(0.33)));
+
+      Parameters.Add(new ValueParameter<ActionSetSubsumptionOperator>(ActionSetSubsumptionOperatorParameterName, "", new ActionSetSubsumptionOperator()));
+
+      Evaluator.InitialErrorParameter.ActualName = "InitialError";
+      Evaluator.InitialFitnessParameter.ActualName = "InitialFitness";
+      Evaluator.InitialPredictionParameter.ActualName = "InitialPrediction";
+
+      coveringSolutionCreator.ChangeSymbolProbabilityParameter.ActualName = ChangeSymbolProbabilityInCoveringParameter.Name;
+      coveringSolutionCreator.CoverInputParameter.ActualName = ClassifierFetcher.CurrentInputToMatchParameter.ActualName;
+      coveringSolutionCreator.CreatedClassifierParameter.ActualName = ChildName;
+
+      ClassifierFetcher.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
+
+      ActionExecuter.CurrentActionToMatchParameter.ActualName = ClassifierFetcher.CurrentActionToMatchParameter.ActualName;
+      ActionExecuter.NegativeRewardParameter.ActualName = NegativeRewardParameter.Name;
+      ActionExecuter.PositiveRewardParameter.ActualName = PositiveRewardParameter.Name;
+
+      ActionSetSubsumptionOperator.ClassifiersParameter.ActualName = ChildName;
+
+      InitializeOperators();
+
+      problemData.Changed += new System.EventHandler(problemData_Changed);
+    }
+
+    private void problemData_Changed(object sender, System.EventArgs e) {
+      SetPossibleActions();
+    }
+
+    private void InitializeOperators() {
+      Operators.Add(new BestTrainingXCSSolutionAnalyzer());
+      Operators.Add(new CurrentXCSSolutionAnalyzer());
+    }
+
+    protected void ParameterizeOperators() {
+      foreach (XCSSolutionAnalyzer xcsAnalyzer in Operators.OfType<XCSSolutionAnalyzer>()) {
+        xcsAnalyzer.ClassifierParameter.ActualName = ChildName;
+        xcsAnalyzer.PredictionParameter.ActualName = Evaluator.PredictionParameter.ActualName;
+        xcsAnalyzer.ErrorParameter.ActualName = Evaluator.ErrorParameter.ActualName;
+        xcsAnalyzer.FitnessParameter.ActualName = Evaluator.FitnessParameter.ActualName;
+        xcsAnalyzer.ExperienceParameter.ActualName = Evaluator.ExperienceParameter.ActualName;
+        xcsAnalyzer.AverageActionSetSizeParameter.ActualName = Evaluator.AverageActionSetSizeParameter.ActualName;
+        xcsAnalyzer.NumerosityParameter.ActualName = Evaluator.NumerosityParameter.ActualName;
+        xcsAnalyzer.TimestampParameter.ActualName = Evaluator.TimestampParameter.ActualName;
+        xcsAnalyzer.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
+        xcsAnalyzer.ResultsParameter.ActualName = "Results";
+        xcsAnalyzer.ClassifierComparerParameter.ActualName = ClassifierComparerParameter.Name;
+      }
+    }
+
+    protected abstract void SetPossibleActions();
+
+    public void Load(V data) {
+      Name = data.Name;
+      Description = data.Description;
+      ProblemData = data;
+    }
+  }
+}
Index: branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/ConditionActionClassificationProblemData.cs
===================================================================
--- branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/ConditionActionClassificationProblemData.cs	(revision 9226)
+++ branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/ConditionActionClassificationProblemData.cs	(revision 9226)
@@ -0,0 +1,170 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.ConditionActionEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Problems.ConditionActionClassification {
+  [StorableClass]
+  [Item("ConditionActionClassificationProblemData", "A problem data for LCS.")]
+  public abstract class ConditionActionClassificationProblemData : ParameterizedNamedItem, IConditionActionProblemData {
+
+    #region default data
+    public static string[] defaultVariableNames = new string[] { "a", "b", "c", "d", "e", "f", "g" };
+    public static double[,] defaultData = new double[,]{
+      {0,0,1,1,0,0,0},
+      {0,1,1,1,0,0,0},
+      {0,0,1,0,0,0,1},
+      {1,0,1,0,1,1,0}
+    };
+    #endregion
+
+    #region parameter properites
+    public IFixedValueParameter<Dataset> DatasetParameter {
+      get { return (IFixedValueParameter<Dataset>)Parameters["Dataset"]; }
+    }
+    public IFixedValueParameter<ReadOnlyCheckedItemList<StringValue>> ConditionVariablesParameter {
+      get { return (IFixedValueParameter<ReadOnlyCheckedItemList<StringValue>>)Parameters["ConditionVariables"]; }
+    }
+    public IFixedValueParameter<ReadOnlyCheckedItemList<StringValue>> ActionVariablesParameter {
+      get { return (IFixedValueParameter<ReadOnlyCheckedItemList<StringValue>>)Parameters["ActionVariables"]; }
+    }
+    public IFixedValueParameter<IntRange> TrainingPartitionParameter {
+      get { return (IFixedValueParameter<IntRange>)Parameters["TrainingPartition"]; }
+    }
+    public IFixedValueParameter<IntRange> TestPartitionParameter {
+      get { return (IFixedValueParameter<IntRange>)Parameters["TestPartition"]; }
+    }
+    #endregion
+
+    #region properties
+    public Dataset Dataset {
+      get { return DatasetParameter.Value; }
+    }
+    public ICheckedItemList<StringValue> ConditionVariables {
+      get { return ConditionVariablesParameter.Value; }
+    }
+    public ICheckedItemList<StringValue> ActionVariables {
+      get { return ActionVariablesParameter.Value; }
+    }
+    public IEnumerable<string> AllowedConditionVariables {
+      get { return ConditionVariables.CheckedItems.Select(x => x.Value.Value); }
+    }
+    public IEnumerable<string> AllowedActionVariables {
+      get { return ActionVariables.CheckedItems.Select(x => x.Value.Value); }
+    }
+    public IntRange TrainingPartition {
+      get { return TrainingPartitionParameter.Value; }
+    }
+    public IntRange TestPartition {
+      get { return TestPartitionParameter.Value; }
+    }
+    public IEnumerable<int> TrainingIndices {
+      get {
+        return Enumerable.Range(TrainingPartition.Start, Math.Max(0, TrainingPartition.End - TrainingPartition.Start))
+                         .Where(IsTrainingSample);
+      }
+    }
+    public IEnumerable<int> TestIndices {
+      get {
+        return Enumerable.Range(TestPartition.Start, Math.Max(0, TestPartition.End - TestPartition.Start))
+           .Where(IsTestSample);
+      }
+    }
+    public bool IsTrainingSample(int index) {
+      return index >= 0 && index < Dataset.Rows &&
+        TrainingPartition.Start <= index && index < TrainingPartition.End &&
+        (index < TestPartition.Start || TestPartition.End <= index);
+    }
+    public bool IsTestSample(int index) {
+      return index >= 0 && index < Dataset.Rows &&
+             TestPartition.Start <= index && index < TestPartition.End;
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected ConditionActionClassificationProblemData(bool deserializing) : base(deserializing) { }
+    protected ConditionActionClassificationProblemData(ConditionActionClassificationProblemData original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public ConditionActionClassificationProblemData(Dataset dataset, IEnumerable<string> allowedConditionVariables, IEnumerable<string> allowedActionVariables) {
+      if (dataset == null) throw new ArgumentNullException("The dataset must not be null.");
+      if (allowedActionVariables == null) throw new ArgumentNullException("The allowedActionVariables must not be null.");
+      if (allowedConditionVariables == null) throw new ArgumentNullException("The allowedActionVariables must not be null.");
+
+      if (allowedActionVariables.Except(dataset.DoubleVariables).Any())
+        throw new ArgumentException("All allowed action variables must be present in the dataset and of type double.");
+      if (allowedConditionVariables.Except(dataset.DoubleVariables).Any())
+        throw new ArgumentException("All allowed condition variables must be present in the dataset and of type double.");
+
+      var actionVariables = new CheckedItemList<StringValue>(dataset.DoubleVariables.Select(x => new StringValue(x)));
+      var conditionVariables = new CheckedItemList<StringValue>(actionVariables);
+      foreach (StringValue x in actionVariables) {
+        actionVariables.SetItemCheckedState(x, allowedActionVariables.Contains(x.Value));
+        conditionVariables.SetItemCheckedState(x, allowedConditionVariables.Contains(x.Value));
+      }
+
+      int trainingPartitionStart = 0;
+      int trainingPartitionEnd = dataset.Rows / 2;
+      int testPartitionStart = dataset.Rows / 2;
+      int testPartitionEnd = dataset.Rows;
+
+      Parameters.Add(new FixedValueParameter<Dataset>("Dataset", "", dataset));
+      Parameters.Add(new FixedValueParameter<ReadOnlyCheckedItemList<StringValue>>("ActionVariables", "", actionVariables.AsReadOnly()));
+      Parameters.Add(new FixedValueParameter<ReadOnlyCheckedItemList<StringValue>>("ConditionVariables", "", conditionVariables.AsReadOnly()));
+      Parameters.Add(new FixedValueParameter<IntRange>("TrainingPartition", "", new IntRange(trainingPartitionStart, trainingPartitionEnd)));
+      Parameters.Add(new FixedValueParameter<IntRange>("TestPartition", "", new IntRange(testPartitionStart, testPartitionEnd)));
+
+      ((ValueParameter<Dataset>)DatasetParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false;
+    }
+
+    public event EventHandler Changed;
+    protected virtual void OnChanged() {
+      var listeners = Changed;
+      if (listeners != null) listeners(this, EventArgs.Empty);
+    }
+
+    public IEnumerable<IInput> FetchInput(IEnumerable<int> rows) {
+      foreach (var row in rows) {
+        yield return FetchInput(row);
+      }
+    }
+    public abstract IInput FetchInput(int rowNumber);
+
+    public IEnumerable<IAction> FetchAction(IEnumerable<int> rows) {
+      foreach (var row in rows) {
+        yield return FetchAction(row);
+      }
+    }
+    public abstract IAction FetchAction(int rowNumber);
+
+    protected IDictionary<int, IInput> fetchInputCache = new Dictionary<int, IInput>();
+  }
+}
Index: branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/HeuristicLab.Problems.ConditionActionClassification-3.3.csproj
===================================================================
--- branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/HeuristicLab.Problems.ConditionActionClassification-3.3.csproj	(revision 9204)
+++ branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/HeuristicLab.Problems.ConditionActionClassification-3.3.csproj	(revision 9226)
@@ -71,8 +71,7 @@
       <Private>False</Private>
     </Reference>
-    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <Private>False</Private>
     </Reference>
-    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     <Reference Include="System" />
     <Reference Include="System.Core" />
@@ -85,6 +84,6 @@
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="Implementation\ConditionActionClassificationProblem.cs" />
-    <Compile Include="Implementation\ConditionActionClassificationProblemData.cs" />
+    <Compile Include="ConditionActionClassificationProblem.cs" />
+    <Compile Include="ConditionActionClassificationProblemData.cs" />
     <Compile Include="Plugin.cs" />
     <None Include="HeuristicLab.snk" />
@@ -99,4 +98,5 @@
       <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
       <Name>HeuristicLab.Core-3.3</Name>
+      <Private>False</Private>
     </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Encodings.CombinedIntegerVectorEncoding\3.3\HeuristicLab.Encodings.CombinedIntegerVectorEncoding-3.3.csproj">
@@ -109,4 +109,8 @@
       <Name>HeuristicLab.Encodings.ConditionActionEncoding-3.3</Name>
       <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis\3.4\HeuristicLab.Problems.DataAnalysis-3.4.csproj">
+      <Project>{DF87C13E-A889-46FF-8153-66DCAA8C5674}</Project>
+      <Name>HeuristicLab.Problems.DataAnalysis-3.4</Name>
     </ProjectReference>
   </ItemGroup>
