Index: /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/HeuristicLab.DataPreprocessing-3.3.csproj
===================================================================
--- /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/HeuristicLab.DataPreprocessing-3.3.csproj	(revision 10382)
+++ /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/HeuristicLab.DataPreprocessing-3.3.csproj	(revision 10383)
@@ -95,5 +95,5 @@
     <Compile Include="Interfaces\IManipulationLogic.cs" />
     <Compile Include="Interfaces\ITransformationLogic.cs" />
-    <Compile Include="PreprocessingCloner.cs" />
+    <Compile Include="ProblemDataCreator.cs" />
     <Compile Include="Views\FilterView.cs">
       <SubType>UserControl</SubType>
Index: /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataPreprocessorStarter.cs
===================================================================
--- /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataPreprocessorStarter.cs	(revision 10382)
+++ /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataPreprocessorStarter.cs	(revision 10383)
@@ -34,11 +34,11 @@
     public void Start(IDataAnalysisProblemData problemData, View currentView) {
       IAlgorithm algorithm;
-      IProblem problem;
+      IDataAnalysisProblem problem;
       IItem parentItem = GetMostOuterContent(currentView, out algorithm, out problem);
-      var context = new PreprocessingContext(problemData, parentItem, algorithm, problem);
+      var context = new PreprocessingContext(problemData, algorithm, problem);
       MainFormManager.MainForm.ShowContent(context);
     }
 
