Changeset 13127


Ignore:
Timestamp:
11/06/15 11:47:44 (4 years ago)
Author:
pfleck
Message:

#2269

  • Added some missing wiring.
  • Unified some parameter properties.
  • Removed some operators.
Location:
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
Files:
9 edited

Legend:

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

    r13124 r13127  
    291291
    292292      Parameters.Add(new ValueParameter<EnumValue<AgingScheme>>("AgingScheme", "The aging scheme for setting the age-limits for the layers.", new EnumValue<AgingScheme>(ALPS.AgingScheme.Polynomial)));
    293       Parameters.Add(new ValueParameter<IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers", new IntValue(20)));
     293      Parameters.Add(new ValueParameter<IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers.", new IntValue(20)));
    294294      Parameters.Add(new ValueParameter<DoubleValue>("AgeInheritance", "A weight that determines the age of a child after crossover based on the older (1.0) and younger (0.0) parent.", new DoubleValue(1.0)) { Hidden = true });
    295295      Parameters.Add(new ValueParameter<IntArray>("AgeLimits", "The maximum ages for the Layers.", new IntArray(new int[0])) { Hidden = true });
    296296
    297297      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 });
    298       Parameters.Add(new ValueParameter<BoolValue>("ReduceToPopulationSize", "Reduce the LayerPopulationSize after elder migration to PopulationSize", new BoolValue(true)) { Hidden = true });
    299 
    300       Parameters.Add(new ValueParameter<MultiTerminator>("Terminator", "The termination criteria which sould be checked.", new MultiTerminator()));
     298      Parameters.Add(new ValueParameter<BoolValue>("ReduceToPopulationSize", "Reduce the CurrentPopulationSize after elder migration to PopulationSize", new BoolValue(true)) { Hidden = true });
     299
     300      Parameters.Add(new ValueParameter<MultiTerminator>("Terminator", "The termination criteria that defines if the algorithm should continue or stop.", new MultiTerminator()));
    301301      #endregion
    302302
     
    306306      var layer0Processor = new SubScopesProcessor();
    307307      var localRandomCreator = new LocalRandomCreator();
    308       var layerVariableCreator = new VariableCreator();
    309308      var layerSolutionsCreator = new SolutionsCreator();
    310309      var initializeAgeProcessor = new UniformSubScopesProcessor();
    311310      var initializeAge = new VariableCreator() { Name = "Initialize Age" };
    312       var initializeLayerPopulationSize = new SubScopesCounter() { Name = "Init LayerPopulationCounter" };
     311      var initializeCurrentPopulationSize = new SubScopesCounter() { Name = "Init CurrentPopulationCounter" };
    313312      var initializeLocalEvaluatedSolutions = new Assigner() { Name = "Initialize LayerEvaluatedSolutions" };
    314313      var initializeGlobalEvaluatedSolutions = new DataReducer() { Name = "Initialize EvaluatedSolutions" };
     
    331330      layer0Processor.Successor = initializeGlobalEvaluatedSolutions;
    332331
    333       localRandomCreator.Successor = layerVariableCreator;
    334 
    335       layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Layer", new IntValue(0)));
    336       layerVariableCreator.Successor = layerSolutionsCreator;
     332      localRandomCreator.Successor = layerSolutionsCreator;
    337333
    338334      layerSolutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
     
    340336
    341337      initializeAgeProcessor.Operator = initializeAge;
    342       initializeAgeProcessor.Successor = initializeLayerPopulationSize;
    343 
    344       initializeLayerPopulationSize.ValueParameter.ActualName = "LayerPopulationSize";
    345       initializeLayerPopulationSize.Successor = initializeLocalEvaluatedSolutions;
     338      initializeAgeProcessor.Successor = initializeCurrentPopulationSize;
     339
     340      initializeCurrentPopulationSize.ValueParameter.ActualName = "CurrentPopulationSize";
     341      initializeCurrentPopulationSize.Successor = initializeLocalEvaluatedSolutions;
    346342
    347343      initializeAge.CollectedValues.Add(new ValueParameter<DoubleValue>("Age", new DoubleValue(0)));
     
    349345
    350346      initializeLocalEvaluatedSolutions.LeftSideParameter.ActualName = "LayerEvaluatedSolutions";
    351       initializeLocalEvaluatedSolutions.RightSideParameter.ActualName = "LayerPopulationSize";
     347      initializeLocalEvaluatedSolutions.RightSideParameter.ActualName = "CurrentPopulationSize";
    352348      initializeLocalEvaluatedSolutions.Successor = null;
    353349
     
    362358
    363359      mainLoop.GlobalRandomParameter.ActualName = "GlobalRandom";
    364       mainLoop.LocalRandomParameter.ActualName = "LocalRandom";
     360      mainLoop.LocalRandomParameter.ActualName = localRandomCreator.LocalRandomParameter.Name;
    365361      mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";
    366362      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
     
    377373      mainLoop.PlusSelectionParameter.ActualName = PlusSelectionParameter.Name;
    378374      mainLoop.AgeParameter.ActualName = "Age";
     375      mainLoop.AgeGapParameter.ActualName = AgeGapParameter.Name;
    379376      mainLoop.AgeInheritanceParameter.ActualName = AgeInheritanceParameter.Name;
    380377      mainLoop.AgeLimitsParameter.ActualName = AgeLimitsParameter.Name;
    381378      mainLoop.MatingPoolRangeParameter.ActualName = MatingPoolRangeParameter.Name;
    382379      mainLoop.ReduceToPopulationSizeParameter.ActualName = ReduceToPopulationSizeParameter.Name;
     380      mainLoop.TerminatorParameter.ActualName = TerminatorParameter.Name;
    383381      #endregion
    384382
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs

    r13124 r13127  
    9898      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Age"]; }
    9999    }
     100    public IValueLookupParameter<IntValue> AgeGapParameter {
     101      get { return (IValueLookupParameter<IntValue>)Parameters["AgeGap"]; }
     102    }
    100103    public IValueLookupParameter<DoubleValue> AgeInheritanceParameter {
    101104      get { return (IValueLookupParameter<DoubleValue>)Parameters["AgeInheritance"]; }
     
    110113    public IValueLookupParameter<BoolValue> ReduceToPopulationSizeParameter {
    111114      get { return (IValueLookupParameter<BoolValue>)Parameters["ReduceToPopulationSize"]; }
     115    }
     116
     117    public IValueLookupParameter<IOperator> TerminatorParameter {
     118      get { return (IValueLookupParameter<IOperator>)Parameters["Terminator"]; }
    112119    }
    113120    #endregion
     
    147154
    148155      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Age", "The age of individuals."));
     156      Parameters.Add(new ValueLookupParameter<IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers."));
    149157      Parameters.Add(new ValueLookupParameter<DoubleValue>("AgeInheritance", "A weight that determines the age of a child after crossover based on the older (1.0) and younger (0.0) parent."));
    150158      Parameters.Add(new ValueLookupParameter<IntArray>("AgeLimits", "The maximum ages for the Layers."));
    151159
    152160      Parameters.Add(new ValueLookupParameter<IntValue>("MatingPoolRange", "The range of sub - populations used for creating a mating pool. (1 = current + previous sub-population)"));
    153       Parameters.Add(new ValueLookupParameter<BoolValue>("ReduceToPopulationSize", "Reduce the LayerPopulationSize after elder migration to PopulationSize"));
     161      Parameters.Add(new ValueLookupParameter<BoolValue>("ReduceToPopulationSize", "Reduce the CurrentPopulationSize after elder migration to PopulationSize"));
     162
     163      Parameters.Add(new ValueLookupParameter<IOperator>("Terminator", "The termination criteria that defines if the algorithm should continue or stop"));
    154164
    155165
     
    183193      initLayerAnalyzerProcessor.Successor = initAnalyzerPlaceholder;
    184194
    185       layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("LayerEvaluatedSolutions"));
     195      layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Layer", new IntValue(0)));
    186196      layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("LayerResults"));
    187197      layerVariableCreator.Successor = initLayerAnalyzerPlaceholder;
     
    253263      analyzerPlaceholder.Successor = termination;
    254264
     265      termination.TerminatorParameter.ActualName = TerminatorParameter.Name;
    255266      termination.ContinueBranch = matingPoolCreator;
    256267    }
     
    273284      selectorProsessor.Operator = eldersSelector;
    274285      selectorProsessor.Successor = shiftToRightMigrator;
     286
     287      eldersSelector.AgeParameter.ActualName = AgeParameter.Name;
     288      eldersSelector.AgeLimitsParameter.ActualName = AgeLimitsParameter.Name;
     289      eldersSelector.NumberOfLayersParameter.ActualName = NumberOfLayersParameter.Name;
     290      eldersSelector.LayerParameter.ActualName = "Layer";
     291      eldersSelector.Successor = null;
    275292
    276293      shiftToRightMigrator.ClockwiseMigrationParameter.Value = new BoolValue(true);
     
    391408      reseeder.OperatorGraph.InitialOperator = reseedingController;
    392409
     410      reseedingController.GenerationsParameter.ActualName = "Generations";
     411      reseedingController.AgeGapParameter.ActualName = AgeGapParameter.Name;
    393412      reseedingController.FirstLayerOperator = removeIndividuals;
     413      reseedingController.Successor = null;
    394414
    395415      removeIndividuals.Successor = createIndividuals;
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/AgeDistributionAnalyzer.cs

    r13046 r13127  
    4040      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Age"]; }
    4141    }
    42     public ValueLookupParameter<ResultCollection> ResultsParameter {
    43       get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
     42    public IValueLookupParameter<ResultCollection> ResultsParameter {
     43      get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; }
    4444    }
    45     private ValueParameter<StringValue> HistogramNameParameter {
    46       get { return (ValueParameter<StringValue>)Parameters["HistogramName"]; }
     45    private IValueParameter<StringValue> HistogramNameParameter {
     46      get { return (IValueParameter<StringValue>)Parameters["HistogramName"]; }
    4747    }
    48     private ValueParameter<BoolValue> StoreHistoryParameter {
    49       get { return (ValueParameter<BoolValue>)Parameters["StoreHistory"]; }
     48    private IValueParameter<BoolValue> StoreHistoryParameter {
     49      get { return (IValueParameter<BoolValue>)Parameters["StoreHistory"]; }
    5050    }
    5151    public ILookupParameter<IntValue> IterationsParameter {
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Analyzers/OldestAverageYoungestAgeAnalyzer.cs

    r13046 r13127  
    5151      get { return (IValueLookupParameter<DataTable>)Parameters["Ages"]; }
    5252    }
    53     public ValueLookupParameter<ResultCollection> ResultsParameter {
    54       get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
     53    public IValueLookupParameter<ResultCollection> ResultsParameter {
     54      get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; }
    5555    }
    5656    #endregion
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersSelector.cs

    r13046 r13127  
    3434  [StorableClass]
    3535  public sealed class EldersSelector : Selector {
    36     private IScopeTreeLookupParameter<DoubleValue> AgeParameter {
     36    public IScopeTreeLookupParameter<DoubleValue> AgeParameter {
    3737      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Age"]; }
    3838    }
    39     private ILookupParameter<IntArray> AgeLimitsParameter {
     39    public ILookupParameter<IntArray> AgeLimitsParameter {
    4040      get { return (ILookupParameter<IntArray>)Parameters["AgeLimits"]; }
    4141    }
    42     private ILookupParameter<IntValue> NumberOfLayersParameter {
     42    public ILookupParameter<IntValue> NumberOfLayersParameter {
    4343      get { return (ILookupParameter<IntValue>)Parameters["NumberOfLayers"]; }
    4444    }
    45     private ILookupParameter<IntValue> LayerParameter {
     45    public ILookupParameter<IntValue> LayerParameter {
    4646      get { return (ILookupParameter<IntValue>)Parameters["Layer"]; }
    4747    }
     
    5757    public EldersSelector()
    5858      : base() {
    59       Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Age"));
    60       Parameters.Add(new LookupParameter<IntArray>("AgeLimits"));
    61       Parameters.Add(new LookupParameter<IntValue>("NumberOfLayers"));
    62       Parameters.Add(new LookupParameter<IntValue>("Layer"));
     59      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Age", "The age of individuals."));
     60      Parameters.Add(new LookupParameter<IntArray>("AgeLimits", "The maximum ages for the Layers."));
     61      Parameters.Add(new LookupParameter<IntValue>("NumberOfLayers", "The number of layers."));
     62      Parameters.Add(new LookupParameter<IntValue>("Layer", "The number of the current Layer."));
    6363    }
    6464
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LastScopeCloner.cs

    r13124 r13127  
    6969      scopes.Add(newScope);
    7070
    71 
    7271      var next = new OperationCollection(base.Apply());
    73       next.Insert(0, ExecutionContext.CreateChildOperation(NewScopeOperator, newScope));
     72      if (NewScopeOperator != null)
     73        next.Insert(0, ExecutionContext.CreateOperation(NewScopeOperator, newScope));
    7474      return next;
    7575    }
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MatingPoolCreator.cs

    r13124 r13127  
    3131  [StorableClass]
    3232  public sealed class MatingPoolCreator : SingleSuccessorOperator {
    33 
    3433    public IValueLookupParameter<IntValue> MatingPoolRangeParameter {
    3534      get { return (IValueLookupParameter<IntValue>)Parameters["MatingPoolRange"]; }
     
    5554    ///         /     |     \            /     |     \
    5655    ///       Pop1   Pop2   Pop3  =>   Pop1   Pop2   Pop3
    57     ///       /|\    /|\    /|\         /|\    /|\   /|\
    58     ///       ABC    DEF    GHI         ABC    DEF   GHI
    59     ///                                        ABC   DEF
     56    ///       /|\    /|\    /|\         /|\   /|\    /|\
     57    ///       ABC    DEF    GHI         ABC   DEF    GHI
     58    ///                                       ABC    DEF
    6059    /// </pre>
    6160    /// </summary>
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/ReseedingController.cs

    r13111 r13127  
    3131  [StorableClass]
    3232  public sealed class ReseedingController : SingleSuccessorOperator {
    33     private ILookupParameter<IntValue> GenerationsParameter {
     33    public ILookupParameter<IntValue> GenerationsParameter {
    3434      get { return (ILookupParameter<IntValue>)Parameters["Generations"]; }
    3535    }
    36     private ILookupParameter<IntValue> AgeGapParameter {
     36    public ILookupParameter<IntValue> AgeGapParameter {
    3737      get { return (ILookupParameter<IntValue>)Parameters["AgeGap"]; }
    3838    }
     
    5959    public ReseedingController()
    6060      : base() {
    61       Parameters.Add(new LookupParameter<IntValue>("Generations"));
    62       Parameters.Add(new LookupParameter<IntValue>("AgeGap"));
    63       Parameters.Add(new OperatorParameter("FirstLayerOperator"));
     61      Parameters.Add(new LookupParameter<IntValue>("Generations", "The current number of generations."));
     62      Parameters.Add(new ValueLookupParameter<IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers."));
     63      Parameters.Add(new OperatorParameter("FirstLayerOperator", "The Operator that is performed on the first layer if reseeding is required."));
    6464    }
    6565
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/WeightingReducer.cs

    r13096 r13127  
    3333  [StorableClass]
    3434  public sealed class WeightingReducer : SingleSuccessorOperator {
    35 
    3635    public IScopeTreeLookupParameter<DoubleValue> ParameterToReduce {
    3736      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["ParameterToReduce"]; }
Note: See TracChangeset for help on using the changeset viewer.