Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11609 for branches


Ignore:
Timestamp:
12/01/14 16:23:24 (10 years ago)
Author:
pfleck
Message:

#2269

  • Fixed Bugs with Per-Layer-Results.
  • Fixed Bugs in EldersSelector.
  • Added LayerCreator instead of LastSubScopeCloner for avoiding operators for some temporary hacks.
Location:
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
Files:
1 added
7 edited

Legend:

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

    r11590 r11609  
    254254
    255255      layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Layer", new IntValue(0)));
    256       layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("Results", new ResultCollection()));
     256      //layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("Results", new ResultCollection()));
    257257      layerVariableCreator.Successor = layerSolutionsCreator;
    258258
     
    275275      initializeGlobalEvaluatedSolutions.Successor = resultsCollector;
    276276
    277       resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("EvaluatedSolutions"));
     277      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
    278278      resultsCollector.Successor = mainLoop;
    279279
     
    375375      MainLoop.LayerUpdator.SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
    376376      MainLoop.LayerUpdator.SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
    377 
    378377    }
    379378    private void ParameterizeMainLoop() {
     
    387386      MainLoop.EldersEmigrator.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
    388387      MainLoop.EldersEmigrator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
     388      MainLoop.LayerUpdator.SolutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
    389389    }
    390390    private void ParameterizeSelectors() {
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs

    r11590 r11609  
    7474
    7575      var variableCreator = new VariableCreator() { Name = "Initialize" };
    76       var resultsCollector = new ResultsCollector();
    77       var initAnalyzerPlaceholder = new Placeholder() { Name = "Analyzer (Placeholder)" };
    7876      var initLayerAnalyzerProcessor = new SubScopesProcessor();
    7977      var layerVariableCreator = new VariableCreator() { Name = "Initialize Layer" };
    8078      var initLayerAnalyzerPlaceholder = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" };
     79      var initAnalyzerPlaceholder = new Placeholder() { Name = "Analyzer (Placeholder)" };
     80      var resultsCollector = new ResultsCollector();
    8181      var matingPoolCreator = new MatingPoolCreator() { Name = "Create Mating Pools" };
    8282      var matingPoolProcessor = new UniformSubScopesProcessor();
     
    9797      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastRefresh", new IntValue(0)));
    9898      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("OpenLayers", new IntValue(1)));
    99       variableCreator.Successor = resultsCollector;
    100 
    101       resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
    102       resultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", "Results"));
    103       resultsCollector.Successor = initAnalyzerPlaceholder;
    104 
    105       initAnalyzerPlaceholder.OperatorParameter.ActualName = AnalyzerParameter.Name;
    106       initAnalyzerPlaceholder.Successor = initLayerAnalyzerProcessor;
     99      variableCreator.Successor = initLayerAnalyzerProcessor;
    107100
    108101      initLayerAnalyzerProcessor.Operators.Add(layerVariableCreator);
    109       initLayerAnalyzerProcessor.Successor = matingPoolCreator;
     102      initLayerAnalyzerProcessor.Successor = initAnalyzerPlaceholder;
    110103
    111104      layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("LayerEvaluatedSolutions"));
     
    115108      initLayerAnalyzerPlaceholder.OperatorParameter.ActualName = LayerAnalyzerParameter.Name;
    116109      initLayerAnalyzerPlaceholder.Successor = null;
     110
     111      initAnalyzerPlaceholder.OperatorParameter.ActualName = AnalyzerParameter.Name;
     112      initAnalyzerPlaceholder.Successor = resultsCollector;
     113
     114      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
     115      resultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", "Results"));
     116      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("OpenLayers"));
     117      resultsCollector.CopyValue = new BoolValue(false);
     118      resultsCollector.Successor = matingPoolCreator;
    117119
    118120      matingPoolCreator.Successor = matingPoolProcessor;
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersSelector.cs

    r11586 r11609  
    6565      int layer = LayerParameter.ActualValue.Value;
    6666
    67       if (layer >= numberOfLayers) // is max layer?
     67      if (layer >= numberOfLayers - 1) // is max layer?
    6868        return new IScope[0];
    6969
    7070      int limit = ageLimits[layer];
    71       var elders =
     71      var eldersQuery =
    7272        from scope in scopes
    7373        let age = ((IntValue)scope.Variables["Age"].Value).Value
     
    7575        select scope;
    7676
    77       return elders.ToArray();
     77      var elders = eldersQuery.ToArray();
     78
     79      if (!CopySelected.Value)
     80        foreach (var elder in elders)
     81          scopes.Remove(elder);
     82
     83      return elders;
    7884    }
    7985  }
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/HeuristicLab.Algorithms.ALPS-3.3.csproj

    r11590 r11609  
    8484    <Compile Include="EldersSelector.cs" />
    8585    <Compile Include="LastSubScopeCloner.cs" />
     86    <Compile Include="LayerCreator.cs" />
    8687    <Compile Include="LayerUpdator.cs" />
    8788    <Compile Include="MatingPoolCreator.cs" />
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LastSubScopeCloner.cs

    r11590 r11609  
    5757      var clone = (IScope)lastSubScope.Clone(new Cloner());
    5858
     59      int number;
     60      if (int.TryParse(clone.Name, out number))
     61        clone.Name = (number + 1).ToString();
     62
    5963      scopes.Add(clone);
    6064
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUpdator.cs

    r11590 r11609  
    5656      var openNewLayerCalculator = new OpenNewLayerCalculator();
    5757      var openNewLayerBranch = new ConditionalBranch() { Name = "OpenNewLayer?" };
    58       var layerCloner = new LastSubScopeCloner() { Name = "Copy Lower Layer" };
     58      //var layerCloner = new LastSubScopeCloner() { Name = "Copy Lower Layer" };
     59      var layerCreator = new LayerCreator() { Name = "Create new Layer" };
    5960      var incrOpenLayers = new IntCounter() { Name = "Incr. OpenLayers" };
     61      var newLayerResultsCollector = new ResultsCollector() { Name = "Collect new Layer Results" };
    6062      var newLayerProsessor = new LastSubScopeProcessor();
    6163      var layerInitializer = new Assigner() { Name = "Init Layer" };
     64      var correctAgeProcessor = new UniformSubScopesProcessor() { Name = "Hack: Decrement Age" };
     65      var correctAgeDecrementor = new IntCounter() { Name = "Age = Age - 1" };
    6266      var incrEvaluatedSolutionsForNewLayer = new SubScopesCounter() { Name = "Update EvaluatedSolutions" };
    6367      var newResultCollectionAssigner = new Assigner() { Name = "Empty Results" };
     
    9498
    9599      openNewLayerBranch.ConditionParameter.ActualName = "OpenNewLayer";
    96       openNewLayerBranch.TrueBranch = layerCloner;
     100      openNewLayerBranch.TrueBranch = layerCreator;
    97101      openNewLayerBranch.Successor = regenerateLayerZeroProsessor;
    98102
    99       layerCloner.Successor = newLayerProsessor;
     103      //layerCloner.Successor = newLayerProsessor;
     104      layerCreator.Successor = newLayerProsessor;
    100105
    101       newLayerProsessor.Operator = layerInitializer;
     106      //newLayerProsessor.Operator = layerInitializer;
     107      newLayerProsessor.Operator = incrEvaluatedSolutionsForNewLayer;
    102108      newLayerProsessor.Successor = incrOpenLayers;
    103109
    104110      layerInitializer.LeftSideParameter.ActualName = "Layer";
    105111      layerInitializer.RightSideParameter.ActualName = "OpenLayers";
    106       layerInitializer.Successor = incrEvaluatedSolutionsForNewLayer;
     112      layerInitializer.Successor = correctAgeProcessor;
     113
     114      correctAgeProcessor.Operator = correctAgeDecrementor;
     115      correctAgeProcessor.Successor = incrEvaluatedSolutionsForNewLayer;
     116
     117      correctAgeDecrementor.Increment = new IntValue(-1);
     118      correctAgeDecrementor.ValueParameter.ActualName = "Age";
    107119
    108120      incrEvaluatedSolutionsForNewLayer.ValueParameter.ActualName = "EvaluatedSolutions";
    109121      incrEvaluatedSolutionsForNewLayer.AccumulateParameter.Value = new BoolValue(true);
    110       incrEvaluatedSolutionsForNewLayer.Successor = newResultCollectionAssigner;
     122      //incrEvaluatedSolutionsForNewLayer.Successor = newResultCollectionAssigner;
     123      incrEvaluatedSolutionsForNewLayer.Successor = mainOperator;
    111124
    112125      newResultCollectionAssigner.LeftSideParameter.ActualName = "Results";
     
    117130      incrOpenLayers.ValueParameter.ActualName = "OpenLayers";
    118131      incrOpenLayers.Increment = new IntValue(1);
    119       incrOpenLayers.Successor = null;
     132      incrOpenLayers.Successor = newLayerResultsCollector;
     133
     134      newLayerResultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("LayerResults", "Result set for each layer", "Results"));
     135      newLayerResultsCollector.CopyValue = new BoolValue(false);
     136      newLayerResultsCollector.Successor = null;
    120137
    121138      regenerateLayerZeroProsessor.Operator = subScopesRemover;
     
    137154
    138155      resetGenSlr.LeftSideParameter.ActualName = "GenerationsSinceLastRefresh";
    139       resetGenSlr.RightSideParameter.Value = new IntValue(1);
     156      resetGenSlr.RightSideParameter.Value = new IntValue(0);
    140157      resetGenSlr.Successor = null;
    141158    }
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MatingPoolCreator.cs

    r11586 r11609  
    4545      var subPopulations = ExecutionContext.Scope.SubScopes;
    4646
    47       for (int i = subPopulations.Count - 1; i > 0; i++) {
     47      for (int i = subPopulations.Count - 1; i > 0; i--) {
    4848        var currentSubPopulation = subPopulations[i].SubScopes;
    4949        var prevSubPopulation = subPopulations[i - 1].SubScopes;
Note: See TracChangeset for help on using the changeset viewer.