ROL
|
Provides the interface to evaluate composite objective functions. More...
#include <ROL_CompositeObjective.hpp>
Public Member Functions | |
CompositeObjective (const std::vector< ROL::Ptr< Objective< Real > > > &obj_vec, const ROL::Ptr< StdObjective< Real > > &std_obj) | |
void | update (const Vector< Real > &x, bool flag=true, int iter=-1) |
Update objective function. More... | |
Real | value (const Vector< Real > &x, Real &tol) |
Compute value. More... | |
void | gradient (Vector< Real > &g, const Vector< Real > &x, Real &tol) |
Compute gradient. More... | |
void | hessVec (Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) |
Apply Hessian approximation to vector. More... | |
void | setParameter (const std::vector< Real > ¶m) |
Public Member Functions inherited from ROL::Objective< Real > | |
virtual | ~Objective () |
virtual Real | dirDeriv (const Vector< Real > &x, const Vector< Real > &d, Real &tol) |
Compute directional derivative. More... | |
virtual void | invHessVec (Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) |
Apply inverse Hessian approximation to vector. More... | |
virtual void | precond (Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) |
Apply preconditioner to vector. More... | |
virtual std::vector < std::vector< Real > > | checkGradient (const Vector< Real > &x, const Vector< Real > &d, const bool printToStream=true, std::ostream &outStream=std::cout, const int numSteps=ROL_NUM_CHECKDERIV_STEPS, const int order=1) |
Finite-difference gradient check. More... | |
virtual std::vector < std::vector< Real > > | checkGradient (const Vector< Real > &x, const Vector< Real > &g, const Vector< Real > &d, const bool printToStream=true, std::ostream &outStream=std::cout, const int numSteps=ROL_NUM_CHECKDERIV_STEPS, const int order=1) |
Finite-difference gradient check. More... | |
virtual std::vector < std::vector< Real > > | checkGradient (const Vector< Real > &x, const Vector< Real > &d, const std::vector< Real > &steps, const bool printToStream=true, std::ostream &outStream=std::cout, const int order=1) |
Finite-difference gradient check with specified step sizes. More... | |
virtual std::vector < std::vector< Real > > | checkGradient (const Vector< Real > &x, const Vector< Real > &g, const Vector< Real > &d, const std::vector< Real > &steps, const bool printToStream=true, std::ostream &outStream=std::cout, const int order=1) |
Finite-difference gradient check with specified step sizes. More... | |
virtual std::vector < std::vector< Real > > | checkHessVec (const Vector< Real > &x, const Vector< Real > &v, const bool printToStream=true, std::ostream &outStream=std::cout, const int numSteps=ROL_NUM_CHECKDERIV_STEPS, const int order=1) |
Finite-difference Hessian-applied-to-vector check. More... | |
virtual std::vector < std::vector< Real > > | checkHessVec (const Vector< Real > &x, const Vector< Real > &hv, const Vector< Real > &v, const bool printToStream=true, std::ostream &outStream=std::cout, const int numSteps=ROL_NUM_CHECKDERIV_STEPS, const int order=1) |
Finite-difference Hessian-applied-to-vector check. More... | |
virtual std::vector < std::vector< Real > > | checkHessVec (const Vector< Real > &x, const Vector< Real > &v, const std::vector< Real > &steps, const bool printToStream=true, std::ostream &outStream=std::cout, const int order=1) |
Finite-difference Hessian-applied-to-vector check with specified step sizes. More... | |
virtual std::vector < std::vector< Real > > | checkHessVec (const Vector< Real > &x, const Vector< Real > &hv, const Vector< Real > &v, const std::vector< Real > &steps, const bool printToStream=true, std::ostream &outStream=std::cout, const int order=1) |
Finite-difference Hessian-applied-to-vector check with specified step sizes. More... | |
virtual std::vector< Real > | checkHessSym (const Vector< Real > &x, const Vector< Real > &v, const Vector< Real > &w, const bool printToStream=true, std::ostream &outStream=std::cout) |
Hessian symmetry check. More... | |
virtual std::vector< Real > | checkHessSym (const Vector< Real > &x, const Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &w, const bool printToStream=true, std::ostream &outStream=std::cout) |
Hessian symmetry check. More... | |
Private Member Functions | |
void | initialize (const Vector< Real > &x) |
void | computeValue (const Vector< Real > &x, Real &tol) |
void | computeGradient (const Vector< Real > &x, Real &tol) |
void | computeHessVec (const Vector< Real > &v, const Vector< Real > &x, Real &tol) |
Private Attributes | |
const std::vector< ROL::Ptr < Objective< Real > > > | obj_vec_ |
const ROL::Ptr< StdObjective < Real > > | std_obj_ |
ROL::Ptr< std::vector< Real > > | obj_value_ |
ROL::Ptr< std::vector< Real > > | obj_grad_ |
ROL::Ptr< std::vector< Real > > | obj_gv_ |
ROL::Ptr< std::vector< Real > > | obj_hess_ |
ROL::Ptr< StdVector< Real > > | obj_value_vec_ |
ROL::Ptr< StdVector< Real > > | obj_grad_vec_ |
ROL::Ptr< StdVector< Real > > | obj_gv_vec_ |
ROL::Ptr< StdVector< Real > > | obj_hess_vec_ |
std::vector< ROL::Ptr< Vector < Real > > > | vec_grad_ |
std::vector< ROL::Ptr< Vector < Real > > > | vec_hess_ |
bool | isInitialized_ |
bool | isValueComputed_ |
bool | isGradientComputed_ |
Additional Inherited Members | |
Protected Member Functions inherited from ROL::Objective< Real > | |
const std::vector< Real > | getParameter (void) const |
Provides the interface to evaluate composite objective functions.
Definition at line 58 of file ROL_CompositeObjective.hpp.
|
inline |
Definition at line 116 of file ROL_CompositeObjective.hpp.
References ROL::CompositeObjective< Real >::obj_grad_, ROL::CompositeObjective< Real >::obj_grad_vec_, ROL::CompositeObjective< Real >::obj_gv_, ROL::CompositeObjective< Real >::obj_gv_vec_, ROL::CompositeObjective< Real >::obj_hess_, ROL::CompositeObjective< Real >::obj_hess_vec_, ROL::CompositeObjective< Real >::obj_value_, ROL::CompositeObjective< Real >::obj_value_vec_, and ROL::CompositeObjective< Real >::obj_vec_.
|
inlineprivate |
Definition at line 69 of file ROL_CompositeObjective.hpp.
References ROL::Vector< Real >::dual(), ROL::CompositeObjective< Real >::isInitialized_, ROL::CompositeObjective< Real >::obj_vec_, ROL::CompositeObjective< Real >::vec_grad_, and ROL::CompositeObjective< Real >::vec_hess_.
Referenced by ROL::CompositeObjective< Real >::computeValue().
|
inlineprivate |
Definition at line 82 of file ROL_CompositeObjective.hpp.
References ROL::CompositeObjective< Real >::initialize(), ROL::CompositeObjective< Real >::isValueComputed_, and ROL::CompositeObjective< Real >::obj_vec_.
Referenced by ROL::CompositeObjective< Real >::computeGradient(), and ROL::CompositeObjective< Real >::value().
|
inlineprivate |
Definition at line 93 of file ROL_CompositeObjective.hpp.
References ROL::CompositeObjective< Real >::computeValue(), ROL::CompositeObjective< Real >::isGradientComputed_, ROL::CompositeObjective< Real >::obj_grad_vec_, ROL::CompositeObjective< Real >::obj_value_vec_, ROL::CompositeObjective< Real >::obj_vec_, ROL::CompositeObjective< Real >::std_obj_, and ROL::CompositeObjective< Real >::vec_grad_.
Referenced by ROL::CompositeObjective< Real >::computeHessVec(), and ROL::CompositeObjective< Real >::gradient().
|
inlineprivate |
Definition at line 105 of file ROL_CompositeObjective.hpp.
References ROL::CompositeObjective< Real >::computeGradient(), ROL::Vector< Real >::dual(), ROL::CompositeObjective< Real >::obj_gv_vec_, ROL::CompositeObjective< Real >::obj_hess_vec_, ROL::CompositeObjective< Real >::obj_value_vec_, ROL::CompositeObjective< Real >::obj_vec_, ROL::CompositeObjective< Real >::std_obj_, ROL::CompositeObjective< Real >::vec_grad_, and ROL::CompositeObjective< Real >::vec_hess_.
Referenced by ROL::CompositeObjective< Real >::hessVec().
|
inlinevirtual |
Update objective function.
This function updates the objective function at new iterations.
[in] | x | is the new iterate. |
[in] | flag | is true if the iterate has changed. |
[in] | iter | is the outer algorithm iterations count. |
Reimplemented from ROL::Objective< Real >.
Definition at line 130 of file ROL_CompositeObjective.hpp.
References ROL::CompositeObjective< Real >::isGradientComputed_, ROL::CompositeObjective< Real >::isValueComputed_, and ROL::CompositeObjective< Real >::obj_vec_.
|
inlinevirtual |
Compute value.
This function returns the objective function value.
[in] | x | is the current iterate. |
[in] | tol | is a tolerance for inexact objective function computation. |
Implements ROL::Objective< Real >.
Definition at line 139 of file ROL_CompositeObjective.hpp.
References ROL::CompositeObjective< Real >::computeValue(), ROL::CompositeObjective< Real >::obj_value_vec_, and ROL::CompositeObjective< Real >::std_obj_.
|
inlinevirtual |
Compute gradient.
This function returns the objective function gradient.
[out] | g | is the gradient. |
[in] | x | is the current iterate. |
[in] | tol | is a tolerance for inexact objective function computation. |
The default implementation is a finite-difference approximation based on the function value. This requires the definition of a basis \(\{\phi_i\}\) for the optimization vectors x and the definition of a basis \(\{\psi_j\}\) for the dual optimization vectors (gradient vectors g). The bases must be related through the Riesz map, i.e., \( R \{\phi_i\} = \{\psi_j\}\), and this must be reflected in the implementation of the ROL::Vector::dual() method.
Reimplemented from ROL::Objective< Real >.
Definition at line 144 of file ROL_CompositeObjective.hpp.
References ROL::Vector< Real >::axpy(), ROL::CompositeObjective< Real >::computeGradient(), ROL::CompositeObjective< Real >::obj_grad_, ROL::CompositeObjective< Real >::obj_vec_, ROL::CompositeObjective< Real >::vec_grad_, and ROL::Vector< Real >::zero().
|
inlinevirtual |
Apply Hessian approximation to vector.
This function applies the Hessian of the objective function to the vector \(v\).
[out] | hv | is the the action of the Hessian on \(v\). |
[in] | v | is the direction vector. |
[in] | x | is the current iterate. |
[in] | tol | is a tolerance for inexact objective function computation. |
Reimplemented from ROL::Objective< Real >.
Definition at line 153 of file ROL_CompositeObjective.hpp.
References ROL::Vector< Real >::axpy(), ROL::CompositeObjective< Real >::computeHessVec(), ROL::CompositeObjective< Real >::obj_grad_, ROL::CompositeObjective< Real >::obj_hess_, ROL::CompositeObjective< Real >::obj_vec_, ROL::CompositeObjective< Real >::vec_grad_, ROL::CompositeObjective< Real >::vec_hess_, and ROL::Vector< Real >::zero().
|
inlinevirtual |
Reimplemented from ROL::Objective< Real >.
Definition at line 165 of file ROL_CompositeObjective.hpp.
References ROL::CompositeObjective< Real >::isGradientComputed_, ROL::CompositeObjective< Real >::isValueComputed_, ROL::CompositeObjective< Real >::obj_vec_, ROL::Objective< Real >::setParameter(), and ROL::CompositeObjective< Real >::std_obj_.
|
private |
Definition at line 60 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::CompositeObjective(), ROL::CompositeObjective< Real >::computeGradient(), ROL::CompositeObjective< Real >::computeHessVec(), ROL::CompositeObjective< Real >::computeValue(), ROL::CompositeObjective< Real >::gradient(), ROL::CompositeObjective< Real >::hessVec(), ROL::CompositeObjective< Real >::initialize(), ROL::CompositeObjective< Real >::setParameter(), and ROL::CompositeObjective< Real >::update().
|
private |
Definition at line 61 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::computeGradient(), ROL::CompositeObjective< Real >::computeHessVec(), ROL::CompositeObjective< Real >::setParameter(), and ROL::CompositeObjective< Real >::value().
|
private |
Definition at line 63 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::CompositeObjective().
|
private |
Definition at line 63 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::CompositeObjective(), ROL::CompositeObjective< Real >::gradient(), and ROL::CompositeObjective< Real >::hessVec().
|
private |
Definition at line 63 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::CompositeObjective().
|
private |
Definition at line 63 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::CompositeObjective(), and ROL::CompositeObjective< Real >::hessVec().
|
private |
Definition at line 64 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::CompositeObjective(), ROL::CompositeObjective< Real >::computeGradient(), ROL::CompositeObjective< Real >::computeHessVec(), and ROL::CompositeObjective< Real >::value().
|
private |
Definition at line 64 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::CompositeObjective(), and ROL::CompositeObjective< Real >::computeGradient().
|
private |
Definition at line 64 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::CompositeObjective(), and ROL::CompositeObjective< Real >::computeHessVec().
|
private |
Definition at line 64 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::CompositeObjective(), and ROL::CompositeObjective< Real >::computeHessVec().
|
private |
Definition at line 65 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::computeGradient(), ROL::CompositeObjective< Real >::computeHessVec(), ROL::CompositeObjective< Real >::gradient(), ROL::CompositeObjective< Real >::hessVec(), and ROL::CompositeObjective< Real >::initialize().
|
private |
Definition at line 65 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::computeHessVec(), ROL::CompositeObjective< Real >::hessVec(), and ROL::CompositeObjective< Real >::initialize().
|
private |
Definition at line 67 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::initialize().
|
private |
Definition at line 67 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::computeValue(), ROL::CompositeObjective< Real >::setParameter(), and ROL::CompositeObjective< Real >::update().
|
private |
Definition at line 67 of file ROL_CompositeObjective.hpp.
Referenced by ROL::CompositeObjective< Real >::computeGradient(), ROL::CompositeObjective< Real >::setParameter(), and ROL::CompositeObjective< Real >::update().