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 | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 | using HeuristicLab.Common;
|
---|
7 | using HeuristicLab.Core;
|
---|
8 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
9 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
10 |
|
---|
11 | namespace 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.