Changeset 12153
- Timestamp:
- 03/06/15 14:51:28 (10 years ago)
- Location:
- branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithm.cs
r12142 r12153 40 40 public class AlpsSsGeneticAlgorithm : Alps { 41 41 #region Parameter Properties 42 private IValueParameter<IntValue> PopulationSizeParameter {43 get { return (IValueParameter<IntValue>)Parameters[" PopulationSize"]; }42 private IValueParameter<IntValue> LayerSizeParameter { 43 get { return (IValueParameter<IntValue>)Parameters["LayerSize"]; } 44 44 } 45 45 private IValueParameter<IntValue> MaximumIterationsParameter { … … 67 67 68 68 #region Properties 69 public IntValue PopulationSize {70 get { return PopulationSizeParameter.Value; }71 set { PopulationSizeParameter.Value = value; }69 public IntValue LayerSize { 70 get { return LayerSizeParameter.Value; } 71 set { LayerSizeParameter.Value = value; } 72 72 } 73 73 public IntValue MaximumIterations { … … 119 119 public AlpsSsGeneticAlgorithm() 120 120 : base() { 121 Parameters.Add(new ValueParameter<IntValue>(" PopulationSize", "The size of the population of solutions each layer.", new IntValue(100)));121 Parameters.Add(new ValueParameter<IntValue>("LayerSize", "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.")); … … 130 130 131 131 var randomCreator = new RandomCreator(); 132 var layer0Creator = new SubScopesCreator() { Name = "Create Layer Zero" }; 133 var layer0Processor = new /*Layer*/UniformSubScopesProcessor(); 134 var layer0VariableCreator = new VariableCreator(); 135 var layer0SolutionsCreator = new SolutionsCreator(); 132 var workingScopeCreator = new NamedSubScopesCreator() { Name = "Create WorkingScope and Layers-Scope" }; 133 var layersProcessor = new SubScopesProcessor(); 134 var layerCreator = new SubScopesCreator() { Name = "Create Layer" }; 135 var layerProcessor = new /*Layer*/UniformSubScopesProcessor(); 136 var layerVariableCreator = new VariableCreator() { Name = "Initialize Layer" }; 137 var layerSolutionsCreator = new SolutionsCreator(); 136 138 var initializeAgeProcessor = new UniformSubScopesProcessor(); 137 139 var initializeAge = new VariableCreator() { Name = "Initialize Age" }; 138 var initializeLayerPopulationSize = new SubScopesCounter() { Name = "Init LayerPopulationCounter" }; 139 var initializeLocalEvaluatedSolutions = new Assigner() { Name = "Initialize LayerEvaluatedSolutions" }; 140 var initializeGlobalEvaluatedSolutions = new DataReducer() { Name = "Initialize EvaluatedSolutions" }; 141 var initializeCurrentPopulationSize = new Assigner() { Name = "CurrentPopulationSize = EvaluatedSolutions" }; 140 var initializeEvaluatedSolutions = new ExpressionCalculator() { Name = "Initialize EvaluatedSolutions" }; 141 var initializePopulationSize = new Assigner() { Name = "Initialize PopulationSize" }; 142 142 var resultsCollector = new ResultsCollector(); 143 143 var mainLoop = new AlpsSsGeneticAlgorithmMainLoop(); … … 147 147 randomCreator.SeedParameter.Value = null; 148 148 randomCreator.SetSeedRandomlyParameter.Value = null; 149 randomCreator.Successor = layer0Creator; 150 151 layer0Creator.NumberOfSubScopesParameter.Value = new IntValue(1); 152 layer0Creator.Successor = layer0Processor; 153 154 layer0Processor.Operator = layer0VariableCreator; 155 layer0Processor.Successor = initializeGlobalEvaluatedSolutions; 156 157 layer0VariableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Layer", new IntValue(0))); 158 layer0VariableCreator.Successor = layer0SolutionsCreator; 159 160 layer0SolutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name; 161 layer0SolutionsCreator.Successor = initializeAgeProcessor; 149 randomCreator.Successor = workingScopeCreator; 150 151 workingScopeCreator.NamesParameter.Value = new StringArray(new[] { "WorkingScope", "Layers" }); 152 workingScopeCreator.Successor = layersProcessor; 153 154 layersProcessor.Operators.Add(new EmptyOperator()); 155 layersProcessor.Operators.Add(layerCreator); 156 157 layerCreator.NumberOfSubScopesParameter.ActualName = "NumberOfLayers"; 158 layerCreator.NumberOfSubScopesParameter.Value = null; 159 layerCreator.Successor = layerProcessor; 160 161 layerProcessor.Operator = layerVariableCreator; 162 layerProcessor.Successor = initializeEvaluatedSolutions; 163 164 layerVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("LayerResults")); 165 layerVariableCreator.Successor = layerSolutionsCreator; 166 167 layerSolutionsCreator.NumberOfSolutionsParameter.ActualName = LayerSizeParameter.Name; 168 layerSolutionsCreator.Successor = initializeAgeProcessor; 162 169 163 170 initializeAgeProcessor.Operator = initializeAge; 164 initializeAgeProcessor.Successor = initializeLayerPopulationSize;165 171 166 172 initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("EvalsCreated", new IntValue(1))); 167 168 initializeLayerPopulationSize.ValueParameter.ActualName = "LayerPopulationSize"; 169 initializeLayerPopulationSize.Successor = initializeLocalEvaluatedSolutions; 170 171 initializeLocalEvaluatedSolutions.LeftSideParameter.ActualName = "LayerEvaluatedSolutions"; 172 initializeLocalEvaluatedSolutions.RightSideParameter.ActualName = "LayerPopulationSize"; 173 initializeLocalEvaluatedSolutions.Successor = null; 174 175 initializeGlobalEvaluatedSolutions.ReductionOperation.Value.Value = ReductionOperations.Sum; 176 initializeGlobalEvaluatedSolutions.TargetOperation.Value.Value = ReductionOperations.Assign; 177 initializeGlobalEvaluatedSolutions.ParameterToReduce.ActualName = "LayerEvaluatedSolutions"; 178 initializeGlobalEvaluatedSolutions.TargetParameter.ActualName = "EvaluatedSolutions"; 179 initializeGlobalEvaluatedSolutions.Successor = initializeCurrentPopulationSize; 180 181 initializeCurrentPopulationSize.LeftSideParameter.ActualName = "CurrentPoulationSize"; 182 initializeCurrentPopulationSize.RightSideParameter.ActualName = "EvaluatedSolutions"; 183 initializeCurrentPopulationSize.Successor = resultsCollector; 173 initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("LastMove", new IntValue(1))); 174 175 initializeEvaluatedSolutions.ExpressionResultParameter.ActualName = "EvaluatedSolutions"; 176 initializeEvaluatedSolutions.ExpressionParameter.Value = new StringValue("LayerSize NumberOfLayers * toint"); 177 initializeEvaluatedSolutions.CollectedValues.Add(new LookupParameter<IntValue>("LayerSize")); 178 initializeEvaluatedSolutions.CollectedValues.Add(new LookupParameter<IntValue>("NumberOfLayers")); 179 initializeEvaluatedSolutions.Successor = initializePopulationSize; 180 181 initializePopulationSize.LeftSideParameter.ActualName = "PopulationSize"; 182 initializePopulationSize.RightSideParameter.ActualName = "EvaluatedSolutions"; 183 initializePopulationSize.Successor = resultsCollector; 184 184 185 185 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions")); 186 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Current PopulationSize", null, "CurrentPopulationSize"));187 186 resultsCollector.Successor = mainLoop; 188 187 … … 234 233 #region Parameterization 235 234 private void Initialize() { 236 //237 235 } 238 236 private void ParameterizeSolutionsCreator() { 239 //MainLoop.LayerUpdator.SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;240 //MainLoop.LayerUpdator.SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;241 237 } 242 238 private void ParameterizeMainLoop() { 243 239 MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 244 240 MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 245 //MainLoop.MainOperator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;246 //MainLoop.MainOperator.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;247 //MainLoop.MainOperator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;248 //MainLoop.LayerUpdator.SolutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;249 241 } 250 242 private void ParameterizeSelectors() { -
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/HeuristicLab.Algorithms.ALPS.SteadyState-3.3.csproj
r12142 r12153 138 138 <Compile Include="AlpsSsGeneticAlgorithmMainOperator.cs" /> 139 139 <Compile Include="AlpsSsMover.cs" /> 140 <Compile Include="NamedSubScopesCreator.cs" /> 140 141 <Compile Include="Properties\AssemblyInfo.cs" /> 141 142 <Compile Include="Plugin.cs" />
Note: See TracChangeset
for help on using the changeset viewer.