ug4
ug::ActiveSet< TDomain, TAlgebra > Class Template Reference

Active Set method. More...

#include <active_set.h>

Public Types

typedef TAlgebra algebra_type
 Type of algebra. More...
 
typedef GridFunction< TDomain, TAlgebra > function_type
 Type of grid function. More...
 
typedef algebra_type::matrix_type matrix_type
 Type of algebra matrix. More...
 
typedef domain_traits< TDomain::dim >::grid_base_object TBaseElem
 base element type of associated domain More...
 
typedef vector_type::value_type value_type
 Type of algebra value. More...
 
typedef algebra_type::vector_type vector_type
 Type of algebra vector. More...
 

Public Member Functions

bool active_index (function_type &u, function_type &rhs, function_type &lagrangeMult, function_type &gap)
 determines the active indices, stores them in a vector and sets dirichlet values in rhs for active indices More...
 
template<typename TElem , typename TIterator >
void active_index_elem (TIterator iterBegin, TIterator iterEnd, function_type &u, function_type &rhs, function_type &lagrangeMult)
 checks the distance to the prescribed obstacle/constraint More...
 
 ActiveSet ()
 constructor More...
 
bool check_conv (function_type &u, const function_type &lambda, const size_t step)
 checks if all constraints are fulfilled & the activeSet remained unchanged More...
 
template<typename TElem , typename TIterator >
bool check_conv_elem (TIterator iterBegin, TIterator iterEnd, function_type &u, const function_type &lambda)
 
bool check_inequ (const matrix_type &mat, const vector_type &u, const vector_type &lagrangeMult, const vector_type &rhs)
 checks if all inequalities are fulfilled More...
 
void lagrange_mat_inv (matrix_type &lagrangeMatInv)
 
template<typename TElem , typename TIterator >
void lagrange_mat_inv_elem (TIterator iterBegin, TIterator iterEnd, matrix_type &lagrangeMatInv)
 
void lagrange_multiplier (function_type &lagrangeMult, const function_type &u)
 computes the lagrange multiplier for a given disc More...
 
void prepare (function_type &u)
 
void residual_lagrange_mult (vector_type &lagMult, const matrix_type &mat, const vector_type &u, vector_type &rhs)
 
void set_dirichlet_rows (matrix_type &mat)
 
void set_lagrange_multiplier_disc (SmartPtr< ILagrangeMultiplierDisc< TDomain, function_type > > lagMultDisc)
 sets a discretization in order to compute the lagrange multiplier More...
 
void set_obstacle (ConstSmartPtr< function_type > obs)
 sets obstacle gridfunction, which limits the solution u More...
 

Static Public Attributes

static const int dim = TDomain::dim
 domain dimension More...
 

Private Attributes

bool m_bObs
 
SmartPtr< DoFDistributionm_spDD
 pointer to the DofDistribution on the whole domain More...
 
SmartPtr< TDomain > m_spDom
 
SmartPtr< ILagrangeMultiplierDisc< TDomain, function_type > > m_spLagMultDisc
 pointer to a lagrangeMultiplier-Disc More...
 
ConstSmartPtr< function_typem_spObs
 number of functions More...
 
vector< DoFIndexm_vActiveSetGlob
 vector of the current active set of global DoFIndices More...
 
vector< DoFIndexm_vActiveSetGlobOld
 vector remembering the active set of global DoFIndices More...
 
vector< int > m_vActiveSubsets
 vector of possible active subsets More...
 

Detailed Description

template<typename TDomain, typename TAlgebra>
class ug::ActiveSet< TDomain, TAlgebra >

Active Set method.

The active Set method is a well-known method in constrained optimization theory. A general formulation for these problems reads

\begin{eqnarray*} min_{x \in \mathbb{R}^n} f(x) \end{eqnarray*}

s.t.

\begin{eqnarray*} c_i(x) = 0, \qquad i \in E \\ c_i(x) \ge 0 \qquad i \in I, \end{eqnarray*}

where \( f \), \( c_i \) are smooth, real-valued functions on a subset of \( \mathbb{R}^n \). \( I \) (set of inequality constraints) and \( E \) (set of equality constraints) are two finite sets of indices. \( f \) is called objective function.

The active Set \( A \) is defined as:

\begin{eqnarray*} A(x) := E \cup \{ i \in I | c_i(x) = 0 \}, \end{eqnarray*}

i.e. for \( i \in I \) the inequality constraint is said to be active, if \( c_i(x) = 0 \). Otherwise ( \( c_i(x) > 0 \)) it is called inactive.

