30 : lineSearch_(
std::move(lineSearch)) {
40 Size maxStationaryStateIterations_
45 Size iterationNumber_ = 0;
51 Real fnew, fold, gold2;
58 Array prevGradient(sz),
d(sz), sddiff(sz), direction(sz);
64 bool first_time =
true;
70 t = (*lineSearch_)(P, ecType, endCriteria,
t);
80 fold = P.functionValue();
81 P.setFunctionValue(
lineSearch_->lastFunctionValue());
85 gold2 = P.gradientNormValue();
86 P.setGradientNormValue(
lineSearch_->lastGradientNorm2());
91 sddiff = direction -
lineSearch_->searchDirection();
95 fnew = P.functionValue();
96 fdiff = 2.0*std::fabs(fnew-fold) /
97 (std::fabs(fnew) + std::fabs(fold) +
QL_EPSILON);
99 endCriteria.checkMaxIterations(iterationNumber_, ecType)) {
100 endCriteria.checkStationaryFunctionValue(0.0, 0.0,
101 maxStationaryStateIterations_, ecType);
102 endCriteria.checkMaxIterations(iterationNumber_, ecType);
105 P.setCurrentValue(
x_);
Armijo line-search class.
1-D array used in linear algebra.
Criteria to end optimization process:
Real functionEpsilon() const
Size maxStationaryStateIterations() const
virtual Array getUpdatedDirection(const Problem &P, Real gold2, const Array &gradient)=0
computes the new search direction
LineSearchBasedMethod(ext::shared_ptr< LineSearch > lSearch=ext::shared_ptr< LineSearch >())
ext::shared_ptr< LineSearch > lineSearch_
line search
EndCriteria::Type minimize(Problem &P, const EndCriteria &endCriteria) override
minimize the optimization problem P
Constrained optimization problem.
const Array & currentValue() const
current value of the local minimum
void setGradientNormValue(Real squaredNorm)
void setFunctionValue(Real functionValue)
void setCurrentValue(const Array ¤tValue)
Real valueAndGradient(Array &grad_f, const Array &x)
call cost function computation and it gradient
std::size_t Size
size of a container
Line search abstract class.
Abstract optimization method class.
Real DotProduct(const Array &v1, const Array &v2)
Abstract optimization problem class.