Changeset 8190 for trunk/sources/HeuristicLab.Optimization
- Timestamp:
- 07/03/12 13:07:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization/3.3/BatchRun.cs
r8189 r8190 153 153 } 154 154 155 private bool batchRunPrepared = false; 155 156 private bool batchRunStarted = false; 156 157 private bool batchRunPaused = false; … … 206 207 batchRunPaused = original.batchRunPaused; 207 208 batchRunStopped = original.batchRunStopped; 209 batchRunPrepared = original.batchRunPrepared; 208 210 Initialize(); 209 211 } … … 228 230 repetitionsCounter = 0; 229 231 if (clearRuns) runs.Clear(); 230 Optimizer.Prepare(clearRuns);232 batchRunPrepared = true; 231 233 batchRunStarted = false; 232 234 batchRunPaused = false; 233 235 batchRunStopped = false; 236 Optimizer.Prepare(clearRuns); 234 237 } else { 235 238 ExecutionState = ExecutionState.Stopped; … … 241 244 if (Optimizer == null) return; 242 245 246 batchRunPrepared = false; 243 247 batchRunStarted = true; 244 248 batchRunPaused = false; … … 253 257 if (Optimizer.ExecutionState != ExecutionState.Started) return; 254 258 259 batchRunPrepared = false; 255 260 batchRunStarted = false; 256 261 batchRunPaused = true; … … 262 267 throw new InvalidOperationException(string.Format("Stop not allowed in execution state \"{0}\".", ExecutionState)); 263 268 if (Optimizer == null) return; 264 if (Optimizer.ExecutionState != ExecutionState.Started && Optimizer.ExecutionState != ExecutionState.Paused) return; 269 if (Optimizer.ExecutionState != ExecutionState.Started && Optimizer.ExecutionState != ExecutionState.Paused) { 270 OnStopped(); 271 return; 272 } 273 274 batchRunPrepared = false; 265 275 batchRunStarted = false; 266 276 batchRunPaused = false; … … 292 302 public event EventHandler Prepared; 293 303 private void OnPrepared() { 304 batchRunPrepared = false; 294 305 ExecutionState = ExecutionState.Prepared; 295 306 EventHandler handler = Prepared; … … 298 309 public event EventHandler Started; 299 310 private void OnStarted() { 311 //TODO add coment 300 312 ExecutionState = ExecutionState.Started; 301 313 EventHandler handler = Started; … … 304 316 public event EventHandler Paused; 305 317 private void OnPaused() { 318 batchRunPaused = false; 306 319 ExecutionState = ExecutionState.Paused; 307 320 EventHandler handler = Paused; … … 310 323 public event EventHandler Stopped; 311 324 private void OnStopped() { 325 //reset flags because it cannot be done if the optimizer gets prepared 326 batchRunStopped = false; 312 327 ExecutionState = ExecutionState.Stopped; 313 328 EventHandler handler = Stopped; … … 354 369 } 355 370 private void Optimizer_Prepared(object sender, EventArgs e) { 356 if ( ExecutionState == ExecutionState.Stopped || !batchRunStarted) {371 if (batchRunPrepared || (ExecutionState == ExecutionState.Stopped)) { 357 372 ExecutionTime = TimeSpan.Zero; 358 373 runsExecutionTime = TimeSpan.Zero; 374 repetitionsCounter = 0; 359 375 OnPrepared(); 360 376 }
Note: See TracChangeset
for help on using the changeset viewer.