A common approach to treat the inequality constraints is its reformulation as equations by using so called complementarity functions, see e.g. C.Hager und B. I. Wohlmuth: "Hindernis- und Kontaktprobleme" for a simple introduction into this topic. By means of complementarity functions, constraints of the form

\begin{eqnarray*} a \ge 0, \, b \ge 0, \, a b = 0 \end{eqnarray*}

with \( a, b \in \mathbb{R}^n \) can be reformulated as

\begin{eqnarray*} C(a,b) = 0, \end{eqnarray*}

with \( C: \mathbb{R}^n x \mathbb{R}^n \to \mathbb{R}^n \) being an appropriate complementarity function. The value of \( C \) indicates, whether the index is active or inactive (see method 'active_index'). Thus, it determines in every step the set of active indices, for which the original system of equations needs to be adapted. The influence of these active indices on the original system of equations ( \( K u = f \), with \( K \): system-matrix; \( u, f \) vectors) can be modelled by means of a lagrange multiplier ' \( \lambda \)'. \( \lambda \) can either be defined by the residual ( \( \lambda := f - K u \), see method 'residual_lagrange_mult') or by a problem-dependent computation (see method 'lagrange_multiplier').

In every Active Set step a linear or linearized system is solved. The algorithm stops when the active and inactive Set remains unchanged (see method 'check_conv').

References:

  • J. Nocedal and S. J. Wright. Numerical optimization.(2000)
Template Parameters
TDomainDomain type
TAlgebraAlgebra type

Member Typedef Documentation

◆ algebra_type

template<typename TDomain , typename TAlgebra >
typedef TAlgebra ug::ActiveSet< TDomain, TAlgebra >::algebra_type

Type of algebra.

◆ function_type

template<typename TDomain , typename TAlgebra >
typedef GridFunction<TDomain, TAlgebra> ug::ActiveSet< TDomain, TAlgebra >::function_type

Type of grid function.

◆ matrix_type

template<typename TDomain , typename TAlgebra >
typedef algebra_type::matrix_type ug::ActiveSet< TDomain, TAlgebra >::matrix_type

Type of algebra matrix.

◆ TBaseElem

template<typename TDomain , typename TAlgebra >
typedef domain_traits<TDomain::dim>::grid_base_object ug::ActiveSet< TDomain, TAlgebra >::TBaseElem

base element type of associated domain

◆ value_type

template<typename TDomain , typename TAlgebra >
typedef vector_type::value_type ug::ActiveSet< TDomain, TAlgebra >::value_type

Type of algebra value.

◆ vector_type

template<typename TDomain , typename TAlgebra >
typedef algebra_type::vector_type ug::ActiveSet< TDomain, TAlgebra >::vector_type

Type of algebra vector.

Constructor & Destructor Documentation

◆ ActiveSet()

template<typename TDomain , typename TAlgebra >
ug::ActiveSet< TDomain, TAlgebra >::ActiveSet ( )
inline

constructor

Member Function Documentation

◆ active_index()

template<typename TDomain , typename TAlgebra >
bool ug::ActiveSet< TDomain, TAlgebra >::active_index ( function_type u,
function_type rhs,
function_type lagrangeMult,
function_type gap 
)

determines the active indices, stores them in a vector and sets dirichlet values in rhs for active indices

References ug::DimensionOfSubset(), ug::DoFDistributionInfoProvider::is_def_in_subset(), ug::DoFDistributionInfoProvider::num_fct(), ug::GridFunction< TDomain, TAlgebra >::num_indices(), UG_LOG, and UG_THROW.

◆ active_index_elem()

template<typename TDomain , typename TAlgebra >
template<typename TElem , typename TIterator >
void ug::ActiveSet< TDomain, TAlgebra >::active_index_elem ( TIterator  iterBegin,
TIterator  iterEnd,
function_type u,
function_type rhs,
function_type lagrangeMult 
)

◆ check_conv()

template<typename TDomain , typename TAlgebra >
bool ug::ActiveSet< TDomain, TAlgebra >::check_conv ( function_type u,
const function_type lambda,
const size_t  step 
)

checks if all constraints are fulfilled & the activeSet remained unchanged

References ug::DimensionOfSubset(), UG_LOG, and UG_THROW.

◆ check_conv_elem()

template<typename TDomain , typename TAlgebra >
template<typename TElem , typename TIterator >
bool ug::ActiveSet< TDomain, TAlgebra >::check_conv_elem ( TIterator  iterBegin,
TIterator  iterEnd,
function_type u,
const function_type lambda 
)

◆ check_inequ()

template<typename TDomain , typename TAlgebra >
bool ug::ActiveSet< TDomain, TAlgebra >::check_inequ ( const matrix_type mat,
const vector_type u,
const vector_type lagrangeMult,
const vector_type rhs 
)

