Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.TestFunctions/3.2/TestFunctionEvaluatorBase.cs @ 2954

Last change on this file since 2954 was 1530, checked in by gkronber, 16 years ago

Moved source files of plugins Hive ... Visualization.Test into version-specific sub-folders. #576

File size: 2.4 KB
RevLine 
[2]1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Text;
25using HeuristicLab.Core;
26using HeuristicLab.Data;
27using HeuristicLab.Operators;
28
29namespace HeuristicLab.TestFunctions {
[1188]30  /// <summary>
31  /// Base class for a test function evaluator.
32  /// </summary>
[2]33  public abstract class TestFunctionEvaluatorBase : SingleObjectiveEvaluatorBase {
[1188]34    /// <summary>
35    /// Initializes a new instance of <see cref="TestFunctionEvaluatorBase"/> with one variable info
36    /// (<c>Point</c>).
37    /// </summary>
[2]38    public TestFunctionEvaluatorBase() {
39      AddVariableInfo(new VariableInfo("Point", "n-dimensional point for which the test function should be evaluated", typeof(DoubleArrayData), VariableKind.In));
40    }
41
[1188]42    /// <summary>
43    /// Evaluates the test function for a specific point.
44    /// </summary>
45    /// <remarks>Calls <see cref="EvaluateFunction(double[])"/>.</remarks>
46    /// <param name="scope">The current scope with the point for which to evaluate.</param>
47    /// <returns>The result value of the function at the given point.</returns>
[2]48    protected sealed override double Evaluate(IScope scope) {
49      return EvaluateFunction(GetVariableValue<DoubleArrayData>("Point", scope, false).Data);
50    }
51
[1188]52    /// <summary>
53    /// Evaluates the test function for a specific <paramref name="point"/>.
54    /// </summary>
55    /// <param name="point">N-dimensional point for which the test function should be evaluated.</param>
56    /// <returns>The result value of the function at the given point.</returns>
[2]57    protected abstract double EvaluateFunction(double[] point);
58  }
59}
Note: See TracBrowser for help on using the repository browser.