Changeset 11742 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.Bandits/BanditPolicies/DefaultPolicyActionInfo.cs
- Timestamp:
- 01/09/15 14:57:28 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.Bandits/BanditPolicies
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.Bandits/BanditPolicies/DefaultPolicyActionInfo.cs
r11732 r11742 6 6 using System.Threading.Tasks; 7 7 8 namespace HeuristicLab.Algorithms.Bandits {8 namespace HeuristicLab.Algorithms.Bandits.BanditPolicies { 9 9 // stores information that is relevant for most of the policies 10 public class DefaultPolicyActionInfo : I PolicyActionInfo {10 public class DefaultPolicyActionInfo : IBanditPolicyActionInfo { 11 11 public bool Disabled { get { return Tries == -1; } } 12 12 public double SumReward { get; private set; } 13 public int Tries { get; private set; } 13 14 public double MaxReward { get; private set; } 14 public int Tries { get; private set; } 15 15 public double Value { get { return SumReward / Tries; } } 16 16 public DefaultPolicyActionInfo() { 17 MaxReward = double. NegativeInfinity;17 MaxReward = double.MinValue; 18 18 } 19 19 … … 37 37 Console.WriteLine("avg reward {0,5:F2} disabled {1}", SumReward / Tries, Disabled); 38 38 } 39 40 public static Func<DefaultPolicyActionInfo, double> AverageReward { 41 get { 42 return (aInfo) => 43 aInfo.Tries == 0 ? 44 double.PositiveInfinity : 45 aInfo.SumReward / (double)aInfo.Tries; 46 } 47 } 39 48 } 40 49 }
Note: See TracChangeset
for help on using the changeset viewer.