ROL
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ROL::MeanVariance< Real > Class Template Reference

Provides an interface for the mean plus a sum of arbitrary order variances. More...

#include <ROL_MeanVariance.hpp>

+ Inheritance diagram for ROL::MeanVariance< Real >:

Public Member Functions

 MeanVariance (const Real order, const Real coeff, const Teuchos::RCP< PositiveFunction< Real > > &pf)
 Constructor. More...
 
 MeanVariance (const std::vector< Real > &order, const std::vector< Real > &coeff, const Teuchos::RCP< PositiveFunction< Real > > &pf)
 Constructor. More...
 
 MeanVariance (Teuchos::ParameterList &parlist)
 Constructor. More...
 
void reset (Teuchos::RCP< Vector< Real > > &x0, const Vector< Real > &x)
 Reset internal risk measure storage. Called for value and gradient computation. More...
 
void reset (Teuchos::RCP< Vector< Real > > &x0, const Vector< Real > &x, Teuchos::RCP< Vector< Real > > &v0, const Vector< Real > &v)
 Reset internal risk measure storage. Called for Hessian-times-a-vector computation. More...
 
void update (const Real val, const Real weight)
 Update internal risk measure storage for value computation. More...
 
Real getValue (SampleGenerator< Real > &sampler)
 Return risk measure value. More...
 
void update (const Real val, const Vector< Real > &g, const Real weight)
 Update internal risk measure storage for gradient computation. More...
 
void getGradient (Vector< Real > &g, SampleGenerator< Real > &sampler)
 Return risk measure (sub)gradient. More...
 
void update (const Real val, const Vector< Real > &g, const Real gv, const Vector< Real > &hv, const Real weight)
 Update internal risk measure storage for Hessian-time-a-vector computation. More...
 
void getHessVec (Vector< Real > &hv, SampleGenerator< Real > &sampler)
 Return risk measure Hessian-times-a-vector. More...
 
- Public Member Functions inherited from ROL::RiskMeasure< Real >
virtual ~RiskMeasure ()
 
 RiskMeasure (void)
 

Private Types

typedef std::vector< Real >::size_type uint
 

Private Member Functions

void checkInputs (void) const
 

Private Attributes

Teuchos::RCP< PositiveFunction< Real > > positiveFunction_
 
Teuchos::RCP< Vector< Real > > dualVector1_
 
Teuchos::RCP< Vector< Real > > dualVector2_
 
Teuchos::RCP< Vector< Real > > dualVector3_
 
Teuchos::RCP< Vector< Real > > dualVector4_
 
std::vector< Real > order_
 
std::vector< Real > coeff_
 
uint NumMoments_
 
std::vector< Real > weights_
 
std::vector< Real > value_storage_
 
std::vector< Teuchos::RCP< Vector< Real > > > gradient_storage_
 
std::vector< Teuchos::RCP< Vector< Real > > > hessvec_storage_
 
std::vector< Real > gradvec_storage_
 
bool firstReset_
 

Additional Inherited Members

- Protected Attributes inherited from ROL::RiskMeasure< Real >
Real val_
 
Real gv_
 
Teuchos::RCP< Vector< Real > > g_
 
Teuchos::RCP< Vector< Real > > hv_
 
Teuchos::RCP< Vector< Real > > dualVector_
 
bool firstReset_
 

Detailed Description

template<class Real>
class ROL::MeanVariance< Real >

Provides an interface for the mean plus a sum of arbitrary order variances.

The mean plus variances risk measure is

\[ \mathcal{R}(X) = \mathbb{E}[X] + \sum_{k=1}^n c_k \mathbb{E}[\wp(X-\mathbb{E}[X])^{p_k}] \]

where \(\wp:\mathbb{R}\to[0,\infty)\) is either the absolute value or \((x)_+ = \max\{0,x\}\), \(c_k > 0\) and \(p_k\in\mathbb{N}\). \(\mathcal{R}\) is law-invariant, but not coherent since it violates positive homogeneity. When \(\wp(x) = |x|\), \(\mathcal{R}\) also violates monotonicity.

When using derivative-based optimization, the user can provide a smooth approximation of \((\cdot)_+\) using the ROL::PositiveFunction class.

Definition at line 79 of file ROL_MeanVariance.hpp.

Member Typedef Documentation

◆ uint

template<class Real >
typedef std::vector<Real>::size_type ROL::MeanVariance< Real >::uint
private

