Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/13/10 09:47:06 (15 years ago)
Author:
abeham
Message:

Updated test functions, added reference for Zakharov
Did not find a reference for SumSquares, just described it
Added wiring for rastrigin and sphere
#934

Location:
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RastriginAdditiveMoveEvaluator.cs

    r3315 r3318  
    2121
    2222using HeuristicLab.Core;
     23using HeuristicLab.Data;
     24using HeuristicLab.Encodings.RealVectorEncoding;
     25using HeuristicLab.Parameters;
    2326using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    24 using HeuristicLab.Encodings.RealVectorEncoding;
    2527
    2628namespace HeuristicLab.Problems.TestFunctions {
    2729  [Item("RastriginAdditiveMoveEvaluator", "Class for evaluating an additive move on the Rastrigin function.")]
    2830  [StorableClass]
    29   public class RastriginAdditiveMoveEvaluator : AdditiveMoveEvaluator {
     31  public class RastriginAdditiveMoveEvaluator : AdditiveMoveEvaluator, IRastriginMoveEvaluator {
    3032    public override System.Type EvaluatorType {
    3133      get { return typeof(RastriginEvaluator); }
    3234    }
     35    /// <summary>
     36    /// The parameter A is a parameter of the objective function y = Sum((x_i)^2 + A * (1 - Cos(2pi*x_i))). Default is A = 10.
     37    /// </summary>
     38    public ValueParameter<DoubleValue> AParameter {
     39      get { return (ValueParameter<DoubleValue>)Parameters["A"]; }
     40    }
     41    /// <summary>
     42    /// The parameter A is a parameter of the objective function y = Sum((x_i)^2 + A * (1 - Cos(2pi*x_i))). Default is A = 10.
     43    /// </summary>
     44    public DoubleValue A {
     45      get { return AParameter.Value; }
     46      set { if (value != null) AParameter.Value = value; }
     47    }
     48
    3349    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3450      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
    35       return RastriginEvaluator.Apply(wrapper, 10); // FIXME: the parameters have to be wired
     51      return RastriginEvaluator.Apply(wrapper, A.Value);
    3652    }
    3753  }
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/SphereAdditiveMoveEvaluator.cs

    r3315 r3318  
    2121
    2222using HeuristicLab.Core;
     23using HeuristicLab.Data;
     24using HeuristicLab.Encodings.RealVectorEncoding;
     25using HeuristicLab.Parameters;
    2326using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    24 using HeuristicLab.Encodings.RealVectorEncoding;
    2527
    2628namespace HeuristicLab.Problems.TestFunctions {
    2729  [Item("SphereAdditiveMoveEvaluator", "Class for evaluating an additive move on the Sphere function.")]
    2830  [StorableClass]
    29   public class SphereAdditiveMoveEvaluator : AdditiveMoveEvaluator {
     31  public class SphereAdditiveMoveEvaluator : AdditiveMoveEvaluator, ISphereMoveEvaluator {
     32    /// <summary>
     33    /// The parameter C modifies the steepness of the objective function y = C * ||X||^Alpha. Default is C = 1.
     34    /// </summary>
     35    public ValueParameter<DoubleValue> CParameter {
     36      get { return (ValueParameter<DoubleValue>)Parameters["C"]; }
     37    }
     38    /// <summary>
     39    /// The parameter Alpha modifies the steepness of the objective function y = C * ||X||^Alpha. Default is Alpha = 2.
     40    /// </summary>
     41    public ValueParameter<DoubleValue> AlphaParameter {
     42      get { return (ValueParameter<DoubleValue>)Parameters["Alpha"]; }
     43    }
     44    /// <summary>
     45    /// The parameter C modifies the steepness of the objective function y = C * ||X||^Alpha. Default is C = 1.
     46    /// </summary>
     47    public DoubleValue C {
     48      get { return CParameter.Value; }
     49      set { if (value != null) CParameter.Value = value; }
     50    }
     51    /// <summary>
     52    /// The parameter Alpha modifies the steepness of the objective function y = C * ||X||^Alpha. Default is Alpha = 2.
     53    /// </summary>
     54    public DoubleValue Alpha {
     55      get { return AlphaParameter.Value; }
     56      set { if (value != null) AlphaParameter.Value = value; }
     57    }
     58
    3059    public override System.Type EvaluatorType {
    3160      get { return typeof(SphereEvaluator); }
     
    3362    protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {
    3463      RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);
    35       return SphereEvaluator.Apply(wrapper, 1, 2); // FIXME: the parameters have to be wired.
     64      return SphereEvaluator.Apply(wrapper, C.Value, Alpha.Value);
    3665    }
    3766  }
Note: See TracChangeset for help on using the changeset viewer.