Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/07/15 14:31:06 (10 years ago)
Author:
gkronber
Message:

#2283 created a new branch to separate development from aballeit

Location:
branches/HeuristicLab.Problems.GrammaticalOptimization-gkr
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/HeuristicLab.Algorithms.Bandits/Policies/BoltzmannExplorationPolicy.cs

    r11806 r12290  
    1111  public class BoltzmannExplorationPolicy : IBanditPolicy {
    1212    private readonly double beta;
    13     private readonly Func<DefaultPolicyActionInfo, double> valueFunction;
    1413
    15     public BoltzmannExplorationPolicy(double beta) : this(beta, DefaultPolicyActionInfo.AverageReward) { }
    16 
    17     public BoltzmannExplorationPolicy(double beta, Func<DefaultPolicyActionInfo, double> valueFunction) {
     14    public BoltzmannExplorationPolicy(double beta)  {
    1815      if (beta < 0) throw new ArgumentException();
    1916      this.beta = beta;
    20       this.valueFunction = valueFunction;
    2117    }
    2218    public int SelectAction(Random random, IEnumerable<IBanditPolicyActionInfo> actionInfos) {
     
    3733
    3834      var w = from aInfo in myActionInfos
    39               select Math.Exp(beta * valueFunction(aInfo));
     35              select Math.Exp(beta * aInfo.Value);
    4036
    4137      var bestAction = Enumerable.Range(0, myActionInfos.Count()).SampleProportional(random, w);
Note: See TracChangeset for help on using the changeset viewer.