13#include <MachineLearning/IObjectiveFunction.h>
17 namespace MachineLearning
19 template<
typename Scalar>
169 std::function<
Scalar(
const af::array&, af::array&)> _function;
173 af::array afLowerBound;
174 af::array afUpperBound;
af::array FiniteGradient(const af::array &x, int accuracy=0)
Finite gradient computation.
std::function< Scalar(const af::array &, af::array &)> GetFunction()
Gets the objective function.
void SetFunction(std::function< Scalar(const af::array &, af::array &)> func)
Gets the objective function.
Scalar Value(const af::array &x)
Computes function value of given x.
NonlinearObjectiveFunction()
Initializes a new instance of the NonlinearObjectiveFunction class.
void CheckGradient(const af::array &probe)
Checks the gradient.
int GetNumberOfVariables()
Gets the number of input variables for the function.
af::array & LowerBound()
Lower bound.
af::array & UpperBound()
Upper bound.
~NonlinearObjectiveFunction()
Destructor.
af::array Gradient(const af::array &x)
Gradient of given x.
NonlinearObjectiveFunction(int numberOfVariables)
Constructor.
NonlinearObjectiveFunction(int numberOfVariables, std::function< Scalar(const af::array &, af::array &)> function)
Creates a new objective function specified through a string.