ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
sol
function
ROL_RiskLessObjective_Def.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_RISKLESSOBJECTIVE_DEF_HPP
11
#define ROL_RISKLESSOBJECTIVE_DEF_HPP
12
13
namespace
ROL
{
14
15
template
<
typename
Real>
16
RiskLessObjective<Real>::RiskLessObjective
(
const
Ptr<
Objective<Real>
> &obj) :
obj_
(obj) {}
17
18
template
<
typename
Real>
19
void
RiskLessObjective<Real>::update
(
const
Vector<Real>
&x,
UpdateType
type,
int
iter ) {
20
Ptr<const Vector<Real>> x0
21
=
dynamic_cast<
const
RiskVector<Real>
&
>
(x).getVector();
22
obj_
->update(*x0,type,iter);
23
}
24
25
template
<
typename
Real>
26
void
RiskLessObjective<Real>::update
(
const
Vector<Real>
&x,
bool
flag,
int
iter ) {
27
Ptr<const Vector<Real>> x0
28
=
dynamic_cast<
const
RiskVector<Real>
&
>
(x).getVector();
29
obj_
->update(*x0,flag,iter);
30
}
31
32
template
<
typename
Real>
33
Real
RiskLessObjective<Real>::value
(
const
Vector<Real>
&x, Real &tol ) {
34
Ptr<const Vector<Real>> x0
35
=
dynamic_cast<
const
RiskVector<Real>
&
>
(x).getVector();
36
return
obj_
->value(*x0,tol);
37
}
38
39
template
<
typename
Real>
40
void
RiskLessObjective<Real>::gradient
(
Vector<Real>
&g,
const
Vector<Real>
&x, Real &tol ) {
41
Ptr<Vector<Real>> g0
42
=
dynamic_cast<
RiskVector<Real>
&
>
(g).getVector();
43
Ptr<const Vector<Real>> x0
44
=
dynamic_cast<
const
RiskVector<Real>
&
>
(x).getVector();
45
obj_
->gradient(*g0,*x0,tol);
46
}
47
48
template
<
typename
Real>
49
void
RiskLessObjective<Real>::hessVec
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
50
const
Vector<Real>
&x, Real &tol ) {
51
Ptr<Vector<Real>> hv0
52
=
dynamic_cast<
RiskVector<Real>
&
>
(hv).getVector();
53
Ptr<const Vector<Real>> v0
54
=
dynamic_cast<
const
RiskVector<Real>
&
>
(v).getVector();
55
Ptr<const Vector<Real>> x0
56
=
dynamic_cast<
const
RiskVector<Real>
&
>
(x).getVector();
57
obj_
->hessVec(*hv0,*v0,*x0,tol);
58
}
59
60
template
<
typename
Real>
61
void
RiskLessObjective<Real>::precond
(
Vector<Real>
&Pv,
const
Vector<Real>
&v,
62
const
Vector<Real>
&x, Real &tol ) {
63
Ptr<Vector<Real>> Pv0
64
=
dynamic_cast<
RiskVector<Real>
&
>
(Pv).getVector();
65
Ptr<const Vector<Real>> v0
66
=
dynamic_cast<
const
RiskVector<Real>
&
>
(v).getVector();
67
Ptr<const Vector<Real>> x0
68
=
dynamic_cast<
const
RiskVector<Real>
&
>
(x).getVector();
69
obj_
->precond(*Pv0,*v0,*x0,tol);
70
}
71
72
template
<
typename
Real>
73
void
RiskLessObjective<Real>::setParameter
(
const
std::vector<Real> ¶m) {
74
Objective<Real>::setParameter
(param);
75
obj_
->setParameter(param);
76
}
77
78
}
79
80
#endif
ROL::Objective::setParameter
virtual void setParameter(const std::vector< Real > ¶m)
Definition
ROL_Objective.hpp:509
ROL::ROL::Objective::Objective
Objective()
Definition
ROL_Constraint_SerialSimOpt.hpp:53
ROL::RiskLessObjective::precond
void precond(Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_RiskLessObjective_Def.hpp:61
ROL::RiskLessObjective::value
Real value(const Vector< Real > &x, Real &tol) override
Definition
ROL_RiskLessObjective_Def.hpp:33
ROL::RiskLessObjective::setParameter
void setParameter(const std::vector< Real > ¶m) override
Definition
ROL_RiskLessObjective_Def.hpp:73
ROL::RiskLessObjective::gradient
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Definition
ROL_RiskLessObjective_Def.hpp:40
ROL::RiskLessObjective::hessVec
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_RiskLessObjective_Def.hpp:49
ROL::RiskLessObjective::obj_
const Ptr< Objective< Real > > obj_
Definition
ROL_RiskLessObjective.hpp:21
ROL::RiskLessObjective::RiskLessObjective
RiskLessObjective(const Ptr< Objective< Real > > &obj)
Definition
ROL_RiskLessObjective_Def.hpp:16
ROL::RiskLessObjective::update
void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Definition
ROL_RiskLessObjective_Def.hpp:19
ROL::RiskVector
Definition
ROL_RiskVector.hpp:20
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::UpdateType
UpdateType
Definition
ROL_UpdateType.hpp:18
Generated by
1.17.0