Drake
Drake C++ Documentation
AugmentedLagrangianSmooth Class Reference

Detailed Description

Compute the augmented Lagrangian (AL) of a given mathematical program.

min f(x)
s.t h(x) = 0
    l <= g(x) <= u
    x_lo <= x <= x_up

We first turn it into an equality constrained program with non-negative slack variable s as follows

min f(x)
s.t h(x) = 0
    c(x) - s = 0
    s >= 0

We regard this as an optimization problem on variable (x, s), with equality constraints h(x) = 0, c(x)-s = 0, and the bound constraint s >= 0.

Depending on the option include_x_bounds, the constraint h(x)=0, c(x)>=0 may or may not include the bounding box constraint x_lo <= x <= x_up.

The (smooth) augmented Lagrangian is defined as

L(x, s, λ, μ) = f(x) − λ₁ᵀh(x) + μ/2 h(x)ᵀh(x)
             - λ₂ᵀ(c(x)-s) + μ/2 (c(x)-s)ᵀ(c(x)-s)

For more details, refer to section 17.4 of Numerical Optimization by Jorge Nocedal and Stephen Wright, Edition 2, 2006. Note that the augmented Lagrangian L(x, s, λ, μ) is a smooth function of (x, s),

This is the implementation used in LANCELOT. To solve the nonlinear optimization through this Augmented Lagrangian, the nonlinear solve should be able to handle bounding box constraints on the decision variables.

#include <drake/solvers/augmented_lagrangian.h>

Public Member Functions

 AugmentedLagrangianSmooth (const MathematicalProgram *prog, bool include_x_bounds)
 
template<typename T >
Eval (const Eigen::Ref< const VectorX< T >> &x, const Eigen::Ref< const VectorX< T >> &s, const Eigen::VectorXd &lambda_val, double mu, VectorX< T > *constraint_residue, T *cost) const
 
const MathematicalProgramprog () const
 
bool include_x_bounds () const
 
int lagrangian_size () const
 
int s_size () const
 
const std::vector< bool > & is_equality () const
 
const Eigen::VectorXd & x_lo () const
 
const Eigen::VectorXd & x_up () const
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 AugmentedLagrangianSmooth (const AugmentedLagrangianSmooth &)=default
 
AugmentedLagrangianSmoothoperator= (const AugmentedLagrangianSmooth &)=default
 
 AugmentedLagrangianSmooth (AugmentedLagrangianSmooth &&)=default
 
AugmentedLagrangianSmoothoperator= (AugmentedLagrangianSmooth &&)=default
 

Constructor & Destructor Documentation

◆ AugmentedLagrangianSmooth() [1/3]

◆ AugmentedLagrangianSmooth() [2/3]

◆ AugmentedLagrangianSmooth() [3/3]

AugmentedLagrangianSmooth ( const MathematicalProgram prog,
bool  include_x_bounds 
)
Parameters
progThe mathematical program we will evaluate.
include_x_bounds.Whether the Lagrangian and the penalty for the bounds x_lo <= x <= x_up are included in the augmented Lagrangian L(x, s, λ, μ) or not.

Member Function Documentation

◆ Eval()

T Eval ( const Eigen::Ref< const VectorX< T >> &  x,
const Eigen::Ref< const VectorX< T >> &  s,
const Eigen::VectorXd &  lambda_val,
double  mu,
VectorX< T > *  constraint_residue,
T *  cost 
) const
Parameters
xThe value of all the decision variables in prog().
sThe value of all slack variables s.
lambda_valThe estimated Lagrangian multipliers. The order of the Lagrangian multiplier is as follows: We first call to evaluate all constraints. Then for each row of the constraint, if it is an equality constraint, we append one single Lagrangian multiplier. Otherwise we append the Lagrangian multiplier for the lower and upper bounds (where the lower comes before the upper), if the corresponding bound is not ±∞. The order of evaluating all the constraints is the same as prog.GetAllConstraints() except for prog.bounding_box_constraints(). If include_x_bounds=true, then we aggregate all the bounding_box_constraints() and evaluate them at the end of all constraints.
muμ in the documentation above. The constant for penalty term weight. This should be a strictly positive number.
[out]constraint_residueThe value of the all the constraints. For an equality constraint c(x)=0, the residue is c(x); for an inequality constraint c(x)>=0, the residue is c(x)-s where s is the corresponding slack variable. Depending on include_x_bounds, constraint_residue may or may not contain the residue for bounding box constraints x_lo <= x <= x_up at the end.
[out]costThe value of the cost function f(x).
Returns
The evaluated Augmented Lagrangian (AL) L(x, s, λ, μ).
Note
This Eval function differs from AugmentedLagrangianNonsmooth::Eval() function as s is an input argument.

◆ include_x_bounds()

bool include_x_bounds ( ) const
Returns
Whether the bounding box constraint x_lo <= x <= x_up is included in the augmented Lagrangian L(x, λ, μ).

◆ is_equality()

const std::vector<bool>& is_equality ( ) const
Returns
Whether each constraint is equality or not. The order of the constraint is explained in the class documentation.

◆ lagrangian_size()

int lagrangian_size ( ) const
Returns
The size of the Lagrangian multiplier λ.

◆ operator=() [1/2]

◆ operator=() [2/2]

AugmentedLagrangianSmooth& operator= ( const AugmentedLagrangianSmooth )
default

◆ prog()

const MathematicalProgram& prog ( ) const
Returns
The mathematical program for which the augmented Lagrangian is computed.

◆ s_size()

int s_size ( ) const
Returns
The size of the slack variable s.

◆ x_lo()

const Eigen::VectorXd& x_lo ( ) const
Returns
All the lower bounds of x.

◆ x_up()

const Eigen::VectorXd& x_up ( ) const
Returns
All the upper bounds of x.

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