Ignore:
Timestamp:
12/14/16 20:45:46 (4 years ago)
Author:
abeham
Message:

#2701:

  • Updated LLE encoding
    • Made folder for version 3.4
    • Added conversion from and to LLE-b representation (back-links)
    • Updated moves and movegenerator to replace bidirectionaldictionary with LLE-b representation
  • Updated MemPR (linear linkage)
    • Updated tabu walk
  • Added test for conversion between LLE-e and LLE and LLE-b and LLE
  • Updated test for move apply/undo and added test for applying in sequence
Location:
branches/MemPRAlgorithm/HeuristicLab.Encodings.LinearLinkageEncoding/3.4
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/MemPRAlgorithm/HeuristicLab.Encodings.LinearLinkageEncoding/3.4/Moves/MergeMove.cs

    r14477 r14492  
    2121
    2222using System;
    23 using HeuristicLab.Collections;
    2423
    2524namespace HeuristicLab.Encodings.LinearLinkageEncoding {
     
    2726
    2827    public int LastItemOfOtherGroup { get; private set; }
    29     private int nextItemOfOtherGroup; // undo information
    3028
    3129    public MergeMove(int item, int lastOfOther) {
    3230      Item = item;
    3331      LastItemOfOtherGroup = lastOfOther;
    34       nextItemOfOtherGroup = -1;
    3532    }
    3633
    3734    public override void Apply(LinearLinkage lle) {
    3835      if (lle[LastItemOfOtherGroup] != LastItemOfOtherGroup) throw new ArgumentException("Move conditions have changed, group does not terminate at " + LastItemOfOtherGroup);
    39       nextItemOfOtherGroup = lle[LastItemOfOtherGroup];
    4036      lle[LastItemOfOtherGroup] = Item;
    4137    }
     
    4339    public override void Undo(LinearLinkage lle) {
    4440      if (lle[LastItemOfOtherGroup] != Item) throw new ArgumentException("Move conditions have changed, groups are no longer linked between " + LastItemOfOtherGroup + " and " + Item);
    45       if (nextItemOfOtherGroup < 0) throw new InvalidOperationException("Cannot undo move that has not been applied first.");
    46       lle[LastItemOfOtherGroup] = nextItemOfOtherGroup;
     41      lle[LastItemOfOtherGroup] = LastItemOfOtherGroup;
    4742    }
    4843
    49     public override void UpdateLinks(BidirectionalDictionary<int, int> links) {
    50       if (nextItemOfOtherGroup < 0) throw new InvalidOperationException("Cannot update links for move that has not been applied first.");
    51       links.RemoveBySecond(nextItemOfOtherGroup);
     44    public override void ApplyToLLEb(int[] lleb) {
     45      lleb[Item] = LastItemOfOtherGroup;
    5246    }
    5347  }
Note: See TracChangeset for help on using the changeset viewer.