Changeset 3154
- Timestamp:
- 03/22/10 01:20:49 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/AckleyEvaluator.cs
r3150 r3154 22 22 using System; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Encodings.RealVectorEncoding; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 27 28 28 namespace HeuristicLab.Problems.TestFunctions.SingleObjective { … … 32 32 /// Optimum: 0.0 at (0, 0, ..., 0) 33 33 /// </summary 34 [Item("AckleyEvaluator", "Evaluates the Ackley function on a given point. The optimum of th e Ackley Function is 0 at the origin.")]34 [Item("AckleyEvaluator", "Evaluates the Ackley function on a given point. The optimum of this function is 0 at the origin.")] 35 35 [StorableClass] 36 36 public class AckleyEvaluator : SingleObjectiveTestFunctionEvaluator { … … 42 42 } 43 43 /// <summary> 44 /// Gets the optimum function value (0). 45 /// </summary> 46 public override double BestKnownQuality { 47 get { return 0; } 48 } 49 /// <summary> 44 50 /// Gets the lower and upper bound of the function. 45 51 /// </summary> 46 52 public override DoubleMatrix Bounds { 47 53 get { return new DoubleMatrix(new double[,] { { -32.768, 32.768 } }); } 48 }49 /// <summary>50 /// Gets the optimum function value (0).51 /// </summary>52 public override double BestKnownQuality {53 get { return 0; }54 54 } 55 55 /// <summary> -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/BealeEvaluator.cs
r3150 r3154 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Text; 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 27 26 namespace HeuristicLab. TestFunctions {28 namespace HeuristicLab.Problems.TestFunctions.SingleObjective { 27 29 /// <summary> 28 30 /// Beale Function<br/> … … 30 32 /// Optimum: 0.0 at (3.0, 0.5) 31 33 /// </summary> 32 public class BealeEvaluator : TestFunctionEvaluatorBase { 33 /// <inheritdoc select="summary"/> 34 public override string Description { 35 get { return 36 @"Beale Function 37 38 Domain: [-4.5 , 4.5]^2 39 Optimum: 0.0 at (3.0, 0.5)"; 40 } 34 [Item("BealeEvaluator", "Evaluates the Beale function on a given point. The optimum of this function is 0 at (3,0.5).")] 35 [StorableClass] 36 public class BealeEvaluator : SingleObjectiveTestFunctionEvaluator { 37 /// <summary> 38 /// Returns false as the Beale 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[,] { { -4.5, 4.5 } }); } 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; } 41 66 } 42 67 … … 46 71 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 47 72 /// <returns>The result value of the Beale function at the given point.</returns> 48 public static double Apply( double[]point) {73 public static double Apply(RealVector point) { 49 74 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); 50 75 } … … 56 81 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 57 82 /// <returns>The result value of the Beale function at the given point.</returns> 58 protected override double EvaluateFunction( double[]point) {83 protected override double EvaluateFunction(RealVector point) { 59 84 return Apply(point); 60 85 } -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/BoothEvaluator.cs
r3150 r3154 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Text; 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 27 26 namespace HeuristicLab. TestFunctions{28 namespace HeuristicLab.Problems.TestFunctions.SingleObjective { 27 29 /// <summary> 28 30 /// Booth Function<br/> … … 30 32 /// Optimum: 0.0 at (1.0, 3.0) 31 33 /// </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; } 42 66 } 43 67 … … 47 71 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 48 72 /// <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) { 50 74 return Math.Pow(point[0] + 2 * point[1] - 7, 2) + Math.Pow(2 * point[0] + point[1] - 5, 2); 51 75 } … … 57 81 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 58 82 /// <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) { 60 84 return Apply(point); 61 85 } -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/GriewangkEvaluator.cs
r3150 r3154 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 23 using HeuristicLab.Core; 26 24 using HeuristicLab.Data; 27 using HeuristicLab.Operators; 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 29 namespace HeuristicLab. TestFunctions{28 namespace HeuristicLab.Problems.TestFunctions.SingleObjective { 30 29 /// <summary> 31 30 /// Griewangk Function<br/> … … 33 32 /// Optimum: 0.0 at (0, 0, ..., 0) 34 33 /// </summary> 35 public class GriewangkEvaluator : TestFunctionEvaluatorBase { 36 /// <inheritdoc select="summary"/> 37 public override string Description { 38 get { return 39 @"Griewangk Function 40 41 Domain: [-600.0 , 600.0]^n 42 Optimum: 0.0 at (0, 0, ..., 0)"; 43 } 34 [Item("GriewangkEvaluator", "Evaluates the Griewangk function on a given point. The optimum of this function is 0 at the origin.")] 35 [StorableClass] 36 public class GriewangkEvaluator : SingleObjectiveTestFunctionEvaluator { 37 /// <summary> 38 /// Returns false as the Griewangk 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[,] { { -600, 600 } }); } 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 (theoretical) maximum problem size (2^31 - 1). 63 /// </summary> 64 public override int MaximumProblemSize { 65 get { return int.MaxValue; } 44 66 } 45 67 … … 49 71 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 50 72 /// <returns>The result value of the Griewangk function at the given point.</returns> 51 public static double Apply( double[]point) {73 public static double Apply(RealVector point) { 52 74 double result = 0; 53 75 double val = 0; … … 71 93 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 72 94 /// <returns>The result value of the Griewangk function at the given point.</returns> 73 protected override double EvaluateFunction( double[]point) {95 protected override double EvaluateFunction(RealVector point) { 74 96 return Apply(point); 75 97 } -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/LevyEvaluator.cs
r3150 r3154 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Text; 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 27 26 namespace HeuristicLab. TestFunctions{28 namespace HeuristicLab.Problems.TestFunctions.SingleObjective { 27 29 /// <summary> 28 30 /// Levy Function<br/> … … 30 32 /// Optimum: 0.0 at (1.0, 1.0, ..., 1.0) 31 33 /// </summary> 32 public class LevyEvaluator : TestFunctionEvaluatorBase { 33 /// <inheritdoc select="summary"/> 34 public override string Description { 35 get { return 36 @"Levy Function 37 38 Domain: [-10.0 , 10.0]^n 39 Optimum: 0.0 at (1.0, 1.0, ..., 1.0)"; 40 } 34 [Item("LevyEvaluator", "Evaluates the Levy function on a given point. The optimum of this function is 0 at (1,1,...,1).")] 35 [StorableClass] 36 public class LevyEvaluator : SingleObjectiveTestFunctionEvaluator { 37 /// <summary> 38 /// Returns false as the Levy 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 (theoretical) maximum problem size (2^31 - 1). 63 /// </summary> 64 public override int MaximumProblemSize { 65 get { return int.MaxValue; } 41 66 } 42 67 … … 46 71 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 47 72 /// <returns>The result value of the Levy function at the given point.</returns> 48 public static double Apply( double[]point) {73 public static double Apply(RealVector point) { 49 74 int length = point.Length; 50 75 double[] z = new double[length]; … … 70 95 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 71 96 /// <returns>The result value of the Levy function at the given point.</returns> 72 protected override double EvaluateFunction( double[]point) {97 protected override double EvaluateFunction(RealVector point) { 73 98 return Apply(point); 74 99 } -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/MatyasEvaluator.cs
r3150 r3154 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Text; 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 27 26 namespace HeuristicLab. TestFunctions{28 namespace HeuristicLab.Problems.TestFunctions.SingleObjective { 27 29 /// <summary> 28 30 /// Matyas Function<br/> … … 30 32 /// Optimum: 0.0 at (0.0, 0.0) 31 33 /// </summary> 32 public class MatyasEvaluator : TestFunctionEvaluatorBase { 33 /// <inheritdoc select="summary"/> 34 public override string Description { 35 get { return 36 @"Matyas Function 37 38 Domain: [-10.0 , 10.0]^2 39 Optimum: 0.0 at (0.0, 0.0)"; 40 } 34 [Item("MatyasEvaluator", "Evaluates the Matyas function on a given point. The optimum of this function is 0 at the origin.")] 35 [StorableClass] 36 public class MatyasEvaluator : SingleObjectiveTestFunctionEvaluator { 37 /// <summary> 38 /// Returns false as the Beale 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; } 41 66 } 42 67 … … 46 71 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 47 72 /// <returns>The result value of the Matyas function at the given point.</returns> 48 public static double Apply( double[]point) {73 public static double Apply(RealVector point) { 49 74 return 0.26 * (point[0] * point[0] + point[1] * point[1]) - 0.48 * point[0] * point[1]; 50 75 } … … 56 81 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 57 82 /// <returns>The result value of the Matyas function at the given point.</returns> 58 protected override double EvaluateFunction( double[]point) {83 protected override double EvaluateFunction(RealVector point) { 59 84 return Apply(point); 60 85 } -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/RastriginEvaluator.cs
r3150 r3154 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 23 using HeuristicLab.Core; 26 24 using HeuristicLab.Data; 27 using HeuristicLab.Operators; 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 29 namespace HeuristicLab. TestFunctions{28 namespace HeuristicLab.Problems.TestFunctions.SingleObjective { 30 29 /// <summary> 31 30 /// Rastrigin Function<br/> 32 /// Domain: [-5.12 , 5.12]^n <br/>31 /// Domain: [-5.12 , 5.12]^n <br/> 33 32 /// Optimum: 0.0 at (0, 0, ..., 0) 34 /// </summary> 35 public class RastriginEvaluator : TestFunctionEvaluatorBase { 36 /// <inheritdoc select="summary"/> 37 public override string Description { 38 get { return 39 @"Rastrigin Function 40 41 Domain: [-5.12 , 5.12]^n 42 Optimum: 0.0 at (0, 0, ..., 0)"; 43 } 33 /// </summary 34 [Item("RastriginEvaluator", "Evaluates the Rastrigin function on a given point. The optimum of this function is 0 at the origin.")] 35 [StorableClass] 36 public class RastriginEvaluator : SingleObjectiveTestFunctionEvaluator { 37 /// <summary> 38 /// Returns false as the Rastrigin 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[,] { { -5.12, 5.12 } }); } 54 } 55 /// <summary> 56 /// Gets the minimum problem size (1). 57 /// </summary> 58 public override int MinimumProblemSize { 59 get { return 1; } 60 } 61 /// <summary> 62 /// Gets the (theoretical) maximum problem size (2^31 - 1). 63 /// </summary> 64 public override int MaximumProblemSize { 65 get { return int.MaxValue; } 44 66 } 45 67 … … 49 71 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 50 72 /// <returns>The result value of the Rastrigin function at the given point.</returns> 51 public static double Apply( double[]point) {73 public static double Apply(RealVector point) { 52 74 double result = 10 * point.Length; 53 75 for (int i = 0; i < point.Length; i++) { … … 64 86 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 65 87 /// <returns>The result value of the Rastrigin function at the given point.</returns> 66 protected override double EvaluateFunction( double[]point) {88 protected override double EvaluateFunction(RealVector point) { 67 89 return Apply(point); 68 90 } -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/RosenbrockEvaluator.cs
r3150 r3154 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 23 using HeuristicLab.Core; 26 24 using HeuristicLab.Data; 27 using HeuristicLab.Operators; 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 29 namespace HeuristicLab. TestFunctions{28 namespace HeuristicLab.Problems.TestFunctions.SingleObjective { 30 29 /// <summary> 31 30 /// Rosenbrock Function<br/> … … 33 32 /// Optimum: 0.0 at (1, 1, ..., 1) 34 33 /// </summary> 35 public class RosenbrockEvaluator : TestFunctionEvaluatorBase { 36 /// <inheritdoc select="summary"/> 37 public override string Description { 38 get { return 39 @"Rosenbrock Function 40 41 Domain: [-2.048 , 2.048]^n 42 Optimum: 0.0 at (1, 1, ..., 1)"; 43 } 34 [Item("RosenbrockEvaluator", "Evaluates the Rosenbrock function on a given point. The optimum of this function is 0 at (1,1,...,1).")] 35 [StorableClass] 36 public class RosenbrockEvaluator : SingleObjectiveTestFunctionEvaluator { 37 /// <summary> 38 /// Returns false as the Rosenbrock 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[,] { { -2.048, 2.048 } }); } 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 (theoretical) maximum problem size (2^31 - 1). 63 /// </summary> 64 public override int MaximumProblemSize { 65 get { return int.MaxValue; } 44 66 } 45 67 … … 49 71 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 50 72 /// <returns>The result value of the Rosenbrock function at the given point.</returns> 51 public static double Apply( double[]point) {73 public static double Apply(RealVector point) { 52 74 double result = 0; 53 75 for (int i = 0; i < point.Length - 1; i++) { … … 64 86 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 65 87 /// <returns>The result value of the Rosenbrock function at the given point.</returns> 66 protected override double EvaluateFunction( double[]point) {88 protected override double EvaluateFunction(RealVector point) { 67 89 return Apply(point); 68 90 } -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/SchwefelEvaluator.cs
r3150 r3154 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 23 using HeuristicLab.Core; 26 24 using HeuristicLab.Data; 27 using HeuristicLab.Operators; 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 29 namespace HeuristicLab. TestFunctions{28 namespace HeuristicLab.Problems.TestFunctions.SingleObjective { 30 29 /// <summary> 31 30 /// Schwefel Function (Sine Root)<br/> … … 33 32 /// Optimum: 0.0 at (420.968746453712, 420.968746453712, ..., 420.968746453712) 34 33 /// </summary> 35 public class SchwefelEvaluator : TestFunctionEvaluatorBase { 36 /// <inheritdoc select="summary"/> 37 public override string Description { 38 get { return 39 @"Schwefel Function (Sine Root) 40 41 Domain: [-500.0 , 500.0]^n 42 Optimum: 0.0 at (420.968746453712, 420.968746453712, ..., 420.968746453712)"; 43 } 34 [Item("SchwefelEvaluator", "Evaluates the Schwefel function on a given point. The optimum of this function is 0 at (420.968746453712,420.968746453712,...,420.968746453712).")] 35 [StorableClass] 36 public class SchwefelEvaluator : SingleObjectiveTestFunctionEvaluator { 37 /// <summary> 38 /// Returns false as the Rosenbrock 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[,] { { -500, 500 } }); } 54 } 55 /// <summary> 56 /// Gets the minimum problem size (1). 57 /// </summary> 58 public override int MinimumProblemSize { 59 get { return 1; } 60 } 61 /// <summary> 62 /// Gets the (theoretical) maximum problem size (2^31 - 1). 63 /// </summary> 64 public override int MaximumProblemSize { 65 get { return int.MaxValue; } 44 66 } 45 67 … … 49 71 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 50 72 /// <returns>The result value of the Schwefel function at the given point.</returns> 51 public static double Apply( double[]point) {73 public static double Apply(RealVector point) { 52 74 double result = 418.982887272433 * point.Length; 53 75 for (int i = 0; i < point.Length; i++) … … 62 84 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 63 85 /// <returns>The result value of the Schwefel function at the given point.</returns> 64 protected override double EvaluateFunction( double[]point) {86 protected override double EvaluateFunction(RealVector point) { 65 87 return Apply(point); 66 88 } -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/SphereEvaluator.cs
r3150 r3154 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 23 using HeuristicLab.Core; 26 24 using HeuristicLab.Data; 27 using HeuristicLab.Operators; 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 29 namespace HeuristicLab. TestFunctions{28 namespace HeuristicLab.Problems.TestFunctions.SingleObjective { 30 29 /// <summary> 31 30 /// Sphere Function<br/> … … 33 32 /// Optimum: 0.0 at (0, 0, ..., 0) 34 33 /// </summary> 35 public class SphereEvaluator : TestFunctionEvaluatorBase { 36 /// <inheritdoc select="summary"/> 37 public override string Description { 38 get { return 39 @"Sphere Function 40 41 Domain: [-5.12 , 5.12]^n 42 Optimum: 0.0 at (0, 0, ..., 0)"; 43 } 34 [Item("SphereEvaluator", "Evaluates the Sphere function on a given point. The optimum of this function is 0 at the origin.")] 35 [StorableClass] 36 public class SphereEvaluator : SingleObjectiveTestFunctionEvaluator { 37 /// <summary> 38 /// Returns false as the Rosenbrock 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[,] { { -5.12, 5.12 } }); } 54 } 55 /// <summary> 56 /// Gets the minimum problem size (1). 57 /// </summary> 58 public override int MinimumProblemSize { 59 get { return 1; } 60 } 61 /// <summary> 62 /// Gets the (theoretical) maximum problem size (2^31 - 1). 63 /// </summary> 64 public override int MaximumProblemSize { 65 get { return int.MaxValue; } 44 66 } 45 67 … … 49 71 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 50 72 /// <returns>The result value of the Sphere function at the given point.</returns> 51 public static double Apply( double[]point) {73 public static double Apply(RealVector point) { 52 74 double result = 0; 53 75 for (int i = 0; i < point.Length; i++) … … 62 84 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 63 85 /// <returns>The result value of the Sphere function at the given point.</returns> 64 protected override double EvaluateFunction( double[]point) {86 protected override double EvaluateFunction(RealVector point) { 65 87 return Apply(point); 66 88 } -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/Evaluators/ZakharovEvaluator.cs
r3150 r3154 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-20 08Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Text; 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.RealVectorEncoding; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 27 26 namespace HeuristicLab. TestFunctions{28 namespace HeuristicLab.Problems.TestFunctions.SingleObjective { 27 29 /// <summary> 28 30 /// Zakharov Function<br/> … … 30 32 /// Optimum: 0.0 at (0.0, 0.0, ..., 0.0) 31 33 /// </summary> 32 public class ZakharovEvaluator : TestFunctionEvaluatorBase { 33 /// <inheritdoc select="summary"/> 34 public override string Description { 35 get { return 36 @"Zakharov Function 37 38 Domain: [-5.0 , 10.0]^n 39 Optimum: 0.0 at (0.0, 0.0, ..., 0.0)"; 40 } 34 [Item("ZakharovEvaluator", "Evaluates the Zakharov function on a given point. The optimum of this function is 0 at the origin.")] 35 [StorableClass] 36 public class ZakharovEvaluator : SingleObjectiveTestFunctionEvaluator { 37 /// <summary> 38 /// Returns false as the Ackley 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[,] { { -5, 10 } }); } 54 } 55 /// <summary> 56 /// Gets the minimum problem size (1). 57 /// </summary> 58 public override int MinimumProblemSize { 59 get { return 1; } 60 } 61 /// <summary> 62 /// Gets the (theoretical) maximum problem size (2^31 - 1). 63 /// </summary> 64 public override int MaximumProblemSize { 65 get { return int.MaxValue; } 41 66 } 42 67 … … 46 71 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 47 72 /// <returns>The result value of the Zakharov function at the given point.</returns> 48 public static double Apply( double[]point) {73 public static double Apply(RealVector point) { 49 74 int length = point.Length; 50 75 double s1 = 0; … … 64 89 /// <param name="point">N-dimensional point for which the test function should be evaluated.</param> 65 90 /// <returns>The result value of the Zakharov function at the given point.</returns> 66 protected override double EvaluateFunction( double[]point) {91 protected override double EvaluateFunction(RealVector point) { 67 92 return Apply(point); 68 93 } -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/HeuristicLab.Problems.TestFunctions.SingleObjective-3.3.csproj
r3150 r3154 53 53 <ItemGroup> 54 54 <Compile Include="Evaluators\AckleyEvaluator.cs" /> 55 <Compile Include="Evaluators\BealeEvaluator.cs" /> 56 <Compile Include="Evaluators\BoothEvaluator.cs" /> 57 <Compile Include="Evaluators\GriewangkEvaluator.cs" /> 58 <Compile Include="Evaluators\LevyEvaluator.cs" /> 59 <Compile Include="Evaluators\MatyasEvaluator.cs" /> 60 <Compile Include="Evaluators\RastriginEvaluator.cs" /> 61 <Compile Include="Evaluators\RosenbrockEvaluator.cs" /> 62 <Compile Include="Evaluators\SchwefelEvaluator.cs" /> 55 63 <Compile Include="Evaluators\SingleObjectiveTestFunctionEvaluator.cs" /> 64 <Compile Include="Evaluators\SphereEvaluator.cs" /> 65 <Compile Include="Evaluators\ZakharovEvaluator.cs" /> 56 66 <Compile Include="HeuristicLabProblemsTestFunctionsSingleObjectivePlugin.cs" /> 57 67 <Compile Include="Interfaces\ISingleObjectiveTestFunctionEvaluator.cs" /> -
trunk/sources/HeuristicLab.Problems.TestFunctions.SingleObjective/3.3/SingleObjectiveTestFunction.cs
r3150 r3154 83 83 84 84 #region Properties 85 public BoolValue Maximization { 86 get { return MaximizationParameter.Value; } 87 set { MaximizationParameter.Value = value; } 88 } 85 89 public DoubleMatrix Bounds { 86 90 get { return BoundsParameter.Value; } … … 193 197 private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) { 194 198 ParameterizeEvaluator(); 199 Maximization.Value = Evaluator.Maximization; 200 BoundsParameter.Value = Evaluator.Bounds; 201 if (ProblemSize.Value < Evaluator.MinimumProblemSize) 202 ProblemSize.Value = Evaluator.MinimumProblemSize; 203 else if (ProblemSize.Value > Evaluator.MaximumProblemSize) 204 ProblemSize.Value = Evaluator.MaximumProblemSize; 205 BestKnownQuality = new DoubleValue(Evaluator.BestKnownQuality); 195 206 Evaluator_QualityParameter_ActualNameChanged(null, EventArgs.Empty); 196 207 } … … 200 211 private void VisualizerParameter_ValueChanged(object sender, EventArgs e) { 201 212 ParameterizeVisualizer(); 213 } 214 private void BoundsParameter_ValueChanged(object sender, EventArgs e) { 215 Bounds.ToStringChanged += new EventHandler(Bounds_ToStringChanged); 216 Bounds_ToStringChanged(null, EventArgs.Empty); 217 } 218 private void Bounds_ToStringChanged(object sender, EventArgs e) { 219 if (Bounds.Columns != 2 || Bounds.Rows < 1) 220 Bounds = new DoubleMatrix(1, 2); 221 } 222 private void Bounds_ItemChanged(object sender, EventArgs<int, int> e) { 223 if (e.Value2 == 0 && Bounds[e.Value, 1] <= Bounds[e.Value, 0]) 224 Bounds[e.Value, 1] = Bounds[e.Value, 0] + 0.1; 225 if (e.Value2 == 1 && Bounds[e.Value, 0] >= Bounds[e.Value, 1]) 226 Bounds[e.Value, 0] = Bounds[e.Value, 1] - 0.1; 202 227 } 203 228 #endregion … … 209 234 ProblemSizeParameter.ValueChanged += new EventHandler(ProblemSizeParameter_ValueChanged); 210 235 ProblemSize.ValueChanged += new EventHandler(ProblemSize_ValueChanged); 236 BoundsParameter.ValueChanged += new EventHandler(BoundsParameter_ValueChanged); 237 Bounds.ToStringChanged += new EventHandler(Bounds_ToStringChanged); 238 Bounds.ItemChanged += new EventHandler<EventArgs<int, int>>(Bounds_ItemChanged); 211 239 SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged); 212 240 SolutionCreator.RealVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_RealVectorParameter_ActualNameChanged);
Note: See TracChangeset
for help on using the changeset viewer.