Index: trunk/sources/HeuristicLab.SupportVectorMachines/3.2/HeuristicLab.SupportVectorMachines-3.2.csproj
===================================================================
--- trunk/sources/HeuristicLab.SupportVectorMachines/3.2/HeuristicLab.SupportVectorMachines-3.2.csproj	(revision 2036)
+++ trunk/sources/HeuristicLab.SupportVectorMachines/3.2/HeuristicLab.SupportVectorMachines-3.2.csproj	(revision 2043)
@@ -88,4 +88,6 @@
     <Compile Include="SupportVectorEvaluator.cs" />
     <Compile Include="SVMHelper.cs" />
+    <Compile Include="VariableEvaluationImpactCalculator.cs" />
+    <Compile Include="VariableQualityImpactCalculator.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -126,4 +128,12 @@
       <Name>HeuristicLab.PluginInfrastructure</Name>
     </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Random\3.2\HeuristicLab.Random-3.2.csproj">
+      <Project>{47019A74-F7F7-482E-83AA-D3F4F777E879}</Project>
+      <Name>HeuristicLab.Random-3.2</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Selection\3.2\HeuristicLab.Selection-3.2.csproj">
+      <Project>{F7CF0571-25CB-43D5-8443-0843A1E2861A}</Project>
+      <Name>HeuristicLab.Selection-3.2</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.SequentialEngine\3.2\HeuristicLab.SequentialEngine-3.2.csproj">
       <Project>{B4BE8E53-BA06-4237-9A01-24255F880201}</Project>
Index: trunk/sources/HeuristicLab.SupportVectorMachines/3.2/HeuristicLabSupportVectorMachinesPlugin.cs
===================================================================
--- trunk/sources/HeuristicLab.SupportVectorMachines/3.2/HeuristicLabSupportVectorMachinesPlugin.cs	(revision 2036)
+++ trunk/sources/HeuristicLab.SupportVectorMachines/3.2/HeuristicLabSupportVectorMachinesPlugin.cs	(revision 2043)
@@ -37,4 +37,6 @@
   [Dependency(Dependency = "HeuristicLab.Logging-3.2")]
   [Dependency(Dependency = "HeuristicLab.Operators.Programmable-3.2")]
+  [Dependency(Dependency = "HeuristicLab.Random-3.2")]
+  [Dependency(Dependency = "HeuristicLab.Selection-3.2")]
   public class HeuristicLabSupportVectorMachinesPlugin : PluginBase {
   }
Index: trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorEvaluator.cs	(revision 2036)
+++ trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorEvaluator.cs	(revision 2043)
@@ -59,5 +59,5 @@
       for (int i = 0; i < end - start; i++) {
         values[i,0] = SVM.Prediction.Predict(modelData.Model, scaledProblem.X[i]);
-        values[i,1] = dataset.Samples[(start + i) * dataset.Columns + targetVariable];
+        values[i,1] = dataset.GetValue(start + i,targetVariable);
       }
 
Index: trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorRegression.cs
===================================================================
--- trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorRegression.cs	(revision 2036)
+++ trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorRegression.cs	(revision 2043)
@@ -34,4 +34,6 @@
 using HeuristicLab.Operators.Programmable;
 using HeuristicLab.Modeling;
