Changeset 8086 for branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearchMainLoop.cs
- Timestamp:
- 06/22/12 11:11:38 (12 years ago)
- Location:
- branches/ScatterSearch (trunk integration)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ScatterSearch (trunk integration)
- Property svn:ignore
-
old new 20 20 bin 21 21 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearchMainLoop.cs
r7954 r8086 92 92 get { return (IValueLookupParameter<ISimilarityCalculator>)Parameters["SimilarityCalculator"]; } 93 93 } 94 public IValueLookupParameter<ISolutionCreator> SolutionCreatorParameter {95 get { return (IValueLookupParameter<ISolutionCreator>)Parameters["SolutionCreator"]; }96 }97 94 public IValueLookupParameter<IItem> TargetParameter { 98 95 get { return (IValueLookupParameter<IItem>)Parameters["Target"]; } … … 173 170 set { SimilarityCalculatorParameter.ActualValue = value; } 174 171 } 175 private ISolutionCreator SolutionCreator {176 get { return SolutionCreatorParameter.ActualValue; }177 set { SolutionCreatorParameter.ActualValue = value; }178 }179 172 private IItem Target { 180 173 get { return TargetParameter.ActualValue; } … … 194 187 private void Initialize() { 195 188 #region Create parameters 196 Parameters.Add(new ValueLookupParameter<IMultiAnalyzer>("Analyzer")); 197 Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality")); 198 Parameters.Add(new ValueLookupParameter<ICrossover>("Crossover")); 199 Parameters.Add(new ValueLookupParameter<IntValue>("EvaluatedSolutions")); 200 Parameters.Add(new ValueLookupParameter<IEvaluator>("Evaluator")); 201 Parameters.Add(new ValueLookupParameter<BoolValue>("ExecutePathRelinking")); 202 Parameters.Add(new ValueLookupParameter<IImprovementOperator>("Improver")); 203 Parameters.Add(new ValueLookupParameter<IntValue>("Iterations")); 204 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization")); 205 Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations")); 206 Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfHighQualitySolutions")); 207 Parameters.Add(new ValueLookupParameter<IPathRelinker>("PathRelinker")); 208 Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize")); 209 Parameters.Add(new ValueLookupParameter<IntValue>("ReferenceSetSize")); 210 Parameters.Add(new ValueLookupParameter<DoubleValue>("Quality")); 211 Parameters.Add(new ValueLookupParameter<IRandom>("Random")); 212 Parameters.Add(new ValueLookupParameter<VariableCollection>("Results")); 213 Parameters.Add(new ValueLookupParameter<ISimilarityCalculator>("SimilarityCalculator")); 214 Parameters.Add(new ValueLookupParameter<ISolutionCreator>("SolutionCreator")); 215 Parameters.Add(new ValueLookupParameter<IItem>("Target")); 189 Parameters.Add(new ValueLookupParameter<IMultiAnalyzer>("Analyzer", "The analyzer used to analyze each iteration.")); 190 Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far.")); 191 Parameters.Add(new ValueLookupParameter<ICrossover>("Crossover", "The operator used to cross solutions.")); 192 Parameters.Add(new ValueLookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated.")); 193 Parameters.Add(new ValueLookupParameter<IEvaluator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization.")); 194 Parameters.Add(new ValueLookupParameter<BoolValue>("ExecutePathRelinking", "True if path relinking should be executed instead of crossover, otherwise false.")); 195 Parameters.Add(new ValueLookupParameter<IImprovementOperator>("Improver", "The operator used to improve solutions.")); 196 Parameters.Add(new ValueLookupParameter<IntValue>("Iterations", "The number of iterations performed.")); 197 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false.")); 198 Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations which should be processed.")); 199 Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfHighQualitySolutions", "The number of high quality solutions in the reference set.")); 200 Parameters.Add(new ValueLookupParameter<IPathRelinker>("PathRelinker", "The operator used to execute path relinking.")); 201 Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population of solutions.")); 202 Parameters.Add(new ValueLookupParameter<IntValue>("ReferenceSetSize", "The size of the reference set.")); 203 Parameters.Add(new ValueLookupParameter<DoubleValue>("Quality", "This parameter is used for name translation only.")); 204 Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator.")); 205 Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored.")); 206 Parameters.Add(new ValueLookupParameter<ISimilarityCalculator>("SimilarityCalculator", "The operator used to calculate the similarity between two solutions.")); 207 Parameters.Add(new ValueLookupParameter<IItem>("Target", "This parameter is used for name translation only.")); 216 208 #endregion 217 209 … … 239 231 SolutionPoolUpdateMethod solutionPoolUpdateMethod = new SolutionPoolUpdateMethod(); 240 232 SolutionsCreator solutionsCreator = new SolutionsCreator(); 241 SubScopesCounter subScopesCounter1 = new SubScopesCounter();242 SubScopesCounter subScopesCounter2 = new SubScopesCounter();233 DataReducer dataReducer1 = new DataReducer(); 234 DataReducer dataReducer2 = new DataReducer(); 243 235 SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor(); 244 236 SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor(); 245 237 SubScopesProcessor subScopesProcessor3 = new SubScopesProcessor(); 238 SubScopesProcessor subScopesProcessor4 = new SubScopesProcessor(); 246 239 ConditionalBranch terminateBranch = new ConditionalBranch(); 247 240 UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor(); … … 253 246 #region Create operator graph 254 247 OperatorGraph.InitialOperator = variableCreator; 255 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>( "Iterations", new IntValue(0)));248 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>(IterationsParameter.Name, new IntValue(0))); 256 249 variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("NewSolutions", new BoolValue(false))); 257 250 variableCreator.Successor = resultsCollector; … … 264 257 iterationsChecker.Name = "IterationsChecker"; 265 258 iterationsChecker.Comparison.Value = ComparisonType.GreaterOrEqual; 266 iterationsChecker.LeftSideParameter.ActualName = "Iterations";267 iterationsChecker.RightSideParameter.ActualName = "MaximumIterations";259 iterationsChecker.LeftSideParameter.ActualName = IterationsParameter.Name; 260 iterationsChecker.RightSideParameter.ActualName = MaximumIterationsParameter.Name; 268 261 iterationsChecker.ResultParameter.ActualName = "Terminate"; 269 262 iterationsChecker.Successor = terminateBranch; … … 273 266 terminateBranch.FalseBranch = referenceSetUpdateMethod; 274 267 275 referenceSetUpdateMethod.TargetParameter.ActualName = TargetParameter.ActualName;276 268 referenceSetUpdateMethod.Successor = assigner1; 277 269 … … 305 297 306 298 pathRelinker.Name = "PathRelinker"; 307 pathRelinker.OperatorParameter.ActualName = "PathRelinker";299 pathRelinker.OperatorParameter.ActualName = PathRelinkerParameter.Name; 308 300 pathRelinker.Successor = offspringProcessor; 309 301 310 302 crossover.Name = "Crossover"; 311 crossover.OperatorParameter.ActualName = "Crossover";303 crossover.OperatorParameter.ActualName = CrossoverParameter.Name; 312 304 crossover.Successor = offspringProcessor; 313 305 … … 326 318 uniformSubScopesProcessor2.DepthParameter.Value = new IntValue(2); 327 319 uniformSubScopesProcessor2.Operator = solutionImprover1; 328 uniformSubScopesProcessor2.Successor = subScopes Counter1;320 uniformSubScopesProcessor2.Successor = subScopesProcessor4; 329 321 330 322 solutionImprover1.Name = "SolutionImprover"; 331 solutionImprover1.OperatorParameter.ActualName = "Improver";323 solutionImprover1.OperatorParameter.ActualName = ImproverParameter.Name; 332 324 solutionImprover1.Successor = solutionEvaluator1; 333 325 334 326 solutionEvaluator1.Name = "SolutionEvaluator"; 335 solutionEvaluator1.OperatorParameter.ActualName = "Evaluator"; 336 337 subScopesCounter1.Name = "Increment EvaluatedSolutions"; 338 subScopesCounter1.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 327 solutionEvaluator1.OperatorParameter.ActualName = EvaluatorParameter.Name; 328 329 subScopesProcessor4.Operators.Add(dataReducer1); 330 331 dataReducer1.Name = "Increment EvaluatedSolutions"; 332 dataReducer1.ParameterToReduce.ActualName = "LocalEvaluatedSolutions"; 333 dataReducer1.TargetParameter.ActualName = EvaluatedSolutionsParameter.Name; 334 dataReducer1.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum); 335 dataReducer1.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum); 339 336 340 337 solutionPoolUpdateMethod.QualityParameter.ActualName = QualityParameter.ActualName; 341 solutionPoolUpdateMethod.TargetParameter.ActualName = TargetParameter.ActualName;342 338 solutionPoolUpdateMethod.Successor = analyzer; 343 339 344 340 analyzer.Name = "Analyzer"; 345 analyzer.OperatorParameter.ActualName = "Analyzer";341 analyzer.OperatorParameter.ActualName = AnalyzerParameter.Name; 346 342 347 343 newSolutionsBranch.Name = "NewSolutionsChecker"; … … 359 355 360 356 solutionsCreator.Name = "DiversificationGenerationMethod"; 361 solutionsCreator.NumberOfSolutionsParameter.ActualName = "PopulationSize";357 solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name; 362 358 solutionsCreator.Successor = uniformSubScopesProcessor3; 363 359 364 360 uniformSubScopesProcessor3.DepthParameter.Value = new IntValue(1); 365 361 uniformSubScopesProcessor3.Operator = solutionImprover2; 366 uniformSubScopesProcessor3.Successor = subScopesCounter2;362 uniformSubScopesProcessor3.Successor = dataReducer2; 367 363 368 364 solutionImprover2.Name = "SolutionImprover"; 369 solutionImprover2.OperatorParameter.ActualName = "Improver";365 solutionImprover2.OperatorParameter.ActualName = ImproverParameter.Name; 370 366 solutionImprover2.Successor = solutionEvaluator2; 371 367 372 368 solutionEvaluator2.Name = "SolutionEvaluator"; 373 solutionEvaluator2.OperatorParameter.ActualName = "Evaluator"; 374 375 subScopesCounter2.Name = "Increment EvaluatedSolutions"; 376 subScopesCounter2.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 369 solutionEvaluator2.OperatorParameter.ActualName = EvaluatorParameter.Name; 370 371 dataReducer2.Name = "Increment EvaluatedSolutions"; 372 dataReducer2.ParameterToReduce.ActualName = "LocalEvaluatedSolutions"; 373 dataReducer2.TargetParameter.ActualName = EvaluatedSolutionsParameter.Name; 374 dataReducer2.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum); 375 dataReducer2.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum); 377 376 378 377 iterationsCounter.Name = "IterationCounter"; 379 378 iterationsCounter.IncrementParameter.Value = new IntValue(1); 380 iterationsCounter.ValueParameter.ActualName = "Iterations";379 iterationsCounter.ValueParameter.ActualName = IterationsParameter.Name; 381 380 iterationsCounter.Successor = resultsCollector; 382 381 #endregion
Note: See TracChangeset
for help on using the changeset viewer.