ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
algorithm
TypeU
trustregion
other
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.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_CONICAPPROXIMATIONMODEL_H
11
#define ROL_CONICAPPROXIMATIONMODEL_H
12
13
#include "
ROL_Objective.hpp
"
14
#include "
ROL_VectorWorkspace.hpp
"
15
27
28
29
namespace
ROL
{
30
31
template
<
class
Real>
32
class
ConicApproximationModel
:
public
Objective
<Real> {
33
34
using
V
=
Vector<Real>
;
35
using
Obj
=
Objective<Real>
;
36
37
private
:
38
Ptr<Obj>
obj_
;
39
const
Ptr<const V>
x_
,
a_
;
40
Ptr<V>
g_
,
s_
,
Hs_
;
41
Real
f_
,
gamma_
,
sHs_
;
42
43
VectorWorkspace<Real>
workspace_
;
44
45
public
:
46
47
virtual
~ConicApproximationModel
() {}
48
49
ConicApproximationModel
(
const
Ptr<Obj>& obj,
const
Ptr<const V>& x,
50
const
Ptr<V>& s,
const
Ptr<const V>& a ) :
51
obj_
( obj ),
x_
( x ),
a_
( a ),
g_
(
x_
->dual().clone() ),
s_
( s ),
52
Hs_
( x->dual().clone() ) {
53
Real tol = sqrt(
ROL_EPSILON<Real>
());
54
gamma_
= 1.0-
a_
->dot(*
s_
);
55
f_
=
obj_
->value( *
x_
, tol );
56
obj_
->gradient( *
g_
,*x,tol );
57
obj_
->hessVec( *
Hs_
, *
s_
, *
x_
, tol );
58
}
59
60
virtual
void
update
(
const
V
& s,
bool
flag=
true
,
int
iter=-1 )
override
{
61
Real tol = sqrt(
ROL_EPSILON<Real>
());
62
s_
->set(s);
63
gamma_
= 1.0-
a_
->dot(*
s_
);
64
obj_
->hessVec( *
Hs_
, *
s_
, *
x_
, tol );
65
}
66
67
virtual
Real
value
(
const
V
& s, Real& tol )
override
{
68
return
f_
+ (
g_
->dot(*
s_
) + 0.5*
sHs_
/
gamma_
)/
gamma_
;
69
}
70
71
virtual
void
gradient
(
V
&g,
const
V
&s, Real &tol )
override
{
72
73
g.
set
( *
g_
);
// g0
74
g.
scale
(
gamma_
);
// gamma*g0
75
g.
plus
( *
Hs_
);
// gamma*g0 + Hs
76
77
auto
u =
workspace_
.copy(*
a_
);
78
u->scale(
s_
->dot(g) );
79
g.
scale
(
gamma_
);
80
g.
plus
( *u );
81
g.
scale
( std::pow(
gamma_
,-3) );
82
83
}
84
85
virtual
void
hessVec
(
V
&hv,
const
V
&v,
const
V
&s, Real &tol )
override
{
86
87
auto
u =
workspace_
.copy(v);
88
89
u->scale(
gamma_
);
// gamma*v
90
u->axpy(
a_
->dot(v), s );
// gamma*v + (a,v)*s
91
obj_
->hessVec( hv, *u, *
x_
, tol );
// gamma*Hv + (a,v)*Hs
92
hv.
set
(*u);
93
hv.
scale
(
gamma_
);
94
hv.
axpy
(u->dot(s),*
a_
);
95
hv.
scale
(std::pow(
gamma_
,-4));
96
}
97
98
virtual
void
invHessVec
(
V
& hv,
const
V
& v,
const
V
& s, Real& tol )
override
{
99
100
auto
u =
workspace_
.copy(v);
101
102
u->axpy( -
a_
->dot(v), s );
// v - (a,v)*s
103
obj_
->invHessVec( hv, *u, *
x_
, tol );
// Hv - (a,v)*Hs
104
hv.
set
(*u);
105
hv.
axpy
(-u->dot(*
s_
),*
a_
);
106
hv.
scale
(std::pow(
gamma_
,2));
107
}
108
109
virtual
void
precond
(
V
& Pv,
const
V
& v,
const
V
& s, Real &tol )
override
{
110
111
auto
u =
workspace_
.copy(v);
112
113
u->axpy( -
a_
->dot(v), *
s_
);
// v - (a,v)*s
114
obj_
->precond( Pv, *u, *
x_
, tol );
// Hv - (a,v)*Hs
115
Pv.
set
(*u);
116
Pv.
axpy
(-u->dot(s),*
a_
);
117
Pv.
scale
(std::pow(
gamma_
,2));
118
}
119
120
121
122
};
// class ConicApproximationModel
123
124
}
// namespace ROL
125
126
127
#endif
ROL_Objective.hpp
ROL_VectorWorkspace.hpp
ROL::ConicApproximationModel::g_
Ptr< V > g_
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:40
ROL::ConicApproximationModel::obj_
Ptr< Obj > obj_
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:38
ROL::ConicApproximationModel::ConicApproximationModel
ConicApproximationModel(const Ptr< Obj > &obj, const Ptr< const V > &x, const Ptr< V > &s, const Ptr< const V > &a)
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:49
ROL::ConicApproximationModel::f_
Real f_
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:41
ROL::ConicApproximationModel::s_
Ptr< V > s_
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:40
ROL::ConicApproximationModel::invHessVec
virtual void invHessVec(V &hv, const V &v, const V &s, Real &tol) override
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:98
ROL::ConicApproximationModel::sHs_
Real sHs_
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:41
ROL::ConicApproximationModel::x_
const Ptr< const V > x_
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:39
ROL::ConicApproximationModel::V
Vector< Real > V
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:34
ROL::ConicApproximationModel::gamma_
Real gamma_
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:41
ROL::ConicApproximationModel::precond
virtual void precond(V &Pv, const V &v, const V &s, Real &tol) override
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:109
ROL::ConicApproximationModel::value
virtual Real value(const V &s, Real &tol) override
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:67
ROL::ConicApproximationModel::hessVec
virtual void hessVec(V &hv, const V &v, const V &s, Real &tol) override
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:85
ROL::ConicApproximationModel::a_
const Ptr< const V > a_
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:39
ROL::ConicApproximationModel::Hs_
Ptr< V > Hs_
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:40
ROL::ConicApproximationModel::Obj
Objective< Real > Obj
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:35
ROL::ConicApproximationModel::update
virtual void update(const V &s, bool flag=true, int iter=-1) override
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:60
ROL::ConicApproximationModel::gradient
virtual void gradient(V &g, const V &s, Real &tol) override
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:71
ROL::ConicApproximationModel::~ConicApproximationModel
virtual ~ConicApproximationModel()
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:47
ROL::ConicApproximationModel::workspace_
VectorWorkspace< Real > workspace_
Definition
algorithm/TypeU/trustregion/other/ROL_ConicApproximationModel.hpp:43
ROL::ROL::Objective::Objective
Objective()
Definition
ROL_Constraint_SerialSimOpt.hpp:53
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL::Vector::set
virtual void set(const Vector &x)
Set where .
Definition
ROL_Vector.hpp:176
ROL::Vector::scale
virtual void scale(const Real alpha)=0
Compute where .
ROL::Vector::plus
virtual void plus(const Vector &x)=0
Compute , where .
ROL::Vector::axpy
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Definition
ROL_Vector.hpp:120
ROL::details::VectorWorkspace
Definition
ROL_VectorWorkspace.hpp:64
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::ROL_EPSILON
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.
Definition
ROL_Types.hpp:57
Generated by
1.17.0