Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/23/17 01:11:18 (8 years ago)
Author:
pkimmesw
Message:

#2665 simplifier, push solution results view, performance improvements, small bug fixes, ui fixes

File:
1 edited

Legend:

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

    r14744 r14777  
    11namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions {
     2  using System;
     3
    24  using Attributes;
    35  using Interpreter;
    46  using Stack;
    57
     8  [Serializable]
    69  public abstract class DoRangeExpression : LoopExpression {
    710    protected DoRangeExpression() { }
     
    1720      var incrementor = destinationIndex < interpreter.IntegerStack.Top ? -1 : 1;
    1821
    19       return new LoopState(
     22      return LoopState.Create(interpreter.PoolContainer.LoopStatePool,
    2023          body: sourceStack.Pop(),
    2124          currentIndex: interpreter.IntegerStack.Top + incrementor,
     
    4750  ///     that is less than the specified current index.
    4851  /// </summary>
    49   [PushExpression(StackType.Code, "CODE.DO*RANGE")]
     52  [Serializable]
     53  [PushExpression(StackTypes.Code, "CODE.DO*RANGE", StackTypes.Integer)]
    5054  public class CodeDoRangeExpression : DoRangeExpression {
    5155    public CodeDoRangeExpression() { }
     
    5660    }
    5761
    58     protected override LoopExpression Clone(LoopState state) {
    59       return new CodeDoRangeExpression(state);
     62    protected override LoopExpression Clone(LoopState state, IPushInterpreter interpreter) {
     63      var expression = interpreter.PoolContainer.GetStatefulExpression<CodeDoRangeExpression>();
     64      expression.State = state;
     65
     66      return expression;
    6067    }
    6168  }
     
    8592  ///     index that is less than the specified current index.
    8693  /// </summary>
    87   [PushExpression(StackType.Exec, "EXEC.DO*RANGE")]
     94  [Serializable]
     95  [PushExpression(StackTypes.Exec, "EXEC.DO*RANGE", StackTypes.Integer)]
    8896  public class ExecDoRangeExpression : DoRangeExpression {
    8997    public ExecDoRangeExpression() { }
     
    93101      return this.Eval(interpreter, interpreter.ExecStack);
    94102    }
    95     protected override LoopExpression Clone(LoopState state) {
    96       return new ExecDoRangeExpression(state);
     103    protected override LoopExpression Clone(LoopState state, IPushInterpreter interpreter) {
     104      var expression = interpreter.PoolContainer.GetStatefulExpression<ExecDoRangeExpression>();
     105      expression.State = state;
     106
     107      return expression;
    97108    }
    98109  }
Note: See TracChangeset for help on using the changeset viewer.