Changeset 11981 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GrammaticalOptimization/SequentialDecisionPolicies/GenericFunctionApproximationGrammarPolicy.cs
- Timestamp:
- 02/11/15 20:11:35 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GrammaticalOptimization/SequentialDecisionPolicies/GenericFunctionApproximationGrammarPolicy.cs
r11980 r11981 60 60 originalIdx++; 61 61 } 62 63 64 /*65 const double beta = 10;66 var w = from idx in Enumerable.Range(0, maxIdx)67 let afterStateQ = activeAfterStates[idx]68 select Math.Exp(beta * afterStateQ);69 70 var bestAction = Enumerable.Range(0, maxIdx).SampleProportional(random, w);71 selectedStateIdx = actionIndexMap[bestAction];72 Debug.Assert(selectedStateIdx >= 0);73 */74 62 75 63 76 if (random.NextDouble() < 0.5) { 64 // TODO: policy should be a parameter of the function approximation policy 65 if (random.NextDouble() < 0.2) { 77 66 selectedStateIdx = actionIndexMap[random.Next(maxIdx)]; 78 67 } else { … … 139 128 private void UpdateWeights(string state, double reward) { 140 129 double delta = reward - GetValue(state); 141 // delta /= problem.GetFeatures(state).Count();142 //const double alpha = 0.001;143 130 foreach (var feature in problem.GetFeatures(state)) { 144 131 featureTries[feature.Id] = GetFeatureTries(feature.Id) + 1;
Note: See TracChangeset
for help on using the changeset viewer.