Changeset 2933


Ignore:
Timestamp:
03/05/10 06:38:53 (12 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • corrected persistence and initialization of algorithms
  • fixed SGA performance test
Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/Tests/UnitTest.cs

    r2917 r2933  
    9393    }
    9494
    95     void sga_ExceptionOccurred(object sender, EventArgs<Exception> e) {
     95    private void sga_ExceptionOccurred(object sender, EventArgs<Exception> e) {
    9696      ex = e.Value;
    9797    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs

    r2917 r2933  
    118118        if (t == null)
    119119          Content.Engine = null;
    120         else
     120        else if ((Content.Engine == null) || (Content.Engine.GetType() != t))
    121121          Content.Engine = (IEngine)Activator.CreateInstance(t);
    122122      }
  • trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs

    r2932 r2933  
    4343    private IProblem problem;
    4444    [Storable]
     45    private IProblem ProblemPersistence {
     46      get { return problem; }
     47      set {
     48        if (problem != null) DeregisterProblemEvents();
     49        problem = value;
     50        if (problem != null) RegisterProblemEvents();
     51      }
     52    }
    4553    public IProblem Problem {
    4654      get { return problem; }
  • trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs

    r2932 r2933  
    3636    private OperatorGraph operatorGraph;
    3737    [Storable]
     38    private OperatorGraph OperatorGraphPersistence {
     39      get { return operatorGraph; }
     40      set {
     41        if (operatorGraph != null) operatorGraph.InitialOperatorChanged -= new EventHandler(OperatorGraph_InitialOperatorChanged);
     42        operatorGraph = value;
     43        if (operatorGraph != null) operatorGraph.InitialOperatorChanged += new EventHandler(OperatorGraph_InitialOperatorChanged);
     44      }
     45    }
    3846    protected OperatorGraph OperatorGraph {
    3947      get { return operatorGraph; }
     
    5866    private IEngine engine;
    5967    [Storable]
     68    private IEngine EnginePersistence {
     69      get { return engine; }
     70      set {
     71        if (engine != null) DeregisterEngineEvents();
     72        engine = value;
     73        if (engine != null) RegisterEngineEvents();
     74      }
     75    }
    6076    public IEngine Engine {
    6177      get { return engine; }
Note: See TracChangeset for help on using the changeset viewer.