Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/24/15 13:56:27 (9 years ago)
Author:
gkronber
Message:

#2283: experiments on grammatical optimization algorithms (maxreward instead of avg reward, ...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/HeuristicLab.Algorithms.GrammaticalOptimization/SequentialDecisionPolicies/GenericPolicy.cs

    r12298 r12893  
    2828    private int[] actionIndexMap; // don't allocate each time
    2929
    30     public bool TrySelect(Random random, string curState, IEnumerable<string> afterStates, out int selectedStateIdx) {
     30    public bool TrySelect(System.Random random, string curState, IEnumerable<string> afterStates, out int selectedStateIdx) {
    3131      // fail if all states are done (corresponding state infos are disabled)
    3232      if (afterStates.All(s => Done(s))) {
     
    101101
    102102
    103     private int SelectBoltzmann(Random random, IEnumerable<double> qs, double beta = 10) {
     103    private int SelectBoltzmann(System.Random random, IEnumerable<double> qs, double beta = 10) {
    104104      // select best
    105105
     
    122122    }
    123123
    124     private int SelectEpsGreedy(Random random, IEnumerable<double> qs, double eps = 0.2) {
     124    private int SelectEpsGreedy(System.Random random, IEnumerable<double> qs, double eps = 0.2) {
    125125      if (random.NextDouble() >= eps) { // eps == 0 should be equivalent to pure exploitation, eps == 1 is pure exploration
    126126        // select best
     
    136136            bestActions.Add(aIdx);
    137137            bestQ = q;
    138           } else if (q.IsAlmost(bestQ)) {
     138          } else if (HeuristicLab.Common.Extensions.IsAlmost(q,bestQ)) {
    139139            bestActions.Add(aIdx);
    140140          }
     
    148148    }
    149149
    150     private int SelectRandom(Random random, IEnumerable<double> qs) {
     150    private int SelectRandom(System.Random random, IEnumerable<double> qs) {
    151151      return qs
    152152         .Select((aInfo, idx) => Tuple.Create(aInfo, idx))
Note: See TracChangeset for help on using the changeset viewer.