13#include <NeMachineLearningLib.h>
14#include <MachineLearning/IOptimizationMethod.h>
15#include <MachineLearning/NonlinearObjectiveFunction.h>
21 namespace MachineLearning
29 template<
typename Scalar>
93 virtual bool Maximize(af::array& values,
int* cycle =
nullptr);
111 virtual bool Minimize(af::array& values,
int* cycle =
nullptr);
241 void init(
int numberOfVariables);
Base class for optimization methods.
virtual bool Minimize(af::array &values, int *cycle=nullptr)
Finds the minimum value of a function. The solution vector will be made available at the Solution pro...
virtual bool Optimize(int *cycle=nullptr)=0
Implements the actual optimization algorithm. This method should try to minimize the objective functi...
BaseOptimizationMethod(int numberOfVariables, std::function< Scalar(const af::array &, af::array &)> function)
Initializes a new instance of the BaseOptimizationMethod class.
virtual bool Maximize(af::array &values, int *cycle=nullptr)
Finds the maximum value of a function. The solution vector will be made available at the Solution pro...
BaseOptimizationMethod(NonlinearObjectiveFunction< Scalar > *function)
Initializes a new instance of the BaseOptimizationMethod class.
virtual af::array GetSolution()
Gets the current solution found, the values of the parameters which optimizes the function.
void SetNumberOfVariables(int n)
Sets the number of variables (free parameters) in the optimization problem.
virtual bool Maximize(int *cycle=nullptr)
Finds the maximum value of a function. The solution vector will be made available at the Solution pro...
virtual int GetNumberOfVariables()
Gets the number of variables (free parameters) in the optimization problem.
virtual bool Minimize(int *cycle=nullptr)
Finds the minimum value of a function. The solution vector will be made available at the Solution pro...
void SetValue(Scalar v)
Sets the output of the function at the current Solution.
virtual void SetSolution(af::array &x)
Sets the current solution found, the values of the parameters which optimizes the function.
void Display(bool display)
Set to display optimization information.
BaseOptimizationMethod(int numberOfVariables)
Initializes a new instance of the BaseOptimizationMethod class.
virtual Scalar GetValue()
Gets the output of the function at the current Solution.
Common interface for function optimization methods.