ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
simopt
ROL_LinearObjective_SimOpt.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_LINEAR_OBJECTIVE_SIMOPT_H
11
#define ROL_LINEAR_OBJECTIVE_SIMOPT_H
12
13
#include "
ROL_Objective_SimOpt.hpp
"
14
27
28
29
namespace
ROL
{
30
31
template
<
class
Real>
32
class
LinearObjective_SimOpt
:
public
Objective_SimOpt
<Real> {
33
private
:
34
const
Ptr<const Vector<Real>>
simcost_
,
optcost_
;
35
36
public
:
37
LinearObjective_SimOpt
(
const
Ptr<
const
Vector<Real>
> &simcost = nullPtr,
38
const
Ptr<
const
Vector<Real>
> &optcost = nullPtr)
39
:
simcost_
(simcost),
optcost_
(optcost) {}
40
41
Real
value
(
const
Vector<Real>
&u,
const
Vector<Real>
&z, Real &tol ) {
42
Real valu(0), valz(0);
43
if
(
simcost_
!= nullPtr) {
44
//valu = u.dot(simcost_->dual());
45
valu = u.
apply
(*
simcost_
);
46
}
47
if
(
optcost_
!= nullPtr) {
48
//valz = z.dot(optcost_->dual());
49
valz = z.
apply
(*
optcost_
);
50
}
51
return
valu + valz;
52
}
53
54
void
gradient_1
(
Vector<Real>
&g,
const
Vector<Real>
&u,
const
Vector<Real>
&z, Real &tol ) {
55
if
(
simcost_
!= nullPtr) {
56
g.
set
(*
simcost_
);
57
}
58
else
{
59
g.
zero
();
60
}
61
}
62
63
void
gradient_2
(
Vector<Real>
&g,
const
Vector<Real>
&u,
const
Vector<Real>
&z, Real &tol ) {
64
if
(
optcost_
!= nullPtr) {
65
g.
set
(*
optcost_
);
66
}
67
else
{
68
g.
zero
();
69
}
70
}
71
72
void
hessVec_11
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
const
Vector<Real>
&u,
const
Vector<Real>
&z, Real &tol ) {
73
hv.
zero
();
74
}
75
76
void
hessVec_12
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
const
Vector<Real>
&u,
const
Vector<Real>
&z, Real &tol ) {
77
hv.
zero
();
78
}
79
80
void
hessVec_21
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
const
Vector<Real>
&u,
const
Vector<Real>
&z, Real &tol ) {
81
hv.
zero
();
82
}
83
84
void
hessVec_22
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
const
Vector<Real>
&u,
const
Vector<Real>
&z, Real &tol ) {
85
hv.
zero
();
86
}
87
88
};
// class LinearObjective_SimOpt
89
90
}
// namespace ROL
91
92
#endif
ROL_Objective_SimOpt.hpp
ROL::LinearObjective_SimOpt::LinearObjective_SimOpt
LinearObjective_SimOpt(const Ptr< const Vector< Real > > &simcost=nullPtr, const Ptr< const Vector< Real > > &optcost=nullPtr)
Definition
ROL_LinearObjective_SimOpt.hpp:37
ROL::LinearObjective_SimOpt::simcost_
const Ptr< const Vector< Real > > simcost_
Definition
ROL_LinearObjective_SimOpt.hpp:34
ROL::LinearObjective_SimOpt::hessVec_12
void hessVec_12(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Definition
ROL_LinearObjective_SimOpt.hpp:76
ROL::LinearObjective_SimOpt::hessVec_11
void hessVec_11(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply Hessian approximation to vector.
Definition
ROL_LinearObjective_SimOpt.hpp:72
ROL::LinearObjective_SimOpt::hessVec_22
void hessVec_22(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Definition
ROL_LinearObjective_SimOpt.hpp:84
ROL::LinearObjective_SimOpt::value
Real value(const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Compute value.
Definition
ROL_LinearObjective_SimOpt.hpp:41
ROL::LinearObjective_SimOpt::gradient_1
void gradient_1(Vector< Real > &g, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Compute gradient with respect to first component.
Definition
ROL_LinearObjective_SimOpt.hpp:54
ROL::LinearObjective_SimOpt::gradient_2
void gradient_2(Vector< Real > &g, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Compute gradient with respect to second component.
Definition
ROL_LinearObjective_SimOpt.hpp:63
ROL::LinearObjective_SimOpt::optcost_
const Ptr< const Vector< Real > > optcost_
Definition
ROL_LinearObjective_SimOpt.hpp:34
ROL::LinearObjective_SimOpt::hessVec_21
void hessVec_21(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Definition
ROL_LinearObjective_SimOpt.hpp:80
ROL::Objective_SimOpt
Provides the interface to evaluate simulation-based objective functions.
Definition
ROL_Objective_SimOpt.hpp:25
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL::Vector::apply
virtual Real apply(const Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
Definition
ROL_Vector.hpp:205
ROL::Vector::set
virtual void set(const Vector &x)
Set where .
Definition
ROL_Vector.hpp:176
ROL::Vector::zero
virtual void zero()
Set to zero vector.
Definition
ROL_Vector.hpp:134
ROL
Definition
ROL_ElementwiseVector.hpp:27
Generated by
1.17.0