Last change
on this file since 17189 was
15771,
checked in by bburlacu, 7 years ago
|
#2895: Add solution skeleton for PushGP with genealogy analysis.
|
File size:
1.2 KB
|
Line | |
---|
1 | using System;
|
---|
2 |
|
---|
3 | using HeuristicLab.Common;
|
---|
4 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; |
---|
5 | |
---|
6 | namespace HeuristicLab.Problems.ProgramSynthesis { |
---|
7 |
|
---|
8 | [Serializable]
|
---|
9 | [StorableClass]
|
---|
10 | public abstract class Expression : IDeepCloneable, IPooledObject {
|
---|
11 |
|
---|
12 | protected Expression() { }
|
---|
13 |
|
---|
14 | [StorableConstructor]
|
---|
15 | protected Expression(bool deserializing) { }
|
---|
16 | protected Expression(Expression origin, Cloner cloner) { }
|
---|
17 |
|
---|
18 | public bool IsProgram { get { return GetType() == typeof(PushProgram); } }
|
---|
19 |
|
---|
20 | public abstract string StringRepresentation { get; }
|
---|
21 |
|
---|
22 | public abstract bool IsNoop(IInternalPushInterpreter interpreter);
|
---|
23 | public abstract void Eval(IInternalPushInterpreter interpreter);
|
---|
24 |
|
---|
25 | public bool TryEval(IInternalPushInterpreter interpreter) {
|
---|
26 | if (IsNoop(interpreter))
|
---|
27 | return false;
|
---|
28 |
|
---|
29 | Eval(interpreter);
|
---|
30 | return true;
|
---|
31 | }
|
---|
32 |
|
---|
33 | public override string ToString() {
|
---|
34 | return StringRepresentation;
|
---|
35 | }
|
---|
36 |
|
---|
37 | public object Clone() {
|
---|
38 | return this;
|
---|
39 | }
|
---|
40 |
|
---|
41 | public virtual IDeepCloneable Clone(Cloner cloner) {
|
---|
42 | return this;
|
---|
43 | }
|
---|
44 |
|
---|
45 | void IPooledObject.Reset() { }
|
---|
46 | }
|
---|
47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.