Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13035


Ignore:
Timestamp:
10/19/15 16:27:05 (9 years ago)
Author:
pfleck
Message:

#2269 Fixed removing unnecessary operators.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs

    r13031 r13035  
    179179      mainLoop.OperatorGraph.InitialOperator = numberOfSubScopesBranch;
    180180
    181       // Remove unused operators
    182       while (oldInitialOp != selector) {
    183         mainLoop.OperatorGraph.Operators.Remove(oldInitialOp);
    184         var op = oldInitialOp as SingleSuccessorOperator;
    185         oldInitialOp = op != null ? op.Successor : null;
    186       }
    187 
    188181      numberOfSubScopesBranch.ConditionParameter.ActualName = "PlusSelection";
    189182      numberOfSubScopesBranch.TrueBranch = numberOfSelectedSubScopesPlusCalculator;
     
    254247        stochasticBranch.RandomParameter.ActualName = "LocalRandom";
    255248
     249      // Remove unused operators
     250      var usedOperators = mainLoop.OperatorGraph.Iterate();
     251      var unusedOperators = mainLoop.OperatorGraph.Operators.Except(usedOperators);
     252      foreach (var op in unusedOperators.ToList())
     253        mainLoop.OperatorGraph.Operators.Remove(op);
     254
    256255      return mainLoop;
    257256    }
Note: See TracChangeset for help on using the changeset viewer.