ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
step
interiorpoint
ROL_LogBarrierObjective.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_LOG_BARRIER_OBJECTIVE_H
11
#define ROL_LOG_BARRIER_OBJECTIVE_H
12
13
#include "
ROL_Objective.hpp
"
14
19
20
namespace
ROL
{
21
22
template
<
class
Real>
23
class
LogBarrierObjective
:
public
Objective
<Real> {
24
public
:
25
26
27
28
/* \brief Objective value J(x) = \f$-\sum_i \log(x_i) \f$ */
29
Real
value
(
const
Vector<Real>
&x, Real &tol ) {
30
31
ROL::Ptr<Vector<Real> > logx = x.
clone
();
32
logx->set(x);
33
34
Elementwise::Logarithm<Real> log;
35
36
logx->applyUnary(log);
37
38
Elementwise::ReductionSum<Real> sum;
39
40
Real result = -(logx->reduce(sum));
41
42
return
result;
43
}
44
45
/* \brief gradient g_i = \f$ 1/x_i \f$ */
46
void
gradient
(
Vector<Real>
&g,
const
Vector<Real>
&x, Real &tol ) {
47
48
g.
set
(x);
49
50
Elementwise::Reciprocal<Real> reciprocal;
51
52
g.
applyUnary
(reciprocal);
53
g.
scale
(-1.0);
54
}
55
56
Real
dirDeriv
(
const
Vector<Real>
&x,
const
Vector<Real>
&d, Real &tol ) {
57
58
ROL::Ptr<Vector<Real> > dbyx = d.
clone
();
59
dbyx->set(x);
60
61
struct
Division :
public
Elementwise::BinaryFunction<Real> {
62
Real
apply
(
const
Real &xc,
const
Real &dc )
const
{
63
return
dc/xc;
64
}
65
} division;
66
67
dbyx->applyBinary( division, d );
68
69
Elementwise::ReductionSum<Real> sum;
70
71
return
-dbyx->reduce(sum);
72
}
73
74
void
hessVec
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
const
Vector<Real>
&x, Real &tol ) {
75
hv.
set
(v);
76
77
struct
HessianApply :
public
Elementwise::BinaryFunction<Real> {
78
Real
apply
(
const
Real &vc,
const
Real &xc )
const
{
79
return
vc/(xc*xc);
80
}
81
} hessian;
82
83
hv.
applyBinary
(hessian,x);
84
85
}
86
87
};
88
89
}
// namespace ROL
90
91
#endif
// ROL_LOG_BARRIER_OBJECTIVE_H
ROL_Objective.hpp
ROL::LogBarrierObjective
Log barrier objective for interior point methods.
Definition
ROL_LogBarrierObjective.hpp:23
ROL::LogBarrierObjective::value
Real value(const Vector< Real > &x, Real &tol)
Definition
ROL_LogBarrierObjective.hpp:29
ROL::LogBarrierObjective::dirDeriv
Real dirDeriv(const Vector< Real > &x, const Vector< Real > &d, Real &tol)
Definition
ROL_LogBarrierObjective.hpp:56
ROL::LogBarrierObjective::hessVec
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Definition
ROL_LogBarrierObjective.hpp:74
ROL::LogBarrierObjective::gradient
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Definition
ROL_LogBarrierObjective.hpp:46
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::applyUnary
virtual void applyUnary(const Elementwise::UnaryFunction< Real > &f)
Definition
ROL_Vector.hpp:209
ROL::Vector::applyBinary
virtual void applyBinary(const Elementwise::BinaryFunction< Real > &f, const Vector &x)
Definition
ROL_Vector.hpp:215
ROL::Vector::scale
virtual void scale(const Real alpha)=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::apply
ROL::BlockOperator2Diagonal BlockOperator2 apply(V &Hv, const V &v, Real &tol) const
Definition
ROL_BlockOperator2Diagonal.hpp:44
Generated by
1.17.0