Changeset 13492 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch
- Timestamp:
- 01/10/16 17:13:27 (9 years ago)
- Location:
- branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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.