Index: branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/Problems/LootProfitProblem.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/Problems/LootProfitProblem.cs	(revision 14649)
+++ branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/Problems/LootProfitProblem.cs	(revision 14653)
@@ -47,5 +47,5 @@
     public Permutation FixedTspSolution { get; set; }
     [Storable]
-    public int[] Availability { get; set; }
+    public Dictionary<int, int[]> Availability { get; set; }
     [Storable]
     public double RentingRatio { get; set; }
@@ -54,6 +54,4 @@
     [Storable]
     public double MaxSpeed { get; set; }
-    [Storable]
-    public TtpUtils.DistanceType DistanceType { get; set; }
 
     [StorableConstructor]
@@ -63,9 +61,8 @@
       Ksp = cloner.Clone(original.Ksp);
       FixedTspSolution = cloner.Clone(original.FixedTspSolution);
-      Availability = original.Availability != null ? (int[])original.Availability.Clone() : null;
+      Availability = original.Availability != null ? original.Availability.ToDictionary(k => k.Key, v => (int[])v.Value.Clone()) : null;
       RentingRatio = original.RentingRatio;
       MinSpeed = original.MinSpeed;
       MaxSpeed = original.MaxSpeed;
-      DistanceType = original.DistanceType;
     }
     public LootProfitProblem() : base() {
@@ -80,5 +77,5 @@
       return TtpUtils.Evaluate(Tsp, FixedTspSolution.ToArray(),
                                Ksp, vector.ToArray(),
-                               Availability, RentingRatio, MinSpeed, MaxSpeed, DistanceType);
+                               Availability, RentingRatio, MinSpeed, MaxSpeed);
     }
 
Index: branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/Problems/TourProfitProblem.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/Problems/TourProfitProblem.cs	(revision 14649)
+++ branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/Problems/TourProfitProblem.cs	(revision 14653)
@@ -46,5 +46,5 @@
     public BinaryVector FixedKspSolution { get; set; }
     [Storable]
-    public int[] Availability { get; set; }
+    public Dictionary<int, int[]> Availability { get; set; }
     [Storable]
     public double RentingRatio { get; set; }
@@ -53,6 +53,4 @@
     [Storable]
     public double MaxSpeed { get; set; }
-    [Storable]
-    public TtpUtils.DistanceType DistanceType { get; set; }
 
     [StorableConstructor]
@@ -62,9 +60,8 @@
       Ksp = cloner.Clone(original.Ksp);
       FixedKspSolution = cloner.Clone(original.FixedKspSolution);
-      Availability = original.Availability != null ? (int[])original.Availability.Clone() : null;
+      Availability = original.Availability != null ? original.Availability.ToDictionary(k => k.Key, v => (int[])v.Value.Clone()) : null;
       RentingRatio = original.RentingRatio;
       MinSpeed = original.MinSpeed;
       MaxSpeed = original.MaxSpeed;
-      DistanceType = original.DistanceType;
     }
     public TourProfitProblem() : base() {
@@ -79,5 +76,5 @@
       return TtpUtils.Evaluate(Tsp, individual.Permutation().ToArray(),
                                Ksp, FixedKspSolution.ToArray(),
-                               Availability, RentingRatio, MinSpeed, MaxSpeed, DistanceType);
+                               Availability, RentingRatio, MinSpeed, MaxSpeed);
     }
 
Index: branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode.cs	(revision 14649)
+++ branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode.cs	(revision 14653)
@@ -207,4 +207,5 @@
       var tsp = TspParameter.Value;
       tsp.Coordinates = new DoubleMatrix(tspCoordinates);
+      tsp.DistanceMatrix = new DistanceMatrix(TtpUtils.GetDistances(tsp.Coordinates, distanceType));
 
       var ksp = KspParameter.Value;
Index: branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode1.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode1.cs	(revision 14649)
+++ branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode1.cs	(revision 14653)
@@ -90,4 +90,6 @@
       var loot = new KnapsackSolution(bestKspSolution, bestKspQuality, kspCapacity, kspWeights, kspValues);
 
+      var availability = TtpUtils.GetAvailability(AvailabilityParameter.Value.ToArray());
+
       var tspMsg = TspSolverOrchestrationPort.PrepareMessage();
       tspMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Prepare | OrchestrationMessage.ClearRuns | OrchestrationMessage.Start);
@@ -96,9 +98,8 @@
         Ksp = (BinaryKnapsackProblem)KspParameter.Value.Clone(),
         FixedKspSolution = bestKspSolution,
-        Availability = AvailabilityParameter.Value.ToArray(),
+        Availability = availability,
         RentingRatio = RentingRatioParameter.Value.Value,
         MinSpeed = MinSpeedParameter.Value.Value,
         MaxSpeed = MaxSpeedParameter.Value.Value,
