Changeset 11730 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.Bandits/Bandits/BernoulliBandit.cs
- Timestamp:
- 01/02/15 16:08:21 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.Bandits/Bandits/BernoulliBandit.cs
r11711 r11730 6 6 7 7 namespace HeuristicLab.Algorithms.Bandits { 8 public class BernoulliBandit {8 public class BernoulliBandit : IBandit { 9 9 public int NumArms { get; private set; } 10 10 public double OptimalExpectedReward { get; private set; } // reward of the best arm, for calculating regret 11 public int OptimalExpectedRewardArm { get; private set; } 12 // the arm with highest expected reward also has the highest probability of return a reward of 1.0 13 public int OptimalMaximalRewardArm { get { return OptimalExpectedRewardArm; } } 14 11 15 private readonly Random random; 12 16 private readonly double[] expReward; … … 19 23 for (int i = 0; i < nArms; i++) { 20 24 expReward[i] = random.NextDouble(); 21 if (expReward[i] > OptimalExpectedReward) OptimalExpectedReward = expReward[i]; 25 if (expReward[i] > OptimalExpectedReward) { 26 OptimalExpectedReward = expReward[i]; 27 OptimalExpectedRewardArm = i; 28 } 22 29 } 23 30 }
Note: See TracChangeset
for help on using the changeset viewer.