Changeset 1188 for trunk/sources
- Timestamp:
- 01/30/09 10:38:42 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.TestFunctions
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.TestFunctions/AckleyEvaluator.cs
r107 r1188 28 28 29 29 namespace HeuristicLab.TestFunctions { 30 /// <summary> 31 /// Ackley Function<br/> 32 /// Domain: [-32.768 , 32.768]^n <br/> 33 /// Optimum: 0.0 at (0, 0, ..., 0) 34 /// </summary> 30 35 public class AckleyEvaluator : TestFunctionEvaluatorBase { 36 /// <inheritdoc select="summary"/> 31 37 public override string Description { 32 38 get { return … … 38 44 } 39 45 46 /// <summary> 47 /// Evaluates the test function for a specific <paramref name="point"/>. 48 /// </summary> 49 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 50 /// <returns>The result value of the Ackley function at the given point.</returns> 40 51 public static double Apply(double[] point) { 41 52 double result = 20 + Math.E; … … 58 69 } 59 70 71 /// <summary> 72 /// Evaluates the test function for a specific <paramref name="point"/>. 73 /// </summary> 74 /// <remarks>Calls <see cref="Apply"/>.</remarks> 75 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 76 /// <returns>The result value of the Ackley function at the given point.</returns> 60 77 protected override double EvaluateFunction(double[] point) { 61 78 return Apply(point); -
trunk/sources/HeuristicLab.TestFunctions/BealeEvaluator.cs
r1183 r1188 24 24 using System.Text; 25 25 26 namespace HeuristicLab.TestFunctions { 26 namespace HeuristicLab.TestFunctions { 27 /// <summary> 28 /// Beale Function<br/> 29 /// Domain: [-4.5 , 4.5]^2<br/> 30 /// Optimum: 0.0 at (3.0, 0.5) 31 /// </summary> 27 32 public class BealeEvaluator : TestFunctionEvaluatorBase { 33 /// <inheritdoc select="summary"/> 28 34 public override string Description { 29 35 get { return … … 35 41 } 36 42 43 /// <summary> 44 /// Evaluates the test function for a specific <paramref name="point"/>. 45 /// </summary> 46 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 47 /// <returns>The result value of the Beale function at the given point.</returns> 37 48 public static double Apply(double[] point) { 38 49 return Math.Pow(1.5 - point[0] * (1 - point[1]), 2) + Math.Pow(2.25 - point[0] * (1 - (point[1] * point[1])), 2) + Math.Pow((2.625 - point[0] * (1 - (point[1] * point[1] * point[1]))), 2); 39 50 } 40 51 52 /// <summary> 53 /// Evaluates the test function for a specific <paramref name="point"/>. 54 /// </summary> 55 /// <remarks>Calls <see cref="Apply"/>.</remarks> 56 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 57 /// <returns>The result value of the Beale function at the given point.</returns> 41 58 protected override double EvaluateFunction(double[] point) { 42 59 return Apply(point); -
trunk/sources/HeuristicLab.TestFunctions/BoothEvaluator.cs
r1183 r1188 25 25 26 26 namespace HeuristicLab.TestFunctions { 27 /// <summary> 28 /// Booth Function<br/> 29 /// Domain: [-10.0 , 10.0]^2<br/> 30 /// Optimum: 0.0 at (1.0, 3.0) 31 /// </summary> 27 32 public class BoothEvaluator : TestFunctionEvaluatorBase { 33 /// <inheritdoc select="summary"/> 28 34 public override string Description { 29 35 get { … … 36 42 } 37 43 44 /// <summary> 45 /// Evaluates the test function for a specific <paramref name="point"/>. 46 /// </summary> 47 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 48 /// <returns>The result value of the Booth function at the given point.</returns> 38 49 public static double Apply(double[] point) { 39 50 return Math.Pow(point[0] + 2 * point[1] - 7, 2) + Math.Pow(2 * point[0] + point[1] - 5, 2); 40 51 } 41 52 53 /// <summary> 54 /// Evaluates the test function for a specific <paramref name="point"/>. 55 /// </summary> 56 /// <remarks>Calls <see cref="Apply"/>.</remarks> 57 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 58 /// <returns>The result value of the Booth function at the given point.</returns> 42 59 protected override double EvaluateFunction(double[] point) { 43 60 return Apply(point); -
trunk/sources/HeuristicLab.TestFunctions/GriewangkEvaluator.cs
r107 r1188 28 28 29 29 namespace HeuristicLab.TestFunctions { 30 /// <summary> 31 /// Griewangk Function<br/> 32 /// Domain: [-600.0 , 600.0]^n<br/> 33 /// Optimum: 0.0 at (0, 0, ..., 0) 34 /// </summary> 30 35 public class GriewangkEvaluator : TestFunctionEvaluatorBase { 36 /// <inheritdoc select="summary"/> 31 37 public override string Description { 32 38 get { return … … 38 44 } 39 45 46 /// <summary> 47 /// Evaluates the test function for a specific <paramref name="point"/>. 48 /// </summary> 49 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 50 /// <returns>The result value of the Griewangk function at the given point.</returns> 40 51 public static double Apply(double[] point) { 41 52 double result = 0; … … 54 65 } 55 66 67 /// <summary> 68 /// Evaluates the test function for a specific <paramref name="point"/>. 69 /// </summary> 70 /// <remarks>Calls <see cref="Apply"/>.</remarks> 71 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 72 /// <returns>The result value of the Griewangk function at the given point.</returns> 56 73 protected override double EvaluateFunction(double[] point) { 57 74 return Apply(point); -
trunk/sources/HeuristicLab.TestFunctions/HeuristicLabTestFunctionsPlugin.cs
r582 r1188 26 26 27 27 namespace HeuristicLab.TestFunctions { 28 /// <summary> 29 /// Plugin class for HeuristicLab.TestFunctions plugin. 30 /// </summary> 28 31 [ClassInfo(Name = "HeuristicLab.TestFunctions-3.2")] 29 32 [PluginFile(Filename = "HeuristicLab.TestFunctions-3.2.dll", Filetype = PluginFileType.Assembly)] -
trunk/sources/HeuristicLab.TestFunctions/LevyEvaluator.cs
r291 r1188 25 25 26 26 namespace HeuristicLab.TestFunctions { 27 /// <summary> 28 /// Levy Function<br/> 29 /// Domain: [-10.0 , 10.0]^n<br/> 30 /// Optimum: 0.0 at (1.0, 1.0, ..., 1.0) 31 /// </summary> 27 32 public class LevyEvaluator : TestFunctionEvaluatorBase { 33 /// <inheritdoc select="summary"/> 28 34 public override string Description { 29 35 get { return … … 35 41 } 36 42 43 /// <summary> 44 /// Evaluates the test function for a specific <paramref name="point"/>. 45 /// </summary> 46 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 47 /// <returns>The result value of the Levy function at the given point.</returns> 37 48 public static double Apply(double[] point) { 38 49 int length = point.Length; … … 53 64 } 54 65 66 /// <summary> 67 /// Evaluates the test function for a specific <paramref name="point"/>. 68 /// </summary> 69 /// <remarks>Calls <see cref="Apply"/>.</remarks> 70 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 71 /// <returns>The result value of the Levy function at the given point.</returns> 55 72 protected override double EvaluateFunction(double[] point) { 56 73 return Apply(point); -
trunk/sources/HeuristicLab.TestFunctions/MatyasEvaluator.cs
r291 r1188 25 25 26 26 namespace HeuristicLab.TestFunctions { 27 /// <summary> 28 /// Matyas Function<br/> 29 /// Domain: [-10.0 , 10.0]^2<br/> 30 /// Optimum: 0.0 at (0.0, 0.0) 31 /// </summary> 27 32 public class MatyasEvaluator : TestFunctionEvaluatorBase { 33 /// <inheritdoc select="summary"/> 28 34 public override string Description { 29 35 get { return … … 35 41 } 36 42 43 /// <summary> 44 /// Evaluates the test function for a specific <paramref name="point"/>. 45 /// </summary> 46 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 47 /// <returns>The result value of the Matyas function at the given point.</returns> 37 48 public static double Apply(double[] point) { 38 49 return 0.26 * (point[0] * point[0] + point[1] * point[1]) - 0.48 * point[0] * point[1]; 39 50 } 40 51 52 /// <summary> 53 /// Evaluates the test function for a specific <paramref name="point"/>. 54 /// </summary> 55 /// <remarks>Calls <see cref="Apply"/>.</remarks> 56 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 57 /// <returns>The result value of the Matyas function at the given point.</returns> 41 58 protected override double EvaluateFunction(double[] point) { 42 59 return Apply(point); -
trunk/sources/HeuristicLab.TestFunctions/RastriginEvaluator.cs
r107 r1188 28 28 29 29 namespace HeuristicLab.TestFunctions { 30 /// <summary> 31 /// Rastrigin Function<br/> 32 /// Domain: [-5.12 , 5.12]^n<br/> 33 /// Optimum: 0.0 at (0, 0, ..., 0) 34 /// </summary> 30 35 public class RastriginEvaluator : TestFunctionEvaluatorBase { 36 /// <inheritdoc select="summary"/> 31 37 public override string Description { 32 38 get { return … … 38 44 } 39 45 46 /// <summary> 47 /// Evaluates the test function for a specific <paramref name="point"/>. 48 /// </summary> 49 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 50 /// <returns>The result value of the Rastrigin function at the given point.</returns> 40 51 public static double Apply(double[] point) { 41 52 double result = 10 * point.Length; … … 47 58 } 48 59 60 /// <summary> 61 /// Evaluates the test function for a specific <paramref name="point"/>. 62 /// </summary> 63 /// <remarks>Calls <see cref="Apply"/>.</remarks> 64 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 65 /// <returns>The result value of the Rastrigin function at the given point.</returns> 49 66 protected override double EvaluateFunction(double[] point) { 50 67 return Apply(point); -
trunk/sources/HeuristicLab.TestFunctions/RosenbrockEvaluator.cs
r107 r1188 28 28 29 29 namespace HeuristicLab.TestFunctions { 30 /// <summary> 31 /// Rosenbrock Function<br/> 32 /// Domain: [-2.048 , 2.048]^n<br/> 33 /// Optimum: 0.0 at (1, 1, ..., 1) 34 /// </summary> 30 35 public class RosenbrockEvaluator : TestFunctionEvaluatorBase { 36 /// <inheritdoc select="summary"/> 31 37 public override string Description { 32 38 get { return … … 38 44 } 39 45 46 /// <summary> 47 /// Evaluates the test function for a specific <paramref name="point"/>. 48 /// </summary> 49 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 50 /// <returns>The result value of the Rosenbrock function at the given point.</returns> 40 51 public static double Apply(double[] point) { 41 52 double result = 0; … … 47 58 } 48 59 60 /// <summary> 61 /// Evaluates the test function for a specific <paramref name="point"/>. 62 /// </summary> 63 /// <remarks>Calls <see cref="Apply"/>.</remarks> 64 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 65 /// <returns>The result value of the Rosenbrock function at the given point.</returns> 49 66 protected override double EvaluateFunction(double[] point) { 50 67 return Apply(point); -
trunk/sources/HeuristicLab.TestFunctions/SchwefelEvaluator.cs
r107 r1188 28 28 29 29 namespace HeuristicLab.TestFunctions { 30 /// <summary> 31 /// Schwefel Function (Sine Root)<br/> 32 /// Domain: [-500.0 , 500.0]^n<br/> 33 /// Optimum: 0.0 at (420.968746453712, 420.968746453712, ..., 420.968746453712) 34 /// </summary> 30 35 public class SchwefelEvaluator : TestFunctionEvaluatorBase { 36 /// <inheritdoc select="summary"/> 31 37 public override string Description { 32 38 get { return … … 38 44 } 39 45 46 /// <summary> 47 /// Evaluates the test function for a specific <paramref name="point"/>. 48 /// </summary> 49 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 50 /// <returns>The result value of the Schwefel function at the given point.</returns> 40 51 public static double Apply(double[] point) { 41 52 double result = 418.982887272433 * point.Length; … … 45 56 } 46 57 58 /// <summary> 59 /// Evaluates the test function for a specific <paramref name="point"/>. 60 /// </summary> 61 /// <remarks>Calls <see cref="Apply"/>.</remarks> 62 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 63 /// <returns>The result value of the Schwefel function at the given point.</returns> 47 64 protected override double EvaluateFunction(double[] point) { 48 65 return Apply(point); -
trunk/sources/HeuristicLab.TestFunctions/SphereEvaluator.cs
r107 r1188 28 28 29 29 namespace HeuristicLab.TestFunctions { 30 /// <summary> 31 /// Sphere Function<br/> 32 /// Domain: [-5.12 , 5.12]^n<br/> 33 /// Optimum: 0.0 at (0, 0, ..., 0) 34 /// </summary> 30 35 public class SphereEvaluator : TestFunctionEvaluatorBase { 36 /// <inheritdoc select="summary"/> 31 37 public override string Description { 32 38 get { return … … 38 44 } 39 45 46 /// <summary> 47 /// Evaluates the test function for a specific <paramref name="point"/>. 48 /// </summary> 49 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 50 /// <returns>The result value of the Sphere function at the given point.</returns> 40 51 public static double Apply(double[] point) { 41 52 double result = 0; … … 45 56 } 46 57 58 /// <summary> 59 /// Evaluates the test function for a specific <paramref name="point"/>. 60 /// </summary> 61 /// <remarks>Calls <see cref="Apply"/>.</remarks> 62 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 63 /// <returns>The result value of the Sphere function at the given point.</returns> 47 64 protected override double EvaluateFunction(double[] point) { 48 65 return Apply(point); -
trunk/sources/HeuristicLab.TestFunctions/SumSquaresEvaluator.cs
r291 r1188 25 25 26 26 namespace HeuristicLab.TestFunctions { 27 /// <summary> 28 /// Sum Squares Function<br/> 29 /// Domain: [-10.0 , 10.0]^n<br/> 30 /// Optimum: 0.0 at (0.0, 0.0, ..., 0.0) 31 /// </summary> 27 32 public class SumSquaresEvaluator : TestFunctionEvaluatorBase { 33 /// <inheritdoc select="summary"/> 28 34 public override string Description { 29 35 get { return … … 35 41 } 36 42 43 /// <summary> 44 /// Evaluates the test function for a specific <paramref name="point"/>. 45 /// </summary> 46 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 47 /// <returns>The result value of the Sum Squares function at the given point.</returns> 37 48 public static double Apply(double[] point) { 38 49 double result = 0; … … 43 54 } 44 55 56 /// <summary> 57 /// Evaluates the test function for a specific <paramref name="point"/>. 58 /// </summary> 59 /// <remarks>Calls <see cref="Apply"/>.</remarks> 60 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 61 /// <returns>The result value of the Sum Squares function at the given point.</returns> 45 62 protected override double EvaluateFunction(double[] point) { 46 63 return Apply(point); -
trunk/sources/HeuristicLab.TestFunctions/TestFunctionEvaluatorBase.cs
r2 r1188 28 28 29 29 namespace HeuristicLab.TestFunctions { 30 /// <summary> 31 /// Base class for a test function evaluator. 32 /// </summary> 30 33 public abstract class TestFunctionEvaluatorBase : SingleObjectiveEvaluatorBase { 34 /// <summary> 35 /// Initializes a new instance of <see cref="TestFunctionEvaluatorBase"/> with one variable info 36 /// (<c>Point</c>). 37 /// </summary> 31 38 public TestFunctionEvaluatorBase() { 32 39 AddVariableInfo(new VariableInfo("Point", "n-dimensional point for which the test function should be evaluated", typeof(DoubleArrayData), VariableKind.In)); 33 40 } 34 41 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> 35 48 protected sealed override double Evaluate(IScope scope) { 36 49 return EvaluateFunction(GetVariableValue<DoubleArrayData>("Point", scope, false).Data); 37 50 } 38 51 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> 39 57 protected abstract double EvaluateFunction(double[] point); 40 58 } -
trunk/sources/HeuristicLab.TestFunctions/TestFunctionInjector.cs
r110 r1188 27 27 28 28 namespace HeuristicLab.TestFunctions { 29 /// <summary> 30 /// Injects the necessary variables for optimizing a test function 31 /// </summary> 29 32 public class TestFunctionInjector : OperatorBase { 33 /// <inheritdoc select="summary"/> 30 34 public override string Description { 31 35 get { … … 34 38 } 35 39 40 /// <summary> 41 /// Gets or sets the boolean flag whether it is an optimization problem or not. 42 /// </summary> 36 43 public bool Maximization { 37 44 get { return GetVariable("Maximization").GetValue<BoolData>().Data; } … … 39 46 } 40 47 48 /// <summary> 49 /// Gets or sets the lower bound. 50 /// </summary> 41 51 public double LowerBound { 42 52 get { return GetVariable("LowerBound").GetValue<DoubleData>().Data; } … … 44 54 } 45 55 56 /// <summary> 57 /// Gets or sets the upper bound. 58 /// </summary> 46 59 public double UpperBound { 47 60 get { return GetVariable("UpperBound").GetValue<DoubleData>().Data; } … … 49 62 } 50 63 64 /// <summary> 65 /// Gets or sets the dimension. 66 /// </summary> 51 67 public int Dimension { 52 68 get { return GetVariable("Dimension").GetValue<IntData>().Data; } … … 54 70 } 55 71 72 /// <summary> 73 /// Initializes a new instance of <see cref="TestFunctionInjector"/> with four variable infos 74 /// (<c>Maximization</c>, <c>LowerBound</c>, <c>UpperBound</c> and <c>Dimension</c>). 75 /// </summary> 56 76 public TestFunctionInjector() 57 77 : base() { … … 62 82 } 63 83 84 /// <summary> 85 /// Injects the necessary variables for optimizing a test function. 86 /// </summary> 87 /// <param name="scope">The scope where to inject the variables.</param> 88 /// <returns><c>null</c>.</returns> 64 89 public override IOperation Apply(IScope scope) { 65 90 scope.AddVariable((IVariable)GetVariable("Maximization").Clone()); … … 70 95 } 71 96 97 /// <summary> 98 /// Creates a new instance of <see cref="TestFunctionInjectorView"/> to represent the current 99 /// instance visually. 100 /// </summary> 101 /// <returns>The newly created view as <see cref="TestFunctionInjectorView"/>.</returns> 72 102 public override IView CreateView() { 73 103 return new TestFunctionInjectorView(this); -
trunk/sources/HeuristicLab.TestFunctions/TestFunctionInjectorView.cs
r109 r1188 32 32 33 33 namespace HeuristicLab.TestFunctions { 34 /// <summary> 35 /// Visual representation of a <see cref="TestFunctionInjector"/>. 36 /// </summary> 34 37 public partial class TestFunctionInjectorView : ViewBase { 38 /// <summary> 39 /// Gets or sets the TestFunctionInjector to represent visually. 40 /// </summary> 41 /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>. 42 /// No own data storage present.</remarks> 35 43 public TestFunctionInjector TestFunctionInjector { 36 44 get { return (TestFunctionInjector)base.Item; } … … 38 46 } 39 47 48 /// <summary> 49 /// Initializes a new instance of <see cref="TestFunctionInjectorView"/>. 50 /// </summary> 40 51 public TestFunctionInjectorView() { 41 52 InitializeComponent(); 42 53 } 43 54 55 /// <summary> 56 /// Initializes a new instance of <see cref="TestFunctionInjectorView"/> with the given 57 /// <paramref name="testFunctionInjector"/> to display. 58 /// </summary> 59 /// <param name="testFunctionInjector">The injector to represent visually.</param> 44 60 public TestFunctionInjectorView(TestFunctionInjector testFunctionInjector) 45 61 : this() { … … 47 63 } 48 64 65 /// <summary> 66 /// Removes the eventhandler from the underlying controls. 67 /// </summary> 68 /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>. 69 /// </remarks> 49 70 protected override void RemoveItemEvents() { 50 71 maximizationCheckBox.DataBindings.Clear(); … … 55 76 } 56 77 78 /// <summary> 79 /// Adds eventhandlers to the underlying controls. 80 /// </summary> 81 /// <remarks>Calls <see cref="ViewBase.AddItemEvents"/> of base class <see cref="ViewBase"/>. 82 /// </remarks> 57 83 protected override void AddItemEvents() { 58 84 base.AddItemEvents(); … … 63 89 } 64 90 91 /// <summary> 92 /// Updates all controls with the latest values. 93 /// </summary> 94 /// <remarks>Calls <see cref="ViewBase.UpdateControls"/> of base class <see cref="ViewBase"/>.</remarks> 65 95 protected override void UpdateControls() { 66 96 base.UpdateControls(); -
trunk/sources/HeuristicLab.TestFunctions/ZakharovEvaluator.cs
r291 r1188 25 25 26 26 namespace HeuristicLab.TestFunctions { 27 /// <summary> 28 /// Zakharov Function<br/> 29 /// Domain: [-5.0 , 10.0]^n<br/> 30 /// Optimum: 0.0 at (0.0, 0.0, ..., 0.0) 31 /// </summary> 27 32 public class ZakharovEvaluator : TestFunctionEvaluatorBase { 33 /// <inheritdoc select="summary"/> 28 34 public override string Description { 29 35 get { return … … 35 41 } 36 42 43 /// <summary> 44 /// Evaluates the test function for a specific <paramref name="point"/>. 45 /// </summary> 46 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 47 /// <returns>The result value of the Zakharov function at the given point.</returns> 37 48 public static double Apply(double[] point) { 38 49 int length = point.Length; … … 47 58 } 48 59 60 /// <summary> 61 /// Evaluates the test function for a specific <paramref name="point"/>. 62 /// </summary> 63 /// <remarks>Calls <see cref="Apply"/>.</remarks> 64 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 65 /// <returns>The result value of the Zakharov function at the given point.</returns> 49 66 protected override double EvaluateFunction(double[] point) { 50 67 return Apply(point);
Note: See TracChangeset
for help on using the changeset viewer.