Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14523


Ignore:
Timestamp:
12/22/16 15:47:00 (8 years ago)
Author:
mkommend
Message:

#2524:

  • Renamed pausable to SupportsPause
  • Changed SupportsPause field to abstract property that has to be implemented
  • Stored initialization flag in BasicAlgorithm
  • Changed CancellationToken access to use the according property
  • Adapted HillClimber to new pausing mechanism
  • Disable pause for PPP, because it does not work correctly
  • Derived FixedDataAnalysisAlgorithm from BasicAlgorithm
  • Changed base class of all data analysis algorithm from BasicAlgorithm to FixedDataAnalysisAlgorithm
Location:
trunk/sources
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/BaselineClassifiers/OneR.cs

    r14185 r14523  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using System.Threading;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    5859    }
    5960
    60     protected override void Run() {
     61    protected override void Run(CancellationToken cancellationToken) {
    6162      var solution = CreateOneRSolution(Problem.ProblemData, MinBucketSizeParameter.Value.Value);
    6263      Results.Add(new Result("OneR solution", "The 1R classifier.", solution));
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/BaselineClassifiers/ZeroR.cs

    r14185 r14523  
    2121
    2222using System.Linq;
     23using System.Threading;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    4950    }
    5051
    51     protected override void Run() {
     52    protected override void Run(CancellationToken cancellationToken) {
    5253      var solution = CreateZeroRSolution(Problem.ProblemData);
    5354      Results.Add(new Result("ZeroR solution", "The simplest possible classifier, ZeroR always predicts the majority class.", solution));
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/FixedDataAnalysisAlgorithm.cs

    r14185 r14523  
    2121
    2222using System;
    23 using System.Threading;
    24 using System.Threading.Tasks;
    2523using HeuristicLab.Common;
    2624using HeuristicLab.Optimization;
     
    3028namespace HeuristicLab.Algorithms.DataAnalysis {
    3129  [StorableClass]
    32   public abstract class FixedDataAnalysisAlgorithm<T> : Algorithm,
    33     IDataAnalysisAlgorithm<T>,
    34     IStorableContent
    35     where T : class, IDataAnalysisProblem {
    36     public string Filename { get; set; }
    37 
     30  public abstract class FixedDataAnalysisAlgorithm<T> : BasicAlgorithm where T : class, IDataAnalysisProblem {
    3831    #region Properties
    3932    public override Type ProblemType {
     
    4437      set { base.Problem = value; }
    4538    }
    46     [Storable]
    47     private ResultCollection results;
    48     public override ResultCollection Results {
    49       get { return results; }
    50     }
    5139    #endregion
    5240
    53     private DateTime lastUpdateTime;
     41    public override bool SupportsPause { get { return false; } }
    5442
    5543    [StorableConstructor]
    5644    protected FixedDataAnalysisAlgorithm(bool deserializing) : base(deserializing) { }
    57     protected FixedDataAnalysisAlgorithm(FixedDataAnalysisAlgorithm<T> original, Cloner cloner)
    58       : base(original, cloner) {
    59       results = cloner.Clone(original.Results);
    60     }
    61     public FixedDataAnalysisAlgorithm()
    62       : base() {
    63       results = new ResultCollection();
    64     }
    65 
    66     public override void Prepare() {
    67       if (Problem != null) base.Prepare();
    68       results.Clear();
    69       OnPrepared();
    70     }
    71 
    72     public override void Start() {
    73       base.Start();
    74       var cancellationTokenSource = new CancellationTokenSource();
    75 
    76       OnStarted();
    77       Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
    78       task.ContinueWith(t => {
    79         try {
    80           t.Wait();
    81         }
    82         catch (AggregateException ex) {
    83           try {
    84             ex.Flatten().Handle(x => x is OperationCanceledException);
    85           }
    86           catch (AggregateException remaining) {
    87             if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
    88             else OnExceptionOccurred(remaining);
    89           }
    90         }
    91         cancellationTokenSource.Dispose();
    92         cancellationTokenSource = null;
    93         OnStopped();
    94       });
    95     }
    96     private void Run(object state) {
    97       CancellationToken cancellationToken = (CancellationToken)state;
    98       lastUpdateTime = DateTime.UtcNow;
    99       System.Timers.Timer timer = new System.Timers.Timer(250);
    100       timer.AutoReset = true;
    101       timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
    102       timer.Start();
    103       try {
    104         Run();
    105       }
    106       finally {
    107         timer.Elapsed -= new System.Timers.ElapsedEventHandler(timer_Elapsed);
    108         timer.Stop();
    109         ExecutionTime += DateTime.UtcNow - lastUpdateTime;
    110       }
    111 
    112       cancellationToken.ThrowIfCancellationRequested();
    113     }
    114     protected abstract void Run();
    115     #region Events
    116     protected override void OnProblemChanged() {
    117       Problem.Reset += new EventHandler(Problem_Reset);
    118       base.OnProblemChanged();
    119     }
    120     private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
    121       System.Timers.Timer timer = (System.Timers.Timer)sender;
    122       timer.Enabled = false;
    123       DateTime now = DateTime.UtcNow;
    124       ExecutionTime += now - lastUpdateTime;
    125       lastUpdateTime = now;
    126       timer.Enabled = true;
    127     }
    128     #endregion
     45    protected FixedDataAnalysisAlgorithm(FixedDataAnalysisAlgorithm<T> original, Cloner cloner) : base(original, cloner) { }
     46    public FixedDataAnalysisAlgorithm() : base() { }
    12947
    13048  }
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GBM/GradientBoostingRegressionAlgorithm.cs

    r14185 r14523  
    4444  [StorableClass]
    4545  [Creatable(CreatableAttribute.Categories.DataAnalysisRegression, Priority = 350)]
    46   public class GradientBoostingRegressionAlgorithm : BasicAlgorithm {
    47     public override Type ProblemType {
    48       get { return typeof(IRegressionProblem); }
    49     }
    50 
    51     public new IRegressionProblem Problem {
    52       get { return (IRegressionProblem)base.Problem; }
    53       set { base.Problem = value; }
    54     }
     46  public class GradientBoostingRegressionAlgorithm : FixedDataAnalysisAlgorithm<IRegressionProblem> {
    5547
    5648    #region ParameterNames
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithm.cs

    r14345 r14523  
    3838  [StorableClass]
    3939  [Creatable(CreatableAttribute.Categories.DataAnalysisRegression, Priority = 125)]
    40   public class GradientBoostedTreesAlgorithm : BasicAlgorithm {
    41     public override Type ProblemType {
    42       get { return typeof(IRegressionProblem); }
    43     }
    44     public new IRegressionProblem Problem {
    45       get { return (IRegressionProblem)base.Problem; }
    46       set { base.Problem = value; }
    47     }
    48 
     40  public class GradientBoostedTreesAlgorithm : FixedDataAnalysisAlgorithm<IRegressionProblem> {
    4941    #region ParameterNames
    5042    private const string IterationsParameterName = "Iterations";
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs

    r14400 r14523  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    5960
    6061    #region Fisher LDA
    61     protected override void Run() {
     62    protected override void Run(CancellationToken cancellationToken) {
    6263      var solution = CreateLinearDiscriminantAnalysisSolution(Problem.ProblemData);
    6364      Results.Add(new Result(LinearDiscriminantAnalysisSolutionResultName, "The linear discriminant analysis.", solution));
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs

    r14400 r14523  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    6061
    6162    #region linear regression
    62     protected override void Run() {
     63    protected override void Run(CancellationToken cancellationToken) {
    6364      double rmsError, cvRmsError;
    6465      var solution = CreateLinearRegressionSolution(Problem.ProblemData, out rmsError, out cvRmsError);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/MultinomialLogitClassification.cs

    r14400 r14523  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    5758
    5859    #region logit classification
    59     protected override void Run() {
     60    protected override void Run(CancellationToken cancellationToken) {
    6061      double rmsError, relClassError;
    6162      var solution = CreateLogitClassificationSolution(Problem.ProblemData, out rmsError, out relClassError);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/MctsSymbolicRegression/MctsSymbolicRegressionAlgorithm.cs

    r14185 r14523  
    3838  [StorableClass]
    3939  [Creatable(CreatableAttribute.Categories.DataAnalysisRegression, Priority = 250)]
    40   public class MctsSymbolicRegressionAlgorithm : BasicAlgorithm {
    41     public override Type ProblemType {
    42       get { return typeof(IRegressionProblem); }
    43     }
    44     public new IRegressionProblem Problem {
    45       get { return (IRegressionProblem)base.Problem; }
    46       set { base.Problem = value; }
    47     }
     40  public class MctsSymbolicRegressionAlgorithm : FixedDataAnalysisAlgorithm<IRegressionProblem> {
    4841
    4942    #region ParameterNames
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourClassification.cs

    r14235 r14523  
    2222using System;
    2323using System.Linq;
     24using System.Threading;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    9192
    9293    #region nearest neighbour
    93     protected override void Run() {
     94    protected override void Run(CancellationToken cancellationToken) {
    9495      double[] weights = null;
    9596      if (Weights != null) weights = Weights.CloneAsArray();
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourRegression.cs

    r14235 r14523  
    2121
    2222using System;
     23using System.Threading;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    9293
    9394    #region nearest neighbour
    94     protected override void Run() {
     95    protected override void Run(CancellationToken cancellationToken) {
    9596      double[] weights = null;
    9697      if (Weights != null) weights = Weights.CloneAsArray();
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs

    r14400 r14523  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    168169
    169170    #region neural network
    170     protected override void Run() {
     171    protected override void Run(CancellationToken cancellationToken) {
    171172      double rmsError, avgRelError, relClassError;
    172173      var solution = CreateNeuralNetworkClassificationSolution(Problem.ProblemData, HiddenLayers, NodesInFirstHiddenLayer, NodesInSecondHiddenLayer, Decay, Restarts, out rmsError, out avgRelError, out relClassError);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs

    r14400 r14523  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    154155
    155156    #region neural network ensemble
    156     protected override void Run() {
     157    protected override void Run(CancellationToken cancellationToken) {
    157158      double rmsError, avgRelError, relClassError;
    158159      var solution = CreateNeuralNetworkEnsembleClassificationSolution(Problem.ProblemData, EnsembleSize, HiddenLayers, NodesInFirstHiddenLayer, NodesInSecondHiddenLayer, Decay, Restarts, out rmsError, out avgRelError, out relClassError);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegression.cs

    r14400 r14523  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    154155
    155156    #region neural network ensemble
    156     protected override void Run() {
     157    protected override void Run(CancellationToken cancellationToken) {
    157158      double rmsError, avgRelError;
    158159      var solution = CreateNeuralNetworkEnsembleRegressionSolution(Problem.ProblemData, EnsembleSize, HiddenLayers, NodesInFirstHiddenLayer, NodesInSecondHiddenLayer, Decay, Restarts, out rmsError, out avgRelError);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegression.cs

    r14400 r14523  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    170171
    171172    #region neural network
    172     protected override void Run() {
     173    protected override void Run(CancellationToken cancellationToken) {
    173174      double rmsError, avgRelError;
    174175      var solution = CreateNeuralNetworkRegressionSolution(Problem.ProblemData, HiddenLayers, NodesInFirstHiddenLayer, NodesInSecondHiddenLayer, Decay, Restarts, out rmsError, out avgRelError);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs

    r14319 r14523  
    2222using System;
    2323using System.Linq;
     24using System.Threading;
    2425using HeuristicLab.Analysis;
    2526using HeuristicLab.Common;
     
    157158
    158159    #region nonlinear regression
    159     protected override void Run() {
     160    protected override void Run(CancellationToken cancellationToken) {
    160161      IRegressionSolution bestSolution = null;
    161162      if (InitializeParametersRandomly) {
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs

    r14185 r14523  
    2020#endregion
    2121
     22using System.Threading;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    132133
    133134    #region random forest
    134     protected override void Run() {
     135    protected override void Run(CancellationToken cancellationToken) {
    135136      double rmsError, relClassificationError, outOfBagRmsError, outOfBagRelClassificationError;
    136137      if (SetSeedRandomly) Seed = new System.Random().Next();
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestRegression.cs

    r14185 r14523  
    2020#endregion
    2121
     22using System.Threading;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    131132
    132133    #region random forest
    133     protected override void Run() {
     134    protected override void Run(CancellationToken cancellationToken) {
    134135      double rmsError, avgRelError, outOfBagRmsError, outOfBagAvgRelError;
    135136      if (SetSeedRandomly) Seed = new System.Random().Next();
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs

    r14185 r14523  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    143144
    144145    #region support vector classification
    145     protected override void Run() {
     146    protected override void Run(CancellationToken cancellationToken) {
    146147      IClassificationProblemData problemData = Problem.ProblemData;
    147148      IEnumerable<string> selectedInputVariables = problemData.AllowedInputVariables;
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorRegression.cs

    r14185 r14523  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    151152
    152153    #region support vector regression
    153     protected override void Run() {
     154    protected override void Run(CancellationToken cancellationToken) {
    154155      IRegressionProblemData problemData = Problem.ProblemData;
    155156      IEnumerable<string> selectedInputVariables = problemData.AllowedInputVariables;
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs

    r14400 r14523  
    2222using System;
    2323using System.Linq;
     24using System.Threading;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    6364    }
    6465
    65     protected override void Run() {
     66    protected override void Run(CancellationToken cancellationToken) {
    6667      double rmsError, cvRmsError;
    6768      var solution = CreateAutoRegressiveSolution(Problem.ProblemData, TimeOffset, out rmsError, out cvRmsError);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs

    r14400 r14523  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    7778
    7879    #region k-Means clustering
    79     protected override void Run() {
     80    protected override void Run(CancellationToken cancellationToken) {
    8081      var solution = CreateKMeansSolution(Problem.ProblemData, K.Value, Restarts.Value);
    8182      Results.Add(new Result(KMeansSolutionResultName, "The k-Means clustering solution.", solution));
  • trunk/sources/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/HillClimber.cs

    r14517 r14523  
    5454      get { return typeof(BinaryProblem); }
    5555    }
     56
     57    public override bool SupportsPause { get { return false; } }
     58
    5659    public new BinaryProblem Problem {
    5760      get { return (BinaryProblem)base.Problem; }
     
    9093    public HillClimber()
    9194      : base() {
    92       pausable = true;
    9395      random = new MersenneTwister();
    9496      Parameters.Add(new FixedValueParameter<IntValue>(IterationsParameterName, "", new IntValue(100)));
    9597    }
    9698
    97     [StorableHook(HookType.AfterDeserialization)]
    98     private void AfterDeserialization() {
    99       // BackwardsCompatibility3.3
    100       #region Backwards compatible code, remove with 3.4
    101       pausable = true;
    102       #endregion
    103     }
    10499
    105100    protected override void Initialize(CancellationToken cancellationToken) {
  • trunk/sources/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/ParameterlessPopulationPyramid.cs

    r14517 r14523  
    5656
    5757    // Tracks all solutions in Pyramid for quick membership checks
    58     private HashSet<BinaryVector> seen = new HashSet<BinaryVector>(new EnumerableBoolEqualityComparer());
     58    private readonly HashSet<BinaryVector> seen = new HashSet<BinaryVector>(new EnumerableBoolEqualityComparer());
    5959
    6060    #region ParameterNames
     
    153153    #endregion
    154154
     155    public override bool SupportsPause { get { return true; } }
     156
    155157    [StorableConstructor]
    156158    protected ParameterlessPopulationPyramid(bool deserializing) : base(deserializing) { }
     
    165167
    166168    public ParameterlessPopulationPyramid() {
    167       pausable = true;
    168169      Parameters.Add(new FixedValueParameter<IntValue>(MaximumIterationsParameterName, "", new IntValue(Int32.MaxValue)));
    169170      Parameters.Add(new FixedValueParameter<IntValue>(MaximumEvaluationsParameterName, "", new IntValue(Int32.MaxValue)));
     
    171172      Parameters.Add(new FixedValueParameter<IntValue>(SeedParameterName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
    172173      Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyParameterName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
    173     }
    174 
    175     [StorableHook(HookType.AfterDeserialization)]
    176     private void AfterDeserialization() {
    177       // BackwardsCompatibility3.3
    178       #region Backwards compatible code, remove with 3.4
    179       pausable = true;
    180       #endregion
    181174    }
    182175
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BasicAlgorithmView.cs

    r14517 r14523  
    3636    protected override void SetEnabledStateOfControls() {
    3737      base.SetEnabledStateOfControls();
    38       pauseButton.Enabled &= Content != null && Content.Pausable;
     38      pauseButton.Enabled &= Content != null && Content.SupportsPause;
    3939    }
    4040
    4141    protected override void SetEnabledStateOfExecutableButtons() {
    4242      base.SetEnabledStateOfExecutableButtons();
    43       pauseButton.Enabled &= Content != null && Content.Pausable;
     43      pauseButton.Enabled &= Content != null && Content.SupportsPause;
    4444    }
    4545  }
  • trunk/sources/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs

    r14517 r14523  
    3030  [StorableClass]
    3131  public abstract class BasicAlgorithm : Algorithm, IStorableContent {
    32     private bool initialized;
     32
    3333    private bool pausePending;
    3434    private DateTime lastUpdateTime;
    35     protected bool pausable;
    3635
    3736    public string Filename { get; set; }
    38     public bool Pausable { get { return pausable; } }
     37
     38    public abstract bool SupportsPause { get; }
    3939
    4040    [Storable]
    41     private ResultCollection results;
     41    private bool initialized;
     42    [Storable]
     43    private readonly ResultCollection results;
    4244    public override ResultCollection Results {
    4345      get { return results; }
     
    5456    protected BasicAlgorithm(BasicAlgorithm original, Cloner cloner)
    5557      : base(original, cloner) {
    56       pausable = original.pausable;
    5758      results = cloner.Clone(original.Results);
    5859    }
     
    7576      pausePending = false;
    7677      OnStarted();
    77       Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
     78
     79      Task task = Task.Factory.StartNew(Run, CancellationTokenSource.Token, CancellationTokenSource.Token);
    7880      task.ContinueWith(t => {
    7981        try {
    8082          t.Wait();
    81         } catch (AggregateException ex) {
     83        }
     84        catch (AggregateException ex) {
    8285          try {
    8386            ex.Flatten().Handle(x => x is OperationCanceledException);
    84           } catch (AggregateException remaining) {
     87          }
     88          catch (AggregateException remaining) {
    8589            if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
    8690            else OnExceptionOccurred(remaining);
     
    9599
    96100    public override void Pause() {
    97       if (!Pausable)
     101      // CancellationToken.ThrowIfCancellationRequested() must be called from within the Run method, otherwise pause does nothing
     102      // alternatively check the IsCancellationRequested property of the cancellation token
     103      if (!SupportsPause)
    98104        throw new NotSupportedException("Pause is not supported by this algorithm.");
    99105
    100106      base.Pause();
    101107      pausePending = true;
    102       cancellationTokenSource.Cancel();
     108      CancellationTokenSource.Cancel();
    103109    }
    104110
     
    123129        initialized = true;
    124130        Run(cancellationToken);
    125       } finally {
     131      }
     132      finally {
    126133        timer.Elapsed -= new System.Timers.ElapsedEventHandler(timer_Elapsed);
    127134        timer.Stop();
Note: See TracChangeset for help on using the changeset viewer.