ROL
ROL::StdBoundConstraint< Real > Class Template Reference

#include <ROL_StdBoundConstraint.hpp>

Inheritance diagram for ROL::StdBoundConstraint< Real >:

Public Member Functions

 StdBoundConstraint (std::vector< Real > &x, bool isLower=false, Real scale=Real(1), const Real feasTol=std::sqrt(ROL_EPSILON< Real >()))
 StdBoundConstraint (std::vector< Real > &l, std::vector< Real > &u, Real scale=Real(1), const Real feasTol=std::sqrt(ROL_EPSILON< Real >()))
void project (Vector< Real > &x) override
 Project optimization variables onto the bounds.
void projectInterior (Vector< Real > &x) override
 Project optimization variables into the interior of the feasible set.
void pruneUpperActive (Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0)) override
 Set variables to zero if they correspond to the upper \(\epsilon\)-active set.
void pruneUpperActive (Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0)) override
 Set variables to zero if they correspond to the upper \(\epsilon\)-binding set.
void pruneLowerActive (Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0)) override
 Set variables to zero if they correspond to the \(\epsilon\)-binding set.
void pruneLowerActive (Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0)) override
 Set variables to zero if they correspond to the lower \(\epsilon\)-active set.
bool isFeasible (const Vector< Real > &v) override
 Check if the vector, v, is feasible.
void applyInverseScalingFunction (Vector< Real > &dv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g) const override
 Apply inverse scaling function.
void applyScalingFunctionJacobian (Vector< Real > &dv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g) const override
 Apply scaling function Jacobian.
Public Member Functions inherited from ROL::BoundConstraint< Real >
virtual ~BoundConstraint ()
 BoundConstraint (void)
 BoundConstraint (const Vector< Real > &x)
virtual const Ptr< const Vector< Real > > getLowerBound (void) const
 Return the ref count pointer to the lower bound vector.
virtual const Ptr< const Vector< Real > > getUpperBound (void) const
 Return the ref count pointer to the upper bound vector.
void activateLower (void)
 Turn on lower bound.
void activateUpper (void)
 Turn on upper bound.
void activate (void)
 Turn on bounds.
void deactivateLower (void)
 Turn off lower bound.
void deactivateUpper (void)
 Turn off upper bound.
void deactivate (void)
 Turn off bounds.
bool isLowerActivated (void) const
 Check if lower bound are on.
bool isUpperActivated (void) const
 Check if upper bound are on.
bool isActivated (void) const
 Check if bounds are on.
