Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/03/12 11:22:21 (13 years ago)
Author:
gkronber
Message:

#1081: merged r7214:7266 from trunk into time series branch.

Location:
branches/HeuristicLab.TimeSeries
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries

  • branches/HeuristicLab.TimeSeries/HeuristicLab.Optimization/3.3/Experiment.cs

    r7213 r7268  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    175175
    176176      if (clearRuns) runs.Clear();
     177
     178      experimentStarted = false;
     179      experimentStopped = false;
    177180      foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState != ExecutionState.Started))
    178181        if (clearRuns || optimizer.ExecutionState != ExecutionState.Prepared)
     
    206209      experimentStarted = false;
    207210      experimentStopped = true;
    208       foreach (IOptimizer optimizer in Optimizers.Where(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused)))
    209         optimizer.Stop();
     211      if (Optimizers.Any(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) {
     212        foreach (IOptimizer optimizer in Optimizers.Where(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused)))
     213          optimizer.Stop();
     214      } else {
     215        OnStopped();
     216      }
    210217    }
    211218
     
    326333    }
    327334    private void optimizer_Paused(object sender, EventArgs e) {
    328       if (Optimizers.All(x => x.ExecutionState != ExecutionState.Started))
    329         OnPaused();
     335      if (Optimizers.All(x => x.ExecutionState != ExecutionState.Started)) OnPaused();
    330336    }
    331337    private void optimizer_Prepared(object sender, EventArgs e) {
    332       if (ExecutionState == ExecutionState.Stopped)
    333         OnPrepared();
     338      if (Optimizers.All(x => x.ExecutionState == ExecutionState.Prepared)) OnPrepared();
     339      else if (Optimizers.All(x => x.ExecutionState != ExecutionState.Started)) OnPaused();
    334340    }
    335341    private void optimizer_Started(object sender, EventArgs e) {
    336       if (ExecutionState != ExecutionState.Started)
    337         OnStarted();
     342      if (ExecutionState != ExecutionState.Started) OnStarted();
    338343    }
    339344    private void optimizer_Stopped(object sender, EventArgs e) {
    340       if (experimentStopped && Optimizers.All(o => o.ExecutionState == ExecutionState.Stopped || o.ExecutionState == ExecutionState.Prepared)) OnStopped();
    341       else if (Optimizers.Any(o => o.ExecutionState == ExecutionState.Stopped) && Optimizers.All(o => o.ExecutionState != ExecutionState.Started) && Optimizers.All(o => o.ExecutionState != ExecutionState.Paused)) OnStopped();
    342       else if (Optimizers.Any(o => o.ExecutionState == ExecutionState.Paused) && Optimizers.All(o => o.ExecutionState != ExecutionState.Started)) OnPaused();
    343       else if (experimentStarted && !experimentStopped && Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused))) {
    344         Optimizers.First(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)).Start();
     345      if (experimentStopped) {
     346        if (Optimizers.All(x => (x.ExecutionState == ExecutionState.Stopped) || (x.ExecutionState == ExecutionState.Prepared))) OnStopped();
     347      } else {
     348        if (experimentStarted && Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused))) {
     349          Optimizers.First(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)).Start();
     350        } else if (Optimizers.All(x => x.ExecutionState == ExecutionState.Stopped)) OnStopped();
     351        else if (Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)) && Optimizers.All(o => o.ExecutionState != ExecutionState.Started)) OnPaused();
    345352      }
    346353    }
Note: See TracChangeset for help on using the changeset viewer.