Index: branches/HeuristicLab.Problems.Orienteering/HeuristicLab.DataPreprocessing/3.4/Implementations/SearchLogic.cs
===================================================================
--- branches/HeuristicLab.Problems.Orienteering/HeuristicLab.DataPreprocessing/3.4/Implementations/SearchLogic.cs	(revision 11185)
+++ branches/HeuristicLab.Problems.Orienteering/HeuristicLab.DataPreprocessing/3.4/Implementations/SearchLogic.cs	(revision 12694)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -23,9 +23,9 @@
 using System.Collections;
 using System.Collections.Generic;
-using System.Linq;
 
 namespace HeuristicLab.DataPreprocessing {
   public class SearchLogic : ISearchLogic {
     private readonly ITransactionalPreprocessingData preprocessingData;
+    private readonly IFilterLogic filterLogic;
 
     private Dictionary<int, IList<int>> MissingValueIndicies { get; set; }
@@ -44,15 +44,24 @@
     }
 
-    public SearchLogic(ITransactionalPreprocessingData thePreprocessingData) {
+    public SearchLogic(ITransactionalPreprocessingData thePreprocessingData, IFilterLogic theFilterLogic) {
       preprocessingData = thePreprocessingData;
+      filterLogic = theFilterLogic;
 
       MissingValueIndicies = new Dictionary<int, IList<int>>();
       ValuesWithoutNaN = new Dictionary<int, IList>();
 
-      preprocessingData.Changed += preprocessingData_Changed;
+      preprocessingData.Changed += PreprocessingData_Changed;
+      filterLogic.FilterChanged += FilterLogic_FilterChanged;
     }
 
-    void preprocessingData_Changed(object sender, DataPreprocessingChangedEventArgs e)
-    {
+    void FilterLogic_FilterChanged(object sender, EventArgs e) {
+      //recalculate
+      for (int i = 0; i < Columns; i++) {
+        MissingValueIndicies.Remove(i);
+        ValuesWithoutNaN.Remove(i);
+      }
+    }
+
+    void PreprocessingData_Changed(object sender, DataPreprocessingChangedEventArgs e) {
       switch (e.Type) {
         case DataPreprocessingChangedEventType.DeleteColumn:
@@ -73,5 +82,5 @@
           ValuesWithoutNaN = new Dictionary<int, IList>();
           break;
-      } 
+      }
     }
 
@@ -97,22 +106,22 @@
 
     public IList<int> GetMissingValueIndices(int columnIndex) {
-      if (!MissingValueIndicies.ContainsKey(columnIndex)){        
-          if (preprocessingData.VariableHasType<double>(columnIndex)) {
-            MissingValueIndicies[columnIndex] = GetMissingValueIndices<double>(columnIndex);
-          } else if (preprocessingData.VariableHasType<string>(columnIndex)) {
-            MissingValueIndicies[columnIndex] = GetMissingValueIndices<string>(columnIndex);
-          } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
-            MissingValueIndicies[columnIndex] = GetMissingValueIndices<DateTime>(columnIndex);
-          } else {
-            throw new ArgumentException("column " + columnIndex + " contains a non supported type.");
-          }
-      } 
+      if (!MissingValueIndicies.ContainsKey(columnIndex)) {
+        if (preprocessingData.VariableHasType<double>(columnIndex)) {
+          MissingValueIndicies[columnIndex] = GetMissingValueIndices<double>(columnIndex);
+        } else if (preprocessingData.VariableHasType<string>(columnIndex)) {
+          MissingValueIndicies[columnIndex] = GetMissingValueIndices<string>(columnIndex);
+        } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
+          MissingValueIndicies[columnIndex] = GetMissingValueIndices<DateTime>(columnIndex);
+        } else {
+          throw new ArgumentException("column " + columnIndex + " contains a non supported type.");
+        }
+      }
+      return MissingValueIndicies[columnIndex];
+    }
 
-      return MissingValueIndicies[columnIndex];
-   }
     private IList<int> GetMissingValueIndices<T>(int columnIndex) {
       List<int> missingIndices = new List<int>();
-     
-      for(int row = 0; row < preprocessingData.Rows; ++row) {
+
+      for (int row = 0; row < preprocessingData.Rows; ++row) {
         if (IsMissingValue(columnIndex, row)) {
           missingIndices.Add(row);
@@ -123,9 +132,8 @@
     }
 
-    public IEnumerable<T> GetValuesWithoutNaN<T>(int columnIndex, bool considerSelection)
-    {
-      if (considerSelection) {     
-        var selectedRows =  preprocessingData.Selection[columnIndex];
-        
+    public IEnumerable<T> GetValuesWithoutNaN<T>(int columnIndex, bool considerSelection) {
+      if (considerSelection) {
+        var selectedRows = preprocessingData.Selection[columnIndex];
+
         List<T> values = new List<T>();
         foreach (var rowIdx in selectedRows) {
