Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/04/18 22:33:26 (6 years ago)
Author:
abeham
Message:

#1614:

  • reverted r15603 by reverse merging
  • added expert system plugins from #2457
File:
1 edited

Legend:

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

    r15719 r15721  
    6464      }
    6565    }
    66    
    67     public abstract TimeSpan ExecutionTime { get; }
     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    }
    6876
    6977    public virtual Type ProblemType {
     
    125133      : base() {
    126134      executionState = ExecutionState.Stopped;
     135      executionTime = TimeSpan.Zero;
    127136      storeAlgorithmInEachRun = false;
    128137      runsCounter = 0;
     
    132141      : base(name) {
    133142      executionState = ExecutionState.Stopped;
     143      executionTime = TimeSpan.Zero;
    134144      storeAlgorithmInEachRun = false;
    135145      runsCounter = 0;
     
    139149      : base(name, parameters) {
    140150      executionState = ExecutionState.Stopped;
     151      executionTime = TimeSpan.Zero;
    141152      storeAlgorithmInEachRun = false;
    142153      runsCounter = 0;
     
    146157      : base(name, description) {
    147158      executionState = ExecutionState.Stopped;
     159      executionTime = TimeSpan.Zero;
    148160      storeAlgorithmInEachRun = false;
    149161      runsCounter = 0;
     
    153165      : base(name, description, parameters) {
    154166      executionState = ExecutionState.Stopped;
     167      executionTime = TimeSpan.Zero;
    155168      storeAlgorithmInEachRun = false;
    156169      runsCounter = 0;
     
    168181      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
    169182      executionState = original.executionState;
     183      executionTime = original.executionTime;
    170184      problem = cloner.Clone(original.problem);
    171185      storeAlgorithmInEachRun = original.storeAlgorithmInEachRun;
     
    246260      if (handler != null) handler(this, EventArgs.Empty);
    247261    }
     262    public event EventHandler ExecutionTimeChanged;
     263    protected virtual void OnExecutionTimeChanged() {
     264      EventHandler handler = ExecutionTimeChanged;
     265      if (handler != null) handler(this, EventArgs.Empty);
     266    }
    248267    public event EventHandler ProblemChanged;
    249268    protected virtual void OnProblemChanged() {
     
    258277    public event EventHandler Prepared;
    259278    protected virtual void OnPrepared() {
     279      ExecutionTime = TimeSpan.Zero;
    260280      foreach (IStatefulItem statefulObject in this.GetObjectGraphObjects(new HashSet<object>() { Runs }).OfType<IStatefulItem>()) {
    261281        statefulObject.InitializeState();
     
    328348    }
    329349    #endregion
    330 
    331     [Obsolete("Deprecate, does nothing, needs to be removed from IExecutable")]
    332     public event EventHandler ExecutionTimeChanged;
    333350  }
    334351}
Note: See TracChangeset for help on using the changeset viewer.