- Timestamp:
- 01/12/15 21:23:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/Main/Program.cs
r11745 r11747 88 88 Tuple.Create((IProblem)new SymbolicRegressionPoly10Problem(), 23), 89 89 }) 90 foreach (var randomTries in new int[] { 1, 10, /* 5, 100 /*, 500, 1000 */}) {90 foreach (var randomTries in new int[] { 0, 1, 10, /* 5, 100 /*, 500, 1000 */}) { 91 91 foreach (var policy in policies) { 92 92 var myRandomTries = randomTries; … … 137 137 138 138 private static void RunDemo() { 139 // TODO: unify MCTS, TD and ContextMCTS Solvers (stateInfos) 139 140 // TODO: test with eps-greedy using max instead of average as value (seems to work well for symb-reg! explore further!) 140 141 // TODO: separate value function from policy … … 165 166 var random = new Random(); 166 167 167 var problem = new SymbolicRegressionPoly10Problem(); // good results e.g. 10 randomtries and EpsGreedyPolicy(0.2, (aInfo)=>aInfo.MaxReward) 168 var phraseLen = 1; 169 var sentenceLen = 25; 170 var numPhrases = sentenceLen / phraseLen; 171 var problem = new RoyalPhraseSequenceProblem(random, 10, numPhrases, phraseLen: 1, k: 1, correctReward: 1, incorrectReward: 0); 172 173 //var problem = new SymbolicRegressionPoly10Problem(); // good results e.g. 10 randomtries and EpsGreedyPolicy(0.2, (aInfo)=>aInfo.MaxReward) 168 174 // Ant 169 175 // good results e.g. with var alg = new MctsSampler(problem, 17, random, 1, (rand, numActions) => new ThresholdAscentPolicy(numActions, 500, 0.01)); … … 175 181 //var problem = new RoyalPairProblem(); 176 182 //var problem = new EvenParityProblem(); 177 //var alg = new MctsSampler(problem, 23, random, 0, new GaussianThompsonSamplingPolicy(true)); 178 var alg = new MctsContextualSampler(problem, 23, random, 0); 179 //var alg = new TemporalDifferenceTreeSearchSampler(problem, 17, random, 10, new EpsGreedyPolicy(0.1)); 180 //var alg = new ExhaustiveBreadthFirstSearch(problem, 17); 183 // symbreg length = 11 q = 0.824522210419616 184 var alg = new MctsSampler(problem, sentenceLen, random, 0, new BoltzmannExplorationPolicy(200)); 185 //var alg = new MctsQLearningSampler(problem, sentenceLen, random, 0, null); 186 //var alg = new MctsQLearningSampler(problem, 30, random, 0, new EpsGreedyPolicy(0.2)); 187 //var alg = new MctsContextualSampler(problem, 23, random, 0); // must visit each canonical solution only once 188 //var alg = new TemporalDifferenceTreeSearchSampler(problem, 30, random, 1); 189 //var alg = new ExhaustiveBreadthFirstSearch(problem, 7); 181 190 //var alg = new AlternativesContextSampler(problem, random, 17, 4, (rand, numActions) => new RandomPolicy(rand, numActions)); 182 191 //var alg = new ExhaustiveDepthFirstSearch(problem, 17); 183 192 // var alg = new AlternativesSampler(problem, 17); 184 193 // var alg = new RandomSearch(problem, random, 17); 185 // 194 //var alg = new ExhaustiveRandomFirstSearch(problem, random, 17); 186 195 187 196 alg.FoundNewBestSolution += (sentence, quality) => { … … 199 208 alg.PrintStats(); 200 209 } 210 //Console.WriteLine(sentence); 201 211 202 212 if (iterations % 10000 == 0) { 203 //Console.WriteLine("{0,10} {1,10:F5} {2,10:F5} {3}", iterations, bestQuality, quality, sentence);204 //Console.WriteLine("{0,4} {1,7} {2}", alg.treeDepth, alg.treeSize, globalStatistics);205 213 //Console.WriteLine("{0,4} {1,7} {2}", alg.treeDepth, alg.treeSize, globalStatistics); 206 214 }
Note: See TracChangeset
for help on using the changeset viewer.