Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/03/10 03:14:37 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on engines and algorithms
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs

    r2882 r2916  
    2121
    2222using System;
     23using System.Linq;
    2324using HeuristicLab.Collections;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.PluginInfrastructure;
    2729
    2830namespace HeuristicLab.Optimization {
     
    9799      globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
    98100      OperatorGraph = new OperatorGraph();
     101      InitializeEngine();
    99102    }
    100103    protected EngineAlgorithm(string name)
     
    103106      globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
    104107      OperatorGraph = new OperatorGraph();
     108      InitializeEngine();
    105109    }
    106110    protected EngineAlgorithm(string name, ParameterCollection parameters)
     
    109113      globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
    110114      OperatorGraph = new OperatorGraph();
     115      InitializeEngine();
    111116    }
    112117    protected EngineAlgorithm(string name, string description)
     
    115120      globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
    116121      OperatorGraph = new OperatorGraph();
     122      InitializeEngine();
    117123    }
    118124    protected EngineAlgorithm(string name, string description, ParameterCollection parameters)
     
    121127      globalScope.Variables.Add(new Variable("Results", new VariableCollection()));
    122128      OperatorGraph = new OperatorGraph();
     129      InitializeEngine();
     130    }
     131
     132    private void InitializeEngine() {
     133      var types = ApplicationManager.Manager.GetTypes(typeof(IEngine));
     134      Type t = types.FirstOrDefault(x => x.Name.Equals("SequentialEngine"));
     135      if (t == null) t = types.FirstOrDefault();
     136      if (t != null) Engine = (IEngine)Activator.CreateInstance(t);
    123137    }
    124138
Note: See TracChangeset for help on using the changeset viewer.