shark::BoxConstrainedShrinkingProblem< Problem > Struct Template Reference

#include <shark/Algorithms/QP/BoxConstrainedProblems.h>

+ Inheritance diagram for shark::BoxConstrainedShrinkingProblem< Problem >:

Public Types

typedef base_type::QpFloatType QpFloatType
 
typedef base_type::MatrixType MatrixType
 
typedef base_type::PreferedSelectionStrategy PreferedSelectionStrategy
 
- Public Types inherited from shark::BoxConstrainedProblem< Problem >
typedef Problem ::QpFloatType QpFloatType
 
typedef Problem ::MatrixType MatrixType
 
typedef MaximumGainCriterion PreferedSelectionStrategy
 

Public Member Functions

 BoxConstrainedShrinkingProblem (Problem &problem, bool shrink=true)
 
virtual void updateSMO (std::size_t i, std::size_t j)
 Does an update of SMO given a working set with indices i and j. More...
 
bool shrink (double epsilon)
 
void unshrink ()
 Unshrink the problem. More...
 
void setShrinking (bool shrinking)
 
void setInitialSolution (RealVector const &alpha, RealVector const &gradient, RealVector const &gradientEdge)
 Define the initial solution for the iterative solver. More...
 
void setInitialSolution (RealVector const &alpha)
 Define the initial solution for the iterative solver. More...
 
void scaleBoxConstraints (double factor, double variableScalingFactor)
 Scales all box constraints by a constant factor and adapts the solution by scaling it by the same factor. More...
 
virtual void deactivateVariable (std::size_t i)
 Remove the i-th example from the problem. More...
 
virtual void setLinear (std::size_t i, double newValue)
 adapts the linear part of the problem and updates the internal data structures accordingly. More...
 
void flipCoordinates (std::size_t i, std::size_t j)
 swap indizes (i,j) More...
 
- Public Member Functions inherited from shark::BoxConstrainedProblem< Problem >
 BoxConstrainedProblem (Problem &problem)
 
std::size_t dimensions () const
 
std::size_t active () const
 
double boxMin (std::size_t i) const
 
double boxMax (std::size_t i) const
 
bool isLowerBound (std::size_t i) const
 
bool isUpperBound (std::size_t i) const
 
bool isDeactivated (std::size_t i) const
 
MatrixTypequadratic ()
 representation of the quadratic part of the objective function More...
 
double linear (std::size_t i) const
 
double alpha (std::size_t i) const
 
double diagonal (std::size_t i) const
 
double gradient (std::size_t i) const
 
std::size_t permutation (std::size_t i) const
 
RealVector getUnpermutedAlpha () const
 
double functionValue () const
 Returns the current function value of the problem. More...
 
bool shrink (double)
 
void reshrink ()
 
void unshrink ()
 
void setInitialSolution (RealVector const &alpha, RealVector const &gradient)
 Define the initial solution for the iterative solver. More...
 
void setInitialSolution (RealVector const &alpha)
 Define the initial solution for the iterative solver. More...
 
void activateVariable (std::size_t i)
 Reactivate an previously deactivated variable. More...
 
void flipCoordinates (std::size_t i, std::size_t j)
 exchange two variables via the permutation More...
 
double checkKKT () const
 

Protected Member Functions

void updateGradientEdge (std::size_t i, double oldAlpha, double newAlpha)
 Updates the edge-part of the gradient when an alpha valu was changed. More...
 
- Protected Member Functions inherited from shark::BoxConstrainedProblem< Problem >
void updateAlphaStatus (std::size_t i)
 

Additional Inherited Members

- Protected Attributes inherited from shark::BoxConstrainedProblem< Problem >
Problem & m_problem
 
RealVector m_gradient
 gradient of the objective function at the current alpha More...
 
std::size_t m_active
 
std::vector< char > m_alphaStatus
 

Detailed Description

template<class Problem>
struct shark::BoxConstrainedShrinkingProblem< Problem >

Definition at line 391 of file BoxConstrainedProblems.h.

Member Typedef Documentation

◆ MatrixType

template<class Problem >
typedef base_type::MatrixType shark::BoxConstrainedShrinkingProblem< Problem >::MatrixType

Definition at line 396 of file BoxConstrainedProblems.h.

◆ PreferedSelectionStrategy

◆ QpFloatType

template<class Problem >
typedef base_type::QpFloatType shark::BoxConstrainedShrinkingProblem< Problem >::QpFloatType

Definition at line 395 of file BoxConstrainedProblems.h.

Constructor & Destructor Documentation

