shark::BoxBasedShrinkingStrategy< Problem > Struct Template Reference

Takes q boxx constrained QP-type problem and implements shrinking on it. More...

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

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

Public Types

typedef Problem::QpFloatType QpFloatType
 
typedef Problem::MatrixType MatrixType
 
typedef Problem::PreferedSelectionStrategy PreferedSelectionStrategy
 

Public Member Functions

template<class ProblemT >
 BoxBasedShrinkingStrategy (ProblemT &problem, bool shrink=true)
 
virtual void updateSMO (std::size_t i, std::size_t j)
 
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 deactivateVariable (std::size_t i)
 Remove the i-th example from the problem. 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 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...
 

Detailed Description

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

Takes q boxx constrained QP-type problem and implements shrinking on it.

Given a QP-type-Problem, implements a strategy which allows to efficiently shrink and unshrink the problem. If a value of the QP has an active box constraint, it is shrinked from the problem when currently there is no possible step using that variable that leads to a gain. This is problem dependent as this might involve consideration of additional constraints. Therefore, every Problem must implement the method testShrinkVariable.

Definition at line 47 of file BoxBasedShrinkingStrategy.h.

Member Typedef Documentation

◆ MatrixType

template<class Problem>
typedef Problem::MatrixType shark::BoxBasedShrinkingStrategy< Problem >::MatrixType

Definition at line 50 of file BoxBasedShrinkingStrategy.h.

◆ PreferedSelectionStrategy

template<class Problem>
typedef Problem::PreferedSelectionStrategy shark::BoxBasedShrinkingStrategy< Problem >::PreferedSelectionStrategy

Definition at line 51 of file BoxBasedShrinkingStrategy.h.

◆ QpFloatType

template<class Problem>
typedef Problem::QpFloatType shark::BoxBasedShrinkingStrategy< Problem >::QpFloatType

Definition at line 49 of file BoxBasedShrinkingStrategy.h.

Constructor & Destructor Documentation

◆ BoxBasedShrinkingStrategy()

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

Definition at line 54 of file BoxBasedShrinkingStrategy.h.

Member Function Documentation

◆ deactivateVariable()

template<class Problem>
void shark::BoxBasedShrinkingStrategy< Problem >::deactivateVariable ( std::size_t  i)
inline

Remove the i-th example from the problem.

Definition at line 189 of file BoxBasedShrinkingStrategy.h.

◆ flipCoordinates()

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

swap indizes (i,j)

Definition at line 222 of file BoxBasedShrinkingStrategy.h.

◆ scaleBoxConstraints()

template<class Problem>
void shark::BoxBasedShrinkingStrategy< 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 198 of file BoxBasedShrinkingStrategy.h.

◆ setInitialSolution() [1/2]

template<class Problem>
void shark::BoxBasedShrinkingStrategy< 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 151 of file BoxBasedShrinkingStrategy.h.

◆ setInitialSolution() [2/2]

template<class Problem>
void shark::BoxBasedShrinkingStrategy< 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 167 of file BoxBasedShrinkingStrategy.h.

◆ setLinear()

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

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

Definition at line 215 of file BoxBasedShrinkingStrategy.h.

◆ setShrinking()

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

Definition at line 140 of file BoxBasedShrinkingStrategy.h.

◆ shrink()

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

Definition at line 86 of file BoxBasedShrinkingStrategy.h.

◆ unshrink()

◆ updateSMO()

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

Definition at line 73 of file BoxBasedShrinkingStrategy.h.


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