Changeset 11727 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.Bandits/Policies/RandomPolicy.cs
- Timestamp:
- 12/29/14 11:02:36 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.Bandits/Policies/RandomPolicy.cs
r11711 r11727 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Diagnostics; 3 4 using System.Linq; 4 5 using System.Text; 5 6 using System.Threading.Tasks; 7 using HeuristicLab.Common; 6 8 7 9 namespace HeuristicLab.Algorithms.Bandits { 8 10 public class RandomPolicy : BanditPolicy { 9 11 private readonly Random random; 12 10 13 public RandomPolicy(Random random, int numActions) 11 14 : base(numActions) { … … 14 17 15 18 public override int SelectAction() { 16 return random.Next(NumActions); 19 Debug.Assert(Actions.Any()); 20 return Actions.SelectRandom(random); 17 21 } 18 22 public override void UpdateReward(int action, double reward) { 19 23 // do nothing 20 24 } 21 public override void Reset() { 22 // do nothing 23 } 25 24 26 } 25 27 }
Note: See TracChangeset
for help on using the changeset viewer.