Changeset 12136 for branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithm.cs
- Timestamp:
- 03/05/15 10:51:17 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithm.cs
r12120 r12136 43 43 get { return (IValueParameter<IntArray>)Parameters["PopulationSize"]; } 44 44 } 45 private IValueParameter<IntValue> Maximum GenerationsParameter {46 get { return (IValueParameter<IntValue>)Parameters["Maximum Generations"]; }45 private IValueParameter<IntValue> MaximumIterationsParameter { 46 get { return (IValueParameter<IntValue>)Parameters["MaximumIterations"]; } 47 47 } 48 48 public IConstrainedValueParameter<ISelector> SelectorParameter { … … 71 71 set { PopulationSizeParameter.Value = value; } 72 72 } 73 public IntValue Maximum Generations {74 get { return Maximum GenerationsParameter.Value; }75 set { Maximum GenerationsParameter.Value = value; }73 public IntValue MaximumIterations { 74 get { return MaximumIterationsParameter.Value; } 75 set { MaximumIterationsParameter.Value = value; } 76 76 } 77 77 … … 116 116 : base() { 117 117 Parameters.Add(new ValueParameter<IntArray>("PopulationSize", "The size of the population of solutions each layer.", new IntArray(new[] { 100 }))); 118 Parameters.Add(new ValueParameter<IntValue>("Maximum Generations", "The maximum number of generations that should be processed.", new IntValue(1000)));118 Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of iterations that should be processed.", new IntValue(1000))); 119 119 Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction.")); 120 120 Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions.")); … … 132 132 var initializeAgeProcessor = new UniformSubScopesProcessor(); 133 133 var initializeAge = new VariableCreator() { Name = "Initialize Age" }; 134 var initializeLocalEvaluatedSolutions = new SubScopesCounter() { Name = "Initialize LayerEvaluatedSolutions" }; 134 var initializeLayerPopulationSize = new SubScopesCounter() { Name = "Init LayerPopulationCounter" }; 135 var initializeLocalEvaluatedSolutions = new Assigner() { Name = "Initialize LayerEvaluatedSolutions" }; 135 136 var initializeGlobalEvaluatedSolutions = new DataReducer() { Name = "Initialize EvaluatedSolutions" }; 137 var initializeCurrentPopulationSize = new Assigner() { Name = "CurrentPopulationSize = EvaluatedSolutions" }; 136 138 var resultsCollector = new ResultsCollector(); 137 139 var mainLoop = new AlpsSsGeneticAlgorithmMainLoop(); … … 156 158 157 159 initializeAgeProcessor.Operator = initializeAge; 158 initializeAgeProcessor.Successor = initializeLocalEvaluatedSolutions; 159 160 initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("Age", new IntValue(0))); 161 162 initializeLocalEvaluatedSolutions.ValueParameter.ActualName = "LayerEvaluatedSolutions"; 160 initializeAgeProcessor.Successor = initializeLayerPopulationSize; 161 162 initializeAge.CollectedValues.Add(new ValueParameter<IntValue>("Age", new IntValue(1))); 163 164 initializeLayerPopulationSize.ValueParameter.ActualName = "LayerPopulationSize"; 165 initializeLayerPopulationSize.Successor = initializeLocalEvaluatedSolutions; 166 167 initializeLocalEvaluatedSolutions.LeftSideParameter.ActualName = "LayerEvaluatedSolutions"; 168 initializeLocalEvaluatedSolutions.RightSideParameter.ActualName = "LayerPopulationSize"; 169 initializeLocalEvaluatedSolutions.Successor = null; 163 170 164 171 initializeGlobalEvaluatedSolutions.ReductionOperation.Value.Value = ReductionOperations.Sum; … … 166 173 initializeGlobalEvaluatedSolutions.ParameterToReduce.ActualName = "LayerEvaluatedSolutions"; 167 174 initializeGlobalEvaluatedSolutions.TargetParameter.ActualName = "EvaluatedSolutions"; 168 initializeGlobalEvaluatedSolutions.Successor = resultsCollector; 175 initializeGlobalEvaluatedSolutions.Successor = initializeCurrentPopulationSize; 176 177 initializeCurrentPopulationSize.LeftSideParameter.ActualName = "CurrentPoulationSize"; 178 initializeCurrentPopulationSize.RightSideParameter.ActualName = "EvaluatedSolutions"; 179 initializeCurrentPopulationSize.Successor = resultsCollector; 169 180 170 181 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions")); 182 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Current PopulationSize", null, "CurrentPopulationSize")); 171 183 resultsCollector.Successor = mainLoop; 172 184 … … 252 264 if (Problem != null) { 253 265 foreach (var @operator in Problem.Operators.OfType<IIterationBasedOperator>()) { 254 @operator.IterationsParameter.ActualName = " Generations";266 @operator.IterationsParameter.ActualName = "Iteration"; 255 267 @operator.IterationsParameter.Hidden = true; 256 @operator.MaximumIterationsParameter.ActualName = Maximum GenerationsParameter.Name;268 @operator.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name; 257 269 @operator.MaximumIterationsParameter.Hidden = true; 258 270 }
Note: See TracChangeset
for help on using the changeset viewer.