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
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 (non-smooth) augmented Lagrangian is defined as
L(x, λ, μ) = f(x) − λ₁ᵀh(x) + μ/2 h(x)ᵀh(x) - λ₂ᵀ(c(x)-s) + μ/2 (c(x)-s)ᵀ(c(x)-s)
where s = max(c(x) - λ₂/μ, 0).
For more details, refer to section 17.4 of Numerical Optimization by Jorge Nocedal and Stephen Wright, Edition 1, 1999 (This formulation isn't presented in Edition 2, but to stay consistent with Edition 2, we use μ/2 as the coefficient of the quadratic penalty term instead of 1/(2μ) in Edition 1). Note that the augmented Lagrangian L(x, λ, μ) is NOT a smooth function of x, since s = max(c(x) - λ₂/μ, 0) is non-smooth at c(x) - λ₂/μ = 0.
#include <drake/solvers/augmented_lagrangian.h>
Public Member Functions | |
AugmentedLagrangianNonsmooth (const MathematicalProgram *prog, bool include_x_bounds) | |
template<typename T > | |
T | Eval (const Eigen::Ref< const VectorX< T >> &x, const Eigen::VectorXd &lambda_val, double mu, VectorX< T > *constraint_residue, T *cost) const |
const MathematicalProgram & | prog () const |
bool | include_x_bounds () const |
int | lagrangian_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 | |
AugmentedLagrangianNonsmooth (const AugmentedLagrangianNonsmooth &)=default | |
AugmentedLagrangianNonsmooth & | operator= (const AugmentedLagrangianNonsmooth &)=default |
AugmentedLagrangianNonsmooth (AugmentedLagrangianNonsmooth &&)=default | |
AugmentedLagrangianNonsmooth & | operator= (AugmentedLagrangianNonsmooth &&)=default |
|
default |
|
default |
AugmentedLagrangianNonsmooth | ( | const MathematicalProgram * | prog, |
bool | include_x_bounds | ||
) |
prog | The 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, λ, μ) or not. |
T Eval | ( | const Eigen::Ref< const VectorX< T >> & | x, |
const Eigen::VectorXd & | lambda_val, | ||
double | mu, | ||
VectorX< T > * | constraint_residue, | ||
T * | cost | ||
) | const |
x | The value of all the decision variables. | |
lambda_val | The estimated Lagrangian multipliers. The order of the Lagrangian multiplier is as this: 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_residue | The value of the all the constraints. For an equality constraint c(x)=0 or the inequality constraint c(x)>= 0, the residue is c(x). 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] | cost | The value of the cost function f(x). |
bool include_x_bounds | ( | ) | const |
const std::vector<bool>& is_equality | ( | ) | const |
int lagrangian_size | ( | ) | const |
|
default |
|
default |
const MathematicalProgram& prog | ( | ) | const |
const Eigen::VectorXd& x_lo | ( | ) | const |
const Eigen::VectorXd& x_up | ( | ) | const |