Changeset 12893 for branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/HeuristicLab.Algorithms.GrammaticalOptimization/SequentialDecisionPolicies/GenericPolicy.cs
- Timestamp:
- 08/24/15 13:56:27 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/HeuristicLab.Algorithms.GrammaticalOptimization/SequentialDecisionPolicies/GenericPolicy.cs
r12298 r12893 28 28 private int[] actionIndexMap; // don't allocate each time 29 29 30 public bool TrySelect( Random random, string curState, IEnumerable<string> afterStates, out int selectedStateIdx) {30 public bool TrySelect(System.Random random, string curState, IEnumerable<string> afterStates, out int selectedStateIdx) { 31 31 // fail if all states are done (corresponding state infos are disabled) 32 32 if (afterStates.All(s => Done(s))) { … … 101 101 102 102 103 private int SelectBoltzmann( Random random, IEnumerable<double> qs, double beta = 10) {103 private int SelectBoltzmann(System.Random random, IEnumerable<double> qs, double beta = 10) { 104 104 // select best 105 105 … … 122 122 } 123 123 124 private int SelectEpsGreedy( Random random, IEnumerable<double> qs, double eps = 0.2) {124 private int SelectEpsGreedy(System.Random random, IEnumerable<double> qs, double eps = 0.2) { 125 125 if (random.NextDouble() >= eps) { // eps == 0 should be equivalent to pure exploitation, eps == 1 is pure exploration 126 126 // select best … … 136 136 bestActions.Add(aIdx); 137 137 bestQ = q; 138 } else if ( q.IsAlmost(bestQ)) {138 } else if (HeuristicLab.Common.Extensions.IsAlmost(q,bestQ)) { 139 139 bestActions.Add(aIdx); 140 140 } … … 148 148 } 149 149 150 private int SelectRandom( Random random, IEnumerable<double> qs) {150 private int SelectRandom(System.Random random, IEnumerable<double> qs) { 151 151 return qs 152 152 .Select((aInfo, idx) => Tuple.Create(aInfo, idx))
Note: See TracChangeset
for help on using the changeset viewer.