12 #ifndef BOGUS_BLOCK_PROJECTED_GRADIENT_HPP
13 #define BOGUS_BLOCK_PROJECTED_GRADIENT_HPP
15 #include "ConstrainedSolverBase.hpp"
23 namespace projected_gradient {
40 template <
typename BlockMatrixType >
45 typedef typename Base::Scalar Scalar ;
54 template <
typename NSLaw,
typename RhsT,
typename ResT >
55 Scalar
solve(
const NSLaw &law,
const RhsT &b, ResT &x )
const ;
67 template < projected_gradient::Variant variant,
typename NSLaw,
typename RhsT,
typename ResT >
68 Scalar
solve(
const NSLaw &law,
const RhsT &b, ResT &x )
const ;
75 Base::updateScalings() ;
81 { m_lsIters = lsIterations ; }
86 { m_lsOptimisticFactor = lsOptimisticFactor ; }
91 { m_lsPessimisticFactor = lsPessimisticFactor ; }
96 { m_lsArmijoCoefficient = lsArmijoCoefficient ; }
100 { m_defaultVariant = variant ; }
102 unsigned lineSearchIterations()
const {
return m_lsIters ; }
103 Scalar lineSearchOptimisticFactor()
const {
return m_lsOptimisticFactor ; }
104 Scalar lineSearchPessimisticFactor()
const {
return m_lsPessimisticFactor ; }
105 Scalar lineSearchArmijoCoefficient()
const {
return m_lsArmijoCoefficient ; }
109 typedef typename Base::Index Index ;
117 m_lsOptimisticFactor = 1.25 ;
118 m_lsPessimisticFactor = .5 ;
119 m_lsArmijoCoefficient = .5 ;
128 Scalar m_lsOptimisticFactor ;
129 Scalar m_lsPessimisticFactor ;
130 Scalar m_lsArmijoCoefficient ;
void setLineSearchArmijoCoefficient(const Scalar lsArmijoCoefficient)
Definition: ProjectedGradient.hpp:95
void setLineSearchPessimisticFactor(const Scalar lsPessimisticFactor)
Definition: ProjectedGradient.hpp:90
void setDefaultVariant(projected_gradient::Variant variant)
Sets the variant that will be used when calling solve() without template arguments.
Definition: ProjectedGradient.hpp:99
Scalar m_tol
See setTol()
Definition: BlockSolverBase.hpp:70
Accelerated Projected Gradient Descent based on and developed in .
Definition: ProjectedGradient.hpp:33
Scalar solve(const NSLaw &law, const RhsT &b, ResT &x) const
Finds an approximate minimum for a constrained quadratic problem.
Projected Gradient iterative solver.
Definition: ProjectedGradient.hpp:41
void setLineSearchOptimisticFactor(const Scalar lsOptimisticFactor)
Definition: ProjectedGradient.hpp:85
Spectral Projected Gradient, loosely adapted from .
Definition: ProjectedGradient.hpp:35
Projected gradient descent.
Definition: ProjectedGradient.hpp:29
Derived & setMatrix(const BlockObjectBase< BlockMatrixType > &matrix)
Sets the system matrix and initializes internal structures.
Definition: ConstrainedSolverBase.hpp:62
void setLineSearchIterations(const unsigned lsIterations)
Sets the maximum number of line-search iterations.
Definition: ProjectedGradient.hpp:80
const BlockObjectBase< BlockMatrixType > * m_matrix
Pointer to the matrix of the system.
Definition: BlockSolverBase.hpp:65
Projected gradient with conjugation of search direction.
Definition: ProjectedGradient.hpp:31
void init()
Sets up the default values for all parameters.
Definition: ProjectedGradient.hpp:112
unsigned m_maxIters
See setMaxIters()
Definition: BlockSolverBase.hpp:68
ProjectedGradient()
Default constructor – you will have to call setMatrix() before using the solve() function.
Definition: ProjectedGradient.hpp:48
Variant
Variants of Projected Gradient algorithm.
Definition: ProjectedGradient.hpp:25
Definition: ConstrainedSolverBase.hpp:20
Standard projected gradient.
Definition: ProjectedGradient.hpp:27
ProjectedGradient(const BlockObjectBase< BlockMatrixType > &matrix)
Constructor with the system matrix.
Definition: ProjectedGradient.hpp:50
ProjectedGradient & setMatrix(const BlockObjectBase< BlockMatrixType > &matrix)
Sets the matrix M defining the quadratic objective function.
Definition: ProjectedGradient.hpp:72