Changeset 12142 for branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState
- Timestamp:
- 03/05/15 15:35:15 (10 years ago)
- Location:
- branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithm.cs
r12138 r12142 40 40 public class AlpsSsGeneticAlgorithm : Alps { 41 41 #region Parameter Properties 42 private IValueParameter<Int Array> PopulationSizeParameter {43 get { return (IValueParameter<Int Array>)Parameters["PopulationSize"]; }42 private IValueParameter<IntValue> PopulationSizeParameter { 43 get { return (IValueParameter<IntValue>)Parameters["PopulationSize"]; } 44 44 } 45 45 private IValueParameter<IntValue> MaximumIterationsParameter { … … 67 67 68 68 #region Properties 69 public Int ArrayPopulationSize {69 public IntValue PopulationSize { 70 70 get { return PopulationSizeParameter.Value; } 71 71 set { PopulationSizeParameter.Value = value; } … … 119 119 public AlpsSsGeneticAlgorithm() 120 120 : base() { 121 Parameters.Add(new ValueParameter<Int Array>("PopulationSize", "The size of the population of solutions each layer.", new IntArray(new[] { 100 })));121 Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions each layer.", new IntValue(100))); 122 122 Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of iterations that should be processed.", new IntValue(1000))); 123 123 Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction.")); … … 131 131 var randomCreator = new RandomCreator(); 132 132 var layer0Creator = new SubScopesCreator() { Name = "Create Layer Zero" }; 133 var layer0Processor = new LayerUniformSubScopesProcessor();133 var layer0Processor = new /*Layer*/UniformSubScopesProcessor(); 134 134 var layer0VariableCreator = new VariableCreator(); 135 135 var layer0SolutionsCreator = new SolutionsCreator(); -
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithmMainLoop.cs
r12138 r12142 71 71 72 72 var variableCreator = new VariableCreator() { Name = "Initialize" }; 73 var randomScopeProcessor = new RandomLayerProcessor() { Name = "Select a layer" }; // TODO LayerSubScopeProcessor for Array conversion73 var randomScopeProcessor = new RandomLayerProcessor() { Name = "Select a layer" }; 74 74 var isLayerZeroComperator = new Comparator() { Name = "IsLayerZero = Layer == 0" }; 75 75 var isLayerZeroBranch = new ConditionalBranch() { Name = "IsLayerZero?" }; … … 95 95 var resetTargetIndex = new Assigner() { Name = "TargetIndex = 0" }; 96 96 var clearMatingPool = new SubScopesRemover() { Name = "Clear WorkingScope" }; 97 var tryMoveUp = new EmptyOperator() { Name = "Try Move Up" }; // TODO98 var setNewIndividual = new EmptyOperator() { Name = "Set New Individual" }; // TODO97 var tryMoveUp = new AlpsSsMover() { Name = "Try Move Up" }; 98 var removeWorkingScope = new LeftReducer() { Name = "Remove Working Scope" }; 99 99 var incrIterations = new IntCounter() { Name = "Incr. Iterations" }; 100 var layerAnalyzerProcessor = new UniformSubScopesProcessor(); 101 var layerAnalyzer = new Placeholder() { Name = "LayerAnalyzer (Placeholder)" }; 100 102 var analyzer = new Placeholder() { Name = "Analyzer (Placeholder)" }; 101 103 var iterationsComparator = new Comparator() { Name = "Iterations >= MaximumIterations" }; … … 109 111 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("OpenLayers", new IntValue(1))); 110 112 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("TargetIndex", new IntValue(0))); 111 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations")); 113 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0))); 114 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("MatingPoolSize", new IntValue(0))); 115 variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("ValidParents", new BoolValue(false))); 112 116 variableCreator.Successor = randomScopeProcessor; 113 117 … … 161 165 selectRandomTargetIndex.MinimumParameter.Value = new IntValue(0); 162 166 selectRandomTargetIndex.MaximumParameter.ActualName = "PopulationSize"; 167 selectRandomTargetIndex.MaximumParameter.Value = null; 163 168 selectRandomTargetIndex.Successor = copyLayer; 164 169 … … 199 204 clearMatingPool.Successor = createRandomIndividual; 200 205 201 tryMoveUp.Successor = setNewIndividual;202 203 setNewIndividual.Successor = incrIterations;206 tryMoveUp.Successor = removeWorkingScope; 207 208 removeWorkingScope.Successor = incrIterations; 204 209 205 210 incrIterations.ValueParameter.ActualName = "Iterations"; 206 211 incrIterations.Increment = new IntValue(1); 207 incrIterations.Successor = analyzer; 212 incrIterations.Successor = layerAnalyzerProcessor; 213 214 layerAnalyzerProcessor.Operator = layerAnalyzer; 215 layerAnalyzerProcessor.Successor = analyzer; 216 217 layerAnalyzer.OperatorParameter.ActualName = "LayerAnalyzer"; 208 218 209 219 analyzer.OperatorParameter.ActualName = "Analyzer"; -
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/HeuristicLab.Algorithms.ALPS.SteadyState-3.3.csproj
r12138 r12142 137 137 <Compile Include="AlpsSsGeneticAlgorithmMainLoop.cs" /> 138 138 <Compile Include="AlpsSsGeneticAlgorithmMainOperator.cs" /> 139 <Compile Include="AlpsSsMover.cs" /> 139 140 <Compile Include="Properties\AssemblyInfo.cs" /> 140 141 <Compile Include="Plugin.cs" /> -
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/RandomLayerProcessor.cs
r12136 r12142 41 41 } 42 42 43 private ILookupParameter<IntArray> PopulationSizeParameter {44 get { return (ILookupParameter<IntArray>)Parameters["PopulationSize"]; }45 }46 47 43 public IOperator Operator { 48 44 get { return OperatorParameter.Value; } … … 59 55 Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied on a random sub-scopes of the current scope.")); 60 56 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use.")); 61 62 Parameters.Add(new LookupParameter<IntArray>("PopulationSize"));63 57 } 64 58 … … 74 68 var subScopes = ExecutionContext.Scope.SubScopes; 75 69 int index = random.Next(subScopes.Count); 76 var selectedLayer = subScopes[index]; 77 78 var layerParameters = new LayerIntermediateParameter { 79 new ValueParameter<IntValue>(PopulationSizeParameter.ActualName, new IntValue(PopulationSizeParameter.ActualValue[Math.Min(index, PopulationSizeParameter.ActualValue.Length - 1)])) 80 }; 81 var immediateContext = new ExecutionContext(ExecutionContext.Parent, layerParameters, selectedLayer); 82 next.Insert(0, immediateContext.CreateChildOperation(Operator, selectedLayer)); 70 next.Insert(0, ExecutionContext.CreateOperation(Operator, subScopes[index])); 83 71 } 84 72 return next;
Note: See TracChangeset
for help on using the changeset viewer.