Changeset 14128 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/Moves/Insertion/InsertionMove.cs
 Timestamp:
 07/20/16 14:02:36 (5 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/Moves/Insertion/InsertionMove.cs
r14046 r14128 32 32 [Item("Insertion Move", "A move on a Sequence vector that is specified by two groupassignmentindexes.")] 33 33 [StorableClass] 34 public class InsertionMove : SequenceMove , IPackingMove{34 public class InsertionMove : SequenceMove { 35 35 [Storable] 36 36 public int Index1 { get; protected set; } … … 45 45 this.Index2 = original.Index2; 46 46 } 47 public InsertionMove(int index1, int index2, P ackingSequenceEncoding PackingSequence)48 : base( PackingSequence) {47 public InsertionMove(int index1, int index2, Permutation packingSequence) 48 : base(packingSequence) { 49 49 Index1 = index1; 50 50 Index2 = index2; … … 55 55 } 56 56 57 public override IPackingSolutionEncoding GetSolutionAfterMove() { 58 PackingSequenceEncoding newSolution = new PackingSequenceEncoding(); 59 60 Permutation original = PackingSequence.PackingSequence; 61 Permutation resultingPermutation = (Permutation)PackingSequence.PackingSequence.Clone(); 57 public override Permutation GetSolutionAfterMove() { 58 Permutation original = PackingSequence; 59 Permutation resultingPermutation = (Permutation)PackingSequence.Clone(); 62 60 int cutIndex, insertIndex, number; 63 61 … … 68 66 int i = 0; // index in new permutation 69 67 int j = 0; // index in old permutation 70 while (i < PackingSequence. PackingSequence.Length) {68 while (i < PackingSequence.Length) { 71 69 if (j == cutIndex) { 72 70 j++; … … 83 81 } 84 82 85 newSolution.PackingSequence = resultingPermutation; 86 return newSolution; 83 return resultingPermutation; 87 84 } 88 85 … … 92 89 93 90 public override SequenceMoveAttribute GetAttribute(double quality) { 94 return new InsertionMoveAttribute(Index1, Index2, PackingSequence .PackingSequence[Index1], PackingSequence.PackingSequence[Index2], quality);91 return new InsertionMoveAttribute(Index1, Index2, PackingSequence[Index1], PackingSequence[Index2], quality); 95 92 } 96 93 … … 103 100 } else 104 101 if (Index1 == attr.Index1 && Index2 == attr.Index2) 105 return true;102 return true; 106 103 } 107 104 return false;
Note: See TracChangeset
for help on using the changeset viewer.