Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/10/17 11:23:05 (7 years ago)
Author:
pkimmesw
Message:

#2665 Added IsNoop to Expression, Made Expressions storable, Fixed Debugger, Fixed and improved problem data and result visualisation, Added custom ErcOption view, Added problem difficulty to problem data name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/Expression.cs

    r14908 r14952  
    22  using System;
    33  using System.Collections.Generic;
     4
     5  using HeuristicLab.Common;
     6  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    47  using HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool;
    58
     
    710
    811  [Serializable]
    9   public abstract class Expression : IPooledObject {
     12  [StorableClass]
     13  public abstract class Expression : IDeepCloneable, IPooledObject {
     14
     15    protected Expression() { }
     16
     17    [StorableConstructor]
     18    protected Expression(bool deserializing) { }
     19
    1020    public bool IsProgram { get { return GetType() == typeof(PushProgram); } }
    1121
     
    2030    }
    2131
    22     //public abstract bool IsNoop(IInternalPushInterpreter interpreter);
     32    public abstract bool IsNoop(IInternalPushInterpreter interpreter);
     33    public abstract void Eval(IInternalPushInterpreter interpreter);
    2334
    24     public abstract bool Eval(IInternalPushInterpreter interpreter);
     35    public bool TryEval(IInternalPushInterpreter interpreter) {
     36      if (IsNoop(interpreter))
     37        return false;
     38
     39      Eval(interpreter);
     40      return true;
     41    }
    2542
    2643    public override string ToString() {
     
    2845    }
    2946
     47    public object Clone() {
     48      return this;
     49    }
     50
     51    public IDeepCloneable Clone(Cloner cloner) {
     52      return this;
     53    }
     54
    3055    void IPooledObject.Reset() { }
    3156  }
Note: See TracChangeset for help on using the changeset viewer.