-    private IItem GetMostOuterContent(Control control, out IAlgorithm algorithm, out IProblem problem) {
+    private IItem GetMostOuterContent(Control control, out IAlgorithm algorithm, out IDataAnalysisProblem problem) {
       algorithm = null;
       problem = null;
@@ -51,6 +51,6 @@
             algorithm = (IAlgorithm)itemView.Content;
           }
-          if (itemView.Content is IProblem) {
-            problem = (IProblem)itemView.Content;
+          if (itemView.Content is IDataAnalysisProblem) {
+            problem = (IDataAnalysisProblem)itemView.Content;
           }
         }
Index: /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingContext.cs
===================================================================
--- /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingContext.cs	(revision 10382)
+++ /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingContext.cs	(revision 10383)
@@ -20,4 +20,5 @@
 #endregion
 
+using System;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -27,8 +28,9 @@
 namespace HeuristicLab.DataPreprocessing {
   [Item("PreprocessingContext", "PreprocessingContext")]
-  public class PreprocessingContext : Item, IPreprocessingContext {
-    public PreprocessingContext(IDataAnalysisProblemData dataAnalysisProblemData, IItem parentItem, IAlgorithm algorithm, IProblem problem) {
+  public class PreprocessingContext
+    : Item, IPreprocessingContext {
+
+    public PreprocessingContext(IDataAnalysisProblemData dataAnalysisProblemData, IAlgorithm algorithm, IDataAnalysisProblem problem) {
       Data = new PreprocessingData(dataAnalysisProblemData);
-      ParentItem = parentItem;
       DataAnalysisProblemData = dataAnalysisProblemData;
       Algorithm = algorithm;
@@ -39,5 +41,4 @@
       : base(original, cloner) {
       Data = cloner.Clone(original.Data);
-      ParentItem = original.ParentItem;
       DataAnalysisProblemData = original.DataAnalysisProblemData;
       Algorithm = original.Algorithm;
@@ -47,18 +48,53 @@
     public IPreprocessingData Data { get; private set; }
 
-    /// <summary>
-    /// Parent algorithm, if available, or problem.
-    /// </summary>
-    public IItem ParentItem { get; private set; }
-
     public IDataAnalysisProblemData DataAnalysisProblemData { get; private set; }
 
     public IAlgorithm Algorithm { get; private set; }
 
-    public IProblem Problem { get; private set; }
+    public IDataAnalysisProblem Problem { get; private set; }
 
     public override IDeepCloneable Clone(Cloner cloner) {
       return new PreprocessingContext(this, cloner);
     }
+
+    public IItem ExportAlgorithmOrProblem() {
+      if (Algorithm != null) {
+        return ExportAlgorithm();
+      } else {
+        return ExportProblem();
+      }
+    }
+
+    public IProblem ExportProblem() {
+      return Export(Problem, SetupProblem);
+    }
+
+    private IDataAnalysisProblem SetupProblem(IProblem problem) {
+      return (IDataAnalysisProblem)problem;
+    }
+
+    public IAlgorithm ExportAlgorithm() {
+      return Export(Algorithm, SetupAlgorithm);
+    }
+
+    private IDataAnalysisProblem SetupAlgorithm(IAlgorithm algorithm) {
+      algorithm.Name = "Cloned " + algorithm.Name;
+      algorithm.Runs.Clear();
+
+      return (IDataAnalysisProblem)algorithm.Problem;
+    }
+
+    private T Export<T>(T original, Func<T, IDataAnalysisProblem> setup) where T : IItem {
+      var creator = new ProblemDataCreator(this);
+      var data = creator.CreateProblemData();
+
+      var clone = (T)original.Clone(new Cloner());
+
+      var problem = setup(clone);
+      problem.ProblemDataParameter.ActualValue = data;
+      problem.Name = "Cloned " + problem.Name;
+
+      return clone;
+    }
   }
 }
Index: /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/StatisticsLogic.cs
===================================================================
--- /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/StatisticsLogic.cs	(revision 10382)
+++ /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/StatisticsLogic.cs	(revision 10383)
@@ -1,6 +1,6 @@
 ﻿using System;
+using System.Collections.Generic;
 using System.Linq;
 using HeuristicLab.Common;
-using System.Collections.Generic;
 
 namespace HeuristicLab.DataPreprocessing {
@@ -75,20 +75,16 @@
     }
 
-    public DateTime GetMedianDateTime(int columnIndex)
-    {
+    public DateTime GetMedianDateTime(int columnIndex) {
       DateTime median = new DateTime();
-      if (preprocessingData.IsType<DateTime>(columnIndex))
-      {
-          median = GetSecondsAsDateTime(GetDateTimeAsSeconds(columnIndex).Median());
+      if (preprocessingData.IsType<DateTime>(columnIndex)) {
+        median = GetSecondsAsDateTime(GetDateTimeAsSeconds(columnIndex).Median());
       }
       return median;
     }
 
-    public DateTime GetAverageDateTime(int columnIndex)
-    {
+    public DateTime GetAverageDateTime(int columnIndex) {
       DateTime avg = new DateTime();
-      if (preprocessingData.IsType<DateTime>(columnIndex))
-      {
-          avg = GetSecondsAsDateTime(GetDateTimeAsSeconds(columnIndex).Average());   
+      if (preprocessingData.IsType<DateTime>(columnIndex)) {
+        avg = GetSecondsAsDateTime(GetDateTimeAsSeconds(columnIndex).Average());
       }
       return avg;
@@ -107,4 +103,6 @@
     public double GetStandardDeviation(int columnIndex) {
       double stdDev = double.NaN;
+      //TODO: fix me
+      /*
       if (preprocessingData.IsType<double>(columnIndex)) {
         stdDev = preprocessingData.GetValues<double>(columnIndex).StandardDeviation();
@@ -113,10 +111,12 @@
         stdDev = GetDateTimeAsSeconds(variableName).StandardDeviation();
       }
+      */
       return stdDev;
     }
 
     public double GetVariance(int columnIndex) {
-       double variance = double.NaN;
-
+      double variance = double.NaN;
+      //TODO: fix me
+      /*
       if (preprocessingData.IsType<double>(columnIndex)) {
         variance = preprocessingData.GetValues<double>(columnIndex).Variance();
@@ -125,4 +125,5 @@
         variance = GetDateTimeAsSeconds(variableName).Variance();
       }
+      */
       return variance;
     }
@@ -161,13 +162,11 @@
     }
 
-    private IEnumerable<double> GetDateTimeAsSeconds(int columnIndex)
-    {
-        return preprocessingData.GetValues<DateTime>(columnIndex).Select(x => (double)x.Ticks / TimeSpan.TicksPerSecond);
+    private IEnumerable<double> GetDateTimeAsSeconds(int columnIndex) {
+      return preprocessingData.GetValues<DateTime>(columnIndex).Select(x => (double)x.Ticks / TimeSpan.TicksPerSecond);
     }
 
-    private DateTime GetSecondsAsDateTime(double seconds)
-    {
-        DateTime dateTime = new DateTime();
-        return dateTime.Add(new TimeSpan(0, 0, (int)seconds));
+    private DateTime GetSecondsAsDateTime(double seconds) {
+      DateTime dateTime = new DateTime();
+      return dateTime.Add(new TimeSpan(0, 0, (int)seconds));
     }
   }
Index: /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingContext.cs
===================================================================
--- /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingContext.cs	(revision 10382)
+++ /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingContext.cs	(revision 10383)
@@ -20,4 +20,5 @@
 #endregion
 
+using System;
 using HeuristicLab.Core;
 using HeuristicLab.Optimization;
@@ -25,17 +26,21 @@
 
 namespace HeuristicLab.DataPreprocessing {
-  public interface IPreprocessingContext : IItem {
+  public interface IPreprocessingContext
+    : IItem {
+
     IPreprocessingData Data { get; }
 
-    /// <summary>
-    /// Parent algorithm, if available, or problem.
-    /// </summary>
-    IItem ParentItem { get; }
-
+    [Obsolete]
     IDataAnalysisProblemData DataAnalysisProblemData { get; }
 
     IAlgorithm Algorithm { get; }
 
-    IProblem Problem { get; }
+    IDataAnalysisProblem Problem { get; }
+
+    IItem ExportAlgorithmOrProblem();
+
+    IAlgorithm ExportAlgorithm();
+
+    IProblem ExportProblem();
   }
 }
Index: /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Plugin.cs.frame
===================================================================
--- /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Plugin.cs.frame	(revision 10382)
+++ /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Plugin.cs.frame	(revision 10383)
@@ -28,4 +28,5 @@
   [Plugin("HeuristicLab.DataPreprocessing", "3.3.9.$WCREV$")]
   [PluginFile("HeuristicLab.DataPreprocessing-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Analysis", "3.3")]
   [PluginDependency("HeuristicLab.Common", "3.3")]
   [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
Index: anches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/PreprocessingCloner.cs
===================================================================
--- /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/PreprocessingCloner.cs	(revision 10382)
+++ 	(revision )
@@ -1,57 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 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.Optimization;
-using HeuristicLab.Problems.DataAnalysis;
-
-namespace HeuristicLab.DataPreprocessing {
-  internal class PreprocessingCloner {
-
-    private readonly IPreprocessingContext context;
-
-    public PreprocessingCloner(IPreprocessingContext context) {
-      this.context = context;
-    }
-
-    public IItem GenerateAlteredClone(IItem obj) {
-      IPreprocessingData data = context.Data;
-
-      Dataset dataset = data.ExportToDataset();
-      var variables = new CheckedItemList<StringValue>(data.VariableNames.Select(s => new StringValue(s))).AsReadOnly();
-
-      var cloner = new Cloner();
-
-      cloner.RegisterClonedObject(context.DataAnalysisProblemData.Dataset, dataset);
-      cloner.RegisterClonedObject(context.DataAnalysisProblemData.TrainingPartition, data.TrainingPartition);
-      cloner.RegisterClonedObject(context.DataAnalysisProblemData.TestPartition, data.TestPartition);
-      cloner.RegisterClonedObject(context.DataAnalysisProblemData.InputVariables, variables);
-      if (context.Algorithm != null) {
-        cloner.RegisterClonedObject(context.Algorithm.Runs, new RunCollection { OptimizerName = context.Algorithm.Name });
-      }
-
-      return cloner.Clone(obj);
-    }
-  }
-}
Index: /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/ProblemDataCreator.cs
===================================================================
--- /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/ProblemDataCreator.cs	(revision 10383)
+++ /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/ProblemDataCreator.cs	(revision 10383)
@@ -0,0 +1,109 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.DataPreprocessing {
+  internal class ProblemDataCreator {
+
+    private readonly IPreprocessingContext context;
+
+    public ProblemDataCreator(IPreprocessingContext context) {
+      this.context = context;
+    }
+
+    public IDataAnalysisProblemData CreateProblemData() {
+
+      IDataAnalysisProblemData problemData = CloneProblemDataWithDataset();
+
+      SetTrainingAndTestPartition(problemData);
+
+      if (problemData is RegressionProblemData) {
+        //SetRegressionData((RegressionProblemData)problemData);
+      } else if (problemData is ClassificationProblemData) {
+        //SetClassificationData((ClassificationProblemData)problemData);
+      } else if (problemData is ClusteringProblemData) {
+        throw new NotImplementedException();
+      }
+
+      return problemData;
+    }
+
+    private IDataAnalysisProblemData CloneProblemDataWithDataset() {
+      var cloner = new Cloner();
+
+      var problemData = context.Problem.ProblemData;
+
+      Dataset dataset = context.Data.ExportToDataset();
+
+      cloner.RegisterClonedObject(problemData.Dataset, dataset);
+
+      return cloner.Clone(problemData);
+    }
+
+    private void SetTrainingAndTestPartition(IDataAnalysisProblemData problemData) {
+      var ppData = context.Data;
+
+      problemData.TrainingPartition.Start = ppData.TrainingPartition.Start;
+      problemData.TrainingPartition.End = ppData.TrainingPartition.End;
+      problemData.TestPartition.Start = ppData.TestPartition.Start;
+      problemData.TestPartition.End = ppData.TestPartition.End;
+    }
+
+    private void SetRegressionData(RegressionProblemData regressionProblemData) {
+      SetInputVariables(regressionProblemData, regressionProblemData.TargetVariable);
+      SetTargetVariable(regressionProblemData.TargetVariableParameter);
+    }
+
+    private void SetClassificationData(ClassificationProblemData classificationProblemData) {
+      SetInputVariables(classificationProblemData, classificationProblemData.TargetVariable);
+      SetTargetVariable(classificationProblemData.TargetVariableParameter);
+    }
+
+    private void SetInputVariables(DataAnalysisProblemData problemData, string targetVariable) {
+      //TODO: InputVariables Set is Readonly
+
+      problemData.InputVariables.Clear();
+
+      foreach (string variable in context.Data.VariableNames) {
+        problemData.InputVariables.Add(new StringValue(variable), variable != targetVariable);
+      }
+    }
+
+    private void SetTargetVariable(IConstrainedValueParameter<StringValue> targetVariableParameter) {
+      string oldTarget = targetVariableParameter.Value.Value;
+
+      var validValues = targetVariableParameter.ValidValues;
+      validValues.Clear();
+
+      foreach (string variable in context.Data.VariableNames.Where(x => context.Data.IsType<double>(x))) {
+        validValues.Add(new StringValue(variable));
+      }
+
+      targetVariableParameter.ActualValue = validValues.FirstOrDefault(v => v.Value == oldTarget);
+    }
+  }
+}
Index: /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/DataPreprocessingView.cs
===================================================================
--- /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/DataPreprocessingView.cs	(revision 10382)
+++ /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/DataPreprocessingView.cs	(revision 10383)
@@ -8,5 +8,5 @@
 namespace HeuristicLab.DataPreprocessing {
   [View("DataPreprocessing View")]
-  [Content(typeof(PreprocessingContext), true)]
+  [Content(typeof(IPreprocessingContext), true)]
   public partial class DataPreprocessingView : ItemView {
 
@@ -97,6 +97,5 @@
 
     private void exportProblemButton_Click(object sender, EventArgs e) {
-      var cloner = new PreprocessingCloner(Content);
-      var alteredClone = cloner.GenerateAlteredClone(Content.Problem);
+      var problem = Content.ExportProblem();
 
       var saveFileDialog = new SaveFileDialog {
@@ -107,5 +106,5 @@
       };
 
-      var content = alteredClone as IStorableContent;
+      var content = problem as IStorableContent;
       if (saveFileDialog.ShowDialog() == DialogResult.OK) {
         bool compressed = saveFileDialog.FilterIndex != 1;
@@ -115,6 +114,5 @@
 
     private void applyInNewTabButton_Click(object sender, EventArgs e) {
-      var cloner = new PreprocessingCloner(Content);
-      var item = cloner.GenerateAlteredClone(Content.ParentItem);
+      var item = Content.ExportAlgorithmOrProblem();
 
       MainFormManager.MainForm.ShowContent(item);
