Index: /branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Evaluators/QAPTranslocationMoveEvaluator.cs
===================================================================
--- /branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Evaluators/QAPTranslocationMoveEvaluator.cs	(revision 5801)
+++ /branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Evaluators/QAPTranslocationMoveEvaluator.cs	(revision 5801)
@@ -0,0 +1,96 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.QuadraticAssignment {
+  [Item("QAPTranslocationMoveEvaluator", "Evaluates translocation moves on a QAP solution.")]
+  [StorableClass]
+  public class QAPTranslocationMoveEvaluator : QAPMoveEvaluator, IPermutationTranslocationMoveOperator {
+
+    public ILookupParameter<TranslocationMove> TranslocationMoveParameter {
+      get { return (ILookupParameter<TranslocationMove>)Parameters["TranslocationMove"]; }
+    }
+
+    [StorableConstructor]
+    protected QAPTranslocationMoveEvaluator(bool deserializing) : base(deserializing) { }
+    protected QAPTranslocationMoveEvaluator(QAPTranslocationMoveEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public QAPTranslocationMoveEvaluator()
+      : base() {
+      Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "A move which takes part of a permutation and inserts it in a different part."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new QAPTranslocationMoveEvaluator(this, cloner);
+    }
+
+    public static double Apply(Permutation assignment, TranslocationMove move, DoubleMatrix weights, DoubleMatrix distances) {
+      double moveQuality = 0;
+      int min = Math.Min(move.Index1, move.Index3);
+      int max = Math.Max(move.Index2, move.Index3 + (move.Index2 - move.Index1));
+      int iOffset, changeOffset;
+      if (move.Index1 < move.Index3) {
+        iOffset = move.Index2 - move.Index1 + 1;
+        changeOffset = min + max - move.Index2;
+      } else {
+        iOffset = move.Index1 - move.Index3;
+        changeOffset = min + move.Index2 - move.Index1 + 1;
+      }
+      for (int i = min; i <= max; i++) {
+        if (i == changeOffset) iOffset -= (max - min + 1);
+        int jOffset = ((move.Index1 < move.Index3) ? (move.Index2 - move.Index1 + 1) : (move.Index1 - move.Index3));
+        for (int j = 0; j < assignment.Length; j++) {
+          moveQuality -= weights[i, j] * distances[assignment[i], assignment[j]];
+          if (j < min || j > max) {
+            moveQuality -= weights[j, i] * distances[assignment[j], assignment[i]];
+            moveQuality += weights[i, j] * distances[assignment[i + iOffset], assignment[j]];
+            moveQuality += weights[j, i] * distances[assignment[j], assignment[i + iOffset]];
+          } else {
+            if (j == changeOffset) jOffset -= (max - min + 1);
+            moveQuality += weights[i, j] * distances[assignment[i + iOffset], assignment[j + jOffset]];
+          }
+        }
+      }
+      return moveQuality;
+    }
+
+    public override IOperation Apply() {
+      TranslocationMove move = TranslocationMoveParameter.ActualValue;
+      if (move == null) throw new InvalidOperationException("Translocation move is not found.");
+      Permutation assignment = PermutationParameter.ActualValue;
+      DoubleMatrix distances = DistanceMatrixParameter.ActualValue;
+      DoubleMatrix weights = WeightsParameter.ActualValue;
+
+      double moveQuality = QualityParameter.ActualValue.Value;
+      moveQuality += Apply(assignment, move, weights, distances);
+      MoveQualityParameter.ActualValue = new DoubleValue(moveQuality);
+      return base.Apply();
+    }
+  }
+}
Index: /branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/HeuristicLab.Problems.QuadraticAssignment-3.3.csproj
===================================================================
--- /branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/HeuristicLab.Problems.QuadraticAssignment-3.3.csproj	(revision 5800)
+++ /branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/HeuristicLab.Problems.QuadraticAssignment-3.3.csproj	(revision 5801)
@@ -140,4 +140,7 @@
     <Compile Include="Evaluators\QAPInversionMoveEvaluator.cs" />
     <Compile Include="Evaluators\QAPMoveEvaluator.cs" />
+    <Compile Include="Evaluators\QAPTranslocationMoveEvaluator.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Include="Interfaces\IQAPEvaluator.cs" />
     <Compile Include="Interfaces\IQAPMoveEvaluator.cs" />
Index: /branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Tests/QAPMoveEvaluatorTest.cs
===================================================================
--- /branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Tests/QAPMoveEvaluatorTest.cs	(revision 5800)
+++ /branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Tests/QAPMoveEvaluatorTest.cs	(revision 5801)
@@ -130,5 +130,5 @@
     }
 
-    /*[TestMethod]
+    [TestMethod]
     public void TranslocationMoveEvaluatorTest() {
       DoubleMatrix distances = new DoubleMatrix(
@@ -156,11 +156,12 @@
         double before = QAPEvaluator.Apply(assignment, weights, distances);
         // translocate
+        Permutation clone = new Cloner().Clone(assignment);
         TranslocationManipulator.Apply(assignment, index1, index2, insertPoint);
         double after = QAPEvaluator.Apply(assignment, weights, distances);
-        // evaluate translocate back
-        double move = QAPTranslocationMoveEvaluator.Apply(assignment, new TranslocationMove(index1, index2, insertPoint, assignment), weights, distances);
-        Assert.IsTrue(move.IsAlmost(before - after));
+        // evaluate translocate move
+        double move = QAPTranslocationMoveEvaluator.Apply(clone, new TranslocationMove(index1, index2, insertPoint, assignment), weights, distances);
+        Assert.IsTrue(move.IsAlmost(after - before));
       }
-    }*/
+    }
 
   }
