public static void Improve(Permutation assignment, DoubleMatrix weights, DoubleMatrix distances, DoubleValue quality, IntValue localIterations, IntValue evaluatedSolutions, bool maximization, int maxIterations, CancellationToken cancellation)
 {
     for (int i = localIterations.Value; i < maxIterations; i++)
     {
         TranslocationMove bestMove    = null;
         double            bestQuality = 0; // we have to make an improvement, so 0 is the baseline
         double            evaluations = 0.0;
         foreach (var move in ExhaustiveInsertionMoveGenerator.Generate(assignment))
         {
             double moveQuality = QAPTranslocationMoveEvaluator.Apply(assignment, move, weights, distances);
             int    min         = Math.Min(move.Index1, move.Index3);
             int    max         = Math.Max(move.Index2, move.Index3 + (move.Index2 - move.Index1));
             evaluations += 2.0 * (max - min + 1) / assignment.Length
                            + 4.0 * (assignment.Length - (max - min + 1)) / assignment.Length;
             if (maximization && moveQuality > bestQuality ||
                 !maximization && moveQuality < bestQuality)
             {
                 bestQuality = moveQuality;
                 bestMove    = move;
             }
         }
         evaluatedSolutions.Value += (int)Math.Ceiling(evaluations);
         if (bestMove == null)
         {
             break;
         }
         TranslocationManipulator.Apply(assignment, bestMove.Index1, bestMove.Index2, bestMove.Index3);
         quality.Value += bestQuality;
         localIterations.Value++;
         cancellation.ThrowIfCancellationRequested();
     }
 }
 protected QAPTranslocationMoveEvaluator(QAPTranslocationMoveEvaluator original, Cloner cloner)
     : base(original, cloner)
 {
 }
 protected QAPTranslocationMoveEvaluator(QAPTranslocationMoveEvaluator original, Cloner cloner)
   : base(original, cloner) {
 }