- Timestamp:
- 04/20/20 14:40:24 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs
r17226 r17513 26 26 using System.Threading; 27 27 using System.Threading.Tasks; 28 using HEAL.Attic; 28 29 using HeuristicLab.Collections; 29 30 using HeuristicLab.Common; 30 31 using HeuristicLab.Core; 31 32 using HeuristicLab.Data; 32 using HEAL.Attic;33 33 34 34 namespace HeuristicLab.Optimization { … … 301 301 foreach ( 302 302 IStatefulItem statefulObject in 303 this.GetObjectGraphObjects(new HashSet<object>() { Runs}).OfType<IStatefulItem>()) {303 this.GetObjectGraphObjects(new HashSet<object>() { Runs }).OfType<IStatefulItem>()) { 304 304 statefulObject.ClearState(); 305 305 } … … 307 307 try { 308 308 runs.Add(new Run(string.Format("{0} Run {1}", Name, runsCounter), this)); 309 } 310 catch (ArgumentException e) { 309 } catch (ArgumentException e) { 311 310 OnExceptionOccurred(new InvalidOperationException("Run creation failed.", e)); 312 311 } 313 } 314 finally { 312 } finally { 315 313 ExecutionState = ExecutionState.Stopped; 316 314 EventHandler handler = Stopped; … … 325 323 326 324 protected virtual void DeregisterProblemEvents() { 327 problem.OperatorsChanged -= new EventHandler(Problem_OperatorsChanged);328 325 problem.Reset -= new EventHandler(Problem_Reset); 329 326 } 330 327 protected virtual void RegisterProblemEvents() { 331 problem.OperatorsChanged += new EventHandler(Problem_OperatorsChanged);332 328 problem.Reset += new EventHandler(Problem_Reset); 333 329 } 334 protected virtual void Problem_OperatorsChanged(object sender, EventArgs e) { }335 330 protected virtual void Problem_Reset(object sender, EventArgs e) { 336 331 Prepare(); -
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/EngineAlgorithm.cs
r17226 r17513 22 22 using System; 23 23 using System.Linq; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 using HeuristicLab.PluginInfrastructure; 28 28 … … 50 50 } 51 51 52 public new IEncodedProblem Problem { 53 get { return (IEncodedProblem)base.Problem; } 54 set { base.Problem = Problem; } 55 } 56 52 57 [Storable] 53 58 private IScope globalScope; … … 181 186 } 182 187 188 189 183 190 #region Events 191 protected override void DeregisterProblemEvents() { 192 Problem.Reset -= new EventHandler(Problem_Reset); 193 } 194 protected override void RegisterProblemEvents() { 195 Problem.Reset += new EventHandler(Problem_Reset); 196 } 197 protected virtual void Problem_OperatorsChanged(object sender, EventArgs e) { } 198 199 184 200 public event EventHandler EngineChanged; 185 201 protected virtual void OnEngineChanged() {
Note: See TracChangeset
for help on using the changeset viewer.