Last change
on this file since 11728 was
11727,
checked in by gkronber, 9 years ago
|
#2283: worked on grammatical optimization problem solvers (simple MCTS done)
|
File size:
668 bytes
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Diagnostics;
|
---|
4 | using System.Linq;
|
---|
5 | using System.Text;
|
---|
6 | using System.Threading.Tasks;
|
---|
7 | using HeuristicLab.Common;
|
---|
8 |
|
---|
9 | namespace 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.