-        DistanceType = distanceType
       };
       tpp.Encoding.Length = TspParameter.Value.Coordinates.Rows;
@@ -114,5 +115,5 @@
       #region Analyze
       double objectiveValue = TtpUtils.Evaluate(TspParameter.Value, tour.Permutation.ToArray(), KspParameter.Value, loot.BinaryVector.ToArray(),
-        AvailabilityParameter.Value.ToArray(), RentingRatioParameter.Value.Value, MinSpeedParameter.Value.Value, MaxSpeedParameter.Value.Value, distanceType);
+        availability, RentingRatioParameter.Value.Value, MinSpeedParameter.Value.Value, MaxSpeedParameter.Value.Value);
       ((DoubleValue)message["Quality"]).Value = objectiveValue;
 
Index: branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode2.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode2.cs	(revision 14649)
+++ branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode2.cs	(revision 14653)
@@ -75,4 +75,5 @@
         tsp.Coordinates[i, 1] = (int)Math.Ceiling(tsp.Coordinates[i, 1] * factors[i * 2 + 1]);
       }
+      tsp.DistanceMatrix = new DistanceMatrix(TtpUtils.GetDistances(tsp.Coordinates, distanceType));
 
       var tspMsg = TspSolverOrchestrationPort.PrepareMessage();
@@ -87,4 +88,6 @@
       var tour = new PathTSPTour(coordinates, bestTspSolution.Permutation, new DoubleValue(TSPCoordinatesPathEvaluator.Apply(new TSPEuclideanPathEvaluator(), coordinates, bestTspSolution.Permutation)));
 
+      var availability = TtpUtils.GetAvailability(AvailabilityParameter.Value.ToArray());
+
       var kspMsg = KspSolverOrchestrationPort.PrepareMessage();
       kspMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Prepare | OrchestrationMessage.ClearRuns | OrchestrationMessage.Start);
@@ -93,9 +96,8 @@
         Ksp = (BinaryKnapsackProblem)KspParameter.Value.Clone(),
         FixedTspSolution = bestTspSolution.Permutation,
-        Availability = AvailabilityParameter.Value.ToArray(),
+        Availability = availability,
         RentingRatio = RentingRatioParameter.Value.Value,
         MinSpeed = MinSpeedParameter.Value.Value,
         MaxSpeed = MaxSpeedParameter.Value.Value,
-        DistanceType = distanceType
       };
       lpp.Encoding.Length = KspParameter.Value.Length;
@@ -115,5 +117,5 @@
       #region Analyze
       double objectiveValue = TtpUtils.Evaluate(TspParameter.Value, tour.Permutation.ToArray(), KspParameter.Value, loot.BinaryVector.ToArray(),
-        AvailabilityParameter.Value.ToArray(), RentingRatioParameter.Value.Value, MinSpeedParameter.Value.Value, MaxSpeedParameter.Value.Value, distanceType);
+        availability, RentingRatioParameter.Value.Value, MinSpeedParameter.Value.Value, MaxSpeedParameter.Value.Value);
       ((DoubleValue)message["Quality"]).Value = objectiveValue;
 
Index: branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode3.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode3.cs	(revision 14649)
+++ branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode3.cs	(revision 14653)
@@ -97,4 +97,5 @@
         tsp.Coordinates[j, 1] = (int)Math.Ceiling(tsp.Coordinates[j, 1] * factors[fi + j * 2 + 1]);
       }
+      tsp.DistanceMatrix = new DistanceMatrix(TtpUtils.GetDistances(tsp.Coordinates, distanceType));
 
       var tspMsg = TspSolverOrchestrationPort.PrepareMessage();
@@ -111,5 +112,5 @@
       #region Analyze
       double objectiveValue = TtpUtils.Evaluate(TspParameter.Value, tour.Permutation.ToArray(), KspParameter.Value, loot.BinaryVector.ToArray(),
-        AvailabilityParameter.Value.ToArray(), RentingRatioParameter.Value.Value, MinSpeedParameter.Value.Value, MaxSpeedParameter.Value.Value, distanceType);
+        TtpUtils.GetAvailability(AvailabilityParameter.Value.ToArray()), RentingRatioParameter.Value.Value, MinSpeedParameter.Value.Value, MaxSpeedParameter.Value.Value);
       ((DoubleValue)message["Quality"]).Value = objectiveValue;
 
Index: branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpUtils.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpUtils.cs	(revision 14649)
+++ branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpUtils.cs	(revision 14653)
@@ -1,5 +1,7 @@
 ﻿using System;
+using System.Collections.Generic;
 using System.IO;
 using System.Linq;
+using HeuristicLab.Data;
 using HeuristicLab.Problems.TravelingSalesman;
 
@@ -68,10 +70,5 @@
     }
 