Definition at line 80 of file ROL_MeanVariance.hpp.

Constructor & Destructor Documentation

◆ MeanVariance() [1/3]

template<class Real >
ROL::MeanVariance< Real >::MeanVariance ( const Real  order,
const Real  coeff,
const Teuchos::RCP< PositiveFunction< Real > > &  pf 
)
inline

Constructor.

Parameters
[in]orderis the variance order
[in]coeffis the weight for variance term
[in]pfis the plus function or an approximation

This constructor produces a mean plus variance risk measure with a single variance.

Definition at line 127 of file ROL_MeanVariance.hpp.

References ROL::MeanVariance< Real >::checkInputs(), ROL::MeanVariance< Real >::coeff_, ROL::MeanVariance< Real >::NumMoments_, and ROL::MeanVariance< Real >::order_.

◆ MeanVariance() [2/3]

template<class Real >
ROL::MeanVariance< Real >::MeanVariance ( const std::vector< Real > &  order,
const std::vector< Real > &  coeff,
const Teuchos::RCP< PositiveFunction< Real > > &  pf 
)
inline

Constructor.

Parameters
[in]orderis a vector of variance orders
[in]coeffis a vector of weights for the variance terms
[in]pfis the plus function or an approximation

This constructor produces a mean plus variance risk measure with an arbitrary number of variances.

Definition at line 145 of file ROL_MeanVariance.hpp.

References ROL::MeanVariance< Real >::checkInputs(), ROL::MeanVariance< Real >::coeff_, ROL::MeanVariance< Real >::NumMoments_, and ROL::MeanVariance< Real >::order_.

◆ MeanVariance() [3/3]

template<class Real >
ROL::MeanVariance< Real >::MeanVariance ( Teuchos::ParameterList &  parlist)
inline

Constructor.

Parameters
[in]parlistis a parameter list specifying inputs

parlist should contain sublists "SOL"->"Risk Measure"->"Mean Plus Variance" and within the "Mean Plus Variance" sublist should have the following parameters

  • "Orders" (array of unsigned integers)
  • "Coefficients" (array of positive scalars)
  • "Deviation Type" (eighter "Upper" or "Absolute")
  • A sublist for positive function information.

Definition at line 171 of file ROL_MeanVariance.hpp.

References ROL::MeanVariance< Real >::checkInputs(), ROL::MeanVariance< Real >::coeff_, ROL::MeanVariance< Real >::NumMoments_, ROL::MeanVariance< Real >::order_, and ROL::MeanVariance< Real >::positiveFunction_.

Member Function Documentation

◆ checkInputs()

template<class Real >
void ROL::MeanVariance< Real >::checkInputs ( void  ) const
inlineprivate

◆ reset() [1/2]

template<class Real >
void ROL::MeanVariance< Real >::reset ( Teuchos::RCP< Vector< Real > > &  x0,
const Vector< Real > &  x 
)
inlinevirtual

Reset internal risk measure storage. Called for value and gradient computation.

Parameters
[out]x0is a user-provided optimization vector
[in]xis a (potentially) augmented risk vector
   On input, \form#56 carries \form#323 and any statistics (scalars)
   associated with the risk measure. 

Reimplemented from ROL::RiskMeasure< Real >.

Definition at line 199 of file ROL_MeanVariance.hpp.

References ROL::MeanVariance< Real >::dualVector1_, ROL::MeanVariance< Real >::dualVector2_, ROL::MeanVariance< Real >::dualVector3_, ROL::MeanVariance< Real >::dualVector4_, ROL::MeanVariance< Real >::firstReset_, ROL::MeanVariance< Real >::gradient_storage_, ROL::MeanVariance< Real >::gradvec_storage_, ROL::MeanVariance< Real >::hessvec_storage_, ROL::RiskMeasure< Real >::reset(), ROL::MeanVariance< Real >::value_storage_, and ROL::MeanVariance< Real >::weights_.

Referenced by ROL::MeanVariance< Real >::reset().

◆ reset() [2/2]

template<class Real >
void ROL::MeanVariance< Real >::reset ( Teuchos::RCP< Vector< Real > > &  x0,
const Vector< Real > &  x,
Teuchos::RCP< Vector< Real > > &  v0,
const Vector< Real > &  v 
)
inlinevirtual

Reset internal risk measure storage. Called for Hessian-times-a-vector computation.

