NeuralEngine
A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes.
FgSCG.h
1
11#pragma once
12
13#include <MachineLearning/BaseGradientOptimizationMethod.h>
14
15namespace NeuralEngine
16{
17 namespace MachineLearning
18 {
24 enum ScaledConjugateGradientMethod
25 {
26 /*/// <summary>
29 FletcherReeves = 1,
30
38 PolakRibiere = 2,
39
48 PositivePolakRibiere = 3,*/
49 };
50
56 /*enum ScaledConjugateGradientCode
57 {
59 Success,
60
62 StepSize = 1,
63
65 DescentNotObtained = -2,
66
72 RoundingErrors = 6,
73
77 StepHigh = 5,
78
82 StepLow = 4,
83
87 MaximumEvaluations = 3,
88
92 Precision = 2,
93 };*/
94
108
143 template<typename Scalar, LineSearchType LSType = MoreThuente>
144 class NE_IMPEXP ScaledConjugateGradient : public BaseGradientOptimizationMethod<Scalar, LSType>
145 {
146 public:
147
157 ScaledConjugateGradient(int numberOfVariables);
158
170 ScaledConjugateGradient(int numberOfVariables, std::function<Scalar(const af::array&, af::array&)> function);
171
180
182
183
184
185 protected:
186
197 virtual bool Optimize(int* cycle = nullptr) override;
198
199 private:
200
201 };
202 }
203}
ScaledConjugateGradient(int numberOfVariables, std::function< Scalar(const af::array &, af::array &)> function)
Creates a new instance of the CG optimization algorithm.
virtual bool Optimize(int *cycle=nullptr) override
Implements the actual optimization algorithm. This method should try to minimize the objective functi...
ScaledConjugateGradient(NonlinearObjectiveFunction< Scalar > *function)
Creates a new instance of the CG optimization algorithm.
ScaledConjugateGradient(int numberOfVariables)
Creates a new instance of the CG optimization algorithm.