Changeset 12159 for branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState
- Timestamp:
- 03/09/15 10:32:47 (10 years ago)
- Location:
- branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithm.cs
r12157 r12159 135 135 var layerProcessor = new /*Layer*/UniformSubScopesProcessor(); 136 136 var layerVariableCreator = new VariableCreator() { Name = "Initialize Layer" }; 137 var layerNumberCreator = new ScopeIndexAssigner() { Name = "Create Layer Number" }; 137 138 var layerSolutionsCreator = new SolutionsCreator(); 138 139 var initializeAgeProcessor = new UniformSubScopesProcessor(); … … 154 155 layersProcessor.TargetScopeParameter.ActualName = "Layers"; 155 156 layersProcessor.Operator = layerCreator; 157 layersProcessor.Successor = initializeEvaluatedSolutions; 156 158 157 159 layerCreator.NumberOfSubScopesParameter.ActualName = "NumberOfLayers"; … … 160 162 161 163 layerProcessor.Operator = layerVariableCreator; 162 layerProcessor.Successor = initializeEvaluatedSolutions;163 164 164 165 layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("LayerResults")); 165 layerVariableCreator.Successor = layerSolutionsCreator; 166 layerVariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Layer")); 167 layerVariableCreator.Successor = layerNumberCreator; 168 169 layerNumberCreator.ValueParameter.ActualName = "Layer"; 170 layerNumberCreator.Successor = layerSolutionsCreator; 166 171 167 172 layerSolutionsCreator.NumberOfSolutionsParameter.ActualName = LayerSizeParameter.Name; -
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithmMainLoop.cs
r12150 r12159 71 71 72 72 var variableCreator = new VariableCreator() { Name = "Initialize" }; 73 var layersProcessor = new NamedSubScopeProcessor() { Name = "Process Layers" }; 73 74 var randomScopeProcessor = new RandomLayerProcessor() { Name = "Select a layer" }; 74 var layerPopulationSizeCounter = new SubScopesCounter() { Name = "Count LayerPopulationSize" };75 75 var isLayerZeroComperator = new Comparator() { Name = "IsLayerZero = Layer == 0" }; 76 76 var isLayerZeroBranch = new ConditionalBranch() { Name = "IsLayerZero?" }; … … 85 85 var initializeAge = new Assigner() { Name = "Initialize Age" }; 86 86 var selectRandomTargetIndex = new RandomIntAssigner(); 87 var copyLayer = new BestSelector();88 var copyLayerProcessor = new SubScopesProcessor();89 87 var matingPoolCreator = new SteadyStateMatingPoolCreator() { Name = "Create MatingPool" }; 88 var matingPoolProcessor = new NamedSubScopeProcessor() { Name = "Process MatingPool" }; 90 89 var matingPoolSize = new SubScopesCounter() { Name = "MatingPoolSize" }; 91 90 var matingPoolSizeMin2 = new Comparator() { Name = "ValidParents = MatingPoolSize >= 2" }; … … 116 115 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("MatingPoolSize", new IntValue(0))); 117 116 variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("ValidParents", new BoolValue(false))); 118 variableCreator.Successor = randomScopeProcessor; 119 120 randomScopeProcessor.Operator = layerPopulationSizeCounter; 117 variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("IsLayerZero", new BoolValue(false))); 118 variableCreator.Successor = layersProcessor; 119 120 layersProcessor.Operator = randomScopeProcessor; 121 layersProcessor.TargetScopeParameter.ActualName = "Layers"; 122 123 randomScopeProcessor.Operator = isLayerZeroComperator; 121 124 randomScopeProcessor.Successor = incrIterations; 122 123 layerPopulationSizeCounter.ValueParameter.ActualName = "LayerPopulationSize";124 layerPopulationSizeCounter.AccumulateParameter.Value = new BoolValue(false);125 layerPopulationSizeCounter.Successor = isLayerZeroComperator;126 125 127 126 isLayerZeroComperator.LeftSideParameter.ActualName = "Layer"; … … 171 170 selectRandomTargetIndex.LeftSideParameter.ActualName = "TargetIndex"; 172 171 selectRandomTargetIndex.MinimumParameter.Value = new IntValue(0); 173 selectRandomTargetIndex.MaximumParameter.ActualName = "Layer PopulationSize";172 selectRandomTargetIndex.MaximumParameter.ActualName = "LayerSize"; 174 173 selectRandomTargetIndex.MaximumParameter.Value = null; 175 selectRandomTargetIndex.Successor = copyLayer; 176 177 copyLayer.NumberOfSelectedSubScopesParameter.ActualName = "LayerPopulationSize"; 178 copyLayer.CopySelected = new BoolValue(true); 179 copyLayer.Successor = copyLayerProcessor; 180 181 copyLayerProcessor.Operators.Add(new EmptyOperator()); 182 copyLayerProcessor.Operators.Add(matingPoolCreator); 183 184 matingPoolCreator.Successor = matingPoolSize; 174 selectRandomTargetIndex.Successor = matingPoolCreator; 175 176 matingPoolCreator.Successor = matingPoolProcessor; 177 178 matingPoolProcessor.Operator = matingPoolSize; 179 matingPoolProcessor.TargetScopeParameter.ActualName = "WorkingScope"; 185 180 186 181 matingPoolSize.ValueParameter.ActualName = "MatingPoolSize"; -
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/HeuristicLab.Algorithms.ALPS.SteadyState-3.3.csproj
r12157 r12159 144 144 <Compile Include="RandomIntAssigner.cs" /> 145 145 <Compile Include="RandomLayerProcessor.cs" /> 146 <Compile Include="ScopeIndexAssigner.cs" /> 146 147 <Compile Include="SteadyStateMatingPoolCreator.cs" /> 147 148 </ItemGroup> -
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/NamedSubScopeProcessor.cs
r12157 r12159 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data;25 24 using HeuristicLab.Operators; 26 25 using HeuristicLab.Parameters; -
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/SteadyStateMatingPoolCreator.cs
r12136 r12159 32 32 [StorableClass] 33 33 public class SteadyStateMatingPoolCreator : SingleSuccessorOperator { 34 private ILookupParameter<IScope> WorkingScopeParameter { 35 get { return (ILookupParameter<IScope>)Parameters["WorkingScope"]; } 36 } 37 private ILookupParameter<IntValue> LayerParameter { 38 get { return (ILookupParameter<IntValue>)Parameters["Layer"]; } 39 } 34 40 35 41 [StorableConstructor] … … 43 49 public SteadyStateMatingPoolCreator() 44 50 : base() { 51 Parameters.Add(new LookupParameter<IScope>("WorkingScope")); 52 Parameters.Add(new LookupParameter<IntValue>("Layer")); 45 53 } 46 54 47 55 public override IOperation Apply() { 48 var matingPool = ExecutionContext.Scope; 49 var currentLayer = matingPool.Parent; 50 int layerNumber = ((IntValue)currentLayer.Variables["Layer"].Value).Value; 56 int layerNumber = LayerParameter.ActualValue.Value; 57 var workingScope = WorkingScopeParameter.ActualValue; 58 59 var currentLayer = ExecutionContext.Scope; 60 foreach (var individual in currentLayer.SubScopes) { 61 workingScope.SubScopes.Add((IScope)individual.Clone()); 62 } 51 63 52 64 if (layerNumber > 0) { 53 var prevLayer = currentLayer.Parent.SubScopes[layerNumber - 1];54 var prevLayer Individuals = prevLayer.SubScopes;65 var layers = currentLayer.Parent; 66 var prevLayer = layers.SubScopes[layerNumber - 1]; 55 67 56 foreach (var individual in prevLayer Individuals) {57 matingPool.SubScopes.Add((IScope)individual.Clone());68 foreach (var individual in prevLayer.SubScopes) { 69 workingScope.SubScopes.Add((IScope)individual.Clone()); 58 70 } 59 71 }
Note: See TracChangeset
for help on using the changeset viewer.