-    public static double Evaluate(TravelingSalesmanProblem tsp, int[] tour, BinaryKnapsackProblem ksp, bool[] loot, int[] availability, double rentingRatio, double minSpeed, double maxSpeed, DistanceType distanceType) {
-      bool feasible;
-      return Evaluate(tsp, tour, ksp, loot, availability, rentingRatio, minSpeed, maxSpeed, distanceType, out feasible);
-    }
-
-    public static double Evaluate(TravelingSalesmanProblem tsp, int[] tour, BinaryKnapsackProblem ksp, bool[] loot, int[] availability, double rentingRatio, double minSpeed, double maxSpeed, DistanceType distanceType, out bool feasible) {
+    public static double Evaluate(TravelingSalesmanProblem tsp, int[] tour, BinaryKnapsackProblem ksp, bool[] loot, Dictionary<int, int[]> availability, double rentingRatio, double minSpeed, double maxSpeed) {
       double collectedWeight = 0.0;
       double objectiveValue = 0.0;
@@ -86,22 +83,19 @@
       while (cityIdx != hideoutIdx) {
         double oldCollectedWeight = collectedWeight;
-        var availableItems = availability.Select((c, i) => new { CityIdx = c, ItemIdx = i }).Where(x => x.CityIdx == tour[cityIdx]);
 
-        foreach (var item in availableItems) {
-          if (!loot[item.ItemIdx]) continue;
-          collectedWeight += ksp.Weights[item.ItemIdx];
-          objectiveValue += ksp.Values[item.ItemIdx];
+        foreach (var itemIdx in availability[tour[cityIdx]]) {
+          if (!loot[itemIdx]) continue;
+          collectedWeight += ksp.Weights[itemIdx];
+          objectiveValue += ksp.Values[itemIdx];
         }
 
-        objectiveValue -= Distance(tsp.Coordinates.CloneAsMatrix(), tour[lastCityIdx], tour[cityIdx], distanceType) * rentingRatio /
-                          (maxSpeed - speedCoefficient * oldCollectedWeight);
+        objectiveValue -= tsp.DistanceMatrix[tour[lastCityIdx], tour[cityIdx]] * rentingRatio / (maxSpeed - speedCoefficient * oldCollectedWeight);
         lastCityIdx = cityIdx;
         cityIdx = (cityIdx + 1) % tour.Length;
       }
 
-      objectiveValue -= Distance(tsp.Coordinates.CloneAsMatrix(), tour[lastCityIdx], tour[hideoutIdx], distanceType) * rentingRatio /
-                        (maxSpeed - speedCoefficient * collectedWeight);
+      objectiveValue -= tsp.DistanceMatrix[tour[lastCityIdx], tour[hideoutIdx]] * rentingRatio / (maxSpeed - speedCoefficient * collectedWeight);
 
-      feasible = collectedWeight <= ksp.KnapsackCapacity.Value;
+      bool feasible = collectedWeight <= ksp.KnapsackCapacity.Value;
       if (!feasible) objectiveValue = infeasibleBaseLine - collectedWeight;
 
@@ -109,12 +103,31 @@
     }
 
-    private static double Distance(double[,] coords, int fromIdx, int toIdx, DistanceType distanceType) {
-      double fromX = coords[fromIdx, 0], fromY = coords[fromIdx, 1],
-             toX = coords[toIdx, 0], toY = coords[toIdx, 1];
+    public static Dictionary<int, int[]> GetAvailability(int[] availability) {
+      return availability.Select((c, i) => Tuple.Create(c, i)).GroupBy(x => x.Item1).ToDictionary(k => k.Key, v => v.Select(x => x.Item2).ToArray());
+    }
+
+    public static double[,] GetDistances(DoubleMatrix coordinates, DistanceType distanceType) {
+      int nrOfNodes = coordinates.Rows;
+      var distances = new double[nrOfNodes, nrOfNodes];
+
+      for (int i = 1; i < nrOfNodes; i++)
+        for (int j = 0; j < i; j++)
+          distances[i, j] = distances[j, i] = Distance(coordinates, i, j, distanceType);
+
+      return distances;
+    }
+
+    private static double Distance(DoubleMatrix coordinates, int fromIdx, int toIdx, DistanceType distanceType) {
+      double fromX = coordinates[fromIdx, 0];
+      double fromY = coordinates[fromIdx, 1];
+      double toX = coordinates[toIdx, 0];
+      double toY = coordinates[toIdx, 1];
+
       double distance = Math.Sqrt((toX - fromX) * (toX - fromX) + (toY - fromY) * (toY - fromY));
+
       switch (distanceType) {
         case DistanceType.CEIL_2D: return (int)Math.Ceiling(distance);
         case DistanceType.EUC_2D: return distance;
-        default: return 0.0;
+        default: return double.NaN;
       }
     }
