- Timestamp:
- 04/08/15 13:05:53 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.GrammaticalOptimization-gkr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/HeuristicLab.Algorithms.GrammaticalOptimization/SequentialDecisionPolicies/GenericPolicy.cs
r12294 r12295 48 48 foreach (var afterState in afterStates) { 49 49 if (!Done(afterState)) { 50 activeAfterStates[idx] = GetValue(afterState); 50 if (GetTries(afterState) == 0) 51 activeAfterStates[idx] = double.PositiveInfinity; 52 else 53 activeAfterStates[idx] = GetValue(afterState); 51 54 actionIndexMap[idx] = originalIdx; 52 55 idx++; … … 179 182 Console.WriteLine(Q.Values.Max()); 180 183 var topTries = Q.Keys.OrderByDescending(key => T[key]).Take(50); 181 var topQs = Q.Keys.Where(key =>key.Contains(",")).OrderByDescending(key => Q[key]).Take(50);184 var topQs = Q.Keys.Where(key => key.Contains(",")).OrderByDescending(key => Q[key]).Take(50); 182 185 foreach (var t in topTries.Zip(topQs, Tuple.Create)) { 183 186 var id1 = t.Item1; -
branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/HeuristicLab.Problems.GrammaticalOptimization/Problems/SymbolicRegressionPoly10Problem.cs
r12294 r12295 163 163 // .Concat(new Feature[] { new Feature(CanonicalRepresentation(phrase), 1.0) }); 164 164 165 //return new Feature[] { new Feature(phrase, 1.0), };166 167 var partialInterpreter = new PartialExpressionInterpreter();168 var vars = new double[] { 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, };169 var s = partialInterpreter.Interpret(phrase, vars);170 //if (s.Any())171 // return new Feature[] { new Feature(s.Pop().ToString(), 1.0), };172 //else173 // return new Feature[] { new Feature("$", 1.0), };174 return new Feature[] { new Feature(string.Join(",", s), 1.0) };165 return new Feature[] { new Feature(phrase, 1.0), }; 166 167 // var partialInterpreter = new PartialExpressionInterpreter(); 168 // var vars = new double[] { 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, }; 169 // var s = partialInterpreter.Interpret(phrase, vars); 170 // //if (s.Any()) 171 // // return new Feature[] { new Feature(s.Pop().ToString(), 1.0), }; 172 // //else 173 // // return new Feature[] { new Feature("$", 1.0), }; 174 // return new Feature[] { new Feature(string.Join(",", s), 1.0) }; 175 175 } 176 176 -
branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/Main/Program.cs
r12294 r12295 54 54 // new HeuristicLab.Algorithms.Bandits.GrammarPolicies.GenericGrammarPolicy(problem, new UCB1TunedPolicy())); 55 55 var policy = new GenericPolicy(problem); 56 var alg = new SequentialSearch(problem, 23, random, 1,56 var alg = new SequentialSearch(problem, 23, random, 0, 57 57 policy); 58 58 //var alg = new MonteCarloTreeSearch(problem, 23, random, new UCB1Policy(), new RandomSimulation(problem, random, 30)); … … 71 71 if (iterations % 1000 == 0) Console.Clear(); 72 72 Console.SetCursorPosition(0, 0); 73 //alg.PrintStats();74 policy.PrintStats();73 alg.PrintStats(); 74 //policy.PrintStats(); 75 75 } 76 76
Note: See TracChangeset
for help on using the changeset viewer.