Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12153


Ignore:
Timestamp:
03/06/15 14:51:28 (10 years ago)
Author:
pfleck
Message:

#2350 Started implementing a different scope structure for steady-state alps.

Location:
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3
Files:
1 added
2 edited

Legend:

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

    r12142 r12153  
    4040  public class AlpsSsGeneticAlgorithm : Alps {
    4141    #region Parameter Properties
    42     private IValueParameter<IntValue> PopulationSizeParameter {
    43       get { return (IValueParameter<IntValue>)Parameters["PopulationSize"]; }
     42    private IValueParameter<IntValue> LayerSizeParameter {
     43      get { return (IValueParameter<IntValue>)Parameters["LayerSize"]; }
    4444    }
    4545    private IValueParameter<IntValue> MaximumIterationsParameter {
     
    6767
    6868    #region Properties
    69     public IntValue PopulationSize {
    70       get { return PopulationSizeParameter.Value; }
    71       set { PopulationSizeParameter.Value = value; }
     69    public IntValue LayerSize {
     70      get { return LayerSizeParameter.Value; }
     71      set { LayerSizeParameter.Value = value; }
    7272    }
    7373    public IntValue MaximumIterations {
     
    119119    public AlpsSsGeneticAlgorithm()
    120120      : base() {
    121       Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions each layer.", new IntValue(100)));
     121      Parameters.Add(new ValueParameter<IntValue>("LayerSize", "The size of the population of solutions each layer.", new IntValue(100)));
    122122      Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of iterations that should be processed.", new IntValue(1000)));
    123123      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
     
    130130
    131131      var randomCreator = new RandomCreator();
    132       var layer0Creator = new SubScopesCreator() { Name = "Create Layer Zero" };
    133       var layer0Processor = new /*Layer*/UniformSubScopesProcessor();
    134       var layer0VariableCreator = new VariableCreator();
    135       var layer0SolutionsCreator = new SolutionsCreator();
     132      var workingScopeCreator = new NamedSubScopesCreator() { Name = "Create WorkingScope and Layers-Scope" };
     133      var layersProcessor = new SubScopesProcessor();
     134      var layerCreator = new SubScopesCreator() { Name = "Create Layer" };
     135      var layerProcessor = new /*Layer*/UniformSubScopesProcessor();
     136      var layerVariableCreator = new VariableCreator() { Name = "Initialize Layer" };
     137      var layerSolutionsCreator = new SolutionsCreator();
    136138      var initializeAgeProcessor = new UniformSubScopesProcessor();
    137139      var initializeAge = new VariableCreator() { Name = "Initialize Age" };
    138       var initializeLayerPopulationSize = new SubScopesCounter() { Name = "Init LayerPopulationCounter" };
    139       var initializeLocalEvaluatedSolutions = new Assigner() { Name = "Initialize LayerEvaluatedSolutions" };
    140       var initializeGlobalEvaluatedSolutions = new DataReducer() { Name = "Initialize EvaluatedSolutions" };
    141       var initializeCurrentPopulationSize = new Assigner() { Name = "CurrentPopulationSize = EvaluatedSolutions" };
     140      var initializeEvaluatedSolutions = new ExpressionCalculator() { Name = "Initialize EvaluatedSolutions" };
     141      var initializePopulationSize = new Assigner() { Name = "Initialize PopulationSize" };
    142142      var resultsCollector = new ResultsCollector();
    143143      var mainLoop = new AlpsSsGeneticAlgorithmMainLoop();
     
    147147      randomCreator.SeedParameter.Value = null;
    148148      randomCreator.SetSeedRandomlyParameter.Value = null;
    149       randomCreator.Successor = layer0Creator;
    150 
    151       layer0Creator.NumberOfSubScopesParameter.Value = new IntValue(1);
    152       layer0Creator.Successor = layer0Processor;
    153 
    154       layer0Processor.Operator = layer0VariableCreator;
    155       layer0Processor.Successor = initializeGlobalEvaluatedSolutions;
    156 
    157       layer0VariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Layer", new IntValue(0)));
    158       layer0VariableCreator.Successor = layer0SolutionsCreator;
    159 
    160       layer0SolutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
    161       layer0SolutionsCreator.Successor = initializeAgeProcessor;
     149      randomCreator.Successor = workingScopeCreator;
     150
     151      workingScopeCreator.NamesParameter.Value = new StringArray(new[] { "WorkingScope", "Layers" });
     152      workingScopeCreator.Successor = layersProcessor;
     153
     154      layersProcessor.Operators.Add(new EmptyOperator());
     155      layersProcessor.Operators.Add(layerCreator);
     156
     157      layerCreator.NumberOfSubScopesParameter.ActualName = "NumberOfLayers";
     158      layerCreator.NumberOfSubScopesParameter.Value = null;
     159      layerCreator.Successor = layerProcessor;
     160
     161      layerProcessor.Operator = layerVariableCreator;
     162      layerProcessor.Successor = initializeEvaluatedSolutions;
     163
     164      layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("LayerResults"));
     165      layerVariableCreator.Successor = layerSolutionsCreator;
     166
     167      layerSolutionsCreator.NumberOfSolutionsParameter.ActualName = LayerSizeParameter.Name;
     168      layerSolutionsCreator.Successor = initializeAgeProcessor;
    162169
    163170      initializeAgeProcessor.Operator = initializeAge;
    164       initializeAgeProcessor.Successor = initializeLayerPopulationSize;
    165171
    166172      initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("EvalsCreated", new IntValue(1)));
    167 
    168       initializeLayerPopulationSize.ValueParameter.ActualName = "LayerPopulationSize";
    169       initializeLayerPopulationSize.Successor = initializeLocalEvaluatedSolutions;
    170 
    171       initializeLocalEvaluatedSolutions.LeftSideParameter.ActualName = "LayerEvaluatedSolutions";
    172       initializeLocalEvaluatedSolutions.RightSideParameter.ActualName = "LayerPopulationSize";
    173       initializeLocalEvaluatedSolutions.Successor = null;
    174 
    175       initializeGlobalEvaluatedSolutions.ReductionOperation.Value.Value = ReductionOperations.Sum;
    176       initializeGlobalEvaluatedSolutions.TargetOperation.Value.Value = ReductionOperations.Assign;
    177       initializeGlobalEvaluatedSolutions.ParameterToReduce.ActualName = "LayerEvaluatedSolutions";
    178       initializeGlobalEvaluatedSolutions.TargetParameter.ActualName = "EvaluatedSolutions";
    179       initializeGlobalEvaluatedSolutions.Successor = initializeCurrentPopulationSize;
    180 
    181       initializeCurrentPopulationSize.LeftSideParameter.ActualName = "CurrentPoulationSize";
    182       initializeCurrentPopulationSize.RightSideParameter.ActualName = "EvaluatedSolutions";
    183       initializeCurrentPopulationSize.Successor = resultsCollector;
     173      initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("LastMove", new IntValue(1)));
     174
     175      initializeEvaluatedSolutions.ExpressionResultParameter.ActualName = "EvaluatedSolutions";
     176      initializeEvaluatedSolutions.ExpressionParameter.Value = new StringValue("LayerSize NumberOfLayers * toint");
     177      initializeEvaluatedSolutions.CollectedValues.Add(new LookupParameter<IntValue>("LayerSize"));
     178      initializeEvaluatedSolutions.CollectedValues.Add(new LookupParameter<IntValue>("NumberOfLayers"));
     179      initializeEvaluatedSolutions.Successor = initializePopulationSize;
     180
     181      initializePopulationSize.LeftSideParameter.ActualName = "PopulationSize";
     182      initializePopulationSize.RightSideParameter.ActualName = "EvaluatedSolutions";
     183      initializePopulationSize.Successor = resultsCollector;
    184184
    185185      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
    186       resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Current PopulationSize", null, "CurrentPopulationSize"));
    187186      resultsCollector.Successor = mainLoop;
    188187
     
    234233    #region Parameterization
    235234    private void Initialize() {
    236       //
    237235    }
    238236    private void ParameterizeSolutionsCreator() {
    239       //MainLoop.LayerUpdator.SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
    240       //MainLoop.LayerUpdator.SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
    241237    }
    242238    private void ParameterizeMainLoop() {
    243239      MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
    244240      MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
    245       //MainLoop.MainOperator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
    246       //MainLoop.MainOperator.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
    247       //MainLoop.MainOperator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
    248       //MainLoop.LayerUpdator.SolutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
    249241    }
    250242    private void ParameterizeSelectors() {
  • branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/HeuristicLab.Algorithms.ALPS.SteadyState-3.3.csproj

    r12142 r12153  
    138138    <Compile Include="AlpsSsGeneticAlgorithmMainOperator.cs" />
    139139    <Compile Include="AlpsSsMover.cs" />
     140    <Compile Include="NamedSubScopesCreator.cs" />
    140141    <Compile Include="Properties\AssemblyInfo.cs" />
    141142    <Compile Include="Plugin.cs" />
Note: See TracChangeset for help on using the changeset viewer.