Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/Base/TreeNode.cs @ 12503

Last change on this file since 12503 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.0 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using HeuristicLab.Algorithms.Bandits;
7using HeuristicLab.Algorithms.Bandits.BanditPolicies;
8using HeuristicLab.Problems.GrammaticalOptimization;
9
10namespace HeuristicLab.Algorithms.MonteCarloTreeSearch.Base
11{
12    public class TreeNode
13    {
14        public string phrase;
15        public TreeNode parent;
16        public List<TreeNode> children;
17        public IBanditPolicyActionInfo actionInfo;
18
19        public TreeNode(TreeNode parent, string phrase, IBanditPolicyActionInfo actionInfo)
20        {
21            this.parent = parent;
22            this.phrase = phrase;
23            this.actionInfo = actionInfo;
24        }
25        public bool IsLeaf()
26        {
27            return children == null || !children.Any();
28        }
29
30        internal IEnumerable<IBanditPolicyActionInfo> GetChildActionInfos()
31        {
32            return children.Select(n => n.actionInfo);
33        }
34    }
35}
Note: See TracBrowser for help on using the repository browser.