Changeset 12955 for branches/HeuristicLab.Algorithms.IteratedSentenceConstruction/HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction/3.3/Policies
- Timestamp:
- 09/17/15 17:35:45 (9 years ago)
- Location:
- branches/HeuristicLab.Algorithms.IteratedSentenceConstruction
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Algorithms.IteratedSentenceConstruction
- Property svn:ignore
-
old new 1 1 bin 2 TestResults
-
- Property svn:ignore
-
branches/HeuristicLab.Algorithms.IteratedSentenceConstruction/HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction/3.3/Policies/BoltzmannExplorationSymbolicExpressionConstructionPolicy.cs
r12924 r12955 68 68 } 69 69 70 protected override object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> action s, ISymbolicExpressionTreeNode parent, int childIdx) {71 return StateValueFunction.StateFunction.CreateState(root, action s, parent, childIdx);70 protected override object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> actionSequence, ISymbolicExpressionTreeNode parent, int childIdx) { 71 return StateValueFunction.StateFunction.CreateState(root, actionSequence, parent, childIdx); 72 72 } 73 73 -
branches/HeuristicLab.Algorithms.IteratedSentenceConstruction/HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction/3.3/Policies/EpsGreedySymbolicExpressionConstructionPolicy.cs
r12923 r12955 62 62 } 63 63 64 protected override object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> action s, ISymbolicExpressionTreeNode parent, int childIdx) {65 return StateValueFunction.StateFunction.CreateState(root, action s, parent, childIdx);64 protected override object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> actionSequence, ISymbolicExpressionTreeNode parent, int childIdx) { 65 return StateValueFunction.StateFunction.CreateState(root, actionSequence, parent, childIdx); 66 66 } 67 67 -
branches/HeuristicLab.Algorithms.IteratedSentenceConstruction/HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction/3.3/Policies/RandomSymbolicExpressionConstructionPolicy.cs
r12924 r12955 26 26 } 27 27 28 protected override object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> action s, ISymbolicExpressionTreeNode parent, int childIdx) {28 protected override object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> actionSequence, ISymbolicExpressionTreeNode parent, int childIdx) { 29 29 return null; // doesn't use state information 30 30 } -
branches/HeuristicLab.Algorithms.IteratedSentenceConstruction/HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction/3.3/Policies/SymbolicExpressionConstructionPolicyBase.cs
r12923 r12955 62 62 var g = Problem.Encoding.Grammar; 63 63 var root = g.ProgramRootSymbol.CreateTreeNode(); 64 int maxDepth = Problem.Encoding.TreeDepthParameter.Value.Value; 64 int maxDepth = Problem.Encoding.TreeDepthParameter.Value.Value; // ignored 65 65 int maxLen = Problem.Encoding.TreeLengthParameter.Value.Value; 66 66 … … 75 75 76 76 while (openSlots.Any()) { 77 var next = openSlots.Pop(); 77 var next = openSlots.First(); 78 openSlots.Pop(); 78 79 var parent = next.parent; 79 80 var childIdx = next.childIdx; … … 82 83 var allowedChildSymbols = g.GetAllowedChildSymbols(parent.Symbol, childIdx) 83 84 .Where(a => a.Enabled) 84 .Where(a => treeSize + g.GetMinimumExpressionLength(a) + openSlots.Select(e => e.minSize).Sum() <= maxLen); 85 .Where(a => treeSize + g.GetMinimumExpressionLength(a) + openSlots.Select(e => e.minSize).Sum() <= maxLen) 86 .OrderBy(a => a.MaximumArity); // terminals should be tried first 85 87 86 88 searchTree.ExpandCurrentNode(allowedChildSymbols); … … 131 133 132 134 // push new slots 133 for (int chIdx = g.GetMinimumSubtreeCount(childNode.Symbol) - 1; chIdx >= 0; chIdx--) {135 for (int chIdx = g.GetMinimumSubtreeCount(childNode.Symbol) -1 ; chIdx >= 0; chIdx--) { 134 136 int minForChild = g.GetAllowedChildSymbols(childNode.Symbol, chIdx) 135 137 .Min(a => g.GetMinimumExpressionLength(a)); // min length of all possible alts for the slot 136 openSlots.Push(new Slot() { parent = childNode, childIdx = chIdx, minSize = minForChild }); 138 openSlots.Push(new Slot() { parent = childNode, childIdx = chIdx, minSize = minForChild }); 137 139 } 138 140 } … … 159 161 public abstract void Update(IEnumerable<object> stateSequence, double quality); 160 162 161 protected abstract object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> action s, ISymbolicExpressionTreeNode parent, int childIdx);163 protected abstract object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> actionSequence, ISymbolicExpressionTreeNode parent, int childIdx); 162 164 } 163 165 } -
branches/HeuristicLab.Algorithms.IteratedSentenceConstruction/HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction/3.3/Policies/UcbSymbolicExpressionConstructionPolicy.cs
r12923 r12955 71 71 } 72 72 73 protected override object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> action s, ISymbolicExpressionTreeNode parent, int childIdx) {74 return StateValueFunction.StateFunction.CreateState(root, action s, parent, childIdx);73 protected override object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> actionSequence, ISymbolicExpressionTreeNode parent, int childIdx) { 74 return StateValueFunction.StateFunction.CreateState(root, actionSequence, parent, childIdx); 75 75 } 76 76 -
branches/HeuristicLab.Algorithms.IteratedSentenceConstruction/HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction/3.3/Policies/UcbTunedSymbolicExpressionConstructionPolicy.cs
r12923 r12955 72 72 } 73 73 74 protected override object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> action s, ISymbolicExpressionTreeNode parent, int childIdx) {75 return StateValueFunction.StateFunction.CreateState(root, action s, parent, childIdx);74 protected override object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> actionSequence, ISymbolicExpressionTreeNode parent, int childIdx) { 75 return StateValueFunction.StateFunction.CreateState(root, actionSequence, parent, childIdx); 76 76 } 77 77
Note: See TracChangeset
for help on using the changeset viewer.