◆ BoxConstrainedShrinkingProblem()

template<class Problem >
shark::BoxConstrainedShrinkingProblem< Problem >::BoxConstrainedShrinkingProblem ( Problem &  problem,
bool  shrink = true 
)
inline

Definition at line 399 of file BoxConstrainedProblems.h.

Member Function Documentation

◆ deactivateVariable()

template<class Problem >
virtual void shark::BoxConstrainedShrinkingProblem< Problem >::deactivateVariable ( std::size_t  i)
inlinevirtual

Remove the i-th example from the problem.

Reimplemented from shark::BoxConstrainedProblem< Problem >.

Definition at line 556 of file BoxConstrainedProblems.h.

References SIZE_CHECK.

◆ flipCoordinates()

template<class Problem >
void shark::BoxConstrainedShrinkingProblem< Problem >::flipCoordinates ( std::size_t  i,
std::size_t  j 
)
inline

swap indizes (i,j)

Definition at line 571 of file BoxConstrainedProblems.h.

References shark::swap().

◆ scaleBoxConstraints()

template<class Problem >
void shark::BoxConstrainedShrinkingProblem< Problem >::scaleBoxConstraints ( double  factor,
double  variableScalingFactor 
)
inline

Scales all box constraints by a constant factor and adapts the solution by scaling it by the same factor.

Definition at line 540 of file BoxConstrainedProblems.h.

◆ setInitialSolution() [1/2]

template<class Problem >
void shark::BoxConstrainedShrinkingProblem< Problem >::setInitialSolution ( RealVector const &  alpha,
RealVector const &  gradient,
RealVector const &  gradientEdge 
)
inline

Define the initial solution for the iterative solver.

This method can be used to warm-start the solver. It requires a feasible solution (alpha) and the corresponding gradient of the dual objective function.

Definition at line 496 of file BoxConstrainedProblems.h.

References SHARK_ASSERT, and SIZE_CHECK.

◆ setInitialSolution() [2/2]

template<class Problem >
void shark::BoxConstrainedShrinkingProblem< Problem >::setInitialSolution ( RealVector const &  alpha)
inline

Define the initial solution for the iterative solver.

This method can be used to warm-start the solver. It requires a feasible solution (alpha), for which it computes the gradient of the dual objective function. Note that this is a quadratic time operation in the number of non-zero coefficients.

Definition at line 518 of file BoxConstrainedProblems.h.

References remora::noalias(), remora::vector< T >::raw_storage(), and SIZE_CHECK.

◆ setLinear()

template<class Problem >
virtual void shark::BoxConstrainedShrinkingProblem< Problem >::setLinear ( std::size_t  i,
double  newValue 
)
inlinevirtual

adapts the linear part of the problem and updates the internal data structures accordingly.

Reimplemented from shark::BoxConstrainedProblem< Problem >.

Definition at line 564 of file BoxConstrainedProblems.h.

◆ setShrinking()

template<class Problem >
void shark::BoxConstrainedShrinkingProblem< Problem >::setShrinking ( bool  shrinking)
inline

Definition at line 485 of file BoxConstrainedProblems.h.

◆ shrink()

template<class Problem >
bool shark::BoxConstrainedShrinkingProblem< Problem >::shrink ( double  epsilon)
inline

Definition at line 431 of file BoxConstrainedProblems.h.

References remora::max(), and remora::min().

◆ unshrink()

template<class Problem >
void shark::BoxConstrainedShrinkingProblem< Problem >::unshrink ( )
inline

Unshrink the problem.

Definition at line 458 of file BoxConstrainedProblems.h.

◆ updateGradientEdge()

template<class Problem >
void shark::BoxConstrainedShrinkingProblem< Problem >::updateGradientEdge ( std::size_t  i,
double  oldAlpha,
double  newAlpha 
)
inlineprotected

Updates the edge-part of the gradient when an alpha valu was changed.

This function overwite the base class method and is called, whenever the base class changes an alpha value.

Definition at line 580 of file BoxConstrainedProblems.h.

References remora::max(), remora::min(), and SIZE_CHECK.

◆ updateSMO()

template<class Problem >
virtual void shark::BoxConstrainedShrinkingProblem< Problem >::updateSMO ( std::size_t  i,
std::size_t  j 
)
inlinevirtual

Does an update of SMO given a working set with indices i and j.

Reimplemented from shark::BoxConstrainedProblem< Problem >.

Definition at line 418 of file BoxConstrainedProblems.h.


The documentation for this struct was generated from the following file: