Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/14/16 20:45:46 (7 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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/MemPRAlgorithm/HeuristicLab.Algorithms.MemPR/3.3/LinearLinkage/LinearLinkageMemPR.cs

    r14487 r14492  
    120120        tabu[i, current[i]] = quality;
    121121      }
    122      
     122
    123123      // this dictionary holds the last relevant links
    124       var links = new BidirectionalDictionary<int, int>();
     124      var groupItems = new List<int>();
     125      var lleb = current.ToBackLinks();
    125126      Move bestOfTheRest = null;
    126127      var bestOfTheRestF = double.NaN;
     
    128129      for (var iter = 0; iter < int.MaxValue; iter++) {
    129130        // clear the dictionary before a new pass through the array is made
    130         links.Clear();
     131        groupItems.Clear();
    131132        for (var i = 0; i < current.Length; i++) {
    132133          if (subspace != null && !subspace[i]) {
    133             links.RemoveBySecond(i);
    134             links.Add(i, current[i]);
     134            if (lleb[i] != i)
     135              groupItems.Remove(lleb[i]);
     136            groupItems.Add(i);
    135137            continue;
    136138          }
     
    141143            if (bestOfTheRest != null) {
    142144              bestOfTheRest.Apply(current);
     145              bestOfTheRest.ApplyToLLEb(lleb);
    143146              currentScope.Fitness = bestOfTheRestF;
    144147              quality = bestOfTheRestF;
     
    162165            break;
    163166          } else {
    164             foreach (var move in MoveGenerator.GenerateForItem(i, next, links)) {
     167            foreach (var move in MoveGenerator.GenerateForItem(i, groupItems, current, lleb)) {
    165168              // we intend to break link i -> next
    166169              var qualityToBreak = tabu[i, next];
     
    185188                if (isAspired) bestQuality = quality;
    186189
    187                 move.UpdateLinks(links);
     190                move.ApplyToLLEb(lleb);
    188191
    189192                if (FitnessComparer.IsBetter(maximization, moveF, bestOfTheWalkF)) {
     
    209212            }
    210213          }
    211           links.RemoveBySecond(i);
    212           links.Add(i, current[i]);
     214          if (lleb[i] != i)
     215            groupItems.Remove(lleb[i]);
     216          groupItems.Add(i);
    213217          if (evaluations >= maxEvals) break;
    214218          if (token.IsCancellationRequested) break;
Note: See TracChangeset for help on using the changeset viewer.