Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/20/20 14:40:24 (5 years ago)
Author:
mkommend
Message:

#2521: Splitted problems into several problem and encoded problems.

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  
    2626using System.Threading;
    2727using System.Threading.Tasks;
     28using HEAL.Attic;
    2829using HeuristicLab.Collections;
    2930using HeuristicLab.Common;
    3031using HeuristicLab.Core;
    3132using HeuristicLab.Data;
    32 using HEAL.Attic;
    3333
    3434namespace HeuristicLab.Optimization {
     
    301301        foreach (
    302302          IStatefulItem statefulObject in
    303           this.GetObjectGraphObjects(new HashSet<object>() {Runs}).OfType<IStatefulItem>()) {
     303          this.GetObjectGraphObjects(new HashSet<object>() { Runs }).OfType<IStatefulItem>()) {
    304304          statefulObject.ClearState();
    305305        }
     
    307307        try {
    308308          runs.Add(new Run(string.Format("{0} Run {1}", Name, runsCounter), this));
    309         }
    310         catch (ArgumentException e) {
     309        } catch (ArgumentException e) {
    311310          OnExceptionOccurred(new InvalidOperationException("Run creation failed.", e));
    312311        }
    313       }   
    314       finally {
     312      } finally {
    315313        ExecutionState = ExecutionState.Stopped;
    316314        EventHandler handler = Stopped;
     
    325323
    326324    protected virtual void DeregisterProblemEvents() {
    327       problem.OperatorsChanged -= new EventHandler(Problem_OperatorsChanged);
    328325      problem.Reset -= new EventHandler(Problem_Reset);
    329326    }
    330327    protected virtual void RegisterProblemEvents() {
    331       problem.OperatorsChanged += new EventHandler(Problem_OperatorsChanged);
    332328      problem.Reset += new EventHandler(Problem_Reset);
    333329    }
    334     protected virtual void Problem_OperatorsChanged(object sender, EventArgs e) { }
    335330    protected virtual void Problem_Reset(object sender, EventArgs e) {
    336331      Prepare();
  • branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/EngineAlgorithm.cs

    r17226 r17513  
    2222using System;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    26 using HEAL.Attic;
    2727using HeuristicLab.PluginInfrastructure;
    2828
     
    5050    }
    5151
     52    public new IEncodedProblem Problem {
     53      get { return (IEncodedProblem)base.Problem; }
     54      set { base.Problem = Problem; }
     55    }
     56
    5257    [Storable]
    5358    private IScope globalScope;
     
    181186    }
    182187
     188
     189
    183190    #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
    184200    public event EventHandler EngineChanged;
    185201    protected virtual void OnEngineChanged() {
Note: See TracChangeset for help on using the changeset viewer.