jrl::qp::internal::ActiveSet Class Reference

#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
 

Detailed Description

A class to track the activation status of a set of constraints and bounds.

This class uses two types of representations and accompanying indices:

  • on one hand, it maintains a vector with the status of all constraints and bounds, active or not. This is the status vector, that is organized with the (general) constraints first and the bounds after.
  • on the other hand it acts as a vector of active constraints, where element i of the vector is the index of an active constraint with respect to the status vector.

Constructor & Destructor Documentation

◆ ActiveSet() [1/3]

jrl::qp::internal::ActiveSet::ActiveSet ( )

Default constructor

◆ ActiveSet() [2/3]

jrl::qp::internal::ActiveSet::ActiveSet ( int  nCstr,
int  nBnd = 0 
)

Constructor declaring a predefined number of constraints and bounds.

Parameters
nCstrNumber of constraints.
nBndNumber of bounds.

◆ ActiveSet() [3/3]

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().

Parameters
asVector 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.
nBndNumber of bounds.

Member Function Documentation

◆ activate()

void jrl::qp::internal::ActiveSet::activate ( int  cstrIdx,
ActivationStatus  status 
)

Activate a constraint with a given status

Parameters
cstrIdxIndex of the constraint to activate. Indices 0 to nbCstr()-1 indicate general constraints. Indices from nbCstr() to nbCstr()+nbBnd()-1 indicate bounds.
statusStatus of the activated constraint. The status must be compatible with the type (general, bound) of the constraint being activated.

◆ activationStatus() [1/2]

const std::vector< ActivationStatus > & jrl::qp::internal::ActiveSet::activationStatus ( ) const

Return the vector of activation status with general constraints first and bounds after.

◆ activationStatus() [2/2]

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.

◆ activationStatusBnd()

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.

◆ deactivate()

void jrl::qp::internal::ActiveSet::deactivate ( int  activeIdx)

Deactivate a constraint.

Parameters
activeIdxIndex of the constraint to deactivate, with respect to the set of activated constraints.

◆ isActive()

bool jrl::qp::internal::ActiveSet::isActive ( int  cstrIdx) const

Check if constraint with index cstrIdx is active. If cstrIdx >= nbCstr(), bounds are accessed.

◆ isActiveBnd()

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.

◆ nbActiveBound()

int jrl::qp::internal::ActiveSet::nbActiveBound ( ) const
inline

◆ nbActiveCstr()

int jrl::qp::internal::ActiveSet::nbActiveCstr ( ) const
inline

◆ nbActiveEquality()

int jrl::qp::internal::ActiveSet::nbActiveEquality ( ) const
inline

◆ nbActiveInequality()

int jrl::qp::internal::ActiveSet::nbActiveInequality ( ) const
inline

◆ nbActiveLowerBound()

int jrl::qp::internal::ActiveSet::nbActiveLowerBound ( ) const
inline

◆ nbActiveLowerInequality()

int jrl::qp::internal::ActiveSet::nbActiveLowerInequality ( ) const
inline

◆ nbActiveUpperBound()

int jrl::qp::internal::ActiveSet::nbActiveUpperBound ( ) const
inline

◆ nbActiveUpperInequality()

int jrl::qp::internal::ActiveSet::nbActiveUpperInequality ( ) const
inline

◆ nbAll()

int jrl::qp::internal::ActiveSet::nbAll ( ) const
inline

Number of general constraints and bounds (i.e. the size of the status vector.

◆ nbBnd()

int jrl::qp::internal::ActiveSet::nbBnd ( ) const
inline

Number of bounds.

◆ nbCstr()

int jrl::qp::internal::ActiveSet::nbCstr ( ) const
inline

Number of (general) constraints.

◆ nbFixedVariable()

int jrl::qp::internal::ActiveSet::nbFixedVariable ( ) const
inline

◆ operator[]()

int jrl::qp::internal::ActiveSet::operator[] ( int  activeIdx) const
inline

Return the index of the activeIdx-th constraint.

◆ reset()

void jrl::qp::internal::ActiveSet::reset ( )

Set all constraints to inactive.

◆ resize()

void jrl::qp::internal::ActiveSet::resize ( int  nCstr,
int  nBnd = 0 
)

Constructor declaring a predefined number of constraints and bounds.

Parameters
nCstrNumber of constraints.
nBndNumber of bounds.

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