- Timestamp:
- 06/04/12 16:48:59 (12 years ago)
- Location:
- branches/ScatterSearch (trunk integration)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearch.cs
r7789 r7954 194 194 Placeholder solutionEvaluator = new Placeholder(); 195 195 Placeholder solutionImprover = new Placeholder(); 196 SubScopesCounter subScopesCounter = new SubScopesCounter(); 197 ResultsCollector resultsCollector = new ResultsCollector(); 196 198 BestSelector bestSelector = new BestSelector(); 197 199 ScatterSearchMainLoop mainLoop = new ScatterSearchMainLoop(); … … 210 212 211 213 uniformSubScopesProcessor.Operator = solutionImprover; 212 uniformSubScopesProcessor.Successor = bestSelector;214 uniformSubScopesProcessor.Successor = subScopesCounter; 213 215 214 216 solutionImprover.Name = "SolutionImprover"; … … 219 221 solutionEvaluator.OperatorParameter.ActualName = "Evaluator"; 220 222 solutionEvaluator.Successor = null; 223 224 subScopesCounter.Name = "Initialize EvaluatedSolutions"; 225 subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions"; 226 subScopesCounter.Successor = resultsCollector; 227 228 resultsCollector.Name = "ResultsCollector"; 229 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("EvaluatedSolutions", null, "EvaluatedSolutions")); 230 resultsCollector.Successor = bestSelector; 221 231 222 232 bestSelector.NumberOfSelectedSubScopesParameter.ActualName = NumberOfHighQualitySolutionsParameter.Name; -
branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearchMainLoop.cs
r7789 r7954 47 47 get { return (IValueLookupParameter<ICrossover>)Parameters["Crossover"]; } 48 48 } 49 public IValueLookupParameter<IntValue> EvaluatedSolutionsParameter { 50 get { return (IValueLookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 51 } 49 52 public IValueLookupParameter<IEvaluator> EvaluatorParameter { 50 53 get { return (IValueLookupParameter<IEvaluator>)Parameters["Evaluator"]; } … … 109 112 get { return CrossoverParameter.ActualValue; } 110 113 set { CrossoverParameter.ActualValue = value; } 114 } 115 private IntValue EvaluatedSolutions { 116 get { return EvaluatedSolutionsParameter.ActualValue; } 117 set { EvaluatedSolutionsParameter.ActualValue = value; } 111 118 } 112 119 private IEvaluator Evaluator { … … 190 197 Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality")); 191 198 Parameters.Add(new ValueLookupParameter<ICrossover>("Crossover")); 199 Parameters.Add(new ValueLookupParameter<IntValue>("EvaluatedSolutions")); 192 200 Parameters.Add(new ValueLookupParameter<IEvaluator>("Evaluator")); 193 201 Parameters.Add(new ValueLookupParameter<BoolValue>("ExecutePathRelinking")); … … 231 239 SolutionPoolUpdateMethod solutionPoolUpdateMethod = new SolutionPoolUpdateMethod(); 232 240 SolutionsCreator solutionsCreator = new SolutionsCreator(); 241 SubScopesCounter subScopesCounter1 = new SubScopesCounter(); 242 SubScopesCounter subScopesCounter2 = new SubScopesCounter(); 233 243 SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor(); 234 244 SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor(); … … 316 326 uniformSubScopesProcessor2.DepthParameter.Value = new IntValue(2); 317 327 uniformSubScopesProcessor2.Operator = solutionImprover1; 328 uniformSubScopesProcessor2.Successor = subScopesCounter1; 318 329 319 330 solutionImprover1.Name = "SolutionImprover"; … … 323 334 solutionEvaluator1.Name = "SolutionEvaluator"; 324 335 solutionEvaluator1.OperatorParameter.ActualName = "Evaluator"; 336 337 subScopesCounter1.Name = "Increment EvaluatedSolutions"; 338 subScopesCounter1.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 325 339 326 340 solutionPoolUpdateMethod.QualityParameter.ActualName = QualityParameter.ActualName; … … 350 364 uniformSubScopesProcessor3.DepthParameter.Value = new IntValue(1); 351 365 uniformSubScopesProcessor3.Operator = solutionImprover2; 366 uniformSubScopesProcessor3.Successor = subScopesCounter2; 352 367 353 368 solutionImprover2.Name = "SolutionImprover"; … … 357 372 solutionEvaluator2.Name = "SolutionEvaluator"; 358 373 solutionEvaluator2.OperatorParameter.ActualName = "Evaluator"; 374 375 subScopesCounter2.Name = "Increment EvaluatedSolutions"; 376 subScopesCounter2.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 359 377 360 378 iterationsCounter.Name = "IterationCounter"; -
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/Improvers/SingleObjectiveTestFunctionImprovementOperator.cs
r7789 r7954 45 45 get { return (IValueParameter<DoubleValue>)Parameters["Beta"]; } 46 46 } 47 public IValueLookupParameter<DoubleMatrix> BoundsParameter { 48 get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; } 49 } 47 50 public ScopeParameter CurrentScopeParameter { 48 51 get { return (ScopeParameter)Parameters["CurrentScope"]; } … … 74 77 private DoubleValue Beta { 75 78 get { return BetaParameter.Value; } 79 } 80 private DoubleMatrix Bounds { 81 get { return BoundsParameter.ActualValue; } 76 82 } 77 83 public IScope CurrentScope { … … 109 115 Parameters.Add(new ValueParameter<DoubleValue>("Alpha", new DoubleValue(1.0))); 110 116 Parameters.Add(new ValueParameter<DoubleValue>("Beta", new DoubleValue(2.0))); 117 Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds")); 111 118 Parameters.Add(new ScopeParameter("CurrentScope")); 112 119 Parameters.Add(new ValueParameter<DoubleValue>("Delta", new DoubleValue(0.5))); … … 136 143 for (int i = 0; i < simplex.Length; i++) { 137 144 simplex[i] = bestSol.Clone() as RealVector; 138 simplex[i][i] += 0.1 * ( Evaluator.Bounds[0, 1] - Evaluator.Bounds[0, 0]);139 if (simplex[i][i] > Evaluator.Bounds[0, 1]) simplex[i][i] = Evaluator.Bounds[0, 1];140 if (simplex[i][i] < Evaluator.Bounds[0, 0]) simplex[i][i] = Evaluator.Bounds[0, 0];145 simplex[i][i] += 0.1 * (Bounds[0, 1] - Bounds[0, 0]); 146 if (simplex[i][i] > Bounds[0, 1]) simplex[i][i] = Bounds[0, 1]; 147 if (simplex[i][i] < Bounds[0, 0]) simplex[i][i] = Bounds[0, 0]; 141 148 } 142 149 … … 195 202 196 203 for (int i = 0; i < simplex[0].Length; i++) { 197 if (simplex[0][i] > Evaluator.Bounds[0, 1]) simplex[0][i] = Evaluator.Bounds[0, 1];198 if (simplex[0][i] < Evaluator.Bounds[0, 0]) simplex[0][i] = Evaluator.Bounds[0, 0];204 if (simplex[0][i] > Bounds[0, 1]) simplex[0][i] = Bounds[0, 1]; 205 if (simplex[0][i] < Bounds[0, 0]) simplex[0][i] = Bounds[0, 0]; 199 206 } 200 207 -
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/SimilarityCalculators/SingleObjectiveTestFunctionSimilarityCalculator.cs
r7793 r7954 26 26 using HeuristicLab.Encodings.RealVectorEncoding; 27 27 using HeuristicLab.Optimization.Operators; 28 using HeuristicLab.Parameters;29 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 29 … … 36 35 [StorableClass] 37 36 public sealed class SingleObjectiveTestFunctionSimilarityCalculator : SimilarityCalculator { 38 #region Parameter properties39 public ILookupParameter<DoubleMatrix> BoundsParameter {40 get { return (ILookupParameter<DoubleMatrix>)Parameters["Bounds"]; }41 }42 #endregion43 44 37 #region Properties 45 private DoubleMatrix Bounds { 46 get { return BoundsParameter.ActualValue; } 47 set { BoundsParameter.ActualValue = value; } 48 } 38 public DoubleMatrix Bounds { get; set; } 49 39 #endregion 50 40 … … 52 42 private SingleObjectiveTestFunctionSimilarityCalculator(bool deserializing) : base(deserializing) { } 53 43 private SingleObjectiveTestFunctionSimilarityCalculator(SingleObjectiveTestFunctionSimilarityCalculator original, Cloner cloner) : base(original, cloner) { } 54 public SingleObjectiveTestFunctionSimilarityCalculator() 55 : base() { 56 #region Create parameters 57 Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds")); 58 #endregion 59 } 44 public SingleObjectiveTestFunctionSimilarityCalculator() : base() { } 60 45 61 46 public override IDeepCloneable Clone(Cloner cloner) { -
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs
r7789 r7954 376 376 op.ParentsParameter.Hidden = true; 377 377 } 378 foreach ( ISimilarityCalculator op in Operators.OfType<ISimilarityCalculator>()) {378 foreach (SingleObjectiveTestFunctionSimilarityCalculator op in Operators.OfType<ISimilarityCalculator>()) { 379 379 op.TargetParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName; 380 380 op.TargetParameter.Hidden = true; 381 op.Bounds = Bounds; 381 382 } 382 383 }
Note: See TracChangeset
for help on using the changeset viewer.