Changeset 11609 for branches/ALPS
- Timestamp:
- 12/01/14 16:23:24 (10 years ago)
- 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 254 254 255 255 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())); 257 257 layerVariableCreator.Successor = layerSolutionsCreator; 258 258 … … 275 275 initializeGlobalEvaluatedSolutions.Successor = resultsCollector; 276 276 277 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions"));277 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions")); 278 278 resultsCollector.Successor = mainLoop; 279 279 … … 375 375 MainLoop.LayerUpdator.SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name; 376 376 MainLoop.LayerUpdator.SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name; 377 378 377 } 379 378 private void ParameterizeMainLoop() { … … 387 386 MainLoop.EldersEmigrator.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 388 387 MainLoop.EldersEmigrator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 388 MainLoop.LayerUpdator.SolutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name; 389 389 } 390 390 private void ParameterizeSelectors() { -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithmMainLoop.cs
r11590 r11609 74 74 75 75 var variableCreator = new VariableCreator() { Name = "Initialize" }; 76 var resultsCollector = new ResultsCollector();77 var initAnalyzerPlaceholder = new Placeholder() { Name = "Analyzer (Placeholder)" };78 76 var initLayerAnalyzerProcessor = new SubScopesProcessor(); 79 77 var layerVariableCreator = new VariableCreator() { Name = "Initialize Layer" }; 80 78 var initLayerAnalyzerPlaceholder = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" }; 79 var initAnalyzerPlaceholder = new Placeholder() { Name = "Analyzer (Placeholder)" }; 80 var resultsCollector = new ResultsCollector(); 81 81 var matingPoolCreator = new MatingPoolCreator() { Name = "Create Mating Pools" }; 82 82 var matingPoolProcessor = new UniformSubScopesProcessor(); … … 97 97 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastRefresh", new IntValue(0))); 98 98 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; 107 100 108 101 initLayerAnalyzerProcessor.Operators.Add(layerVariableCreator); 109 initLayerAnalyzerProcessor.Successor = matingPoolCreator;102 initLayerAnalyzerProcessor.Successor = initAnalyzerPlaceholder; 110 103 111 104 layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("LayerEvaluatedSolutions")); … … 115 108 initLayerAnalyzerPlaceholder.OperatorParameter.ActualName = LayerAnalyzerParameter.Name; 116 109 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; 117 119 118 120 matingPoolCreator.Successor = matingPoolProcessor; -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/EldersSelector.cs
r11586 r11609 65 65 int layer = LayerParameter.ActualValue.Value; 66 66 67 if (layer >= numberOfLayers ) // is max layer?67 if (layer >= numberOfLayers - 1) // is max layer? 68 68 return new IScope[0]; 69 69 70 70 int limit = ageLimits[layer]; 71 var elders =71 var eldersQuery = 72 72 from scope in scopes 73 73 let age = ((IntValue)scope.Variables["Age"].Value).Value … … 75 75 select scope; 76 76 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; 78 84 } 79 85 } -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/HeuristicLab.Algorithms.ALPS-3.3.csproj
r11590 r11609 84 84 <Compile Include="EldersSelector.cs" /> 85 85 <Compile Include="LastSubScopeCloner.cs" /> 86 <Compile Include="LayerCreator.cs" /> 86 87 <Compile Include="LayerUpdator.cs" /> 87 88 <Compile Include="MatingPoolCreator.cs" /> -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LastSubScopeCloner.cs
r11590 r11609 57 57 var clone = (IScope)lastSubScope.Clone(new Cloner()); 58 58 59 int number; 60 if (int.TryParse(clone.Name, out number)) 61 clone.Name = (number + 1).ToString(); 62 59 63 scopes.Add(clone); 60 64 -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUpdator.cs
r11590 r11609 56 56 var openNewLayerCalculator = new OpenNewLayerCalculator(); 57 57 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" }; 59 60 var incrOpenLayers = new IntCounter() { Name = "Incr. OpenLayers" }; 61 var newLayerResultsCollector = new ResultsCollector() { Name = "Collect new Layer Results" }; 60 62 var newLayerProsessor = new LastSubScopeProcessor(); 61 63 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" }; 62 66 var incrEvaluatedSolutionsForNewLayer = new SubScopesCounter() { Name = "Update EvaluatedSolutions" }; 63 67 var newResultCollectionAssigner = new Assigner() { Name = "Empty Results" }; … … 94 98 95 99 openNewLayerBranch.ConditionParameter.ActualName = "OpenNewLayer"; 96 openNewLayerBranch.TrueBranch = layerC loner;100 openNewLayerBranch.TrueBranch = layerCreator; 97 101 openNewLayerBranch.Successor = regenerateLayerZeroProsessor; 98 102 99 layerCloner.Successor = newLayerProsessor; 103 //layerCloner.Successor = newLayerProsessor; 104 layerCreator.Successor = newLayerProsessor; 100 105 101 newLayerProsessor.Operator = layerInitializer; 106 //newLayerProsessor.Operator = layerInitializer; 107 newLayerProsessor.Operator = incrEvaluatedSolutionsForNewLayer; 102 108 newLayerProsessor.Successor = incrOpenLayers; 103 109 104 110 layerInitializer.LeftSideParameter.ActualName = "Layer"; 105 111 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"; 107 119 108 120 incrEvaluatedSolutionsForNewLayer.ValueParameter.ActualName = "EvaluatedSolutions"; 109 121 incrEvaluatedSolutionsForNewLayer.AccumulateParameter.Value = new BoolValue(true); 110 incrEvaluatedSolutionsForNewLayer.Successor = newResultCollectionAssigner; 122 //incrEvaluatedSolutionsForNewLayer.Successor = newResultCollectionAssigner; 123 incrEvaluatedSolutionsForNewLayer.Successor = mainOperator; 111 124 112 125 newResultCollectionAssigner.LeftSideParameter.ActualName = "Results"; … … 117 130 incrOpenLayers.ValueParameter.ActualName = "OpenLayers"; 118 131 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; 120 137 121 138 regenerateLayerZeroProsessor.Operator = subScopesRemover; … … 137 154 138 155 resetGenSlr.LeftSideParameter.ActualName = "GenerationsSinceLastRefresh"; 139 resetGenSlr.RightSideParameter.Value = new IntValue( 1);156 resetGenSlr.RightSideParameter.Value = new IntValue(0); 140 157 resetGenSlr.Successor = null; 141 158 } -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/MatingPoolCreator.cs
r11586 r11609 45 45 var subPopulations = ExecutionContext.Scope.SubScopes; 46 46 47 for (int i = subPopulations.Count - 1; i > 0; i ++) {47 for (int i = subPopulations.Count - 1; i > 0; i--) { 48 48 var currentSubPopulation = subPopulations[i].SubScopes; 49 49 var prevSubPopulation = subPopulations[i - 1].SubScopes;
Note: See TracChangeset
for help on using the changeset viewer.