The BenchmarkFunction trait specifies the requirements for the logic of an object representing a benchmark function. The methods provided in this trait are used for tests and benchmarks performed on function optimization and gradient descent classes.
Classes mixing in this trait must declare the functionMinimum field and implement the objFunction method. Additionally, overriding the default implementation of the gradientFunction method is highly recommended. The objFunction method represents the mathematical function the object will model. The functionMinimum field represents the variable values that minimize the output of the objFunction method. Finally, the gradientFunction method represents the gradient function for the objFunction function. An approximation for this method is automatically provided by making use of the Differential class, but overriding it with a hard-coded definition of the gradient function is highly recommended as it will greatly improve the accuracy of the results.
The objective function used for benchmarking or testing purposes. Can be any mathematical function that receives an arbitrary number of real numbers as input and produces a single real number as an output.
The objective function used for benchmarking or testing purposes. Can be any mathematical function that receives an arbitrary number of real numbers as input and produces a single real number as an output.
Value parameters
x
VectorD with the values of the variables to be used as input for the objective function.
Attributes
Returns
Double The output of the objective function given by using the values in x as input.
The mathematical function that represents the gradient of the objective function represented by objFunction. An approximation using the Differential class is provided as the default implementation of this method, but it is highly encouraged to override this method with a hard-coded implementation of the correct gradient function in order to greatly improve the accuracy of the results.
The mathematical function that represents the gradient of the objective function represented by objFunction. An approximation using the Differential class is provided as the default implementation of this method, but it is highly encouraged to override this method with a hard-coded implementation of the correct gradient function in order to greatly improve the accuracy of the results.
The function described in this method implementation should correspond to the gradient of the function described in objFunction or else the results obtained in any tests or benchmarks will be void of meaning.
Value parameters
x
VectorD with the values of the variables to be used as input for the gradient function.
Attributes
Returns
VectorD The gradient of the objective function in the position given by the values in x.