Changeset 3340 for trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMoveTabuMaker.cs
- Timestamp:
- 04/14/10 03:52:07 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/InversionMoveTabuMaker.cs
r3233 r3340 29 29 30 30 namespace 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).")] 32 32 [StorableClass] 33 33 public class InversionMoveTabuMaker : TabuMaker, IPermutationInversionMoveOperator { … … 48 48 } 49 49 50 protected override IItem GetTabuAttribute( ) {50 protected override IItem GetTabuAttribute(bool maximization, double quality, double moveQuality) { 51 51 InversionMove move = InversionMoveParameter.ActualValue; 52 52 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 53 55 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); 55 57 else 56 58 return new InversionMoveRelativeAttribute(permutation.GetCircular(move.Index1 - 1), 57 59 permutation[move.Index1], 58 60 permutation[move.Index2], 59 permutation.GetCircular(move.Index2 + 1)); 61 permutation.GetCircular(move.Index2 + 1), 62 baseQuality); 60 63 } 61 64 }
Note: See TracChangeset
for help on using the changeset viewer.