Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Algorithms.IteratedSentenceConstruction/HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction/3.3/StateFunctions/DefaultStateFunction.cs @ 12924

Last change on this file since 12924 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.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using HeuristicLab.Common;
7using HeuristicLab.Core;
8using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
9using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
10
11namespace HeuristicLab.Algorithms.IteratedSymbolicExpressionConstruction {
12  // simply returns the concatenated actions (the full path of actions to the current decision represents the state)
13  [StorableClass]
14  [Item("DefaultStateFunction", "")]
15  public class DefaultStateFunction : Item, IStateFunction {
16    public DefaultStateFunction()
17      : base() {
18    }
19
20    public object CreateState(ISymbolicExpressionTreeNode root, List<ISymbol> actions, ISymbolicExpressionTreeNode parentNode, int childIdx) {
21      return string.Join(",", actions.Select(a => a.Name)); // TODO: perf
22    }
23
24    #region item
25    [StorableConstructor]
26    protected DefaultStateFunction(bool deserializing) : base(deserializing) { }
27    protected DefaultStateFunction(DefaultStateFunction original, Cloner cloner)
28      : base(original, cloner) {
29    }
30    public override IDeepCloneable Clone(Cloner cloner) {
31      return new DefaultStateFunction(this, cloner);
32    }
33    #endregion
34
35  }
36}
Note: See TracBrowser for help on using the repository browser.