Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.Bandits/Policies/RandomPolicy.cs @ 11728

Last change on this file since 11728 was 11727, checked in by gkronber, 8 years ago

#2283: worked on grammatical optimization problem solvers (simple MCTS done)

File size: 668 bytes
RevLine 
[11708]1using System;
2using System.Collections.Generic;
[11727]3using System.Diagnostics;
[11708]4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
[11727]7using HeuristicLab.Common;
[11708]8
9namespace HeuristicLab.Algorithms.Bandits {
10  public class RandomPolicy : BanditPolicy {
11    private readonly Random random;
[11727]12
[11708]13    public RandomPolicy(Random random, int numActions)
14      : base(numActions) {
15      this.random = random;
16    }
17
18    public override int SelectAction() {
[11727]19      Debug.Assert(Actions.Any());
20      return Actions.SelectRandom(random);
[11708]21    }
22    public override void UpdateReward(int action, double reward) {
23      // do nothing
24    }
[11727]25
[11708]26  }
27}
Note: See TracBrowser for help on using the repository browser.