checks if all inequalities are fulfilled

References MatMult(), ug::MatMultDirect(), UG_LOG, and UG_THROW.

◆ lagrange_mat_inv()

template<typename TDomain , typename TAlgebra >
void ug::ActiveSet< TDomain, TAlgebra >::lagrange_mat_inv ( matrix_type lagrangeMatInv)

◆ lagrange_mat_inv_elem()

template<typename TDomain , typename TAlgebra >
template<typename TElem , typename TIterator >
void ug::ActiveSet< TDomain, TAlgebra >::lagrange_mat_inv_elem ( TIterator  iterBegin,
TIterator  iterEnd,
matrix_type lagrangeMatInv 
)

◆ lagrange_multiplier()

template<typename TDomain , typename TAlgebra >
void ug::ActiveSet< TDomain, TAlgebra >::lagrange_multiplier ( function_type lagrangeMult,
const function_type u 
)

computes the lagrange multiplier for a given disc

References UG_LOG, and UG_THROW.

◆ prepare()

template<typename TDomain , typename TAlgebra >
void ug::ActiveSet< TDomain, TAlgebra >::prepare ( function_type u)

◆ residual_lagrange_mult()

template<typename TDomain , typename TAlgebra >
void ug::ActiveSet< TDomain, TAlgebra >::residual_lagrange_mult ( vector_type lagMult,
const matrix_type mat,
const vector_type u,
vector_type rhs 
)

computes the lagrange multiplier by means of the residuum (lagMult = rhs - mat * u)

References ug::DoFRef(), MatMult(), ug::MatMultDirect(), UG_LOG, and UG_THROW.

◆ set_dirichlet_rows()

template<typename TDomain , typename TAlgebra >
void ug::ActiveSet< TDomain, TAlgebra >::set_dirichlet_rows ( matrix_type mat)

References ug::SetDirichletRow().

◆ set_lagrange_multiplier_disc()

template<typename TDomain , typename TAlgebra >
void ug::ActiveSet< TDomain, TAlgebra >::set_lagrange_multiplier_disc ( SmartPtr< ILagrangeMultiplierDisc< TDomain, function_type > >  lagMultDisc)
inline

sets a discretization in order to compute the lagrange multiplier

◆ set_obstacle()

template<typename TDomain , typename TAlgebra >
void ug::ActiveSet< TDomain, TAlgebra >::set_obstacle ( ConstSmartPtr< function_type obs)
inline

sets obstacle gridfunction, which limits the solution u

Member Data Documentation

◆ dim

template<typename TDomain , typename TAlgebra >
const int ug::ActiveSet< TDomain, TAlgebra >::dim = TDomain::dim
static

domain dimension

◆ m_bObs

template<typename TDomain , typename TAlgebra >
bool ug::ActiveSet< TDomain, TAlgebra >::m_bObs
private

◆ m_spDD

template<typename TDomain , typename TAlgebra >
SmartPtr<DoFDistribution> ug::ActiveSet< TDomain, TAlgebra >::m_spDD
private

pointer to the DofDistribution on the whole domain

◆ m_spDom

template<typename TDomain , typename TAlgebra >
SmartPtr<TDomain> ug::ActiveSet< TDomain, TAlgebra >::m_spDom
private

◆ m_spLagMultDisc

template<typename TDomain , typename TAlgebra >
SmartPtr<ILagrangeMultiplierDisc<TDomain, function_type> > ug::ActiveSet< TDomain, TAlgebra >::m_spLagMultDisc
private

pointer to a lagrangeMultiplier-Disc

◆ m_spObs

template<typename TDomain , typename TAlgebra >
ConstSmartPtr<function_type> ug::ActiveSet< TDomain, TAlgebra >::m_spObs
private

number of functions

pointer to a gridfunction describing an obstacle-constraint

◆ m_vActiveSetGlob

template<typename TDomain , typename TAlgebra >
vector<DoFIndex> ug::ActiveSet< TDomain, TAlgebra >::m_vActiveSetGlob
private

vector of the current active set of global DoFIndices

◆ m_vActiveSetGlobOld

template<typename TDomain , typename TAlgebra >
vector<DoFIndex> ug::ActiveSet< TDomain, TAlgebra >::m_vActiveSetGlobOld
private

vector remembering the active set of global DoFIndices

◆ m_vActiveSubsets

template<typename TDomain , typename TAlgebra >
vector<int> ug::ActiveSet< TDomain, TAlgebra >::m_vActiveSubsets
private

vector of possible active subsets


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