- Timestamp:
- 01/21/11 22:51:59 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithm.cs
r5346 r5352 135 135 } 136 136 private GeneticAlgorithmMainLoop GeneticAlgorithmMainLoop { 137 get { return (GeneticAlgorithmMainLoop)(( Assigner)SolutionsCreator.Successor).Successor; }137 get { return (GeneticAlgorithmMainLoop)((SubScopesCounter)SolutionsCreator.Successor).Successor; } 138 138 } 139 139 [Storable] … … 156 156 RandomCreator randomCreator = new RandomCreator(); 157 157 SolutionsCreator solutionsCreator = new SolutionsCreator(); 158 Assigner assigner = new Assigner();158 SubScopesCounter subScopesCounter = new SubScopesCounter(); 159 159 GeneticAlgorithmMainLoop geneticAlgorithmMainLoop = new GeneticAlgorithmMainLoop(); 160 160 OperatorGraph.InitialOperator = randomCreator; … … 168 168 169 169 solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name; 170 solutionsCreator.Successor = assigner; 171 172 assigner.Name = "Initialize EvaluatedSolutions"; 173 assigner.LeftSideParameter.ActualName = "EvaluatedSolutions"; 174 assigner.RightSideParameter.ActualName = PopulationSizeParameter.Name; 175 assigner.Successor = geneticAlgorithmMainLoop; 170 solutionsCreator.Successor = subScopesCounter; 171 172 subScopesCounter.Name = "Initialize EvaluatedSolutions"; 173 subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions"; 174 subScopesCounter.Successor = geneticAlgorithmMainLoop; 176 175 177 176 geneticAlgorithmMainLoop.SelectorParameter.ActualName = SelectorParameter.Name; -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithmMainLoop.cs
r5346 r5352 134 134 UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor(); 135 135 Placeholder evaluator = new Placeholder(); 136 IntCounter intCounter1 = new IntCounter();136 SubScopesCounter subScopesCounter = new SubScopesCounter(); 137 137 SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor(); 138 138 BestSelector bestSelector = new BestSelector(); 139 139 RightReducer rightReducer = new RightReducer(); 140 140 MergingReducer mergingReducer = new MergingReducer(); 141 IntCounter intCounter 2= new IntCounter();141 IntCounter intCounter = new IntCounter(); 142 142 Comparator comparator = new Comparator(); 143 143 ResultsCollector resultsCollector2 = new ResultsCollector(); … … 175 175 evaluator.OperatorParameter.ActualName = "Evaluator"; 176 176 177 intCounter1.Name = "Increment EvaluatedSolutions"; 178 intCounter1.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 179 intCounter1.Increment = null; 180 intCounter1.IncrementParameter.ActualName = PopulationSizeParameter.Name; 177 subScopesCounter.Name = "Increment EvaluatedSolutions"; 178 subScopesCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 181 179 182 180 bestSelector.CopySelected = new BoolValue(false); … … 185 183 bestSelector.QualityParameter.ActualName = "Quality"; 186 184 187 intCounter 2.Increment = new IntValue(1);188 intCounter 2.ValueParameter.ActualName = "Generations";185 intCounter.Increment = new IntValue(1); 186 intCounter.ValueParameter.ActualName = "Generations"; 189 187 190 188 comparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual); … … 222 220 subScopesRemover.Successor = null; 223 221 uniformSubScopesProcessor2.Operator = evaluator; 224 uniformSubScopesProcessor2.Successor = intCounter1;222 uniformSubScopesProcessor2.Successor = subScopesCounter; 225 223 evaluator.Successor = null; 226 intCounter1.Successor = null;224 subScopesCounter.Successor = null; 227 225 subScopesProcessor2.Operators.Add(bestSelector); 228 226 subScopesProcessor2.Operators.Add(new EmptyOperator()); … … 230 228 bestSelector.Successor = rightReducer; 231 229 rightReducer.Successor = null; 232 mergingReducer.Successor = intCounter 2;233 intCounter 2.Successor = comparator;230 mergingReducer.Successor = intCounter; 231 intCounter.Successor = comparator; 234 232 comparator.Successor = resultsCollector2; 235 233 resultsCollector2.Successor = analyzer2; -
trunk/sources/HeuristicLab.Operators/3.3/IntCounter.cs
r5208 r5352 33 33 [StorableClass] 34 34 public sealed class IntCounter : SingleSuccessorOperator { 35 private object locker = new object();36 35 37 36 public LookupParameter<IntValue> ValueParameter { … … 62 61 63 62 public override IOperation Apply() { 64 lock (locker) { 65 if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new IntValue(); 66 ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value; 67 } 63 if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new IntValue(); 64 ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value; 68 65 return base.Apply(); 69 66 }
Note: See TracChangeset
for help on using the changeset viewer.