Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12998 for branches


Ignore:
Timestamp:
10/13/15 09:57:42 (9 years ago)
Author:
pfleck
Message:

#2269

  • Removed unused operators in modified GA mainloop.
  • Unhide PlusSelection parameter.
Location:
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
Files:
2 edited

Legend:

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

    r12997 r12998  
    295295      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
    296296      Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });
    297       Parameters.Add(new ValueParameter<BoolValue>("PlusSelection", "Include the parents in the selection of the invividuals for the next generation.", new BoolValue(false)) { Hidden = true });
     297      Parameters.Add(new ValueParameter<BoolValue>("PlusSelection", "Include the parents in the selection of the invividuals for the next generation.", new BoolValue(false)));
    298298
    299299      Parameters.Add(new ValueParameter<EnumValue<AgingScheme>>("AgingScheme", "The aging scheme for setting the age-limits for the layers.", new EnumValue<AgingScheme>(ALPS.AgingScheme.Polynomial)));
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs

    r12997 r12998  
    172172      var mainLoop = new GeneticAlgorithmMainLoop();
    173173
     174      var oldInitialOp = mainLoop.OperatorGraph.InitialOperator;
    174175      var selector = mainLoop.OperatorGraph.Iterate().OfType<Placeholder>().First(o => o.OperatorParameter.ActualName == "Selector");
    175176      var crossover = mainLoop.OperatorGraph.Iterate().OfType<Placeholder>().First(o => o.OperatorParameter.ActualName == "Crossover");
     
    183184      var replacementBranch = new ConditionalBranch() { Name = "PlusSelection?" };
    184185
     186      // Set new initial operator
    185187      mainLoop.OperatorGraph.InitialOperator = numberOfSubScopesBranch;
     188
     189      // Remove unused operators
     190      while (oldInitialOp != selector) {
     191        mainLoop.OperatorGraph.Operators.Remove(oldInitialOp);
     192        var op = oldInitialOp as SingleSuccessorOperator;
     193        oldInitialOp = op != null ? op.Successor : null;
     194      }
    186195
    187196      numberOfSubScopesBranch.ConditionParameter.ActualName = "PlusSelection";
Note: See TracChangeset for help on using the changeset viewer.