Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15560 for trunk


Ignore:
Timestamp:
12/22/17 16:34:50 (7 years ago)
Author:
pfleck
Message:

#2822:

  • Fixed bug that multiple of the same event was triggreed.
  • Set experimentStarted to false if experiment is paused/prepared/stopped.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs

    r15452 r15560  
    235235        }
    236236
    237         Task.WaitAll(startedOptimizers.Values.ToArray()); // retreive exeptions of the asyncrounously started optimizer
     237        Task.WaitAll(startedOptimizers.Values.ToArray()); // retrieve exeptions of the asyncrounously started optimizer
    238238      }
    239239    }
     
    289289    public event EventHandler Prepared;
    290290    private void OnPrepared() {
     291      if (ExecutionState == ExecutionState.Prepared) return;
    291292      ExecutionState = ExecutionState.Prepared;
    292293      EventHandler handler = Prepared;
     
    295296    public event EventHandler Started;
    296297    private void OnStarted() {
     298      if (ExecutionState == ExecutionState.Started) return;
    297299      ExecutionState = ExecutionState.Started;
    298300      EventHandler handler = Started;
     
    301303    public event EventHandler Paused;
    302304    private void OnPaused() {
     305      if (ExecutionState == ExecutionState.Paused) return;
    303306      ExecutionState = ExecutionState.Paused;
    304307      EventHandler handler = Paused;
     
    307310    public event EventHandler Stopped;
    308311    private void OnStopped() {
     312      if (ExecutionState == ExecutionState.Stopped) return;
    309313      ExecutionState = ExecutionState.Stopped;
    310314      EventHandler handler = Stopped;
     
    427431      lock (locker) {
    428432        // 1. experiment is running & further startable optimizers are available => continue executing
    429         if (experimentStarted && StartableOptimizers.Any()) return;
     433        if (experimentStarted && StartableOptimizers.Any())
     434          return;
    430435
    431436        // 2. any optimizer is running => continue executing
    432         else if (Optimizers.Any(x => x.ExecutionState == ExecutionState.Started))
     437        if (Optimizers.Any(x => x.ExecutionState == ExecutionState.Started))
    433438          return;
    434439
     440        experimentStarted = false;
    435441        // 3. any optimizer is paused => experiment paused
    436         else if (Optimizers.Any(x => x.ExecutionState == ExecutionState.Paused))
     442        if (Optimizers.Any(x => x.ExecutionState == ExecutionState.Paused))
    437443          OnPaused();
    438444
Note: See TracChangeset for help on using the changeset viewer.