+using HeuristicLab.Random;
+using HeuristicLab.Selection;
 
 namespace HeuristicLab.SupportVectorMachines {
@@ -118,20 +120,75 @@
       main.AddSubOperator(CreateGlobalInjector());
       main.AddSubOperator(new ProblemInjector());
-
-      SequentialProcessor nuLoop = new SequentialProcessor();
-      nuLoop.Name = "NuLoop";
-      SequentialProcessor costLoop = new SequentialProcessor();
-      costLoop.Name = "CostLoop";
-      main.AddSubOperator(nuLoop);
-      nuLoop.AddSubOperator(CreateResetOperator("CostIndex"));
-      nuLoop.AddSubOperator(costLoop);
+      main.AddSubOperator(new RandomInjector());
+
       SubScopesCreater modelScopeCreator = new SubScopesCreater();
       modelScopeCreator.GetVariableInfo("SubScopes").Local = true;
       modelScopeCreator.AddVariable(new HeuristicLab.Core.Variable("SubScopes", new IntData(1)));
+      main.AddSubOperator(modelScopeCreator);
+
+      SequentialSubScopesProcessor seqSubScopesProc = new SequentialSubScopesProcessor();
+      IOperator modelProcessor = CreateModelProcessor();
+      seqSubScopesProc.AddSubOperator(modelProcessor);
+      main.AddSubOperator(seqSubScopesProc);
+
+      SequentialProcessor nuLoop = new SequentialProcessor();
+      nuLoop.Name = "NuLoop";
+
+      IOperator costCounter = CreateCounter("Cost");
+      IOperator costComparator = CreateComparator("Cost");
+      nuLoop.AddSubOperator(costCounter);
+      nuLoop.AddSubOperator(costComparator);
+      ConditionalBranch costBranch = new ConditionalBranch();
+      costBranch.Name = "IfValidCostIndex";
+      costBranch.GetVariableInfo("Condition").ActualName = "RepeatCostLoop";
+
+      // build cost loop
+      SequentialProcessor costLoop = new SequentialProcessor();
+      costLoop.Name = "CostLoop";
       costLoop.AddSubOperator(modelScopeCreator);
       SequentialSubScopesProcessor subScopesProcessor = new SequentialSubScopesProcessor();
       costLoop.AddSubOperator(subScopesProcessor);
+      subScopesProcessor.AddSubOperator(new EmptyOperator());
+      subScopesProcessor.AddSubOperator(modelProcessor);
+
+      Sorter sorter = new Sorter();
+      sorter.GetVariableInfo("Value").ActualName = "ValidationQuality";
+      sorter.GetVariableInfo("Descending").Local = true;
+      sorter.AddVariable(new Variable("Descending", new BoolData(false)));
+      costLoop.AddSubOperator(sorter);
+
+      LeftSelector selector = new LeftSelector();
+      selector.GetVariableInfo("Selected").Local = true;
+      selector.AddVariable(new Variable("Selected", new IntData(1)));
+      costLoop.AddSubOperator(selector);
+
+      RightReducer reducer = new RightReducer();
+      costLoop.AddSubOperator(reducer);
+
+      costLoop.AddSubOperator(costCounter);
+      costLoop.AddSubOperator(costComparator);
+
+      costBranch.AddSubOperator(costLoop);
+      costLoop.AddSubOperator(costBranch);
+
+      nuLoop.AddSubOperator(costBranch);
+      nuLoop.AddSubOperator(CreateResetOperator("CostIndex"));
+
+      nuLoop.AddSubOperator(CreateCounter("Nu"));
+      nuLoop.AddSubOperator(CreateComparator("Nu"));
+
+      ConditionalBranch nuBranch = new ConditionalBranch();
+      nuBranch.Name = "NuLoop";
+      nuBranch.GetVariableInfo("Condition").ActualName = "RepeatNuLoop";
+      nuBranch.AddSubOperator(nuLoop);
+      nuLoop.AddSubOperator(nuBranch);
+
+      main.AddSubOperator(nuLoop);
+      main.AddSubOperator(CreateModelAnalyser());
+      return main;
+    }
+
+    private IOperator CreateModelProcessor() {
       SequentialProcessor modelProcessor = new SequentialProcessor();
-      subScopesProcessor.AddSubOperator(modelProcessor);
       modelProcessor.AddSubOperator(CreateSetNextParameterValueOperator("Nu"));
       modelProcessor.AddSubOperator(CreateSetNextParameterValueOperator("Cost"));
@@ -160,30 +217,5 @@
       ((ItemList<StringData>)collector.GetVariable("VariableNames").Value).Add(new StringData("ValidationQuality"));
       modelProcessor.AddSubOperator(collector);
-
-      BestSolutionStorer solStorer = new BestSolutionStorer();
-      solStorer.GetVariableInfo("Quality").ActualName = "ValidationQuality";
-      solStorer.GetVariableInfo("Maximization").Local = true;
-      solStorer.GetVariableInfo("BestSolution").ActualName = "BestValidationSolution";
-      solStorer.AddVariable(new HeuristicLab.Core.Variable("Maximization", new BoolData(false)));
-
-      costLoop.AddSubOperator(solStorer);
-      SubScopesRemover remover = new SubScopesRemover();
-      costLoop.AddSubOperator(remover);
-      costLoop.AddSubOperator(CreateCounter("Cost"));
-      costLoop.AddSubOperator(CreateComparator("Cost"));
-      ConditionalBranch costBranch = new ConditionalBranch();
-      costBranch.Name = "CostLoop";
-      costBranch.GetVariableInfo("Condition").ActualName = "RepeatCostLoop";
-      costBranch.AddSubOperator(costLoop);
-      costLoop.AddSubOperator(costBranch);
-
-      nuLoop.AddSubOperator(CreateCounter("Nu"));
-      nuLoop.AddSubOperator(CreateComparator("Nu"));
-      ConditionalBranch nuBranch = new ConditionalBranch();
-      nuBranch.Name = "NuLoop";
-      nuBranch.GetVariableInfo("Condition").ActualName = "RepeatNuLoop";
-      nuBranch.AddSubOperator(nuLoop);
-      nuLoop.AddSubOperator(nuBranch);
-      return main;
+      return modelProcessor;
     }
 
