jrl::qp::DualSolver Class Referenceabstract

#include <jrl-qp/DualSolver.h>

Inheritance diagram for jrl::qp::DualSolver:
Collaboration diagram for jrl::qp::DualSolver:

Classes

struct  StepLength
 

Public Member Functions

 DualSolver ()
 
 DualSolver (int nbVar, int nbCstr, bool useBounds)
 
virtual ~DualSolver ()=default
 
void resize (int nbVar, int nbCstr, bool useBounds)
 
void options (const SolverOptions &options)
 
WConstVector solution () const
 
WConstVector multipliers () const
 
double objectiveValue () const
 
int iterations () const
 
const std::vector< ActivationStatus > & activeSet () const
 
void resetActiveSet ()
 

Protected Member Functions

TerminationStatus solve ()
 
TerminationStatus terminate (TerminationStatus status)
 
internal::InitTermination init ()
 
internal::SelectedConstraint selectViolatedConstraint (const VectorConstRef &x) const
 
void computeStep (VectorRef z, VectorRef r, const internal::SelectedConstraint &sc) const
 
StepLength computeStepLength (const internal::SelectedConstraint &sc, const VectorConstRef &x, const VectorConstRef &u, const VectorConstRef &z, const VectorConstRef &r) const
 
bool addConstraint (const internal::SelectedConstraint &sc)
 
bool removeConstraint (int l, VectorRef u)
 
virtual double dot (const internal::SelectedConstraint &sc, const VectorConstRef &z)
 
virtual internal::InitTermination init_ ()=0
 
virtual internal::SelectedConstraint selectViolatedConstraint_ (const VectorConstRef &x) const =0
 
virtual void computeStep_ (VectorRef z, VectorRef r, const internal::SelectedConstraint &sc) const =0
 
virtual StepLength computeStepLength_ (const internal::SelectedConstraint &sc, const VectorConstRef &x, const VectorConstRef &u, const VectorConstRef &z, const VectorConstRef &r) const =0
 
virtual bool addConstraint_ (const internal::SelectedConstraint &sc)=0
 
virtual bool removeConstraint_ (int l)=0
 
virtual double dot_ (const internal::SelectedConstraint &sc, const VectorConstRef &z)=0
 
virtual void resize_ (int nbVar, int nbCstr, bool useBounds)=0
 

Protected Attributes

SolverOptions options_
 
utils::Logger log_
 
int it_
 
int nbVar_
 
internal::ActiveSet A_
 
double f_
 
internal::Workspace work_x_
 
internal::Workspace work_z_
 
internal::Workspace work_u_
 
internal::Workspace work_r_
 
bool needToExpandMultipliers_
 

Detailed Description

Base class for dual QP solver. It implements the general logic of the Goldfarb-Idnani paper, and relies on call to virtual functions to do the actual work, depending on the specificities of the problem.

Constructor & Destructor Documentation

◆ DualSolver() [1/2]

jrl::qp::DualSolver::DualSolver ( )

◆ DualSolver() [2/2]

jrl::qp::DualSolver::DualSolver ( int  nbVar,
int  nbCstr,
bool  useBounds 
)

Pre-allocate the data for a problem with nbVar variables, nbCstr (general) constraints, and bounds if useBounds is true.

◆ ~DualSolver()

virtual jrl::qp::DualSolver::~DualSolver ( )
virtualdefault

Member Function Documentation

◆ activeSet()

const std::vector< ActivationStatus > & jrl::qp::DualSolver::activeSet ( ) const

Get the active set at the solution.

The i-th element corresponds to the activation status of the i-th constraint with the general constraints first, followed by the bound constraints.

◆ addConstraint()

bool jrl::qp::DualSolver::addConstraint ( const internal::SelectedConstraint sc)
protected

Add a constraint to the active set and update the computation data accordingly.

◆ addConstraint_()

virtual bool jrl::qp::DualSolver::addConstraint_ ( const internal::SelectedConstraint sc)
protectedpure virtual

Add a constraint to the active set and update the computation data accordingly.

Implemented in jrl::qp::experimental::BlockGISolver, jrl::qp::experimental::GoldfarbIdnaniSolver, and jrl::qp::GoldfarbIdnaniSolver.

◆ computeStep()

void jrl::qp::DualSolver::computeStep ( VectorRef  z,
VectorRef  r,
const internal::SelectedConstraint sc 
) const
protected

Compute a primal step z and dual step r, given n+

◆ computeStep_()

virtual void jrl::qp::DualSolver::computeStep_ ( VectorRef  z,
VectorRef  r,
const internal::SelectedConstraint sc 
) const
protectedpure virtual

Compute a primal step z and dual step r, given n+

Implemented in jrl::qp::experimental::BlockGISolver, jrl::qp::experimental::GoldfarbIdnaniSolver, and jrl::qp::GoldfarbIdnaniSolver.

◆ computeStepLength()

DualSolver::StepLength jrl::qp::DualSolver::computeStepLength ( const internal::SelectedConstraint sc,
const VectorConstRef x,
const VectorConstRef u,
const VectorConstRef z,
const VectorConstRef r 
) const
protected

Compute a step length and update x and u given the data n+, z and r.

◆ computeStepLength_()

virtual StepLength jrl::qp::DualSolver::computeStepLength_ ( const internal::SelectedConstraint sc,
const VectorConstRef x,
const VectorConstRef u,
const VectorConstRef z,
const VectorConstRef r 
) const
protectedpure virtual

