ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
dynamic
ROL_NonlinearLeastSquaresObjective_Dynamic.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_NONLINEARLEASTSQUARESOBJECTIVE_DYNAMIC_H
11
#define ROL_NONLINEARLEASTSQUARESOBJECTIVE_DYNAMIC_H
12
13
#include "
ROL_Objective.hpp
"
14
#include "
ROL_DynamicConstraint.hpp
"
15
#include "
ROL_Types.hpp
"
16
34
35
36
namespace
ROL
{
37
38
template
<
class
Real>
39
class
DynamicConstraint
;
40
41
template
<
class
Real>
42
class
NonlinearLeastSquaresObjective_Dynamic
:
public
Objective
<Real> {
43
private
:
44
const
Ptr<DynamicConstraint<Real>>
con_
;
45
const
Ptr<const Vector<Real>>
uo_
;
46
const
Ptr<const Vector<Real>>
z_
;
47
const
Ptr<const TimeStamp<Real>>
ts_
;
48
const
bool
GaussNewtonHessian_
;
49
50
Ptr<Vector<Real> >
c1_
,
c2_
,
cdual_
,
udual_
;
51
52
public
:
60
NonlinearLeastSquaresObjective_Dynamic
(
const
Ptr<
DynamicConstraint<Real>
> &con,
61
const
Vector<Real>
&c,
62
const
Ptr<
const
Vector<Real>
> &uo,
63
const
Ptr<
const
Vector<Real>
> &z,
64
const
Ptr<
const
TimeStamp<Real>
> &ts,
65
const
bool
GNH =
false
)
66
:
con_
(con),
uo_
(uo),
z_
(z),
ts_
(ts),
GaussNewtonHessian_
(GNH) {
67
c1_
= c.
clone
();
68
c2_
= c.
clone
();
69
cdual_
= c.
dual
().clone();
70
udual_
= uo->dual().clone();
71
}
72
73
void
update
(
const
Vector<Real>
&u,
bool
flag =
true
,
int
iter = -1 ) {
74
//con_->update_un(u,*ts_);
75
con_
->update(*
uo_
,u,*
z_
,*
ts_
);
76
con_
->value(*
c1_
,*
uo_
,u,*
z_
,*
ts_
);
77
cdual_
->set(
c1_
->dual());
78
}
79
80
Real
value
(
const
Vector<Real>
&x, Real &tol ) {
81
Real half(0.5);
82
return
half*(
c1_
->dot(*
cdual_
));
83
}
84
85
void
gradient
(
Vector<Real>
&g,
const
Vector<Real>
&u, Real &tol ) {
86
con_
->applyAdjointJacobian_un(g,*
cdual_
,*
uo_
,u,*
z_
,*
ts_
);
87
}
88
89
void
hessVec
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
const
Vector<Real>
&u, Real &tol ) {
90
con_
->applyJacobian_un(*
c2_
,v,*
uo_
,u,*
z_
,*
ts_
);
91
con_
->applyAdjointJacobian_un(hv,
c2_
->dual(),*
uo_
,u,*
z_
,*
ts_
);
92
if
( !
GaussNewtonHessian_
) {
93
con_
->applyAdjointHessian_un_un(*
udual_
,*
cdual_
,v,*
uo_
,u,*
z_
,*
ts_
);
94
hv.
plus
(*
udual_
);
95
}
96
}
97
98
void
precond
(
Vector<Real>
&pv,
const
Vector<Real>
&v,
const
Vector<Real>
&u, Real &tol ) {
99
con_
->applyInverseAdjointJacobian_un(*
cdual_
,v,*
uo_
,u,*
z_
,*
ts_
);
100
con_
->applyInverseJacobian_un(pv,
cdual_
->dual(),*
uo_
,u,*
z_
,*
ts_
);
101
}
102
103
// Definitions for parametrized (stochastic) equality constraints
104
//public:
105
// void setParameter(const std::vector<Real> ¶m) {
106
// Objective<Real>::setParameter(param);
107
// con_->setParameter(param);
108
// }
109
};
110
111
}
// namespace ROL
112
113
#endif
ROL_DynamicConstraint.hpp
ROL_Objective.hpp
ROL_Types.hpp
Contains definitions of custom data types in ROL.
ROL::DynamicConstraint
Defines the time-dependent constraint operator interface for simulation-based optimization.
Definition
ROL_DynamicConstraint.hpp:53
ROL::NonlinearLeastSquaresObjective_Dynamic::cdual_
Ptr< Vector< Real > > cdual_
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:50
ROL::NonlinearLeastSquaresObjective_Dynamic::udual_
Ptr< Vector< Real > > udual_
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:50
ROL::NonlinearLeastSquaresObjective_Dynamic::ts_
const Ptr< const TimeStamp< Real > > ts_
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:47
ROL::NonlinearLeastSquaresObjective_Dynamic::update
void update(const Vector< Real > &u, bool flag=true, int iter=-1)
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:73
ROL::NonlinearLeastSquaresObjective_Dynamic::precond
void precond(Vector< Real > &pv, const Vector< Real > &v, const Vector< Real > &u, Real &tol)
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:98
ROL::NonlinearLeastSquaresObjective_Dynamic::NonlinearLeastSquaresObjective_Dynamic
NonlinearLeastSquaresObjective_Dynamic(const Ptr< DynamicConstraint< Real > > &con, const Vector< Real > &c, const Ptr< const Vector< Real > > &uo, const Ptr< const Vector< Real > > &z, const Ptr< const TimeStamp< Real > > &ts, const bool GNH=false)
Constructor.
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:60
ROL::NonlinearLeastSquaresObjective_Dynamic::c2_
Ptr< Vector< Real > > c2_
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:50
ROL::NonlinearLeastSquaresObjective_Dynamic::gradient
void gradient(Vector< Real > &g, const Vector< Real > &u, Real &tol)
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:85
ROL::NonlinearLeastSquaresObjective_Dynamic::GaussNewtonHessian_
const bool GaussNewtonHessian_
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:48
ROL::NonlinearLeastSquaresObjective_Dynamic::value
Real value(const Vector< Real > &x, Real &tol)
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:80
ROL::NonlinearLeastSquaresObjective_Dynamic::z_
const Ptr< const Vector< Real > > z_
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:46
ROL::NonlinearLeastSquaresObjective_Dynamic::c1_
Ptr< Vector< Real > > c1_
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:50
ROL::NonlinearLeastSquaresObjective_Dynamic::hessVec
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, Real &tol)
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:89
ROL::NonlinearLeastSquaresObjective_Dynamic::con_
const Ptr< DynamicConstraint< Real > > con_
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:44
ROL::NonlinearLeastSquaresObjective_Dynamic::uo_
const Ptr< const Vector< Real > > uo_
Definition
ROL_NonlinearLeastSquaresObjective_Dynamic.hpp:45
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::dual
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis,...
Definition
ROL_Vector.hpp:193
ROL::Vector::plus
virtual void plus(const Vector &x)=0
Compute , where .
ROL::Vector::clone
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::TimeStamp
Contains local time step information.
Definition
ROL_TimeStamp.hpp:35
Generated by
1.17.0