@@ -271,5 +303,5 @@
       progOp.RemoveVariableInfo("Result");
       progOp.AddVariableInfo(new VariableInfo("Value", "Value", typeof(IntData), VariableKind.In | VariableKind.Out));
-      progOp.Code = "Value.Data = 0;";
+      progOp.Code = "Value.Data = -1;";
       progOp.GetVariableInfo("Value").ActualName = paramName;
       return progOp;
@@ -279,8 +311,8 @@
       VariableInjector injector = new VariableInjector();
       injector.AddVariable(new HeuristicLab.Core.Variable("CostIndex", new IntData(0)));
-      injector.AddVariable(new HeuristicLab.Core.Variable("CostList", new DoubleArrayData(new double[] { 0.1, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0 })));
+      injector.AddVariable(new HeuristicLab.Core.Variable("CostList", new DoubleArrayData(new double[] { 0.1, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0 })));
       injector.AddVariable(new HeuristicLab.Core.Variable("MaxCostIndex", new IntData()));
       injector.AddVariable(new HeuristicLab.Core.Variable("NuIndex", new IntData(0)));
-      injector.AddVariable(new HeuristicLab.Core.Variable("NuList", new DoubleArrayData(new double[] { 0.01, 0.05, 0.1, 0.5, 0.9 })));
+      injector.AddVariable(new HeuristicLab.Core.Variable("NuList", new DoubleArrayData(new double[] { 0.01, 0.05, 0.1, 0.5 })));
       injector.AddVariable(new HeuristicLab.Core.Variable("MaxNuIndex", new IntData()));
       injector.AddVariable(new HeuristicLab.Core.Variable("Log", new ItemList()));
@@ -291,4 +323,23 @@
       return injector;
     }
+
+    private IOperator CreateModelAnalyser() {
+      CombinedOperator modelAnalyser = new CombinedOperator();
+      modelAnalyser.Name = "Model Analyzer";
+      SequentialSubScopesProcessor seqSubScopeProc = new SequentialSubScopesProcessor();
+      SequentialProcessor seqProc = new SequentialProcessor();
+      VariableEvaluationImpactCalculator evalImpactCalc = new VariableEvaluationImpactCalculator();
+      evalImpactCalc.GetVariableInfo("SVMModel").ActualName = "Model";
+      VariableQualityImpactCalculator qualImpactCalc = new VariableQualityImpactCalculator();
+      qualImpactCalc.GetVariableInfo("SVMModel").ActualName = "Model";
+
+      seqProc.AddSubOperator(evalImpactCalc);
+      seqProc.AddSubOperator(qualImpactCalc);
+      seqSubScopeProc.AddSubOperator(seqProc);
+      modelAnalyser.OperatorGraph.InitialOperator = seqSubScopeProc;
+      modelAnalyser.OperatorGraph.AddOperator(seqSubScopeProc);
+      return modelAnalyser;
+    }
+
 
     protected internal virtual Model CreateSVMModel(IScope bestModelScope) {
@@ -309,9 +360,23 @@
       model.ValidationVarianceAccountedFor = bestModelScope.GetVariableValue<DoubleData>("ValidationVAF", false).Data;
       model.TestVarianceAccountedFor = bestModelScope.GetVariableValue<DoubleData>("TestVAF", false).Data;
-      
+
       model.Data = bestModelScope.GetVariableValue<SVMModel>("BestValidationModel", false);
       HeuristicLab.DataAnalysis.Dataset ds = bestModelScope.GetVariableValue<Dataset>("Dataset", true);
       model.Dataset = ds;
       model.TargetVariable = ds.GetVariableName(bestModelScope.GetVariableValue<IntData>("TargetVariable", true).Data);
+
+      ItemList evaluationImpacts = bestModelScope.GetVariableValue<ItemList>("VariableEvaluationImpacts", false);
+      ItemList qualityImpacts = bestModelScope.GetVariableValue<ItemList>("VariableQualityImpacts", false);
+      foreach (ItemList row in evaluationImpacts) {
+        string variableName = ((StringData)row[0]).Data;
+        double impact = ((DoubleData)row[0]).Data;
+        model.SetVariableEvaluationImpact(variableName, impact);
+      }
+      foreach (ItemList row in qualityImpacts) {
+        string variableName = ((StringData)row[0]).Data;
+        double impact = ((DoubleData)row[0]).Data;
+        model.SetVariableQualityImpact(variableName, impact);
+      }
+
       return model;
     }
