Changeset 14927 for branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs
- Timestamp:
- 05/04/17 17:19:35 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs
r14185 r14927 28 28 using HeuristicLab.Common; 29 29 using HeuristicLab.Core; 30 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;30 using HeuristicLab.Persistence; 31 31 32 32 namespace HeuristicLab.Optimization { … … 36 36 [Item("Experiment", "An experiment which contains multiple algorithms, batch runs or other experiments.")] 37 37 [Creatable(CreatableAttribute.Categories.TestingAndAnalysis, Priority = 100)] 38 [Storable Class]38 [StorableType("4caf8199-dc27-407b-bea9-085857f25029")] 39 39 public sealed class Experiment : NamedItem, IOptimizer, IStorableContent { 40 40 public string Filename { get; set; } … … 181 181 foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState != ExecutionState.Started)) { 182 182 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 183 try { optimizer.Prepare(clearRuns); } 184 catch (InvalidOperationException) { } 183 try { optimizer.Prepare(clearRuns); } catch (InvalidOperationException) { } 185 184 } 186 185 } … … 195 194 if (optimizer != null) { 196 195 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 197 try { optimizer.Start(); } 198 catch (InvalidOperationException) { } 196 try { optimizer.Start(); } catch (InvalidOperationException) { } 199 197 } 200 198 } … … 208 206 foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState == ExecutionState.Started)) { 209 207 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 210 try { optimizer.Pause(); } 211 catch (InvalidOperationException) { } 208 try { optimizer.Pause(); } catch (InvalidOperationException) { } 212 209 } 213 210 } … … 222 219 foreach (var optimizer in Optimizers.Where(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) { 223 220 // a race-condition may occur when the optimizer has changed the state by itself in the meantime 224 try { optimizer.Stop(); } 225 catch (InvalidOperationException) { } 221 try { optimizer.Stop(); } catch (InvalidOperationException) { } 226 222 } 227 223 } else { … … 357 353 try { 358 354 ExecutionTime = Optimizers.Aggregate(TimeSpan.Zero, (t, o) => t + o.ExecutionTime); 359 } 360 finally { 355 } finally { 361 356 Monitor.Exit(locker); 362 357 }
Note: See TracChangeset
for help on using the changeset viewer.