Rev | Line | |
---|
[12050] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using System.Threading.Tasks;
|
---|
| 6 | using HeuristicLab.Algorithms.Bandits;
|
---|
[12098] | 7 | using HeuristicLab.Algorithms.Bandits.BanditPolicies;
|
---|
[12050] | 8 | using HeuristicLab.Problems.GrammaticalOptimization;
|
---|
| 9 |
|
---|
[12098] | 10 | namespace HeuristicLab.Algorithms.MonteCarloTreeSearch.Base
|
---|
[12050] | 11 | {
|
---|
| 12 | public class TreeNode
|
---|
| 13 | {
|
---|
| 14 | public string phrase;
|
---|
| 15 | public TreeNode parent;
|
---|
| 16 | public List<TreeNode> children;
|
---|
| 17 | public IBanditPolicyActionInfo actionInfo;
|
---|
| 18 |
|
---|
[12098] | 19 | public TreeNode(TreeNode parent, string phrase)
|
---|
[12050] | 20 | {
|
---|
[12098] | 21 | this.parent = parent;
|
---|
[12050] | 22 | this.phrase = phrase;
|
---|
[12098] | 23 | actionInfo = new DefaultPolicyActionInfo();
|
---|
[12050] | 24 | }
|
---|
[12098] | 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 | }
|
---|
[12050] | 34 | }
|
---|
| 35 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.