Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/25/15 23:24:01 (8 years ago)
Author:
abeham
Message:

#2521:

  • Adapted single-objective test function problem to new problem infrastructure
  • Added additional interfaces to RealVectorEncoding
  • Fixed IParticleUpdater interface (must implement IStochasticOperator if it contains a Random parameter)
Location:
branches/ProblemRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Functions
Files:
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Functions/SingleObjectiveTestFunction.cs

    r13393 r13403  
    2424using HeuristicLab.Data;
    2525using HeuristicLab.Encodings.RealVectorEncoding;
    26 using HeuristicLab.Operators;
    27 using HeuristicLab.Parameters;
    2826using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2927
     
    3230  /// Base class for a test function evaluator.
    3331  /// </summary>
    34   [Item("Evaluator", "Base calls for single objective test function evaluators.")]
     32  [Item("Single-Objective Function", "Base class for single objective functions.")]
    3533  [StorableClass]
    36   public abstract class SingleObjectiveTestFunctionProblemEvaluator : InstrumentedOperator, ISingleObjectiveTestFunctionProblemEvaluator {
    37     /// <summary>
    38     /// The name of the function
    39     /// </summary>
    40     public abstract string FunctionName { get; }
     34  public abstract class SingleObjectiveTestFunction : ParameterizedNamedItem, ISingleObjectiveTestFunction {
    4135    /// <summary>
    4236    /// These operators should not change their name through the GUI
     
    6660    public abstract int MaximumProblemSize { get; }
    6761
    68     public ILookupParameter<DoubleValue> QualityParameter {
    69       get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; }
    70     }
    71     public ILookupParameter<RealVector> PointParameter {
    72       get { return (ILookupParameter<RealVector>)Parameters["Point"]; }
    73     }
    74 
    7562    [StorableConstructor]
    76     protected SingleObjectiveTestFunctionProblemEvaluator(bool deserializing) : base(deserializing) { }
    77     protected SingleObjectiveTestFunctionProblemEvaluator(SingleObjectiveTestFunctionProblemEvaluator original, Cloner cloner) : base(original, cloner) { }
    78     /// <summary>
    79     /// Initializes a new instance of <see cref="SingleObjectiveTestFunctionEvaluator"/> with two parameters
    80     /// (<c>Quality</c> and <c>Point</c>).
    81     /// </summary>
    82     public SingleObjectiveTestFunctionProblemEvaluator()
    83       : base() {
    84       Parameters.Add(new LookupParameter<DoubleValue>("Quality", "Result of the evaluation of a solution."));
    85       Parameters.Add(new LookupParameter<RealVector>("Point", "The point at which the function should be evaluated."));
    86     }
    87 
    88     public override IOperation InstrumentedApply() {
    89       RealVector point = PointParameter.ActualValue;
    90       double quality = Evaluate(point);
    91       QualityParameter.ActualValue = new DoubleValue(quality);
    92       return base.InstrumentedApply();
    93     }
     63    protected SingleObjectiveTestFunction(bool deserializing) : base(deserializing) { }
     64    protected SingleObjectiveTestFunction(SingleObjectiveTestFunction original, Cloner cloner) : base(original, cloner) { }
     65    protected SingleObjectiveTestFunction() : base() { }
    9466
    9567    public virtual double Evaluate2D(double x, double y) {
Note: See TracChangeset for help on using the changeset viewer.