Changeset 3276


Ignore:
Timestamp:
04/06/10 04:12:26 (11 years ago)
Author:
swagner
Message:

Continued work on algorithm batch processing (#947).

Location:
trunk/sources/HeuristicLab.Optimization/3.3
Files:
2 edited

Legend:

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

    r3275 r3276  
    259259    }
    260260    private void Algorithm_Prepared(object sender, EventArgs e) {
    261       OnPrepared();
     261      if ((ExecutionState == ExecutionState.Paused) || (ExecutionState == ExecutionState.Stopped))
     262        OnPrepared();
    262263    }
    263264    private void Algorithm_Started(object sender, EventArgs e) {
    264265      stopPending = false;
    265       OnStarted();
     266      if (ExecutionState != ExecutionState.Started)
     267        OnStarted();
    266268    }
    267269    private void Algorithm_Stopped(object sender, EventArgs e) {
    268270      ExecutionTime += Algorithm.ExecutionTime;
    269       OnStopped();
    270271
    271272      if (!stopPending && (runs.Count < repetitions)) {
    272273        Algorithm.Prepare();
    273274        Algorithm.Start();
     275      } else {
     276        OnStopped();
    274277      }
    275278    }
  • trunk/sources/HeuristicLab.Optimization/3.3/Experiment.cs

    r3275 r3276  
    278278    }
    279279    private void optimizer_Stopped(object sender, EventArgs e) {
    280       bool stop = stopPending;
    281 
    282       if (Optimizers.All(x => (x.ExecutionState != ExecutionState.Started) && (x.ExecutionState != ExecutionState.Paused))) {
    283         stopPending = false;
    284         OnStopped();
    285       }
    286 
    287       if (!stop) {
    288         IOptimizer next = Optimizers.FirstOrDefault(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused));
    289         if (next != null)
    290           next.Start();
     280      if (!stopPending && Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused))) {
     281        Optimizers.First(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)).Start();
     282      } else {
     283        if (Optimizers.All(x => (x.ExecutionState != ExecutionState.Started) && (x.ExecutionState != ExecutionState.Paused))) {
     284          stopPending = false;
     285          OnStopped();
     286        }
    291287      }
    292288    }
Note: See TracChangeset for help on using the changeset viewer.