Changeset 12097


Ignore:
Timestamp:
02/27/15 13:55:24 (3 years ago)
Author:
pfleck
Message:

#2269 Replaced the OpenNewLayerCalculator with an ExpressionOperator.

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

Legend:

Unmodified
Added
Removed
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/HeuristicLab.Algorithms.ALPS-3.3.csproj

    r12092 r12097  
    145145    <Compile Include="LayerUpdator.cs" />
    146146    <Compile Include="MatingPoolCreator.cs" />
    147     <Compile Include="NumberOfSelectedSubScopesCalculator.cs" />
    148     <Compile Include="OpenNewLayerCalculator.cs" />
    149147    <Compile Include="Plugin.cs" />
    150148    <Compile Include="Properties\AssemblyInfo.cs" />
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUpdator.cs

    r12071 r12097  
    5353      var genSlrEqAgeGap = new Comparator() { Name = "GenerationsSinceLastRefresh >= AgeGap" };
    5454      var updateLayersBranch = new ConditionalBranch() { Name = "UpdateLayers?" };
    55       // TODO: if expression calculator supports array indexing, use expression calculator
    56       //var openNewLayerCalculator = new ExpressionCalculator();
    57       var openNewLayerCalculator = new OpenNewLayerCalculator();
     55      var maxLayerReached = new Comparator() { Name = "MaxLayersReached = OpenLayers >= NumberOfLayers" };
     56      var maxLayerReachedBranch = new ConditionalBranch() { Name = "MaxLayersReached?" };
     57      var openNewLayerCalculator = new ExpressionCalculator() { Name = "OpenNewLayer = Generations >= AgeLimits[OpenLayers - 1]" };
    5858      var openNewLayerBranch = new ConditionalBranch() { Name = "OpenNewLayer?" };
    59       //var layerCloner = new LastSubScopeCloner() { Name = "Copy Lower Layer" };
    6059      var layerCreator = new LayerCreator() { Name = "Create new Layer" };
    6160      var incrOpenLayers = new IntCounter() { Name = "Incr. OpenLayers" };
    6261      var newLayerResultsCollector = new ResultsCollector() { Name = "Collect new Layer Results" };
    6362      var newLayerSelector = new RightSelector();
    64       var newLayerProsessor = new SubScopesProcessor();
     63      var newLayerProsessor = new SubScopesProcessor() { Name = "NewLayerProcessor" };
    6564      var newLayerLayerProcessor = new LayerUniformSubScopesProcessor();
    6665      var newLayerReducer = new MergingReducer();
     
    7170      var newResultCollectionAssigner = new Assigner() { Name = "Empty Results" };
    7271      var regenerateLayerZeroSelector = new LeftSelector();
    73       var regenerateLayerZeroProsessor = new SubScopesProcessor();
     72      var regenerateLayerZeroProsessor = new SubScopesProcessor() { Name = "LayerZeroProcessor" };
    7473      var regenerateLayerZeroLayerProsessor = new LayerUniformSubScopesProcessor();
    7574      var regenerateLayerZeroReducer = new MergingReducer();
     
    9594
    9695      updateLayersBranch.ConditionParameter.ActualName = "UpdateLayers";
    97       updateLayersBranch.TrueBranch = openNewLayerCalculator;
     96      updateLayersBranch.TrueBranch = maxLayerReached;
    9897
    99       //openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
    100       //openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("AgeGap"));
    101       //openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("OpenLayers"));
    102       //openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("NumberOfLayers"));
    103       //openNewLayerCalculator.ExpressionParameter.Value = new StringValue("Generations AgeLimits [] OpenedLayers 1 - 1 + = false OpenLayers NumberOfLayers < if");
    104       //openNewLayerCalculator.ExpressionResultParameter.ActualName = "OpenNewLayer";
     98      maxLayerReached.LeftSideParameter.ActualName = "OpenLayers";
     99      maxLayerReached.RightSideParameter.ActualName = "NumberOfLayers";
     100      maxLayerReached.ResultParameter.ActualName = "MaxLayerReached";
     101      maxLayerReached.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
     102      maxLayerReached.Successor = maxLayerReachedBranch;
     103
     104      maxLayerReachedBranch.ConditionParameter.ActualName = "MaxLayerReached";
     105      maxLayerReachedBranch.FalseBranch = openNewLayerCalculator;
     106      maxLayerReachedBranch.Successor = regenerateLayerZeroSelector;
     107
     108      openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntArray>("AgeLimits"));
     109      openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
     110      openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("NumberOfLayers"));
     111      openNewLayerCalculator.CollectedValues.Add(new LookupParameter<IntValue>("OpenLayers"));
     112      openNewLayerCalculator.ExpressionResultParameter.ActualName = "OpenNewLayer";
     113      openNewLayerCalculator.ExpressionParameter.Value = new StringValue("Generations 1 + AgeLimits OpenLayers 1 - [] >");
    105114      openNewLayerCalculator.Successor = openNewLayerBranch;
    106115
    107116      openNewLayerBranch.ConditionParameter.ActualName = "OpenNewLayer";
    108117      openNewLayerBranch.TrueBranch = layerCreator;
    109       openNewLayerBranch.Successor = regenerateLayerZeroSelector;
    110118
    111119      layerCreator.Successor = newLayerSelector;
     
    135143      incrEvaluatedSolutionsForNewLayer.ValueParameter.ActualName = "EvaluatedSolutions";
    136144      incrEvaluatedSolutionsForNewLayer.AccumulateParameter.Value = new BoolValue(true);
    137       //incrEvaluatedSolutionsForNewLayer.Successor = newResultCollectionAssigner;
    138145      incrEvaluatedSolutionsForNewLayer.Successor = mainOperator;
    139146
Note: See TracChangeset for help on using the changeset viewer.