ug4
|
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< DoFDistribution > | m_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_type > | m_spObs |
number of functions More... | |
vector< DoFIndex > | m_vActiveSetGlob |
vector of the current active set of global DoFIndices More... | |
vector< DoFIndex > | m_vActiveSetGlobOld |
vector remembering the active set of global DoFIndices More... | |
vector< int > | m_vActiveSubsets |
vector of possible active subsets More... | |
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:
TDomain | Domain type |
TAlgebra | Algebra type |
typedef TAlgebra ug::ActiveSet< TDomain, TAlgebra >::algebra_type |
Type of algebra.
typedef GridFunction<TDomain, TAlgebra> ug::ActiveSet< TDomain, TAlgebra >::function_type |
Type of grid function.
typedef algebra_type::matrix_type ug::ActiveSet< TDomain, TAlgebra >::matrix_type |
Type of algebra matrix.
typedef domain_traits<TDomain::dim>::grid_base_object ug::ActiveSet< TDomain, TAlgebra >::TBaseElem |
base element type of associated domain
typedef vector_type::value_type ug::ActiveSet< TDomain, TAlgebra >::value_type |
Type of algebra value.
typedef algebra_type::vector_type ug::ActiveSet< TDomain, TAlgebra >::vector_type |
Type of algebra vector.
|
inline |
constructor
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.
void ug::ActiveSet< TDomain, TAlgebra >::active_index_elem | ( | TIterator | iterBegin, |
TIterator | iterEnd, | ||
function_type & | u, | ||
function_type & | rhs, | ||
function_type & | lagrangeMult | ||
) |
checks the distance to the prescribed obstacle/constraint
References ug::BlockRef(), ug::CollectCornerCoordinates(), ug::LocalIndices::comp(), dim, ug::GridFunction< TDomain, TAlgebra >::domain(), boost::get(), ug::GetLocalVector(), ug::LocalIndices::index(), ug::GridFunction< TDomain, TAlgebra >::indices(), ug::LocalIndices::num_dof(), ug::LocalIndices::num_fct(), ug::LocalVector::resize(), UG_LOG, ug::VecDot(), and ug::VecLength().
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.
bool ug::ActiveSet< TDomain, TAlgebra >::check_conv_elem | ( | TIterator | iterBegin, |
TIterator | iterEnd, | ||
function_type & | u, | ||
const function_type & | lambda | ||
) |
References ug::CollectCornerCoordinates(), dim, ug::GridFunction< TDomain, TAlgebra >::domain(), boost::get(), ug::GetLocalVector(), ug::GridFunction< TDomain, TAlgebra >::indices(), ug::LocalIndices::num_dof(), ug::LocalIndices::num_fct(), ug::LocalVector::resize(), ug::VecDot(), and ug::VecLength().
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.
void ug::ActiveSet< TDomain, TAlgebra >::lagrange_mat_inv | ( | matrix_type & | lagrangeMatInv | ) |
References ug::DimensionOfSubset(), UG_LOG, and UG_THROW.
void ug::ActiveSet< TDomain, TAlgebra >::lagrange_mat_inv_elem | ( | TIterator | iterBegin, |
TIterator | iterEnd, | ||
matrix_type & | lagrangeMatInv | ||
) |
void ug::ActiveSet< TDomain, TAlgebra >::lagrange_multiplier | ( | function_type & | lagrangeMult, |
const function_type & | u | ||
) |
void ug::ActiveSet< TDomain, TAlgebra >::prepare | ( | function_type & | u | ) |
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.
void ug::ActiveSet< TDomain, TAlgebra >::set_dirichlet_rows | ( | matrix_type & | mat | ) |
References ug::SetDirichletRow().
|
inline |
sets a discretization in order to compute the lagrange multiplier
|
inline |
sets obstacle gridfunction, which limits the solution u
|
static |
domain dimension
|
private |
|
private |
pointer to the DofDistribution on the whole domain
|
private |
|
private |
pointer to a lagrangeMultiplier-Disc
|
private |
number of functions
pointer to a gridfunction describing an obstacle-constraint
|
private |
vector of the current active set of global DoFIndices
|
private |
vector remembering the active set of global DoFIndices
|
private |
vector of possible active subsets