Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/22/10 01:20:49 (15 years ago)
Author:
abeham
Message:

Updated test functions problem #934

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/BoothEvaluator.cs

    r3150 r3154  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Text;
     23using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.RealVectorEncoding;
     26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2527
    26 namespace HeuristicLab.TestFunctions {
     28namespace HeuristicLab.Problems.TestFunctions.SingleObjective {
    2729  /// <summary>
    2830  /// Booth Function<br/>
     
    3032  /// Optimum: 0.0 at (1.0, 3.0)
    3133  /// </summary>
    32   public class BoothEvaluator : TestFunctionEvaluatorBase {
    33     /// <inheritdoc select="summary"/>
    34     public override string Description {
    35       get {
    36         return
    37           @"Booth Function
    38 
    39 Domain:  [-10.0 , 10.0]^2
    40 Optimum: 0.0 at (1.0, 3.0)";
    41       }
     34  [Item("BoothEvaluator", "Evaluates the Booth function on a given point. The optimum of this function is 0 at (1,3).")]
     35  [StorableClass]
     36  public class BoothEvaluator : SingleObjectiveTestFunctionEvaluator {
     37    /// <summary>
     38    /// Returns false as the Booth function is a minimization problem.
     39    /// </summary>
     40    public override bool Maximization {
     41      get { return false; }
     42    }
     43    /// <summary>
     44    /// Gets the optimum function value (0).
     45    /// </summary>
     46    public override double BestKnownQuality {
     47      get { return 0; }
     48    }
     49    /// <summary>
     50    /// Gets the lower and upper bound of the function.
     51    /// </summary>
     52    public override DoubleMatrix Bounds {
     53      get { return new DoubleMatrix(new double[,] { { -10, 10 } }); }
     54    }
     55    /// <summary>
     56    /// Gets the minimum problem size (2).
     57    /// </summary>
     58    public override int MinimumProblemSize {
     59      get { return 2; }
     60    }
     61    /// <summary>
     62    /// Gets the maximum problem size (2).
     63    /// </summary>
     64    public override int MaximumProblemSize {
     65      get { return 2; }
    4266    }
    4367
     
    4771    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    4872    /// <returns>The result value of the Booth function at the given point.</returns>
    49     public static double Apply(double[] point) {
     73    public static double Apply(RealVector point) {
    5074      return Math.Pow(point[0] + 2 * point[1] - 7, 2) + Math.Pow(2 * point[0] + point[1] - 5, 2);
    5175    }
     
    5781    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
    5882    /// <returns>The result value of the Booth function at the given point.</returns>
    59     protected override double EvaluateFunction(double[] point) {
     83    protected override double EvaluateFunction(RealVector point) {
    6084      return Apply(point);
    6185    }
Note: See TracChangeset for help on using the changeset viewer.