Changeset 13492
- Timestamp:
- 01/10/16 17:13:27 (9 years ago)
- Location:
- branches/HeuristicLab.Problems.GrammaticalOptimization
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml
r12840 r13492 115 115 <d3:Header Content="Quality-Chart"/> 116 116 <d3:VerticalAxisTitle Content="Qualität" /> 117 <d3:HorizontalAxisTitle Content=" Evaluierungen"/>117 <d3:HorizontalAxisTitle Content="Iterationen"/> 118 118 </d3:ChartPlotter> 119 119 </Grid> … … 130 130 <d3:ChartPlotter Grid.Column="1" x:Name="SelectionChartPlotter" LegendVisible="False" EnableSmoothPanningForNumericAxes="True" > 131 131 <d3:VerticalAxisTitle Content="Qualität" /> 132 <d3:HorizontalAxisTitle Content=" Evaluierungen"/>132 <d3:HorizontalAxisTitle Content="Iterationen"/> 133 133 </d3:ChartPlotter> 134 134 </Grid> -
branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml.cs
r12840 r13492 142 142 run.TreeInfos = mctsSolver.GetTreeInfos(); 143 143 144 //byte[] output = mctsSolver.GenerateSvg();145 //if (output != null && output.Length > 0)146 //{147 //run.SvgFile = string.Format("MCTS_SVG_#{0}_{1}.svg", run.RunNumber, DateTime.Now.Ticks);148 //File.WriteAllBytes(run.SvgFile, mctsSolver.GenerateSvg());149 //}144 byte[] output = mctsSolver.GenerateSvg(); 145 if (output != null && output.Length > 0) 146 { 147 run.SvgFile = string.Format("MCTS_SVG_#{0}_{1}.svg", run.RunNumber, DateTime.Now.Ticks); 148 File.WriteAllBytes(run.SvgFile, mctsSolver.GenerateSvg()); 149 } 150 150 mctsSolver.FreeAll(); 151 151 } … … 192 192 if (policy == typeof(UCTPolicy)) 193 193 { 194 policyInstance = new UCTPolicy( );194 policyInstance = new UCTPolicy(vm.Epsylon); 195 195 } 196 196 else if (policy == typeof(ThresholdAscentPolicy)) … … 457 457 { 458 458 TextBoxEpsylon.Visibility = Visibility.Visible; 459 TextBoxEpsylon.Text = Math.Sqrt(1).ToString(); 460 TextBlockEpsylon.Text = "Epsylon"; 461 TextBlockEpsylon.Visibility = Visibility.Visible; 462 } 463 else if (vm.SelectedPolicy == typeof (UCTPolicy)) 464 { 465 TextBoxEpsylon.Visibility = Visibility.Visible; 466 TextBoxEpsylon.Text = Math.Sqrt(2).ToString(); 467 TextBlockEpsylon.Text = "c"; 459 468 TextBlockEpsylon.Visibility = Visibility.Visible; 460 469 } … … 468 477 private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) 469 478 { 470 if (ChartSelector.SelectedItem == TabSelectionIndicator) 471 { 472 if (vm.SelectedRun != null) 473 { 474 if (vm.SelectedRun.RunState == RunState.Finished) 475 { 476 ClearSelectionChart(); 477 DrawSelectionChart(vm.SelectedRun); 478 } 479 } 480 } 481 else if (ChartSelector.SelectedItem == TabQualityChart) 482 { 483 if (vm.SelectedRun != null) 484 { 485 if (vm.SelectedRun.RunState == RunState.Finished) 486 { 487 ClearQualityChart(); 488 DrawQualityChart(vm.SelectedRun); 489 } 479 if (vm.SelectedRun != null && vm.SelectedRun.RunState == RunState.Finished) 480 { 481 482 if (ChartSelector.SelectedItem == TabSelectionIndicator) 483 { 484 485 ClearSelectionChart(); 486 DrawSelectionChart(vm.SelectedRun); 487 } 488 else if (ChartSelector.SelectedItem == TabQualityChart) 489 { 490 491 ClearQualityChart(); 492 DrawQualityChart(vm.SelectedRun); 493 } 494 else if (ChartSelector.SelectedItem == TabItemTree) 495 { 496 DrawTreeChart(vm.SelectedRun); 490 497 } 491 498 } -
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.Bandits/Policies/UCTPolicy.cs
r12503 r13492 12 12 private readonly double c; 13 13 14 public UCTPolicy(double c = 1.0) { 14 // c = sqrt(2) 15 public UCTPolicy(double c = 1.41421356237) 16 { 15 17 this.c = c; 16 18 } … … 30 32 q = double.PositiveInfinity; 31 33 } else { 32 q = aInfo.SumReward / aInfo.Tries + 2.0 *c * Math.Sqrt(Math.Log(totalTries) / aInfo.Tries);34 q = aInfo.SumReward / aInfo.Tries + c * Math.Sqrt(Math.Log(totalTries) / aInfo.Tries); 33 35 } 34 36 if (q > bestQ) { -
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GeneticProgramming/StandardGP.cs
r12840 r13492 30 30 PopulationSize = 1000; 31 31 TournamentGroupSize = 4; 32 MutationRate = 0. 15;33 MaxSolutionSize = 201;32 MutationRate = 0.05; 33 MaxSolutionSize = 40; 34 34 MaxSolutionDepth = 17; 35 35 this.saveAlg = saveAlg; -
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/Base/TreeNode.cs
r12832 r13492 1 using System;1 using HeuristicLab.Algorithms.Bandits; 2 2 using System.Collections.Generic; 3 3 using System.Linq; 4 using System.Text;5 using System.Threading.Tasks;6 using HeuristicLab.Algorithms.Bandits;7 using HeuristicLab.Algorithms.Bandits.BanditPolicies;8 using HeuristicLab.Problems.GrammaticalOptimization;9 4 10 5 namespace HeuristicLab.Algorithms.MonteCarloTreeSearch.Base -
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/MonteCarloTreeSearch.cs
r12840 r13492 86 86 currentNode.GetChildActionInfos()); 87 87 currentNode = currentNode.children[currentActionIndex]; 88 selections++;89 CheckSelection(currentNode, selections);88 //selections++; 89 //CheckSelection(currentNode, selections); 90 90 } 91 91 … … 98 98 currentNode.children[behaviourPolicy.SelectAction(random, currentNode.GetChildActionInfos()) 99 99 ]; 100 selections++;101 CheckSelection(currentNode, selections);100 //selections++; 101 //CheckSelection(currentNode, selections); 102 102 } 103 103 if (currentNode.phrase.Length <= maxLen) … … 223 223 public byte[] GenerateSvg() 224 224 { 225 if (GetTreeInfos().TotalNodes < 1000)225 if (GetTreeInfos().TotalNodes < 6000) 226 226 { 227 227 IGetStartProcessQuery getStartProcessQuery = new GetStartProcessQuery(); … … 233 233 getProcessStartInfoQuery, 234 234 registerLayoutPluginCommand); 235 wrapper.GraphvizPath = @"../../../ Graphviz2.38/bin";235 wrapper.GraphvizPath = @"../../../../Graphviz2.38/bin"; 236 236 StringBuilder dotFile = new StringBuilder("digraph {"); 237 237 dotFile.AppendLine(); … … 279 279 foreach (TreeNode childNode in currentNode.children) 280 280 { 281 toDoNodes.Add(childNode); 282 // declare node 283 284 string hexColor = GetHexNodeColor(Color.White, Color.OrangeRed, childNode.actionInfo.Value); 285 dotFile.AppendLine( 286 string.Format("{0} [label=\"{1}\\n{2:0.00}/{3}\", style=filled, fillcolor=\"{4}\"]", 287 childNode.GetHashCode(), 288 childNode.phrase, childNode.actionInfo.Value, childNode.actionInfo.Tries, hexColor)); 289 // add edge 290 dotFile.AppendLine(string.Format("{0} -> {1}", currentNode.GetHashCode(), 291 childNode.GetHashCode())); 281 if (childNode.actionInfo.Tries > 1) 282 { 283 toDoNodes.Add(childNode); 284 // declare node 285 286 string hexColor = GetHexNodeColor(Color.White, Color.OrangeRed, 287 childNode.actionInfo.Value); 288 dotFile.AppendLine( 289 string.Format("{0} [label=\"{1}\\n{2:0.00}/{3}\", style=filled, fillcolor=\"{4}\"]", 290 childNode.GetHashCode(), 291 childNode.phrase, childNode.actionInfo.Value, childNode.actionInfo.Tries, 292 hexColor)); 293 // add edge 294 dotFile.AppendLine(string.Format("{0} -> {1}", currentNode.GetHashCode(), 295 childNode.GetHashCode())); 296 } 292 297 } 293 298 } -
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/MonteCarloTreeSearch_PruneLeaves.cs
r12840 r13492 48 48 // already removed all child nodes so remove it too.. 49 49 currentNode.parent.RemoveChildren(currentNode); 50 i--; 50 51 continue; 51 52 } … … 75 76 Propagate(currentNode, quality); 76 77 } 78 else 79 { 80 i--; 81 82 } 77 83 } 78 84 }
Note: See TracChangeset
for help on using the changeset viewer.