Changeset 12150 for branches/ALPS
- Timestamp:
- 03/06/15 13:24:42 (10 years ago)
- Location:
- branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithmMainLoop.cs
r12142 r12150 72 72 var variableCreator = new VariableCreator() { Name = "Initialize" }; 73 73 var randomScopeProcessor = new RandomLayerProcessor() { Name = "Select a layer" }; 74 var layerPopulationSizeCounter = new SubScopesCounter() { Name = "Count LayerPopulationSize" }; 74 75 var isLayerZeroComperator = new Comparator() { Name = "IsLayerZero = Layer == 0" }; 75 76 var isLayerZeroBranch = new ConditionalBranch() { Name = "IsLayerZero?" }; … … 97 98 var tryMoveUp = new AlpsSsMover() { Name = "Try Move Up" }; 98 99 var removeWorkingScope = new LeftReducer() { Name = "Remove Working Scope" }; 100 var incrementEvaluations = new IntCounter() { Name = "incr. EvaluatedSolutions" }; 99 101 var incrIterations = new IntCounter() { Name = "Incr. Iterations" }; 100 102 var layerAnalyzerProcessor = new UniformSubScopesProcessor(); … … 116 118 variableCreator.Successor = randomScopeProcessor; 117 119 118 randomScopeProcessor.Operator = isLayerZeroComperator; 120 randomScopeProcessor.Operator = layerPopulationSizeCounter; 121 randomScopeProcessor.Successor = incrIterations; 122 123 layerPopulationSizeCounter.ValueParameter.ActualName = "LayerPopulationSize"; 124 layerPopulationSizeCounter.AccumulateParameter.Value = new BoolValue(false); 125 layerPopulationSizeCounter.Successor = isLayerZeroComperator; 119 126 120 127 isLayerZeroComperator.LeftSideParameter.ActualName = "Layer"; … … 164 171 selectRandomTargetIndex.LeftSideParameter.ActualName = "TargetIndex"; 165 172 selectRandomTargetIndex.MinimumParameter.Value = new IntValue(0); 166 selectRandomTargetIndex.MaximumParameter.ActualName = " PopulationSize";173 selectRandomTargetIndex.MaximumParameter.ActualName = "LayerPopulationSize"; 167 174 selectRandomTargetIndex.MaximumParameter.Value = null; 168 175 selectRandomTargetIndex.Successor = copyLayer; … … 178 185 179 186 matingPoolSize.ValueParameter.ActualName = "MatingPoolSize"; 187 matingPoolSize.AccumulateParameter.Value = new BoolValue(false); 180 188 matingPoolSize.Successor = matingPoolSizeMin2; 181 189 … … 206 214 tryMoveUp.Successor = removeWorkingScope; 207 215 208 removeWorkingScope.Successor = incrIterations; 216 removeWorkingScope.Successor = incrementEvaluations; 217 218 incrementEvaluations.Increment = new IntValue(1); 219 incrementEvaluations.ValueParameter.ActualName = "EvaluatedSolutions"; 209 220 210 221 incrIterations.ValueParameter.ActualName = "Iterations"; -
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithmMainOperator.cs
r12138 r12150 50 50 var subScopesRemover = new SubScopesRemover(); 51 51 var evaluator = new Placeholder() { Name = "Evaluator (Placeholder)" }; 52 var incrementEvaluations = new IntCounter() { Name = "incr. EvaluatedSolutions" };52 53 53 54 54 OperatorGraph.InitialOperator = selector; … … 80 80 81 81 evaluator.OperatorParameter.ActualName = "Evaluator"; 82 evaluator.Successor = incrementEvaluations;83 84 incrementEvaluations.Increment = new IntValue(1);85 incrementEvaluations.ValueParameter.ActualName = "EvaluatedSolutions";86 82 } 87 83 } -
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsMover.cs
r12142 r12150 77 77 78 78 if (i < n) { 79 TryMoveUp(gs, newIndividual, i, j, n, m, random);79 TryMoveUp(gs, newIndividual, layer, i, j, n, m, random); 80 80 layer.SubScopes[j] = newIndividual; 81 81 newIndividual.Name = j.ToString(); … … 85 85 } 86 86 87 private void TryMoveUp(IScope gs, IScope individual, int i, int j, int n, int m, IRandom random) {87 private void TryMoveUp(IScope gs, IScope individual, IScope layer, int i, int j, int n, int m, IRandom random) { 88 88 if (i < n) { 89 89 if (gs.SubScopes.Count <= i + 1) { 90 90 var newLayer = new Scope((i + 1).ToString()); 91 91 newLayer.Variables.Add(new Variable("Layer", new IntValue(i + 1))); 92 newLayer.Variables.Add(new Variable("LayerPopulationSize", new IntValue(1))); 92 93 gs.SubScopes.Add(newLayer); 93 94 } … … 96 97 var replaceIndex = FindReplaceable(higherLayer, individual, random, m); 97 98 if (replaceIndex.HasValue) { 98 TryMoveUp(gs, higherLayer.SubScopes[j], i + 1, replaceIndex.Value, n, m, random); // TODO higherlayer[j] does not exist 99 if (replaceIndex.Value >= higherLayer.SubScopes.Count) 100 higherLayer.SubScopes.Add(individual); 101 else 102 higherLayer.SubScopes[replaceIndex.Value] = individual; 99 var replacedIndividual = layer.SubScopes[j]; 100 if (replaceIndex.Value >= higherLayer.SubScopes.Count) { 101 higherLayer.SubScopes.Add(replacedIndividual); 102 } else { 103 TryMoveUp(gs, higherLayer.SubScopes[j], higherLayer, i + 1, replaceIndex.Value, n, m, random); 104 // TODO higherlayer[j] does not exist 105 higherLayer.SubScopes[replaceIndex.Value] = replacedIndividual; 106 } 103 107 } 104 108 }
Note: See TracChangeset
for help on using the changeset viewer.