Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/04/17 17:19:35 (8 years ago)
Author:
gkronber
Message:

#2520: changed all usages of StorableClass to use StorableType with an auto-generated GUID (did not add StorableType to other type definitions yet)

Location:
branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/MetaOptimizers
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/MetaOptimizers/BatchRun.cs

    r14185 r14927  
    2727using HeuristicLab.Core;
    2828using HeuristicLab.Data;
    29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Persistence;
    3030
    3131namespace HeuristicLab.Optimization {
     
    3737  [Item("Batch Run", "A run in which an optimizer is executed a given number of times.")]
    3838  [Creatable(CreatableAttribute.Categories.TestingAndAnalysis, Priority = 110)]
    39   [StorableClass]
     39  [StorableType("99c15ae1-95a6-490e-813f-7a43c09e7c74")]
    4040  public sealed class BatchRun : NamedItem, IOptimizer, IStorableContent {
    4141    public string Filename { get; set; }
     
    237237        batchRunAction = BatchRunAction.Prepare;
    238238        // a race-condition may occur when the optimizer has changed the state by itself in the meantime
    239         try { Optimizer.Prepare(clearRuns); }
    240         catch (InvalidOperationException) { }
     239        try { Optimizer.Prepare(clearRuns); } catch (InvalidOperationException) { }
    241240      } else {
    242241        ExecutionState = ExecutionState.Stopped;
     
    250249      if (Optimizer.ExecutionState == ExecutionState.Stopped) Optimizer.Prepare();
    251250      // a race-condition may occur when the optimizer has changed the state by itself in the meantime
    252       try { Optimizer.Start(); }
    253       catch (InvalidOperationException) { }
     251      try { Optimizer.Start(); } catch (InvalidOperationException) { }
    254252    }
    255253    public void Pause() {
     
    260258      if (Optimizer.ExecutionState != ExecutionState.Started) return;
    261259      // a race-condition may occur when the optimizer has changed the state by itself in the meantime
    262       try { Optimizer.Pause(); }
    263       catch (InvalidOperationException) { }
     260      try { Optimizer.Pause(); } catch (InvalidOperationException) { }
    264261    }
    265262    public void Stop() {
     
    273270      }
    274271      // a race-condition may occur when the optimizer has changed the state by itself in the meantime
    275       try { Optimizer.Stop(); }
    276       catch (InvalidOperationException) { }
     272      try { Optimizer.Stop(); } catch (InvalidOperationException) { }
    277273    }
    278274
  • branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs

    r14185 r14927  
    2828using HeuristicLab.Common;
    2929using HeuristicLab.Core;
    30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.Persistence;
    3131
    3232namespace HeuristicLab.Optimization {
     
    3636  [Item("Experiment", "An experiment which contains multiple algorithms, batch runs or other experiments.")]
    3737  [Creatable(CreatableAttribute.Categories.TestingAndAnalysis, Priority = 100)]
    38   [StorableClass]
     38  [StorableType("4caf8199-dc27-407b-bea9-085857f25029")]
    3939  public sealed class Experiment : NamedItem, IOptimizer, IStorableContent {
    4040    public string Filename { get; set; }
     
    181181      foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState != ExecutionState.Started)) {
    182182        // 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) { }
    185184      }
    186185    }
     
    195194      if (optimizer != null) {
    196195        // 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) { }
    199197      }
    200198    }
     
    208206      foreach (IOptimizer optimizer in Optimizers.Where(x => x.ExecutionState == ExecutionState.Started)) {
    209207        // 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) { }
    212209      }
    213210    }
     
    222219        foreach (var optimizer in Optimizers.Where(x => (x.ExecutionState == ExecutionState.Started) || (x.ExecutionState == ExecutionState.Paused))) {
    223220          // 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) { }
    226222        }
    227223      } else {
     
    357353      try {
    358354        ExecutionTime = Optimizers.Aggregate(TimeSpan.Zero, (t, o) => t + o.ExecutionTime);
    359       }
    360       finally {
     355      } finally {
    361356        Monitor.Exit(locker);
    362357      }
  • branches/PersistenceReintegration/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs

    r14185 r14927  
    3030using HeuristicLab.Common.Resources;
    3131using HeuristicLab.Core;
    32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     32using HeuristicLab.Persistence;
    3333
    3434namespace HeuristicLab.Optimization {
     
    3838  [Item("Timelimit Run", "A run in which an optimizer is executed a certain maximum time.")]
    3939  [Creatable(CreatableAttribute.Categories.TestingAndAnalysis, Priority = 115)]
    40   [StorableClass]
     40  [StorableType("f06a64ea-1449-4310-9056-5e5626b88d54")]
    4141  public sealed class TimeLimitRun : NamedItem, IOptimizer, IStorableContent, INotifyPropertyChanged {
    4242    public string Filename { get; set; }
Note: See TracChangeset for help on using the changeset viewer.