Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/14/10 03:52:07 (15 years ago)
Author:
abeham
Message:

Updated Tabu search, permutation move operators, real vector move operators, binary vector move operators #840
Added a Tabu Search TSP workbench

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMoveTabuMaker.cs

    r3233 r3340  
    2929
    3030namespace HeuristicLab.Encodings.PermutationEncoding {
    31   [Item("InversionMoveTabuMaker", "Declares a given inversion move (2-opt) as tabu, by adding its attributes to the tabu list.")]
     31  [Item("InversionMoveTabuMaker", "Declares a given inversion move (2-opt) as tabu, by adding its attributes to the tabu list and also store the solution quality or the move quality (whichever is better).")]
    3232  [StorableClass]
    3333  public class InversionMoveTabuMaker : TabuMaker, IPermutationInversionMoveOperator {
     
    4848    }
    4949
    50     protected override IItem GetTabuAttribute() {
     50    protected override IItem GetTabuAttribute(bool maximization, double quality, double moveQuality) {
    5151      InversionMove move = InversionMoveParameter.ActualValue;
    5252      Permutation permutation = PermutationParameter.ActualValue;
     53      double baseQuality = moveQuality;
     54      if (maximization && quality > moveQuality || !maximization && quality < moveQuality) baseQuality = quality; // we make an uphill move, the lower bound is the solution quality
    5355      if (permutation.PermutationType == PermutationTypes.Absolute)
    54         return new InversionMoveAbsoluteAttribute(move.Index1, permutation[move.Index1], move.Index2, permutation[move.Index2]);
     56        return new InversionMoveAbsoluteAttribute(move.Index1, permutation[move.Index1], move.Index2, permutation[move.Index2], baseQuality);
    5557      else
    5658        return new InversionMoveRelativeAttribute(permutation.GetCircular(move.Index1 - 1),
    5759          permutation[move.Index1],
    5860          permutation[move.Index2],
    59           permutation.GetCircular(move.Index2 + 1));
     61          permutation.GetCircular(move.Index2 + 1),
     62          baseQuality);
    6063    }
    6164  }
Note: See TracChangeset for help on using the changeset viewer.