Changeset 13110


Ignore:
Timestamp:
11/03/15 15:34:46 (7 years ago)
Author:
pfleck
Message:

#2269

  • Removed ContinuousReseeding because it does not bring any improvements and makes reseeding more complicated.
  • Adapted changes from UnidirectionalRingMigrator.
Location:
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
Files:
3 edited

Legend:

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

    r13096 r13110  
    114114      get { return (IValueParameter<IntValue>)Parameters["MatingPoolRange"]; }
    115115    }
    116     private IValueParameter<BoolValue> ContinuousReseedingParameter {
    117       get { return (IValueParameter<BoolValue>)Parameters["ContinuousReseeding"]; }
    118     }
    119116
    120117    private IValueParameter<MultiTerminator> TerminatorParameter {
     
    198195      get { return MatingPoolRangeParameter.Value; }
    199196      set { MatingPoolRangeParameter.Value = value; }
    200     }
    201     public BoolValue ContinuousReseeding {
    202       get { return ContinuousReseedingParameter.Value; }
    203       set { ContinuousReseedingParameter.Value = value; }
    204197    }
    205198
     
    300293
    301294      Parameters.Add(new ValueParameter<IntValue>("MatingPoolRange", "The range of layers used for creating a mating pool. (1 = current + previous layer)", new IntValue(1)) { Hidden = true });
    302       Parameters.Add(new ValueParameter<BoolValue>("ContinuousReseeding", "Instead of replacing the lowest layer every AgeGap generations replace 1/AgeGap individuals every generation", new BoolValue(false)) { Hidden = true });
    303295
    304296      Parameters.Add(new ValueParameter<MultiTerminator>("Terminator", "The termination criteria which sould be checked.", new MultiTerminator()));
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersEmigrator.cs

    r13079 r13110  
    6161      eldersSelector.Successor = null;
    6262
    63       shiftToRightMigrator.ClockwiseMigrationDirectionParameter.Value = new BoolValue(true);
     63      shiftToRightMigrator.ClockwiseMigrationParameter.Value = new BoolValue(true);
    6464      shiftToRightMigrator.Successor = mergingProsessor;
    6565
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerReseeder.cs

    r13096 r13110  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    30 using HeuristicLab.Selection;
    3130
    3231namespace HeuristicLab.Algorithms.ALPS {
     
    4443    }
    4544
    46     private ILookupParameter<BoolValue> ContinuousReseedingParameter {
    47       get { return (ILookupParameter<BoolValue>)Parameters["ContinuousReseeding"]; }
    48     }
    4945    private ILookupParameter<IntValue> GenerationsParameter {
    5046      get { return (ILookupParameter<IntValue>)Parameters["Generations"]; }
     
    7470    public LayerReseeder()
    7571      : base() {
    76       Parameters.Add(new LookupParameter<BoolValue>("ContinuousReseeding"));
    7772      Parameters.Add(new LookupParameter<IntValue>("Generations"));
    7873      Parameters.Add(new LookupParameter<IntValue>("AgeGap"));
     
    8075      operatorGraph = new OperatorGraph();
    8176
    82       var subScopesCounter = new SubScopesCounter();
    83       var numberOfReplacedCalculator = new ExpressionCalculator() { Name = "NumberOfReplaced = if ContinuousReseeding then max(LayerPopulationSize - (PopulationSize - PopulationSize / AgeGap), 0) else PopulationSize" };
    84       var numberOfNewIndividualsCalculator = new ExpressionCalculator() { Name = "NumberOfNewIndividuals = PopulationSize - (LayerPopulatioSize - NumberOfReplaced)" };
    85       var oldestSelector = new BestSelector();
    86       var processOldest = new SubScopesProcessor();
    8777      var removeIndividuals = new SubScopesRemover();
    8878      var createIndividuals = new SolutionsCreator();
    89       var mergeIndididuals = new MergingReducer();
    9079      var initializeAgeProsessor = new UniformSubScopesProcessor();
    9180      var initializeAge = new VariableCreator() { Name = "Initialize Age" };
    9281      var incrEvaluatedSolutionsAfterReseeding = new SubScopesCounter() { Name = "Update EvaluatedSolutions" };
    93       var subScopesCounter2 = new SubScopesCounter();
    9482
    95       OperatorGraph.InitialOperator = subScopesCounter;
    96 
    97       subScopesCounter.ValueParameter.ActualName = "LayerPopulationSize";
    98       subScopesCounter.AccumulateParameter.Value = new BoolValue(false);
    99       subScopesCounter.Successor = numberOfReplacedCalculator;
    100 
    101       numberOfReplacedCalculator.CollectedValues.Add(new LookupParameter<BoolValue>("ContinuousReseeding"));
    102       numberOfReplacedCalculator.CollectedValues.Add(new LookupParameter<IntValue>("LayerPopulationSize"));
    103       numberOfReplacedCalculator.CollectedValues.Add(new LookupParameter<IntValue>("PopulationSize"));
    104       numberOfReplacedCalculator.CollectedValues.Add(new LookupParameter<IntValue>("AgeGap"));
    105       numberOfReplacedCalculator.ExpressionResultParameter.ActualName = "NumberOfReplaced";
    106       const string numSelected = "LayerPopulationSize PopulationSize PopulationSize AgeGap / - -";
    107       numberOfReplacedCalculator.ExpressionParameter.Value = new StringValue(numSelected + " 0 0 " + numSelected + " < if PopulationSize ContinuousReseeding if toint");
    108       numberOfReplacedCalculator.Successor = numberOfNewIndividualsCalculator;
    109 
    110       numberOfNewIndividualsCalculator.CollectedValues.Add(new LookupParameter<IntValue>("PopulationSize"));
    111       numberOfNewIndividualsCalculator.CollectedValues.Add(new LookupParameter<IntValue>("NumberOfReplaced"));
    112       numberOfNewIndividualsCalculator.CollectedValues.Add(new LookupParameter<IntValue>("LayerPopulationSize"));
    113       numberOfNewIndividualsCalculator.ExpressionResultParameter.ActualName = "NumberOfNewIndividuals";
    114       numberOfNewIndividualsCalculator.ExpressionParameter.Value = new StringValue("PopulationSize LayerPopulationSize NumberOfReplaced - - toint");
    115       numberOfNewIndividualsCalculator.Successor = oldestSelector;
    116 
    117       oldestSelector.QualityParameter.ActualName = "Age";
    118       oldestSelector.NumberOfSelectedSubScopesParameter.ActualName = "NumberOfReplaced";
    119       oldestSelector.MaximizationParameter.Value = new BoolValue(true);
    120       oldestSelector.CopySelected = new BoolValue(false);
    121       oldestSelector.Successor = processOldest;
    122 
    123       processOldest.Operators.Add(new EmptyOperator());
    124       processOldest.Operators.Add(removeIndividuals);
    125       processOldest.Successor = mergeIndididuals;
     83      OperatorGraph.InitialOperator = removeIndividuals;
    12684
    12785      removeIndividuals.Successor = createIndividuals;
    12886
    129       createIndividuals.NumberOfSolutionsParameter.ActualName = "NumberOfNewIndividuals";
     87      createIndividuals.NumberOfSolutionsParameter.ActualName = "PopulationSize";
    13088      createIndividuals.Successor = initializeAgeProsessor;
    13189
     
    13997      incrEvaluatedSolutionsAfterReseeding.AccumulateParameter.Value = new BoolValue(true);
    14098      incrEvaluatedSolutionsAfterReseeding.Successor = null;
    141 
    142       mergeIndididuals.Successor = subScopesCounter2;
    143 
    144       subScopesCounter2.ValueParameter.ActualName = "LayerPopulationSize";
    145       subScopesCounter2.AccumulateParameter.Value = new BoolValue(false);
    14699    }
    147100
    148101    public override IOperation Apply() {
    149       bool continuousReseeding = ContinuousReseedingParameter.ActualValue.Value;
    150102      int generations = GenerationsParameter.ActualValue.Value;
    151103      int ageGap = AgeGapParameter.ActualValue.Value;
    152104
    153105      var next = new OperationCollection(base.Apply());
    154       if (continuousReseeding || generations % ageGap == 0) {
     106      if (generations % ageGap == 0) {
    155107        var layerZeroScope = ExecutionContext.Scope.SubScopes[0];
    156108        if (operatorGraph.InitialOperator != null)
Note: See TracChangeset for help on using the changeset viewer.