Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/16/15 18:26:35 (9 years ago)
Author:
gkronber
Message:

#2283 work-in-progress commit (does not compile)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GrammaticalOptimization/SequentialSearch.cs

    r11770 r11792  
    5757      Reset();
    5858
    59       for (int i = 0; !Done() && i < maxIterations; i++) {
     59      for (int i = 0; bestQuality < 1.0 && !Done() && i < maxIterations; i++) {
    6060        var phrase = SampleSentence(problem.Grammar);
    6161        // can fail on the last sentence
     
    7676        }
    7777      }
    78 
    79       // clean up
    80       // Reset(); GC.Collect();
    8178    }
    8279
     
    10097      while (!phrase.IsTerminal) {
    10198
     99        var newPhrases = GenerateFollowStates(g, phrase);
     100       
     101        throw new NotImplementedException(); // TODO: reintroduce random-trie checking once the tree of all states has been reintroduced
    102102        //if (n.randomTries < randomTries) {
    103103        //  n.randomTries++;
     
    107107        //} else {
    108108
    109         var newPhrases = GenerateFollowStates(g, phrase);
    110 
    111         // => select using bandit policy
    112         // failure means we simply restart
    113         if (!behaviourPolicy.TrySelect(random, phrase, newPhrases, out phrase)) {
    114           return false;
    115         }
     109
     110          // => select using bandit policy
     111          // failure means we simply restart
     112          if (!behaviourPolicy.TrySelect(random, phrase, newPhrases, out phrase)) {
     113            return false;
     114          }
     115        // }
    116116        stateChain.Add(phrase);
    117117        curDepth++;
     
    125125    private readonly Dictionary<ReadonlySequence, ReadonlySequence[]> cache;
    126126    private IEnumerable<ReadonlySequence> GenerateFollowStates(IGrammar g, ReadonlySequence phrase) {
     127      throw new NotImplementedException();
     128      // TODO: Replace caching by a tree of all states. tree is only used for easily retrieving the follow-states of a state
    127129      ReadonlySequence[] follow;
    128       if (!cache.TryGetValue(phrase, out follow)) {
     130      //if (!cache.TryGetValue(phrase, out follow)) {
    129131        char nt = phrase.FirstNonTerminal;
    130132
     
    142144          follow[idx++] = new ReadonlySequence(newPhrase);
    143145        }
    144         cache[phrase] = follow;
    145       }
     146      //  cache[phrase] = follow;
     147      //}
    146148      return follow;
    147149    }
Note: See TracChangeset for help on using the changeset viewer.