void pruneActive (Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
 Set variables to zero if they correspond to the \(\epsilon\)-active set.
void pruneActive (Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
 Set variables to zero if they correspond to the \(\epsilon\)-binding set.
void pruneLowerInactive (Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
 Set variables to zero if they correspond to the \(\epsilon\)-inactive set.
void pruneUpperInactive (Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
 Set variables to zero if they correspond to the \(\epsilon\)-inactive set.
void pruneLowerInactive (Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
 Set variables to zero if they correspond to the \(\epsilon\)-nonbinding set.
void pruneUpperInactive (Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
 Set variables to zero if they correspond to the \(\epsilon\)-nonbinding set.
void pruneInactive (Vector< Real > &v, const Vector< Real > &x, Real eps=Real(0))
 Set variables to zero if they correspond to the \(\epsilon\)-inactive set.
void pruneInactive (Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real xeps=Real(0), Real geps=Real(0))
 Set variables to zero if they correspond to the \(\epsilon\)-nonbinding set.
void computeProjectedGradient (Vector< Real > &g, const Vector< Real > &x)
 Compute projected gradient.
void computeProjectedStep (Vector< Real > &v, const Vector< Real > &x)
 Compute projected step.

Private Member Functions

Real buildC (int i) const
Real sgn (Real x) const
void buildScalingFunction (Vector< Real > &d, const Vector< Real > &x, const Vector< Real > &g) const

Private Attributes

int dim_
std::vector< Real > x_lo_
std::vector< Real > x_up_
const Real scale_
const Real feasTol_
Real min_diff_

Additional Inherited Members

Protected Member Functions inherited from ROL::BoundConstraint< Real >
Real computeInf (const Vector< Real > &x) const
Protected Attributes inherited from ROL::BoundConstraint< Real >
Ptr< Vector< Real > > lower_
Ptr< Vector< Real > > upper_

Detailed Description

template<class Real>
class ROL::StdBoundConstraint< Real >

Definition at line 24 of file ROL_StdBoundConstraint.hpp.

Constructor & Destructor Documentation

◆ StdBoundConstraint() [1/2]

template<class Real>
ROL::StdBoundConstraint< Real >::StdBoundConstraint ( std::vector< Real > & x,
bool isLower = false,
Real scale = Real(1),
const Real feasTol = std::sqrt(ROL_EPSILON<Real>()) )

◆ StdBoundConstraint() [2/2]

template<class Real>
ROL::StdBoundConstraint< Real >::StdBoundConstraint ( std::vector< Real > & l,
std::vector< Real > & u,
Real scale = Real(1),
const Real feasTol = std::sqrt(ROL_EPSILON<Real>()) )

Member Function Documentation

◆ buildC()

template<class Real>
Real ROL::StdBoundConstraint< Real >::buildC ( int i) const
inlineprivate

Definition at line 39 of file ROL_StdBoundConstraint.hpp.

References x_lo_, and x_up_.

Referenced by applyScalingFunctionJacobian(), and buildScalingFunction().

◆ sgn()

template<class Real>
Real ROL::StdBoundConstraint< Real >::sgn ( Real x) const
inlineprivate

Definition at line 44 of file ROL_StdBoundConstraint.hpp.

References zero.

Referenced by applyScalingFunctionJacobian().

◆ buildScalingFunction()

template<class Real>
void ROL::StdBoundConstraint< Real >::buildScalingFunction ( Vector< Real > & d,
const Vector< Real > & x,
const Vector< Real > & g ) const
private

Definition at line 201 of file ROL_StdBoundConstraint_Def.hpp.

References buildC(), dim_, x_lo_, and x_up_.

Referenced by applyInverseScalingFunction(), and applyScalingFunctionJacobian().

◆ project()

template<class Real>
void ROL::StdBoundConstraint< Real >::project ( Vector< Real > & x)
overridevirtual

Project optimization variables onto the bounds.

This function implements the projection of \(x\) onto the bounds, i.e.,

\[ (P_{[a,b]}(x))(\xi) = \min\{b(\xi),\max\{a(\xi),x(\xi)\}\} \quad \text{for almost every }\xi\in\Xi. \]

Parameters
[in,out]xis the optimization variable.

Reimplemented from ROL::BoundConstraint< Real >.

Definition at line 60 of file ROL_StdBoundConstraint_Def.hpp.

References dim_, ROL::BoundConstraint< Real >::isActivated(), ROL::BoundConstraint< Real >::isLowerActivated(), ROL::BoundConstraint< Real >::isUpperActivated(), x_lo_, and x_up_.

◆ projectInterior()

template<class Real>
void ROL::StdBoundConstraint< Real >::projectInterior ( Vector< Real > & x)
overridevirtual

Project optimization variables into the interior of the feasible set.

This function implements the projection of \(x\) into the interior of the feasible set, i.e.,

\[ (\bar{P}_{[a,b]}(x))(\xi) \in (a(\xi),b(\xi)) \quad \text{for almost every }\xi\in\Xi. \]

Parameters
[in,out]xis the optimization variable.

Reimplemented from ROL::BoundConstraint< Real >.

Definition at line 78 of file ROL_StdBoundConstraint_Def.hpp.

References dim_, feasTol_, ROL::BoundConstraint< Real >::isActivated(), ROL::BoundConstraint< Real >::isLowerActivated(), ROL::BoundConstraint< Real >::isUpperActivated(), min_diff_, ROL::ROL_EPSILON(), x_lo_, and x_up_.

◆ pruneUpperActive() [1/2]

template<class Real>
void ROL::StdBoundConstraint< Real >::pruneUpperActive ( Vector< Real > & v,
const Vector< Real > & x,
Real eps = Real(0) )
overridevirtual

Set variables to zero if they correspond to the upper \(\epsilon\)-active set.

This function sets \(v(\xi)=0\) if \(\xi\in\mathcal{A}^+_\epsilon(x)\). Here, the upper \(\epsilon\)-active set is defined as

\[ \mathcal{A}^+_\epsilon(x) = \{\,\xi\in\Xi\,:\,x(\xi) \ge b(\xi)-\epsilon\,\}. \]

Parameters
[out]vis the variable to be pruned.
[in]xis the current optimization variable.
[in]epsis the active-set tolerance \(\epsilon\).

Reimplemented from ROL::BoundConstraint< Real >.

Definition at line 107 of file ROL_StdBoundConstraint_Def.hpp.

References dim_, ROL::BoundConstraint< Real >::isUpperActivated(), min_diff_, scale_, and x_up_.

◆ pruneUpperActive() [2/2]

template<class Real>
void ROL::StdBoundConstraint< Real >::pruneUpperActive ( Vector< Real > & v,
const Vector< Real > & g,
const Vector< Real > & x,
Real xeps = Real(0),
Real geps = Real(0) )
overridevirtual

Set variables to zero if they correspond to the upper \(\epsilon\)-binding set.

This function sets \(v(\xi)=0\) if \(\xi\in\mathcal{B}^+_\epsilon(x)\). Here, the upper \(\epsilon\)-binding set is defined as

\[ \mathcal{B}^+_\epsilon(x) = \{\,\xi\in\Xi\,:\,x(\xi) \ge b(\xi)-\epsilon_x,\; g(\xi) < -\epsilon_g \,\}. \]

Parameters
[out]vis the variable to be pruned.
[in]gis the negative search direction.
[in]xis the current optimization variable.
[in]xepsis the active-set tolerance \(\epsilon_x\).
[in]gepsis the binding-set tolerance \(\epsilon_g\).

Reimplemented from ROL::BoundConstraint< Real >.

Definition at line 123 of file ROL_StdBoundConstraint_Def.hpp.

References dim_, ROL::BoundConstraint< Real >::isUpperActivated(), min_diff_, scale_, and x_up_.

◆ pruneLowerActive() [1/2]

template<class Real>
void ROL::StdBoundConstraint< Real >::pruneLowerActive ( Vector< Real > & v,
const Vector< Real > & g,
const Vector< Real > & x,
Real xeps = Real(0),
Real geps = Real(0) )
overridevirtual

Set variables to zero if they correspond to the \(\epsilon\)-binding set.

This function sets \(v(\xi)=0\) if \(\xi\in\mathcal{B}^-_\epsilon(x)\). Here, the lower \(\epsilon\)-binding set is defined as

\[ \mathcal{B}^-_\epsilon(x) = \{\,\xi\in\Xi\,:\,x(\xi) \le a(\xi)+\epsilon,\; g(\xi) > 0 \,\}. \]

Parameters
[out]vis the variable to be pruned.
[in]gis the negative search direction.
[in]xis the current optimization variable.
[in]xepsis the active-set tolerance \(\epsilon_x\).
[in]gepsis the binding-set tolerance \(\epsilon_g\).

Reimplemented from ROL::BoundConstraint< Real >.

Definition at line 157 of file ROL_StdBoundConstraint_Def.hpp.

References dim_, ROL::BoundConstraint< Real >::isLowerActivated(), min_diff_, scale_, and x_lo_.

◆ pruneLowerActive() [2/2]

template<class Real>
void ROL::StdBoundConstraint< Real >::pruneLowerActive ( Vector< Real > & v,
const Vector< Real > & x,
Real eps = Real(0) )
overridevirtual

Set variables to zero if they correspond to the lower \(\epsilon\)-active set.

This function sets \(v(\xi)=0\) if \(\xi\in\mathcal{A}^-_\epsilon(x)\). Here, the lower \(\epsilon\)-active set is defined as

\[ \mathcal{A}^-_\epsilon(x) = \{\,\xi\in\Xi\,:\,x(\xi) \le a(\xi)+\epsilon\,\}. \]

Parameters
[out]vis the variable to be pruned.
[in]xis the current optimization variable.
[in]epsis the active-set tolerance \(\epsilon\).

Reimplemented from ROL::BoundConstraint< Real >.

Definition at line 141 of file ROL_StdBoundConstraint_Def.hpp.

References dim_, ROL::BoundConstraint< Real >::isLowerActivated(), min_diff_, scale_, and x_lo_.

◆ isFeasible()

template<class Real>
bool ROL::StdBoundConstraint< Real >::isFeasible ( const Vector< Real > & v)
overridevirtual

Check if the vector, v, is feasible.

This function returns true if \(v = P_{[a,b]}(v)\).

Parameters
[in]vis the vector to be checked.

Reimplemented from ROL::BoundConstraint< Real >.

Definition at line 175 of file ROL_StdBoundConstraint_Def.hpp.

References dim_, ROL::BoundConstraint< Real >::isActivated(), ROL::BoundConstraint< Real >::isLowerActivated(), ROL::BoundConstraint< Real >::isUpperActivated(), x_lo_, and x_up_.

◆ applyInverseScalingFunction()

template<class Real>
void ROL::StdBoundConstraint< Real >::applyInverseScalingFunction ( Vector< Real > & dv,
const Vector< Real > & v,
const Vector< Real > & x,
const Vector< Real > & g ) const
overridevirtual

Apply inverse scaling function.

This function applies the inverse scaling function \(d(x,g)\) to a vector \(v\), i.e., the output is \(\mathrm{diag}(d(x,g)^{-1})v\). The scaling function must satisfy: (i) \(d(x,g)_i = 0\) if \(x_i = a_i\) and \(g_i \ge 0\); (ii) \(d(x,g)_i = 0\) if \(x_i = b_i\) and \(g_i \le 0\); and (iii) \(d(x,g)_i > 0\) otherwise.

Parameters
[out]dvis the inverse scaling function applied to v.
[in]vis the vector being scaled.
[in]xis the primal vector at which the scaling function is evaluated.
[in]gis the dual vector at which the scaling function is evaluated.

Reimplemented from ROL::BoundConstraint< Real >.

Definition at line 233 of file ROL_StdBoundConstraint_Def.hpp.

References buildScalingFunction(), and dim_.

Referenced by testCases(), and testRandomInputs().

◆ applyScalingFunctionJacobian()

template<class Real>
void ROL::StdBoundConstraint< Real >::applyScalingFunctionJacobian ( Vector< Real > & dv,
const Vector< Real > & v,
const Vector< Real > & x,
const Vector< Real > & g ) const
overridevirtual

Apply scaling function Jacobian.

This function applies the Jacobian of the scaling function \(d(x,g)\) to a vector \(v\). The output is \(\mathrm{diag}(d_x(x,g)g)v\). The scaling function must satisfy: (i) \(d(x,g)_i = 0\) if \(x_i = a_i\) and \(g_i \ge 0\); (ii) \(d(x,g)_i = 0\) if \(x_i = b_i\) and \(g_i \le 0\); and (iii) \(d(x,g)_i > 0\) otherwise.

Parameters
[out]dvis the scaling function Jacobian applied to v.
[in]vis the vector being scaled.
[in]xis the primal vector at which the scaling function is evaluated.
[in]gis the dual vector at which the scaling function is evaluated.

Reimplemented from ROL::BoundConstraint< Real >.

Definition at line 247 of file ROL_StdBoundConstraint_Def.hpp.

References buildC(), buildScalingFunction(), dim_, sgn(), x_lo_, x_up_, and zero.

Referenced by testCases(), and testRandomInputs().

Member Data Documentation

◆ dim_

◆ x_lo_

◆ x_up_

◆ scale_

template<class Real>
const Real ROL::StdBoundConstraint< Real >::scale_
private

◆ feasTol_

template<class Real>
const Real ROL::StdBoundConstraint< Real >::feasTol_
private

◆ min_diff_


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