|
ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization Version of the Day
|
Represents and manages the active set for the QPSchur algorithm. More...
#include <ConstrainedOptPack_QPSchur.hpp>
Public Types | |
| typedef QPSchurPack::QP | QP |
| | |
| typedef MatrixSymAddDelUpdateable | MSADU |
| | |
Public Member Functions | |
| STANDARD_COMPOSITION_MEMBERS (MatrixSymAddDelUpdateableWithOpNonsingular, schur_comp) | |
| «std comp» members for schur complement matrix S_hat. | |
| STANDARD_MEMBER_COMPOSITION_MEMBERS (MSADU::PivotTolerances, pivot_tols) | |
| Set the tolerances to use when updating the schur complement. | |
| ActiveSet (const schur_comp_ptr_t &schur_comp, MSADU::PivotTolerances pivot_tols=MSADU::PivotTolerances(1e-6, 1e-8, 1e-8)) | |
| | |
Update the active set. | |
| void | initialize (QP &qp, size_type num_act_change, const int ij_act_change[], const EBounds bnds[], bool test, bool salvage_init_schur_comp, std::ostream *out, EOutputLevel output_level) |
| Initialize with an additional active set. | |
| void | refactorize_schur_comp () |
| Reinitialize the schur complement factorization for the current active set. | |
| bool | add_constraint (size_type ja, EBounds bnd_ja, bool update_steps, std::ostream *out, EOutputLevel output_level, bool force_refactorization=true, bool allow_any_cond=false) |
| Add a constraint to the active set then refactorize the schur complemnt (if forced). | |
| bool | drop_constraint (int jd, std::ostream *out, EOutputLevel output_level, bool force_refactorization=true, bool allow_any_cond=false) |
| Drop a constraint from the active set then refactorize the schur complement (if forced). | |
| bool | drop_add_constraints (int jd, size_type ja, EBounds bnd_ja, bool update_steps, std::ostream *out, EOutputLevel output_level) |
| Drop a constraint from, then add a constraint to the active set and refactorize the schur complement. | |
access the QP | |
| QP & | qp () |
| | |
| const QP & | qp () const |
| | |
Access the active sets quantities. | |
| size_type | q_hat () const |
| Return the total size of the schur complement. | |
| size_type | q_plus_hat () const |
| Return the number of constraints from A_bar added to the active set. | |
| size_type | q_F_hat () const |
| Return the number of variables that where initially fixed but are currently free or fixed to another bound. | |
| size_type | q_C_hat () const |
| Return the number of variables that where initially fixed but are currently fixed to another bound. | |
| size_type | q_D_hat () const |
| Return the number of variables that where initially fixed and are still currently fixed to their intial bounds. | |
| int | ij_map (size_type s) const |
| Returns -i for row & column of S_bar for an initially fixed variable left out of Ko that became free and returns j for the constraint a(j)'*x that was added to the active set. | |
| size_type | s_map (int ij) const |
| Map from a constraint or initially fixed variable to a row and column in the schur complement S_bar. | |
| value_type | constr_norm (size_type s) const |
| Returns ||a(j)||2 where j = ij_map(s). | |
| EBounds | bnd (size_type s) const |
| Return which bound is active for the active constraint. | |
| size_type | l_fxfx (size_type k) const |
| Returns the indice of x_X(l) of the initially fixed variables that are still fixed at their original bounds. | |
| const U_hat_t & | U_hat () const |
| | |
| const MatrixSymOpNonsing & | S_hat () const |
| | |
| const GenPermMatrixSlice & | P_XF_hat () const |
| | |
| const GenPermMatrixSlice & | P_FC_hat () const |
| | |
| const GenPermMatrixSlice & | P_plus_hat () const |
| | |
| const GenPermMatrixSlice & | Q_XD_hat () const |
| | |
| const DVectorSlice | d_hat () const |
| | |
| DVectorSlice | z_hat () |
| | |
| const DVectorSlice | z_hat () const |
| | |
| DVectorSlice | p_z_hat () |
| | |
| const DVectorSlice | p_z_hat () const |
| | |
| DVectorSlice | mu_D_hat () |
| | |
| const DVectorSlice | mu_D_hat () const |
| | |
| DVectorSlice | p_mu_D_hat () |
| | |
| const DVectorSlice | p_mu_D_hat () const |
| | |
| bool | is_init_fixed (size_type j) const |
| Determine if a constriant was an initially fixed variable. | |
| bool | all_dof_used_up () const |
| Returns true if all the degrees of freedom of the QP are used up. | |
Represents and manages the active set for the QPSchur algorithm.
This is a concrete type that encapsulates the maintaince of the active set and abstracts quantities associated with it.
At each iteration the dual active-set QP algorithm must solve the system:
[ Ko U_hat ] [ v ] [ fo ]
[ U_hat' V_hat ] * [ z_hat ] = [ d_hat ]
Above, U_hat contains the updates to the KKT system for adding constraints to the active set and freeing variables that where initially fixed and therefore left out of Ko.
This object maintains references to objects that represent the current augmented KKT system:
MatrixOp : U_hat <: R^((n_R+m) x q_hat) MatrixSymOp : V_hat <: R^(q_hat x q_hat) MatrixSymOpNonsing : S_hat <: R^(q_hat x q_hat) GenPermMatrixSlice : P_XF_hat <: R^(n x q_hat) (q_F_hat nonzeros) GenPermMatrixSlice : P_FC_hat <: R^(q_hat x q_hat) (q_C_hat nonzeros) GenPermMatrixSlice : P_plus_hat <: R^((n+m_breve) x q_hat) (q_plus_hat nonzeros) GenPermMatrixSlice : Q_XD_hat <: R^(n x q_D_hat) (q_D_hat nonzeros) DVector : d_hat <: R^(q_hat) DVector : z_hat <: R^(q_hat)
Definition at line 714 of file ConstrainedOptPack_QPSchur.hpp.
Definition at line 721 of file ConstrainedOptPack_QPSchur.hpp.
| typedef MatrixSymAddDelUpdateable ConstrainedOptPack::QPSchur::ActiveSet::MSADU |
Definition at line 723 of file ConstrainedOptPack_QPSchur.hpp.
| ConstrainedOptPack::QPSchur::ActiveSet::ActiveSet | ( | const schur_comp_ptr_t & | schur_comp, |
| MSADU::PivotTolerances | pivot_tols = MSADU::PivotTolerances( 1e-6,1e-8,1e-8 ) |
||
| ) |
Definition at line 1008 of file ConstrainedOptPack_QPSchur.cpp.
| ConstrainedOptPack::QPSchur::ActiveSet::STANDARD_COMPOSITION_MEMBERS | ( | MatrixSymAddDelUpdateableWithOpNonsingular | , |
| schur_comp | |||
| ) |
«std comp» members for schur complement matrix S_hat.
Warning: Resetting schur_comp will cause a reinitialization to an empty active set.
| ConstrainedOptPack::QPSchur::ActiveSet::STANDARD_MEMBER_COMPOSITION_MEMBERS | ( | MSADU::PivotTolerances | , |
| pivot_tols | |||
| ) |
Set the tolerances to use when updating the schur complement.
| void ConstrainedOptPack::QPSchur::ActiveSet::initialize | ( | QP & | qp, |
| size_type | num_act_change, | ||
| const int | ij_act_change[], | ||
| const EBounds | bnds[], | ||
| bool | test, | ||
| bool | salvage_init_schur_comp, | ||
| std::ostream * | out, | ||
| EOutputLevel | output_level | ||
| ) |
Initialize with an additional active set.
If the initial schur complement is not full rank then an LDConstraintException exception will be thrown. The active set will contain all of the constraints it can such that the schur complement is nonsingular.
Definition at line 1026 of file ConstrainedOptPack_QPSchur.cpp.
| void ConstrainedOptPack::QPSchur::ActiveSet::refactorize_schur_comp | ( | ) |
Reinitialize the schur complement factorization for the current active set.
ToDo: Finish documentation
Definition at line 1458 of file ConstrainedOptPack_QPSchur.cpp.
| bool ConstrainedOptPack::QPSchur::ActiveSet::add_constraint | ( | size_type | ja, |
| EBounds | bnd_ja, | ||
| bool | update_steps, | ||
| std::ostream * | out, | ||
| EOutputLevel | output_level, | ||
| bool | force_refactorization = true, |
||
| bool | allow_any_cond = false |
||
| ) |
Add a constraint to the active set then refactorize the schur complemnt (if forced).
ToDo: Finish documentation
If the new KKT system is singular then the exeption MatrixSymAddDelUpdateable::SingularUpdateException will be thrown but the old KKT system will be kept intact.
If the reduced Hessian for the new KKT system does not have the correct inertia then the exception MatrixSymAddDelUpdateable::WrongInertiaUpdateException will be thrown but the old KKT system will be kept intact.
Definition at line 1464 of file ConstrainedOptPack_QPSchur.cpp.
| bool ConstrainedOptPack::QPSchur::ActiveSet::drop_constraint | ( | int | jd, |
| std::ostream * | out, | ||
| EOutputLevel | output_level, | ||
| bool | force_refactorization = true, |
||
| bool | allow_any_cond = false |
||
| ) |
Drop a constraint from the active set then refactorize the schur complement (if forced).
ToDo: Finish documentation
Returns true if any output was sent to *out.
Definition at line 1703 of file ConstrainedOptPack_QPSchur.cpp.
| bool ConstrainedOptPack::QPSchur::ActiveSet::drop_add_constraints | ( | int | jd, |
| size_type | ja, | ||
| EBounds | bnd_ja, | ||
| bool | update_steps, | ||
| std::ostream * | out, | ||
| EOutputLevel | output_level | ||
| ) |
Drop a constraint from, then add a constraint to the active set and refactorize the schur complement.
ToDo: Finish documentation
Returns true if any output was sent to *out.
Definition at line 1927 of file ConstrainedOptPack_QPSchur.cpp.
| QPSchur::ActiveSet::QP & ConstrainedOptPack::QPSchur::ActiveSet::qp | ( | ) |
Definition at line 1941 of file ConstrainedOptPack_QPSchur.cpp.
| const QPSchur::ActiveSet::QP & ConstrainedOptPack::QPSchur::ActiveSet::qp | ( | ) | const |
Definition at line 1948 of file ConstrainedOptPack_QPSchur.cpp.
| size_type ConstrainedOptPack::QPSchur::ActiveSet::q_hat | ( | ) | const |
Return the total size of the schur complement.
q_hat = q_plus_hat + q_F_hat + q_C_hat.
Definition at line 1954 of file ConstrainedOptPack_QPSchur.cpp.
| size_type ConstrainedOptPack::QPSchur::ActiveSet::q_plus_hat | ( | ) | const |
Return the number of constraints from A_bar added to the active set.
Definition at line 1960 of file ConstrainedOptPack_QPSchur.cpp.
| size_type ConstrainedOptPack::QPSchur::ActiveSet::q_F_hat | ( | ) | const |
Return the number of variables that where initially fixed but are currently free or fixed to another bound.
Definition at line 1966 of file ConstrainedOptPack_QPSchur.cpp.
| size_type ConstrainedOptPack::QPSchur::ActiveSet::q_C_hat | ( | ) | const |
Return the number of variables that where initially fixed but are currently fixed to another bound.
Definition at line 1972 of file ConstrainedOptPack_QPSchur.cpp.
| size_type ConstrainedOptPack::QPSchur::ActiveSet::q_D_hat | ( | ) | const |
Return the number of variables that where initially fixed and are still currently fixed to their intial bounds.
Definition at line 1978 of file ConstrainedOptPack_QPSchur.cpp.
| int ConstrainedOptPack::QPSchur::ActiveSet::ij_map | ( | size_type | s | ) | const |
Returns -i for row & column of S_bar for an initially fixed variable left out of Ko that became free and returns j for the constraint a(j)'*x that was added to the active set.
1 <= s <= q_hat
Definition at line 1984 of file ConstrainedOptPack_QPSchur.cpp.
| size_type ConstrainedOptPack::QPSchur::ActiveSet::s_map | ( | int | ij | ) | const |
Map from a constraint or initially fixed variable to a row and column in the schur complement S_bar.
To determine if an initially fixed varible x(i) is now free call s_map(-i). If s_map(-i) returns zero then x(i) is still fixed. Otherwise s_map(-i) returns the row and column in S_bar for this change in the active set.
To determine if a constraint a(j)'*x is part of the active set call s_map(j). If s_map(j) returns zero then a(j)'*x is not part of the active set. Otherwise s_map(j) returns the row and column in S_bar for this change in the active set.
Definition at line 1990 of file ConstrainedOptPack_QPSchur.cpp.
| value_type ConstrainedOptPack::QPSchur::ActiveSet::constr_norm | ( | size_type | s | ) | const |
Returns ||a(j)||2 where j = ij_map(s).
If ij_map(s) < 0, the this function returns zero.
1 <= s <= q_hat
Definition at line 1999 of file ConstrainedOptPack_QPSchur.cpp.
| EBounds ConstrainedOptPack::QPSchur::ActiveSet::bnd | ( | size_type | s | ) | const |
Return which bound is active for the active constraint.
Definition at line 2005 of file ConstrainedOptPack_QPSchur.cpp.
Returns the indice of x_X(l) of the initially fixed variables that are still fixed at their original bounds.
i <= k <= q_D_hat
Definition at line 2011 of file ConstrainedOptPack_QPSchur.cpp.
| const QPSchur::U_hat_t & ConstrainedOptPack::QPSchur::ActiveSet::U_hat | ( | ) | const |
Definition at line 2017 of file ConstrainedOptPack_QPSchur.cpp.
| const MatrixSymOpNonsing & ConstrainedOptPack::QPSchur::ActiveSet::S_hat | ( | ) | const |
Definition at line 2023 of file ConstrainedOptPack_QPSchur.cpp.
| const GenPermMatrixSlice & ConstrainedOptPack::QPSchur::ActiveSet::P_XF_hat | ( | ) | const |
Definition at line 2029 of file ConstrainedOptPack_QPSchur.cpp.
| const GenPermMatrixSlice & ConstrainedOptPack::QPSchur::ActiveSet::P_FC_hat | ( | ) | const |
Definition at line 2035 of file ConstrainedOptPack_QPSchur.cpp.
| const GenPermMatrixSlice & ConstrainedOptPack::QPSchur::ActiveSet::P_plus_hat | ( | ) | const |
Definition at line 2041 of file ConstrainedOptPack_QPSchur.cpp.
| const GenPermMatrixSlice & ConstrainedOptPack::QPSchur::ActiveSet::Q_XD_hat | ( | ) | const |
Definition at line 2047 of file ConstrainedOptPack_QPSchur.cpp.
| const DVectorSlice ConstrainedOptPack::QPSchur::ActiveSet::d_hat | ( | ) | const |
Definition at line 2053 of file ConstrainedOptPack_QPSchur.cpp.
| DVectorSlice ConstrainedOptPack::QPSchur::ActiveSet::z_hat | ( | ) |
Definition at line 2059 of file ConstrainedOptPack_QPSchur.cpp.
| const DVectorSlice ConstrainedOptPack::QPSchur::ActiveSet::z_hat | ( | ) | const |
Definition at line 2065 of file ConstrainedOptPack_QPSchur.cpp.
| DVectorSlice ConstrainedOptPack::QPSchur::ActiveSet::p_z_hat | ( | ) |
Definition at line 2071 of file ConstrainedOptPack_QPSchur.cpp.
| const DVectorSlice ConstrainedOptPack::QPSchur::ActiveSet::p_z_hat | ( | ) | const |
Definition at line 2077 of file ConstrainedOptPack_QPSchur.cpp.
| DVectorSlice ConstrainedOptPack::QPSchur::ActiveSet::mu_D_hat | ( | ) |
Definition at line 2083 of file ConstrainedOptPack_QPSchur.cpp.
| const DVectorSlice ConstrainedOptPack::QPSchur::ActiveSet::mu_D_hat | ( | ) | const |
Definition at line 2089 of file ConstrainedOptPack_QPSchur.cpp.
| DVectorSlice ConstrainedOptPack::QPSchur::ActiveSet::p_mu_D_hat | ( | ) |
Definition at line 2095 of file ConstrainedOptPack_QPSchur.cpp.
| const DVectorSlice ConstrainedOptPack::QPSchur::ActiveSet::p_mu_D_hat | ( | ) | const |
Definition at line 2101 of file ConstrainedOptPack_QPSchur.cpp.
| bool ConstrainedOptPack::QPSchur::ActiveSet::is_init_fixed | ( | size_type | j | ) | const |
Determine if a constriant was an initially fixed variable.
This function will return true if:
j <= n && x_init(j) != FREE
This is just a function of convienience
Definition at line 2107 of file ConstrainedOptPack_QPSchur.cpp.
| bool ConstrainedOptPack::QPSchur::ActiveSet::all_dof_used_up | ( | ) | const |
Returns true if all the degrees of freedom of the QP are used up.
Definition at line 2113 of file ConstrainedOptPack_QPSchur.cpp.
1.7.4