Parameters
[out]x0is a user-provided optimization vector
[in]xis a (potentially) augmented risk vector
[out]v0is a user-provided direction vector
[in]vis a (potentially) augmented risk vector
   On input, \form#56 carries \form#323 and any statistics (scalars)
   associated with the risk measure.  Similarly, \form#37 carries
\(v_0\) and any statistics (scalars) associated with the risk measure.

Reimplemented from ROL::RiskMeasure< Real >.

Definition at line 217 of file ROL_MeanVariance.hpp.

References ROL::RiskVector< Real >::getVector(), and ROL::MeanVariance< Real >::reset().

◆ update() [1/3]

template<class Real >
void ROL::MeanVariance< Real >::update ( const Real  val,
const Real  weight 
)
inlinevirtual

Update internal risk measure storage for value computation.

Parameters
[in]valis the value of the random variable objective function at the current sample point
[in]weightis the weight associated with the current sample point

Reimplemented from ROL::RiskMeasure< Real >.

Definition at line 224 of file ROL_MeanVariance.hpp.

References ROL::MeanVariance< Real >::value_storage_, and ROL::MeanVariance< Real >::weights_.

◆ getValue()

template<class Real >
Real ROL::MeanVariance< Real >::getValue ( SampleGenerator< Real > &  sampler)
inlinevirtual

Return risk measure value.

Parameters
[in]sampleris the ROL::SampleGenerator used to sample the objective function

Upon return, getValue returns \(\mathcal{R}(f(x_0))\) where \(f(x_0)\) denotes the random variable objective function evaluated at \(x_0\).

Reimplemented from ROL::RiskMeasure< Real >.

Definition at line 230 of file ROL_MeanVariance.hpp.

References ROL::MeanVariance< Real >::coeff_, ROL::MeanVariance< Real >::NumMoments_, ROL::MeanVariance< Real >::order_, ROL::MeanVariance< Real >::positiveFunction_, ROL::SampleGenerator< Real >::sumAll(), ROL::MeanVariance< Real >::value_storage_, and ROL::MeanVariance< Real >::weights_.

◆ update() [2/3]

template<class Real >
void ROL::MeanVariance< Real >::update ( const Real  val,
const Vector< Real > &  g,
const Real  weight 
)
inlinevirtual

Update internal risk measure storage for gradient computation.

Parameters
[in]valis the value of the random variable objective function at the current sample point
[in]gis the gradient of the random variable objective function at the current sample point
[in]weightis the weight associated with the current sample point

Reimplemented from ROL::RiskMeasure< Real >.

Definition at line 249 of file ROL_MeanVariance.hpp.

References ROL::Vector< Real >::clone(), ROL::MeanVariance< Real >::gradient_storage_, ROL::MeanVariance< Real >::value_storage_, and ROL::MeanVariance< Real >::weights_.

◆ getGradient()

template<class Real >
void ROL::MeanVariance< Real >::getGradient ( Vector< Real > &  g,
SampleGenerator< Real > &  sampler 
)
inlinevirtual

Return risk measure (sub)gradient.

Parameters
[out]gis the (sub)gradient of the risk measure
[in]sampleris the ROL::SampleGenerator used to sample the objective function

Upon return, getGradient returns \(\theta\in\partial\mathcal{R}(f(x_0))\) where \(f(x_0)\) denotes the random variable objective function evaluated at \(x_0\) and \(\partial\mathcal{R}(X)\) denotes the subdifferential of \(\mathcal{R}\) at \(X\).

Reimplemented from ROL::RiskMeasure< Real >.

Definition at line 260 of file ROL_MeanVariance.hpp.

References ROL::MeanVariance< Real >::coeff_, ROL::MeanVariance< Real >::dualVector1_, ROL::MeanVariance< Real >::dualVector2_, ROL::MeanVariance< Real >::dualVector3_, ROL::MeanVariance< Real >::gradient_storage_, ROL::MeanVariance< Real >::NumMoments_, ROL::MeanVariance< Real >::order_, ROL::MeanVariance< Real >::positiveFunction_, ROL::SampleGenerator< Real >::sumAll(), ROL::MeanVariance< Real >::value_storage_, and ROL::MeanVariance< Real >::weights_.

◆ update() [3/3]

template<class Real >
void ROL::MeanVariance< Real >::update ( const Real  val,
const Vector< Real > &  g,
const Real  gv,
const Vector< Real > &  hv,
const Real  weight 
)
inlinevirtual

Update internal risk measure storage for Hessian-time-a-vector computation.

