- Timestamp:
- 06/04/12 16:48:59 (13 years ago)
- Location:
- branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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.