Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/15 10:51:17 (8 years ago)
Author:
pfleck
Message:

#2350

  • Worked on AlpsSsGeneticAlgorithmMainLoop.
  • Added SteadyStateMatingPoolCreator, RandomLayerProcessor and RandomIntAssigner.
File:
1 edited

Legend:

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

    r12120 r12136  
    4343      get { return (IValueParameter<IntArray>)Parameters["PopulationSize"]; }
    4444    }
    45     private IValueParameter<IntValue> MaximumGenerationsParameter {
    46       get { return (IValueParameter<IntValue>)Parameters["MaximumGenerations"]; }
     45    private IValueParameter<IntValue> MaximumIterationsParameter {
     46      get { return (IValueParameter<IntValue>)Parameters["MaximumIterations"]; }
    4747    }
    4848    public IConstrainedValueParameter<ISelector> SelectorParameter {
     
    7171      set { PopulationSizeParameter.Value = value; }
    7272    }
    73     public IntValue MaximumGenerations {
    74       get { return MaximumGenerationsParameter.Value; }
    75       set { MaximumGenerationsParameter.Value = value; }
     73    public IntValue MaximumIterations {
     74      get { return MaximumIterationsParameter.Value; }
     75      set { MaximumIterationsParameter.Value = value; }
    7676    }
    7777
     
    116116      : base() {
    117117      Parameters.Add(new ValueParameter<IntArray>("PopulationSize", "The size of the population of solutions each layer.", new IntArray(new[] { 100 })));
    118       Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations that should be processed.", new IntValue(1000)));
     118      Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of iterations that should be processed.", new IntValue(1000)));
    119119      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
    120120      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
     
    132132      var initializeAgeProcessor = new UniformSubScopesProcessor();
    133133      var initializeAge = new VariableCreator() { Name = "Initialize Age" };
    134       var initializeLocalEvaluatedSolutions = new SubScopesCounter() { Name = "Initialize LayerEvaluatedSolutions" };
     134      var initializeLayerPopulationSize = new SubScopesCounter() { Name = "Init LayerPopulationCounter" };
     135      var initializeLocalEvaluatedSolutions = new Assigner() { Name = "Initialize LayerEvaluatedSolutions" };
    135136      var initializeGlobalEvaluatedSolutions = new DataReducer() { Name = "Initialize EvaluatedSolutions" };
     137      var initializeCurrentPopulationSize = new Assigner() { Name = "CurrentPopulationSize = EvaluatedSolutions" };
    136138      var resultsCollector = new ResultsCollector();
    137139      var mainLoop = new AlpsSsGeneticAlgorithmMainLoop();
     
    156158
    157159      initializeAgeProcessor.Operator = initializeAge;
    158       initializeAgeProcessor.Successor = initializeLocalEvaluatedSolutions;
    159 
    160       initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("Age", new IntValue(0)));
    161 
    162       initializeLocalEvaluatedSolutions.ValueParameter.ActualName = "LayerEvaluatedSolutions";
     160      initializeAgeProcessor.Successor = initializeLayerPopulationSize;
     161
     162      initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("Age", new IntValue(1)));
     163
     164      initializeLayerPopulationSize.ValueParameter.ActualName = "LayerPopulationSize";
     165      initializeLayerPopulationSize.Successor = initializeLocalEvaluatedSolutions;
     166
     167      initializeLocalEvaluatedSolutions.LeftSideParameter.ActualName = "LayerEvaluatedSolutions";
     168      initializeLocalEvaluatedSolutions.RightSideParameter.ActualName = "LayerPopulationSize";
     169      initializeLocalEvaluatedSolutions.Successor = null;
    163170
    164171      initializeGlobalEvaluatedSolutions.ReductionOperation.Value.Value = ReductionOperations.Sum;
     
    166173      initializeGlobalEvaluatedSolutions.ParameterToReduce.ActualName = "LayerEvaluatedSolutions";
    167174      initializeGlobalEvaluatedSolutions.TargetParameter.ActualName = "EvaluatedSolutions";
    168       initializeGlobalEvaluatedSolutions.Successor = resultsCollector;
     175      initializeGlobalEvaluatedSolutions.Successor = initializeCurrentPopulationSize;
     176
     177      initializeCurrentPopulationSize.LeftSideParameter.ActualName = "CurrentPoulationSize";
     178      initializeCurrentPopulationSize.RightSideParameter.ActualName = "EvaluatedSolutions";
     179      initializeCurrentPopulationSize.Successor = resultsCollector;
    169180
    170181      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
     182      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Current PopulationSize", null, "CurrentPopulationSize"));
    171183      resultsCollector.Successor = mainLoop;
    172184
     
    252264      if (Problem != null) {
    253265        foreach (var @operator in Problem.Operators.OfType<IIterationBasedOperator>()) {
    254           @operator.IterationsParameter.ActualName = "Generations";
     266          @operator.IterationsParameter.ActualName = "Iteration";
    255267          @operator.IterationsParameter.Hidden = true;
    256           @operator.MaximumIterationsParameter.ActualName = MaximumGenerationsParameter.Name;
     268          @operator.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name;
    257269          @operator.MaximumIterationsParameter.Hidden = true;
    258270        }
Note: See TracChangeset for help on using the changeset viewer.