Parameters
[in]valis the value of the random variable objective function at the current sample point
[in]gis the gradient of the random variable objective function at the current sample point
[in]gvis the gradient of the random variable objective function at the current sample point applied to the vector v0
[in]hvis the Hessian of the random variable objective function at the current sample point applied to the vector v0
[in]weightis the weight associated with the current sample point

Reimplemented from ROL::RiskMeasure< Real >.

Definition at line 286 of file ROL_MeanVariance.hpp.

References ROL::Vector< Real >::clone(), ROL::MeanVariance< Real >::gradient_storage_, ROL::MeanVariance< Real >::gradvec_storage_, ROL::MeanVariance< Real >::hessvec_storage_, ROL::MeanVariance< Real >::value_storage_, and ROL::MeanVariance< Real >::weights_.

◆ getHessVec()

template<class Real >
void ROL::MeanVariance< Real >::getHessVec ( Vector< Real > &  hv,
SampleGenerator< Real > &  sampler 
)
inlinevirtual

Return risk measure Hessian-times-a-vector.

Parameters
[out]hvis the Hessian-times-a-vector of the risk measure
[in]sampleris the ROL::SampleGenerator used to sample the objective function

Upon return, getHessVec returns \(\nabla^2 \mathcal{R}(f(x_0))v_0\) (if available) where \(f(x_0)\) denotes the random variable objective function evaluated at \(x_0\).

Reimplemented from ROL::RiskMeasure< Real >.

Definition at line 305 of file ROL_MeanVariance.hpp.

References ROL::MeanVariance< Real >::coeff_, ROL::MeanVariance< Real >::dualVector1_, ROL::MeanVariance< Real >::dualVector2_, ROL::MeanVariance< Real >::dualVector3_, ROL::MeanVariance< Real >::dualVector4_, ROL::MeanVariance< Real >::gradient_storage_, ROL::MeanVariance< Real >::gradvec_storage_, ROL::MeanVariance< Real >::hessvec_storage_, ROL::MeanVariance< Real >::NumMoments_, ROL::MeanVariance< Real >::order_, ROL::MeanVariance< Real >::positiveFunction_, ROL::SampleGenerator< Real >::sumAll(), ROL::MeanVariance< Real >::value_storage_, ROL::MeanVariance< Real >::weights_, and ROL::Vector< Real >::zero().

Member Data Documentation

◆ positiveFunction_

template<class Real >
Teuchos::RCP<PositiveFunction<Real> > ROL::MeanVariance< Real >::positiveFunction_
private

◆ dualVector1_

template<class Real >
Teuchos::RCP<Vector<Real> > ROL::MeanVariance< Real >::dualVector1_
private

◆ dualVector2_

template<class Real >
Teuchos::RCP<Vector<Real> > ROL::MeanVariance< Real >::dualVector2_
private

◆ dualVector3_

template<class Real >
Teuchos::RCP<Vector<Real> > ROL::MeanVariance< Real >::dualVector3_
private

◆ dualVector4_

template<class Real >
Teuchos::RCP<Vector<Real> > ROL::MeanVariance< Real >::dualVector4_
private

◆ order_

template<class Real >
std::vector<Real> ROL::MeanVariance< Real >::order_
private

◆ coeff_

template<class Real >
std::vector<Real> ROL::MeanVariance< Real >::coeff_
private

◆ NumMoments_

template<class Real >
uint ROL::MeanVariance< Real >::NumMoments_
private

◆ weights_

template<class Real >
std::vector<Real> ROL::MeanVariance< Real >::weights_
private

◆ value_storage_

template<class Real >
std::vector<Real> ROL::MeanVariance< Real >::value_storage_
private

◆ gradient_storage_

template<class Real >
std::vector<Teuchos::RCP<Vector<Real> > > ROL::MeanVariance< Real >::gradient_storage_
private

◆ hessvec_storage_

template<class Real >
std::vector<Teuchos::RCP<Vector<Real> > > ROL::MeanVariance< Real >::hessvec_storage_
private

◆ gradvec_storage_

template<class Real >
std::vector<Real> ROL::MeanVariance< Real >::gradvec_storage_
private

◆ firstReset_

template<class Real >
bool ROL::MeanVariance< Real >::firstReset_
private

Definition at line 100 of file ROL_MeanVariance.hpp.

Referenced by ROL::MeanVariance< Real >::reset().


The documentation for this class was generated from the following file: