Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/27/15 21:52:10 (9 years ago)
Author:
aballeit
Message:

#2283: implemented MCTS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/Base/TreeNode.cs

    r12050 r12098  
    55using System.Threading.Tasks;
    66using HeuristicLab.Algorithms.Bandits;
     7using HeuristicLab.Algorithms.Bandits.BanditPolicies;
    78using HeuristicLab.Problems.GrammaticalOptimization;
    89
    9 namespace HeuristicLab.Algorithms.MonteCarloTreeSearch
     10namespace HeuristicLab.Algorithms.MonteCarloTreeSearch.Base
    1011{
    1112    public class TreeNode
     
    1516        public List<TreeNode> children;
    1617        public IBanditPolicyActionInfo actionInfo;
    17         public bool expandable;
    18         public List<int> unvisitedNonTerminals;
    1918
    20         public TreeNode(TreeNode parent, string phrase, bool expandable, List<int> unvisitedNonTerminals)
     19        public TreeNode(TreeNode parent, string phrase)
    2120        {
     21            this.parent = parent;
    2222            this.phrase = phrase;
    23             this.expandable = expandable;
    24             this.unvisitedNonTerminals = unvisitedNonTerminals;
     23            actionInfo = new DefaultPolicyActionInfo();
     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);
    2533        }
    2634    }
Note: See TracChangeset for help on using the changeset viewer.