Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/12/18 13:33:23 (6 years ago)
Author:
abeham
Message:

#1614: Implemented changed behavior to measure execution time (cf. #2869)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs

    r15287 r15603  
    6464      }
    6565    }
    66 
    67     [Storable]
    68     private TimeSpan executionTime;
    69     public TimeSpan ExecutionTime {
    70       get { return executionTime; }
    71       protected set {
    72         executionTime = value;
    73         OnExecutionTimeChanged();
    74       }
    75     }
     66   
     67    public abstract TimeSpan ExecutionTime { get; }
    7668
    7769    public virtual Type ProblemType {
     
    133125      : base() {
    134126      executionState = ExecutionState.Stopped;
    135       executionTime = TimeSpan.Zero;
    136127      storeAlgorithmInEachRun = false;
    137128      runsCounter = 0;
     
    141132      : base(name) {
    142133      executionState = ExecutionState.Stopped;
    143       executionTime = TimeSpan.Zero;
    144134      storeAlgorithmInEachRun = false;
    145135      runsCounter = 0;
     
    149139      : base(name, parameters) {
    150140      executionState = ExecutionState.Stopped;
    151       executionTime = TimeSpan.Zero;
    152141      storeAlgorithmInEachRun = false;
    153142      runsCounter = 0;
     
    157146      : base(name, description) {
    158147      executionState = ExecutionState.Stopped;
    159       executionTime = TimeSpan.Zero;
    160148      storeAlgorithmInEachRun = false;
    161149      runsCounter = 0;
     
    165153      : base(name, description, parameters) {
    166154      executionState = ExecutionState.Stopped;
    167       executionTime = TimeSpan.Zero;
    168155      storeAlgorithmInEachRun = false;
    169156      runsCounter = 0;
     
    181168      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
    182169      executionState = original.executionState;
    183       executionTime = original.executionTime;
    184170      problem = cloner.Clone(original.problem);
    185171      storeAlgorithmInEachRun = original.storeAlgorithmInEachRun;
     
    259245      if (handler != null) handler(this, EventArgs.Empty);
    260246    }
    261     public event EventHandler ExecutionTimeChanged;
    262     protected virtual void OnExecutionTimeChanged() {
    263       EventHandler handler = ExecutionTimeChanged;
    264       if (handler != null) handler(this, EventArgs.Empty);
    265     }
    266247    public event EventHandler ProblemChanged;
    267248    protected virtual void OnProblemChanged() {
     
    276257    public event EventHandler Prepared;
    277258    protected virtual void OnPrepared() {
    278       ExecutionTime = TimeSpan.Zero;
    279259      foreach (IStatefulItem statefulObject in this.GetObjectGraphObjects(new HashSet<object>() { Runs }).OfType<IStatefulItem>()) {
    280260        statefulObject.InitializeState();
     
    347327    }
    348328    #endregion
     329
     330    [Obsolete("Deprecate, does nothing, needs to be removed from IExecutable")]
     331    public event EventHandler ExecutionTimeChanged;
    349332  }
    350333}
Note: See TracChangeset for help on using the changeset viewer.