ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
sol
function
expectationquad
ROL_LogExponentialQuadrangle.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_LOGEXPONENTIALQUAD_HPP
11
#define ROL_LOGEXPONENTIALQUAD_HPP
12
13
#include "
ROL_ExpectationQuad.hpp
"
14
43
44
namespace
ROL
{
45
46
template
<
class
Real>
47
class
LogExponentialQuadrangle
:
public
ExpectationQuad
<Real> {
48
private
:
49
Real
coeff_
;
50
51
void
parseParameterList
(ROL::ParameterList &parlist) {
52
std::string type = parlist.sublist(
"SOL"
).get(
"Type"
,
"Risk Averse"
);
53
ROL::ParameterList list;
54
if
(type ==
"Risk Averse"
) {
55
list = parlist.sublist(
"SOL"
).sublist(
"Risk Measure"
).sublist(
"Entropic Risk"
);
56
}
57
else
if
(type ==
"Error"
) {
58
list = parlist.sublist(
"SOL"
).sublist(
"Error Measure"
).sublist(
"Exponential"
);
59
}
60
else
if
(type ==
"Deviation"
) {
61
list = parlist.sublist(
"SOL"
).sublist(
"Deviation Measure"
).sublist(
"Entropic"
);
62
}
63
else
if
(type ==
"Regret"
) {
64
list = parlist.sublist(
"SOL"
).sublist(
"Regret Measure"
).sublist(
"Exponential"
);
65
}
66
coeff_
= list.get<Real>(
"Rate"
);
67
}
68
69
void
checkInputs
(
void
)
const
{
70
Real
zero
(0);
71
ROL_TEST_FOR_EXCEPTION((
coeff_
<=
zero
), std::invalid_argument,
72
">>> ERROR (ROL::LogExponentialQuadrangle): Rate must be positive!"
);
73
}
74
75
public
:
80
LogExponentialQuadrangle
(
const
Real coeff = 1)
81
:
ExpectationQuad
<Real>(),
coeff_
(coeff) {
82
checkInputs
();
83
}
84
93
LogExponentialQuadrangle
(ROL::ParameterList &parlist)
94
:
ExpectationQuad
<Real>() {
95
parseParameterList
(parlist);
96
checkInputs
();
97
}
98
99
Real
error
(Real x,
int
deriv = 0) {
100
Real err(0), one(1), cx =
coeff_
*x;
101
if
(deriv==0) {
102
err = (std::exp(cx) - cx - one)/
coeff_
;
103
}
104
else
if
(deriv==1) {
105
err = std::exp(cx) - one;
106
}
107
else
{
108
err =
coeff_
*std::exp(cx);
109
}
110
return
err;
111
}
112
113
Real
regret
(Real x,
int
deriv = 0) {
114
Real
zero
(0), one(1);
115
Real X = ((deriv==0) ? x : ((deriv==1) ? one :
zero
));
116
Real reg =
error
(x,deriv) + X;
117
return
reg;
118
}
119
120
};
121
122
}
123
#endif
ROL_ExpectationQuad.hpp
zero
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0 zero)()
Definition
ROL_Objective_SerialSimOpt.hpp:77
ROL::ExpectationQuad::ExpectationQuad
ExpectationQuad(void)
Definition
ROL_ExpectationQuad.hpp:56
ROL::LogExponentialQuadrangle::parseParameterList
void parseParameterList(ROL::ParameterList &parlist)
Definition
ROL_LogExponentialQuadrangle.hpp:51
ROL::LogExponentialQuadrangle::checkInputs
void checkInputs(void) const
Definition
ROL_LogExponentialQuadrangle.hpp:69
ROL::LogExponentialQuadrangle::error
Real error(Real x, int deriv=0)
Evaluate the scalar error function at x.
Definition
ROL_LogExponentialQuadrangle.hpp:99
ROL::LogExponentialQuadrangle::LogExponentialQuadrangle
LogExponentialQuadrangle(const Real coeff=1)
Constructor.
Definition
ROL_LogExponentialQuadrangle.hpp:80
ROL::LogExponentialQuadrangle::regret
Real regret(Real x, int deriv=0)
Evaluate the scalar regret function at x.
Definition
ROL_LogExponentialQuadrangle.hpp:113
ROL::LogExponentialQuadrangle::LogExponentialQuadrangle
LogExponentialQuadrangle(ROL::ParameterList &parlist)
Constructor.
Definition
ROL_LogExponentialQuadrangle.hpp:93
ROL::LogExponentialQuadrangle::coeff_
Real coeff_
Definition
ROL_LogExponentialQuadrangle.hpp:49
ROL
Definition
ROL_ElementwiseVector.hpp:27
Generated by
1.17.0