Last change
on this file since 13398 was
12924,
checked in by gkronber, 9 years ago
|
#2471
- implemented a demo for value approximation with gbt and a trivial feature function
|
File size:
1.4 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Runtime.InteropServices.WindowsRuntime;
|
---|
5 | using System.Text;
|
---|
6 | using System.Threading.Tasks;
|
---|
7 | using HeuristicLab.Common;
|
---|
8 | using HeuristicLab.Core;
|
---|
9 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
10 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
11 |
|
---|
12 | namespace HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction {
|
---|
13 | // the state represents the combination of parent symbol and it's child index
|
---|
14 | [StorableClass]
|
---|
15 | [Item("ParentChildStateFunction", "")]
|
---|
16 | public class ParentChildStateFunction : Item, IStateFunction {
|
---|
17 | public ParentChildStateFunction()
|
---|
18 | : base() {
|
---|
19 | }
|
---|
20 |
|
---|
21 | public object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> actions, ISymbolicExpressionTreeNode parentNode, int childIdx) {
|
---|
22 | if (parentNode == null) return string.Empty;
|
---|
23 | else return parentNode.Symbol.Name + "." + string.Join(".", parentNode.Subtrees.Select(t => t.Symbol.Name));
|
---|
24 | }
|
---|
25 |
|
---|
26 | #region item
|
---|
27 | [StorableConstructor]
|
---|
28 | protected ParentChildStateFunction(bool deserializing) : base(deserializing) { }
|
---|
29 | protected ParentChildStateFunction(ParentChildStateFunction original, Cloner cloner)
|
---|
30 | : base(original, cloner) {
|
---|
31 | }
|
---|
32 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
33 | return new ParentChildStateFunction(this, cloner);
|
---|
34 | }
|
---|
35 | #endregion
|
---|
36 | }
|
---|
37 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.