Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/25/17 13:53:11 (7 years ago)
Author:
pfleck
Message:

#2849: AlpsOs2 with a ContinuousMatingPoolCreator

File:
1 copied

Legend:

Unmodified
Added
Removed
  • branches/Enhanced OSALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsOs2MainLoop.cs

    r15429 r15432  
    3232namespace HeuristicLab.Algorithms.ALPS {
    3333
    34   [Item("AlpsOffspringSelectionGeneticAlgorithmMainLoop", "An ALPS offspring selection genetic algorithm main loop operator.")]
     34  [Item("AlpsOs2MainLoop", "An ALPS offspring selection genetic algorithm main loop operator.")]
    3535  [StorableClass]
    36   public sealed class AlpsOffspringSelectionGeneticAlgorithmMainLoop : AlgorithmOperator {
     36  public sealed class AlpsOs2MainLoop : AlgorithmOperator {
    3737    #region Parameter Properties
    3838    public IValueLookupParameter<IRandom> GlobalRandomParameter {
     
    121121    }
    122122
    123     public IValueLookupParameter<IntValue> MatingPoolRangeParameter {
    124       get { return (IValueLookupParameter<IntValue>)Parameters["MatingPoolRange"]; }
     123    public IValueLookupParameter<DoubleArray> MatingPoolRangesParameter {
     124      get { return (IValueLookupParameter<DoubleArray>)Parameters["MatingPoolRanges"]; }
    125125    }
    126126    public IValueLookupParameter<BoolValue> ReduceToPopulationSizeParameter {
     
    133133    #endregion
    134134
    135     [StorableConstructor]
    136     private AlpsOffspringSelectionGeneticAlgorithmMainLoop(bool deserializing)
    137       : base(deserializing) { }
    138     private AlpsOffspringSelectionGeneticAlgorithmMainLoop(AlpsOffspringSelectionGeneticAlgorithmMainLoop original, Cloner cloner)
    139       : base(original, cloner) { }
    140     public override IDeepCloneable Clone(Cloner cloner) {
    141       return new AlpsOffspringSelectionGeneticAlgorithmMainLoop(this, cloner);
    142     }
    143     public AlpsOffspringSelectionGeneticAlgorithmMainLoop()
     135    #region Constructor, Cloning & Persistence
     136    public AlpsOs2MainLoop()
    144137      : base() {
    145138      Parameters.Add(new ValueLookupParameter<IRandom>("GlobalRandom", "A pseudo random number generator."));
     
    176169      Parameters.Add(new ValueLookupParameter<IntArray>("AgeLimits", "The maximum age an individual is allowed to reach in a certain layer."));
    177170
    178       Parameters.Add(new ValueLookupParameter<IntValue>("MatingPoolRange", "The range of sub - populations used for creating a mating pool. (1 = current + previous sub-population)"));
     171      Parameters.Add(new ValueLookupParameter<DoubleArray>("MatingPoolRanges", "The range of sub-populations used for creating a mating pool. (1 = current + previous sub-population)"));
    179172      Parameters.Add(new ValueLookupParameter<BoolValue>("ReduceToPopulationSize", "Reduce the CurrentPopulationSize after elder migration to PopulationSize"));
    180173
     
    189182      var initAnalyzerPlaceholder = new Placeholder() { Name = "Analyzer (Placeholder)" };
    190183      var resultsCollector = new ResultsCollector();
    191       var matingPoolCreator = new MatingPoolCreator() { Name = "Create Mating Pools" };
     184      var matingPoolCreator = new ContinuousMatingPoolCreator() { Name = "Create Mating Pools" };
    192185      var matingPoolProcessor = new UniformSubScopesProcessor() { Name = "Process Mating Pools" };
    193186      var initializeLayer = new Assigner() { Name = "Reset LayerEvaluatedSolutions" };
    194       var mainOperator = new AlpsOffspringSelectionGeneticAlgorithmMainOperator();
     187      var mainOperator = new AlpsOs2MainOperator();
    195188      var generationsIcrementor = new IntCounter() { Name = "Increment Generations" };
    196189      var evaluatedSolutionsReducer = new DataReducer() { Name = "Increment EvaluatedSolutions" };
     
    235228      resultsCollector.Successor = matingPoolCreator;
    236229
    237       matingPoolCreator.MatingPoolRangeParameter.Value = null;
    238       matingPoolCreator.MatingPoolRangeParameter.ActualName = MatingPoolRangeParameter.Name;
     230      matingPoolCreator.RangesParameter.ActualName = MatingPoolRangesParameter.Name;
     231      matingPoolCreator.QualityParameter.ActualName = QualityParameter.Name;
     232      matingPoolCreator.MaximizationParameter.ActualName = MaximizationParameter.Name;
    239233      matingPoolCreator.Successor = matingPoolProcessor;
    240234
     
    466460      return reseeder;
    467461    }
     462
     463    public override IDeepCloneable Clone(Cloner cloner) {
     464      return new AlpsOs2MainLoop(this, cloner);
     465    }
     466    private AlpsOs2MainLoop(AlpsOs2MainLoop original, Cloner cloner)
     467      : base(original, cloner) { }
     468
     469    [StorableConstructor]
     470    private AlpsOs2MainLoop(bool deserializing)
     471      : base(deserializing) { }
     472    #endregion
    468473  }
    469474}
Note: See TracChangeset for help on using the changeset viewer.