Rev | Line | |
---|
[11708] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using System.Threading.Tasks;
|
---|
| 6 |
|
---|
| 7 | namespace HeuristicLab.Algorithms.Bandits {
|
---|
| 8 | public class RandomPolicy : BanditPolicy {
|
---|
| 9 | private readonly Random random;
|
---|
| 10 | public RandomPolicy(Random random, int numActions)
|
---|
| 11 | : base(numActions) {
|
---|
| 12 | this.random = random;
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | public override int SelectAction() {
|
---|
| 16 | return random.Next(NumActions);
|
---|
| 17 | }
|
---|
| 18 | public override void UpdateReward(int action, double reward) {
|
---|
| 19 | // do nothing
|
---|
| 20 | }
|
---|
| 21 | public override void Reset() {
|
---|
| 22 | // do nothing
|
---|
| 23 | }
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.