@@ -337,5 +402,4 @@
 
     #endregion
-
   }
 }
Index: trunk/sources/HeuristicLab.SupportVectorMachines/3.2/VariableEvaluationImpactCalculator.cs
===================================================================
--- trunk/sources/HeuristicLab.SupportVectorMachines/3.2/VariableEvaluationImpactCalculator.cs	(revision 2043)
+++ trunk/sources/HeuristicLab.SupportVectorMachines/3.2/VariableEvaluationImpactCalculator.cs	(revision 2043)
@@ -0,0 +1,52 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Text;
+using System.Xml;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.DataAnalysis;
+using System.Linq;
+
+namespace HeuristicLab.SupportVectorMachines {
+  public class VariableEvaluationImpactCalculator : HeuristicLab.Modeling.VariableEvaluationImpactCalculator {
+
+    public VariableEvaluationImpactCalculator()
+      : base() {
+      AddVariableInfo(new VariableInfo("SVMModel", "The model that should be evaluated", typeof(SVMModel), VariableKind.In));
+    }
+
+
+    protected override double[] GetOutputs(IScope scope, Dataset dataset, int targetVariable, ItemList<IntData> allowedFeatures, int start, int end) {
+      SVMModel model = GetVariableValue<SVMModel>("SVMModel", scope, true);
+      SVM.Problem problem = SVMHelper.CreateSVMProblem(dataset, allowedFeatures, targetVariable, start, end);
+      SVM.Problem scaledProblem = SVM.Scaling.Scale(problem, model.RangeTransform);
+
+      double[] values = new double[end - start];
+      for (int i = 0; i < end - start; i++) {
+        values[i] = SVM.Prediction.Predict(model.Model, scaledProblem.X[i]);
+      }
+      return values;
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.SupportVectorMachines/3.2/VariableQualityImpactCalculator.cs
===================================================================
--- trunk/sources/HeuristicLab.SupportVectorMachines/3.2/VariableQualityImpactCalculator.cs	(revision 2043)
+++ trunk/sources/HeuristicLab.SupportVectorMachines/3.2/VariableQualityImpactCalculator.cs	(revision 2043)
@@ -0,0 +1,53 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Text;
+using System.Xml;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.DataAnalysis;
+using System.Linq;
+
+namespace HeuristicLab.SupportVectorMachines {
+  public class VariableQualityImpactCalculator : HeuristicLab.Modeling.VariableQualityImpactCalculator {
+
+    public VariableQualityImpactCalculator()
+      : base() {
+      AddVariableInfo(new VariableInfo("SVMModel", "The model that should be evaluated", typeof(SVMModel), VariableKind.In));
+    }
+
+    protected override double CalculateQuality(IScope scope, Dataset dataset, int targetVariable, ItemList<IntData> allowedFeatures, int start, int end) {
+      SVMModel model = GetVariableValue<SVMModel>("SVMModel", scope, true);
+      SVM.Problem problem = SVMHelper.CreateSVMProblem(dataset, allowedFeatures, targetVariable, start, end);
+      SVM.Problem scaledProblem = SVM.Scaling.Scale(problem, model.RangeTransform);
+
+      double[,] values = new double[end - start, 2];
+      for (int i = 0; i < end - start; i++) {
+        values[i, 0] = SVM.Prediction.Predict(model.Model, scaledProblem.X[i]);
+        values[i, 1] = dataset.GetValue(start + i,targetVariable);
+      }
+
+      return HeuristicLab.Modeling.SimpleMSEEvaluator.Calculate(values);
+    }
+  }
+}