Compute a step length and update x and u given the data n+, z and r.

Implemented in jrl::qp::experimental::BlockGISolver, jrl::qp::experimental::GoldfarbIdnaniSolver, and jrl::qp::GoldfarbIdnaniSolver.

◆ dot()

double jrl::qp::DualSolver::dot ( const internal::SelectedConstraint sc,
const VectorConstRef z 
)
protectedvirtual

Compute the dot product between the vector corresponding to sc and z.

◆ dot_()

virtual double jrl::qp::DualSolver::dot_ ( const internal::SelectedConstraint sc,
const VectorConstRef z 
)
protectedpure virtual

Compute the dot product between the vector corresponding to sc and z.

Implemented in jrl::qp::experimental::BlockGISolver, jrl::qp::experimental::GoldfarbIdnaniSolver, and jrl::qp::GoldfarbIdnaniSolver.

◆ init()

internal::InitTermination jrl::qp::DualSolver::init ( )
protected

Initialize the problem data. In particular compute the initial primal-dual point and perform the initial decompositions.

◆ init_()

virtual internal::InitTermination jrl::qp::DualSolver::init_ ( )
protectedpure virtual

Compute the initial iterate, the corresponding objective value and initialize any relevant data of the derived class.

Implemented in jrl::qp::experimental::BlockGISolver, jrl::qp::experimental::GoldfarbIdnaniSolver, jrl::qp::GoldfarbIdnaniSolver, and jrl::qp::experimental::BoxAndSingleConstraintSolver.

◆ iterations()

int jrl::qp::DualSolver::iterations ( ) const

Get the number of active-set iterations used to find the solution

◆ multipliers()

WConstVector jrl::qp::DualSolver::multipliers ( ) const

Get the Lagrange multipliers at the solution.

◆ objectiveValue()

double jrl::qp::DualSolver::objectiveValue ( ) const

Get the objective value at the solution.

◆ options()

void jrl::qp::DualSolver::options ( const SolverOptions options)

Specify the solver options.

◆ removeConstraint()

bool jrl::qp::DualSolver::removeConstraint ( int  l,
VectorRef  u 
)
protected

Remove the l-th active constraint from the active set and update the computation data accordingly.

◆ removeConstraint_()

virtual bool jrl::qp::DualSolver::removeConstraint_ ( int  l)
protectedpure virtual

Remove the l-th active constraint from the active set and update the computation data accordingly.

Implemented in jrl::qp::experimental::BlockGISolver, jrl::qp::experimental::GoldfarbIdnaniSolver, and jrl::qp::GoldfarbIdnaniSolver.

◆ resetActiveSet()

void jrl::qp::DualSolver::resetActiveSet ( )

Reset the active set.

◆ resize()

void jrl::qp::DualSolver::resize ( int  nbVar,
int  nbCstr,
bool  useBounds 
)

Resize the data for a problem with nbVar variables, nbCstr (general) constraints, and bounds if useBounds is true.

◆ resize_()

virtual void jrl::qp::DualSolver::resize_ ( int  nbVar,
int  nbCstr,
bool  useBounds 
)
protectedpure virtual

Resize the data managed by the derived class.

Implemented in jrl::qp::experimental::BlockGISolver, jrl::qp::experimental::GoldfarbIdnaniSolver, and jrl::qp::GoldfarbIdnaniSolver.

◆ selectViolatedConstraint()

internal::SelectedConstraint jrl::qp::DualSolver::selectViolatedConstraint ( const VectorConstRef x) const
protected

Select a violated constraint and return it as a description of n+.

◆ selectViolatedConstraint_()

virtual internal::SelectedConstraint jrl::qp::DualSolver::selectViolatedConstraint_ ( const VectorConstRef x) const
protectedpure virtual

Select the violated constraint to be considered for the current iteration.

Implemented in jrl::qp::experimental::BlockGISolver, jrl::qp::experimental::GoldfarbIdnaniSolver, and jrl::qp::GoldfarbIdnaniSolver.

◆ solution()

WConstVector jrl::qp::DualSolver::solution ( ) const

Get the solution.

◆ solve()

TerminationStatus jrl::qp::DualSolver::solve ( )
protected

Call to the solving routines. Need to be initiated by the derived class.

◆ terminate()

TerminationStatus jrl::qp::DualSolver::terminate ( TerminationStatus  status)
protected

Finalize a function call by logging relevant information.

Member Data Documentation

◆ A_

internal::ActiveSet jrl::qp::DualSolver::A_
protected

◆ f_

double jrl::qp::DualSolver::f_
protected

◆ it_

int jrl::qp::DualSolver::it_
protected

◆ log_

utils::Logger jrl::qp::DualSolver::log_
protected

◆ nbVar_

int jrl::qp::DualSolver::nbVar_
protected

◆ needToExpandMultipliers_

bool jrl::qp::DualSolver::needToExpandMultipliers_
mutableprotected

◆ options_

SolverOptions jrl::qp::DualSolver::options_
protected

◆ work_r_

internal::Workspace jrl::qp::DualSolver::work_r_
mutableprotected

◆ work_u_

internal::Workspace jrl::qp::DualSolver::work_u_
mutableprotected

◆ work_x_

internal::Workspace jrl::qp::DualSolver::work_x_
protected

◆ work_z_

internal::Workspace jrl::qp::DualSolver::work_z_
protected

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