#include <jrl-qp/internal/ActiveSet.h>
Public Member Functions | |
ActiveSet () | |
ActiveSet (int nCstr, int nBnd=0) | |
ActiveSet (const std::vector< ActivationStatus > &as, int nBnd) | |
void | resize (int nCstr, int nBnd=0) |
void | reset () |
bool | isActive (int cstrIdx) const |
bool | isActiveBnd (int bndIdx) const |
ActivationStatus | activationStatus (int cstrIdx) const |
ActivationStatus | activationStatusBnd (int bndIdx) const |
const std::vector< ActivationStatus > & | activationStatus () const |
int | operator[] (int activeIdx) const |
void | activate (int cstrIdx, ActivationStatus status) |
void | deactivate (int activeIdx) |
int | nbCstr () const |
int | nbBnd () const |
int | nbAll () const |
int | nbActiveCstr () const |
int | nbActiveEquality () const |
int | nbActiveInequality () const |
int | nbActiveLowerInequality () const |
int | nbActiveUpperInequality () const |
int | nbActiveBound () const |
int | nbActiveLowerBound () const |
int | nbActiveUpperBound () const |
int | nbFixedVariable () const |
A class to track the activation status of a set of constraints and bounds.
This class uses two types of representations and accompanying indices:
i
of the vector is the index of an active constraint with respect to the status vector. jrl::qp::internal::ActiveSet::ActiveSet | ( | ) |
Default constructor
jrl::qp::internal::ActiveSet::ActiveSet | ( | int | nCstr, |
int | nBnd = 0 |
||
) |
Constructor declaring a predefined number of constraints and bounds.
nCstr | Number of constraints. |
nBnd | Number of bounds. |
jrl::qp::internal::ActiveSet::ActiveSet | ( | const std::vector< ActivationStatus > & | as, |
int | nBnd | ||
) |
Constructor for a vector of activation status, such as can be returned by jrl::qp::ActiveSet::activationStatus().
as | Vector of activation status with status of general constraints first, followed by the status of bounds. as[i] contains the activation status of the i-th constraint/bound, wether it is active or not. |
nBnd | Number of bounds. |
void jrl::qp::internal::ActiveSet::activate | ( | int | cstrIdx, |
ActivationStatus | status | ||
) |
Activate a constraint with a given status
cstrIdx | Index of the constraint to activate. Indices 0 to nbCstr()-1 indicate general constraints. Indices from nbCstr() to nbCstr()+nbBnd()-1 indicate bounds. |
status | Status of the activated constraint. The status must be compatible with the type (general, bound) of the constraint being activated. |
const std::vector< ActivationStatus > & jrl::qp::internal::ActiveSet::activationStatus | ( | ) | const |
Return the vector of activation status with general constraints first and bounds after.
ActivationStatus jrl::qp::internal::ActiveSet::activationStatus | ( | int | cstrIdx | ) | const |
Get the activation status of the constraint with index cstrIdx
. If cstrIdx
>= nbCstr()
, bounds are accessed.
ActivationStatus jrl::qp::internal::ActiveSet::activationStatusBnd | ( | int | bndIdx | ) | const |
Get the activation status of the bound with index bndIdx
, where 0 corresponds to the first bound.
void jrl::qp::internal::ActiveSet::deactivate | ( | int | activeIdx | ) |
Deactivate a constraint.
activeIdx | Index of the constraint to deactivate, with respect to the set of activated constraints. |
bool jrl::qp::internal::ActiveSet::isActive | ( | int | cstrIdx | ) | const |
Check if constraint with index cstrIdx
is active. If cstrIdx
>= nbCstr()
, bounds are accessed.
bool jrl::qp::internal::ActiveSet::isActiveBnd | ( | int | bndIdx | ) | const |
Check if the bound with index bndIdx
is active, where 0 corresponds to the first bound.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Number of general constraints and bounds (i.e. the size of the status vector.
|
inline |
Number of bounds.
|
inline |
Number of (general) constraints.
|
inline |
|
inline |
Return the index of the activeIdx-th
constraint.
void jrl::qp::internal::ActiveSet::reset | ( | ) |
Set all constraints to inactive.
void jrl::qp::internal::ActiveSet::resize | ( | int | nCstr, |
int | nBnd = 0 |
||
) |
Constructor declaring a predefined number of constraints and bounds.
nCstr | Number of constraints. |
nBnd | Number of bounds. |