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