Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/InExpressions.cs @ 15189

Last change on this file since 15189 was 15189, checked in by pkimmesw, 7 years ago

#2665 Fixed small issues, testet benchmark suite, added INX Expressions

File size: 4.3 KB
Line 
1namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions {
2  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
3  using HeuristicLab.Problems.ProgramSynthesis.Push.Attributes;
4  using HeuristicLab.Problems.ProgramSynthesis.Push.Interpreter;
5  using HeuristicLab.Problems.ProgramSynthesis.Push.Stack;
6
7  /// <summary>
8  /// InExpression has a state, but this state is static at compile time and therefore InExpression can be seen as stateless at runtime
9  /// </summary>
10  [StorableClass]
11  public abstract class InExpression : StatelessExpression {
12    private readonly int index;
13
14    protected InExpression(int nr) {
15      this.index = nr - 1;
16    }
17
18    [StorableConstructor]
19    protected InExpression(bool deserializing) : base(deserializing) { }
20
21    public override bool IsNoop(IInternalPushInterpreter interpreter) {
22      return false;
23    }
24
25    public override void Eval(IInternalPushInterpreter interpreter) {
26      var inputArgument = interpreter.InputExpressions[index];
27
28      inputArgument.Eval(interpreter);
29    }
30  }
31
32  [PushExpression(
33    StackTypes.None,
34    "IN1",
35    "Pushes first input parameter.",
36    isHidden: true)]
37  [StorableClass]
38  public class In1Expression : InExpression {
39    public In1Expression() : base(1) { }
40
41    [StorableConstructor]
42    protected In1Expression(bool deserializing) : base(deserializing) { }
43  }
44
45  [PushExpression(
46    StackTypes.None,
47    "IN2",
48    "Pushes second input parameter.",
49    isHidden: true)]
50  [StorableClass]
51  public class In2Expression : InExpression {
52    public In2Expression() : base(2) { }
53
54    [StorableConstructor]
55    protected In2Expression(bool deserializing) : base(deserializing) { }
56  }
57
58  [PushExpression(
59   StackTypes.None,
60   "IN3",
61   "Pushes third input parameter.",
62    isHidden: true)]
63  [StorableClass]
64  public class In3Expression : InExpression {
65    public In3Expression() : base(3) { }
66
67    [StorableConstructor]
68    protected In3Expression(bool deserializing) : base(deserializing) { }
69  }
70
71  [PushExpression(
72    StackTypes.None,
73    "IN4",
74    "Pushes fourth input parameter.",
75    isHidden: true)]
76  [StorableClass]
77  public class In4Expression : InExpression {
78    public In4Expression() : base(4) { }
79
80    [StorableConstructor]
81    protected In4Expression(bool deserializing) : base(deserializing) { }
82  }
83
84  [PushExpression(
85    StackTypes.None,
86    "IN5",
87    "Pushes fifth input parameter.",
88    isHidden: true)]
89  [StorableClass]
90  public class In5Expression : InExpression {
91    public In5Expression() : base(5) { }
92
93    [StorableConstructor]
94    protected In5Expression(bool deserializing) : base(deserializing) { }
95  }
96
97  [PushExpression(
98    StackTypes.None,
99    "IN6",
100    "Pushes sixth input parameter.",
101    isHidden: true)]
102  [StorableClass]
103  public class In6Expression : InExpression {
104    public In6Expression() : base(6) { }
105
106    [StorableConstructor]
107    protected In6Expression(bool deserializing) : base(deserializing) { }
108  }
109
110  [PushExpression(
111    StackTypes.None,
112    "IN7",
113    "Pushes seventh input parameter.",
114    isHidden: true)]
115  [StorableClass]
116  public class In7Expression : InExpression {
117    public In7Expression() : base(7) { }
118
119    [StorableConstructor]
120    protected In7Expression(bool deserializing) : base(deserializing) { }
121  }
122
123  [PushExpression(
124    StackTypes.None,
125    "IN8",
126    "Pushes eighth input parameter.",
127    isHidden: true)]
128  [StorableClass]
129  public class In8Expression : InExpression {
130    public In8Expression() : base(8) { }
131
132    [StorableConstructor]
133    protected In8Expression(bool deserializing) : base(deserializing) { }
134  }
135
136  [PushExpression(
137    StackTypes.None,
138    "IN9",
139    "Pushes nineth input parameter.",
140    isHidden: true)]
141  [StorableClass]
142  public class In9Expression : InExpression {
143    public In9Expression() : base(9) { }
144
145    [StorableConstructor]
146    protected In9Expression(bool deserializing) : base(deserializing) { }
147  }
148
149  [PushExpression(
150    StackTypes.None,
151    "IN10",
152    "Pushes tenth input parameter.",
153    isHidden: true)]
154  [StorableClass]
155  public class In10Expression : InExpression {
156    public In10Expression() : base(10) { }
157
158    [StorableConstructor]
159    protected In10Expression(bool deserializing) : base(deserializing) { }
160  }
161}
Note: See TracBrowser for help on using the repository browser.