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
|
Rev | Line | |
---|
[11708] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
[11727] | 3 | using System.Diagnostics;
|
---|
[11708] | 4 | using System.Linq;
|
---|
| 5 | using System.Text;
|
---|
| 6 | using System.Threading.Tasks;
|
---|
[11727] | 7 | using HeuristicLab.Common;
|
---|
[11708] | 8 |
|
---|
| 9 | namespace 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.