Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/20/20 17:31:31 (4 years ago)
Author:
abeham
Message:

#2521: Worked on ResultParameter for Problem and Algorithms

  • Add ResultParameter to TSP, BinaryVectorProblem, and HillClimber
  • Refactor ResultParameter to allow presetting the ResultCollection instead of having to discover it (e.g. for use in BasicAlgorithms)
  • Unify Results property among EngineAlgorithm and BasicAlgorithm
    • There is now only a single instance which is storable
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/Algorithms/EngineAlgorithm.cs

    r17513 r17517  
    7676    }
    7777
    78     public override ResultCollection Results {
    79       get {
    80         return (ResultCollection)globalScope.Variables["Results"].Value;
    81       }
    82     }
    83 
    8478    protected EngineAlgorithm()
    8579      : base() {
    8680      globalScope = new Scope("Global Scope");
    87       globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
     81      globalScope.Variables.Add(new Variable("Results", Results));
    8882      operatorGraph = new OperatorGraph();
    8983      Initialize();
     
    9286      : base(name) {
    9387      globalScope = new Scope("Global Scope");
    94       globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
     88      globalScope.Variables.Add(new Variable("Results", Results));
    9589      operatorGraph = new OperatorGraph();
    9690      Initialize();
     
    9993      : base(name, parameters) {
    10094      globalScope = new Scope("Global Scope");
    101       globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
     95      globalScope.Variables.Add(new Variable("Results", Results));
    10296      operatorGraph = new OperatorGraph();
    10397      Initialize();
     
    106100      : base(name, description) {
    107101      globalScope = new Scope("Global Scope");
    108       globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
     102      globalScope.Variables.Add(new Variable("Results", Results));
    109103      operatorGraph = new OperatorGraph();
    110104      Initialize();
     
    113107      : base(name, description, parameters) {
    114108      globalScope = new Scope("Global Scope");
    115       globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
     109      globalScope.Variables.Add(new Variable("Results", Results));
    116110      operatorGraph = new OperatorGraph();
    117111      Initialize();
     
    160154      base.Prepare();
    161155      globalScope.Clear();
    162       globalScope.Variables.Add(new Variable("Results", new ResultCollection()));
     156      globalScope.Variables.Add(new Variable("Results", Results));
    163157
    164158      if ((engine != null) && (operatorGraph.InitialOperator != null)) {
Note: See TracChangeset for help on using the changeset viewer.