ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
algorithm
TypeU
linesearch
ROL_PathBasedTargetLevel_U.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Rapid Optimization Library (ROL) Package
4
//
5
// Copyright 2014 NTESS and the ROL contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef ROL_PATHBASEDTARGETLEVEL_U_H
11
#define ROL_PATHBASEDTARGETLEVEL_U_H
12
16
17
#include "
ROL_LineSearch_U.hpp
"
18
19
namespace
ROL
{
20
21
template
<
typename
Real>
22
class
PathBasedTargetLevel_U
:
public
LineSearch_U
<Real> {
23
private
:
24
Ptr<Vector<Real>>
xnew_
;
25
26
Real
min_value_
;
27
Real
rec_value_
;
28
Real
target_
;
29
Real
delta_
;
30
Real
sigma_
;
31
Real
bound_
;
32
33
public
:
34
35
PathBasedTargetLevel_U
( ParameterList &parlist )
36
:
LineSearch_U
<Real>(parlist),
37
min_value_
(
ROL_OVERFLOW
<Real>()),
38
rec_value_
(
ROL_OVERFLOW
<Real>()),
target_
(0.0),
sigma_
(0.0) {
39
Real p1(0.1), one(1);
40
delta_
= parlist.sublist(
"Step"
).sublist(
"Line Search"
).sublist(
"Line-Search Method"
).sublist(
"Path-Based Target Level"
).get(
"Target Relaxation Parameter"
,p1);
41
bound_
= parlist.sublist(
"Step"
).sublist(
"Line Search"
).sublist(
"Line-Search Method"
).sublist(
"Path-Based Target Level"
).get(
"Upper Bound on Path Length"
,one);
42
}
43
44
void
initialize
(
const
Vector<Real>
&x,
const
Vector<Real>
&g)
override
{
45
LineSearch_U<Real>::initialize
(x,g);
46
xnew_
= x.
clone
();
47
}
48
49
// Run Iteration scaled line search
50
void
run
( Real &alpha, Real &fval,
int
&ls_neval,
int
&ls_ngrad,
51
const
Real &gs,
const
Vector<Real>
&s,
const
Vector<Real>
&x,
52
Objective<Real>
&obj )
override
{
53
Real tol = std::sqrt(
ROL_EPSILON<Real>
()),
zero
(0), half(0.5);
54
ls_neval = 0;
55
ls_ngrad = 0;
56
// Update target objective value
57
if
( fval <
min_value_
) {
58
min_value_
= fval;
59
}
60
target_
=
rec_value_
- half*
delta_
;
61
if
( fval <
target_
) {
62
rec_value_
=
min_value_
;
63
sigma_
=
zero
;
64
}
65
else
{
66
if
(
sigma_
>
bound_
) {
67
rec_value_
=
min_value_
;
68
sigma_
=
zero
;
69
delta_
*= half;
70
}
71
}
72
target_
=
rec_value_
-
delta_
;
73
// Get line-search parameter
74
alpha = (fval -
target_
)/std::abs(gs);
75
// Update iterate
76
xnew_
->set(x);
xnew_
->axpy(alpha,s);
77
// Compute objective function value
78
obj.
update
(*
xnew_
,
UpdateType::Trial
);
79
fval = obj.
value
(*
xnew_
,tol);
80
ls_neval++;
81
// Update sigma
82
sigma_
+= alpha*std::sqrt(std::abs(gs));
83
}
84
};
// class ROL::PathBasedTargetValue_U
85
86
}
// namespace ROL
87
88
#endif
ROL_LineSearch_U.hpp
zero
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0 zero)()
Definition
ROL_Objective_SerialSimOpt.hpp:77
ROL::LineSearch_U::initialize
virtual void initialize(const Vector< Real > &x, const Vector< Real > &g)
Definition
ROL_LineSearch_U.hpp:117
ROL::LineSearch_U::LineSearch_U
LineSearch_U(ParameterList &parlist)
Definition
ROL_LineSearch_U.hpp:81
ROL::Objective
Provides the interface to evaluate objective functions.
Definition
ROL_Objective.hpp:44
ROL::Objective::value
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
ROL::Objective::update
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
Definition
ROL_Objective.hpp:62
ROL::PathBasedTargetLevel_U::sigma_
Real sigma_
Definition
ROL_PathBasedTargetLevel_U.hpp:30
ROL::PathBasedTargetLevel_U::min_value_
Real min_value_
Definition
ROL_PathBasedTargetLevel_U.hpp:26
ROL::PathBasedTargetLevel_U::bound_
Real bound_
Definition
ROL_PathBasedTargetLevel_U.hpp:31
ROL::PathBasedTargetLevel_U::PathBasedTargetLevel_U
PathBasedTargetLevel_U(ParameterList &parlist)
Definition
ROL_PathBasedTargetLevel_U.hpp:35
ROL::PathBasedTargetLevel_U::rec_value_
Real rec_value_
Definition
ROL_PathBasedTargetLevel_U.hpp:27
ROL::PathBasedTargetLevel_U::initialize
void initialize(const Vector< Real > &x, const Vector< Real > &g) override
Definition
ROL_PathBasedTargetLevel_U.hpp:44
ROL::PathBasedTargetLevel_U::xnew_
Ptr< Vector< Real > > xnew_
Definition
ROL_PathBasedTargetLevel_U.hpp:24
ROL::PathBasedTargetLevel_U::target_
Real target_
Definition
ROL_PathBasedTargetLevel_U.hpp:28
ROL::PathBasedTargetLevel_U::run
void run(Real &alpha, Real &fval, int &ls_neval, int &ls_ngrad, const Real &gs, const Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj) override
Definition
ROL_PathBasedTargetLevel_U.hpp:50
ROL::PathBasedTargetLevel_U::delta_
Real delta_
Definition
ROL_PathBasedTargetLevel_U.hpp:29
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL::Vector::clone
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::ROL_EPSILON
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.
Definition
ROL_Types.hpp:57
ROL::ROL_OVERFLOW
Real ROL_OVERFLOW(void)
Platform-dependent maximum double.
Definition
ROL_Types.hpp:68
ROL::UpdateType::Trial
@ Trial
Definition
ROL_UpdateType.hpp:22
Generated by
1.17.0