Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/28/17 09:03:34 (7 years ago)
Author:
pkimmesw
Message:

#2665 Testet Problems, Improved Performance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Interpreter/PushInterpreter.cs

    r15334 r15341  
    1717  public class PushInterpreter : IInternalPushInterpreter, IDisposable {
    1818    private Task currentTask;
    19     private Expression currentProgram;
     19    private int evalPushLimit;
    2020
    2121    /// <summary>
     
    3030      Configuration = config ?? new PushConfiguration();
    3131
    32       // setting the capacity of the Stacks to max points ensures that there will be enough memory at runtime
    3332      ExecStack = new PushStack<Expression>(Configuration.MaxProgramLength);
    3433      CodeStack = new PushStack<Expression>();
     
    6665      PoolContainer = poolContainer ?? new InterpreterPoolContainer();
    6766
     67      InitEvalPushLimit();
    6868      ConfigureStacks();
    6969    }
     
    9292               !IsPaused &&
    9393               !IsAborted &&
    94                (ExecCounter < Configuration.EvalPushLimit);
     94               (ExecCounter < evalPushLimit);
    9595      }
    9696    }
     
    261261    public void Run(Expression expression, bool stepwise = false) {
    262262      IsPaused = stepwise;
    263       currentProgram = expression;
    264263
    265264      /* Push top expression so the loop is able to enter
     
    347346      Random = (IRandom)randomOrigin.Clone();
    348347
     348      InitEvalPushLimit();
     349
    349350      ExecCounter = 0;
    350351      IsAborted = false;
    351352      IsPaused = false;
    352353      currentTask = null;
    353       currentProgram = null;
    354354
    355355      inputExpressions.Clear();
    356356      ClearStacks();
    357357      ConfigureStacks();
     358    }
     359
     360    private void InitEvalPushLimit() {
     361      // evalPushLimit is accessed very often and using the getter of the configuration object is rather expensive as the values is capsuled within a parameter
     362      evalPushLimit = Configuration.EvalPushLimit;
     363    }
     364
     365    private void EvalPushLimitChanged(object sender, EventArgs e) {
     366      this.evalPushLimit = Configuration.EvalPushLimit;
    358367    }
    359368
Note: See TracChangeset for help on using the changeset viewer.