Index: branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPEstimatedInsertionLocalImprovement.cs
===================================================================
--- branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPEstimatedInsertionLocalImprovement.cs	(revision 17226)
+++ branches/2521_ProblemRefactoring/HeuristicLab.Problems.PTSP/3.3/Improvers/PTSPEstimatedInsertionLocalImprovement.cs	(revision 17253)
@@ -21,5 +21,8 @@
 
 using System;
+using System.Collections.Generic;
+using System.Linq;
 using System.Threading;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -29,5 +32,4 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
 
 namespace HeuristicLab.Problems.PTSP {
@@ -70,10 +72,10 @@
     }
 
-    public ILookupParameter<DistanceMatrix> DistanceMatrixParameter {
-      get { return (ILookupParameter<DistanceMatrix>)Parameters["DistanceMatrix"]; }
+    public ILookupParameter<IProbabilisticTSPData> ProbabilisticTSPDataParameter {
+      get { return (ILookupParameter<IProbabilisticTSPData>)Parameters["PTSP Data"]; }
     }
 
-    public ILookupParameter<ItemList<BoolArray>> RealizationsParameter {
-      get { return (ILookupParameter<ItemList<BoolArray>>)Parameters["Realizations"]; }
+    public ILookupParameter<ReadOnlyItemList<BoolArray>> RealizationsParameter {
+      get { return (ILookupParameter<ReadOnlyItemList<BoolArray>>)Parameters["Realizations"]; }
     }
 
@@ -90,5 +92,5 @@
       Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value of the assignment."));
       Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem should be maximized or minimized."));
-      Parameters.Add(new LookupParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
+      Parameters.Add(new LookupParameter<IProbabilisticTSPData>("PTSP Data", "The main parameters of the p-TSP."));
       Parameters.Add(new LookupParameter<ItemList<BoolArray>>("Realizations", "The list of samples drawn from all possible stochastic instances."));
     }
@@ -98,7 +100,5 @@
     }
 
-    public static void Improve(Permutation assignment, DoubleMatrix distances, DoubleValue quality, IntValue localIterations, IntValue evaluatedSolutions, bool maximization, int maxIterations, ItemList<BoolArray> realizations, CancellationToken cancellation) {
-      var distanceM = (DistanceMatrix)distances;
-      Func<int, int, double> distance = (a, b) => distanceM[a, b];
+    public static void Improve(Permutation assignment, IProbabilisticTSPData data, DoubleValue quality, IntValue localIterations, IntValue evaluatedSolutions, bool maximization, int maxIterations, IEnumerable<BoolArray> realizations, CancellationToken cancellation) {
       for (var i = localIterations.Value; i < maxIterations; i++) {
         TranslocationMove bestMove = null;
@@ -106,6 +106,6 @@
         double evaluations = 0.0;
         foreach (var move in ExhaustiveInsertionMoveGenerator.Generate(assignment)) {
-          double moveQuality = PTSPEstimatedInsertionMoveEvaluator.EvaluateMove(assignment, move, distance, realizations);
-          evaluations += realizations.Count * 6.0 / (assignment.Length * assignment.Length);
+          double moveQuality = PTSPEstimatedInsertionMoveEvaluator.EvaluateMove(assignment, move, data, realizations);
+          evaluations += realizations.Count() * 6.0 / (assignment.Length * assignment.Length);
           if (maximization && moveQuality > bestQuality
             || !maximization && moveQuality < bestQuality) {
@@ -127,8 +127,8 @@
       var assignment = PermutationParameter.ActualValue;
       var maximization = MaximizationParameter.ActualValue.Value;
-      var distances = DistanceMatrixParameter.ActualValue;
       var quality = QualityParameter.ActualValue;
       var localIterations = LocalIterationsParameter.ActualValue;
       var evaluations = EvaluatedSolutionsParameter.ActualValue;
+      var data = ProbabilisticTSPDataParameter.ActualValue;
       var realizations = RealizationsParameter.ActualValue;
       if (localIterations == null) {
@@ -137,5 +137,5 @@
       }
 
-      Improve(assignment, distances, quality, localIterations, evaluations, maximization, maxIterations, realizations, CancellationToken);
+      Improve(assignment, data, quality, localIterations, evaluations, maximization, maxIterations, realizations, CancellationToken);
 
       localIterations.Value = 0;
