Ignore:
Timestamp:
07/20/16 14:02:36 (5 years ago)
Author:
gkronber
Message:

#1966: refactoring of bin packing implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/Moves/Swap2/Swap2Move.cs

    r14046 r14128  
    3232  [Item("Swap2 Move", "A move on a Sequence vector that is specified by two group-assignment-indexes.")]
    3333  [StorableClass]
    34   public class Swap2Move : SequenceMove, IPackingMove {
     34  public class Swap2Move : SequenceMove, IPackingMove<Permutation> {
    3535    [Storable]
    3636    public int Index1 { get; protected set; }
     
    4545      this.Index2 = original.Index2;
    4646    }
    47     public Swap2Move(int index1, int index2, PackingSequenceEncoding PackingSequence)
    48       : base(PackingSequence) {
     47    public Swap2Move(int index1, int index2, Permutation packingSequence)
     48      : base(packingSequence) {
    4949      Index1 = index1;
    5050      Index2 = index2;
     
    5555    }
    5656
    57     public override IPackingSolutionEncoding GetSolutionAfterMove() {
    58       PackingSequenceEncoding newSolution = new PackingSequenceEncoding();
    59       newSolution.PackingSequence = (Permutation)PackingSequence.PackingSequence.Clone(new Cloner());
    60       newSolution.PackingSequence[Index1] = PackingSequence.PackingSequence[Index2];
    61       newSolution.PackingSequence[Index2] = PackingSequence.PackingSequence[Index1];
     57    public override Permutation GetSolutionAfterMove() {
     58      Permutation newSolution = (Permutation)PackingSequence.Clone(new Cloner());
     59      newSolution[Index1] = PackingSequence[Index2];
     60      newSolution[Index2] = PackingSequence[Index1];
    6261      return newSolution;
    6362    }
     
    6867
    6968    public override SequenceMoveAttribute GetAttribute(double quality) {
    70       return new Swap2MoveAttribute(Index1, Index2, PackingSequence.PackingSequence[Index1], PackingSequence.PackingSequence[Index2], quality);
     69      return new Swap2MoveAttribute(Index1, Index2, PackingSequence[Index1], PackingSequence[Index2], quality);
    7170    }
    7271
Note: See TracChangeset for help on using the changeset viewer.