12 #ifndef BOGUS_ADMM_HPP
13 #define BOGUS_ADMM_HPP
15 #include "ConstrainedSolverBase.hpp"
43 template <
typename BlockMatrixType >
50 typedef typename GlobalProblemTraits::Scalar Scalar ;
68 template < admm::Variant variant,
typename NSLaw,
typename ProxOp,
typename RhsT,
typename ResT >
70 const NSLaw &law,
const ProxOp& op,
71 const RhsT &w, ResT &v, ResT &r )
const ;
74 template <
typename NSLaw,
typename ProxOp,
typename RhsT,
typename ResT >
76 const NSLaw &law,
const ProxOp& op,
77 const RhsT &w, ResT &v, ResT &r )
const ;
83 Base::updateScalings() ;
89 { m_stepSize = size ; }
93 { m_defaultVariant = variant ; }
95 Scalar stepSize()
const {
return m_stepSize ; }
99 typedef typename Base::Index Index ;
126 template<
typename ObjectType >
130 typedef typename BlockTraits::Scalar Scalar ;
134 typedef typename GlobalProblemTraits::DynVector AffineVec ;
145 const AffineVec& affinePart )
146 : m_coefficient( lambda ), m_linearOp( linearExpr ),
147 m_affinePart( affinePart )
153 template <
typename RhsT,
typename ResT >
154 void eval( RhsT & rhs, ResT & res )
const ;
158 return m_coefficient ;
162 const Scalar m_coefficient ;
163 const LinearOp& m_linearOp ;
164 const AffineVec& m_affinePart ;
190 template <
typename BlockMatrixType >
197 typedef typename GlobalProblemTraits::Scalar Scalar ;
206 template <
typename NSLaw,
typename MatrixT,
typename RhsT,
typename ResT >
209 const RhsT &f,
const RhsT &w,
210 ResT &v, ResT &r )
const ;
213 template <
admm::Variant variant,
typename NSLaw,
typename MatrixT,
214 typename RhsT,
typename ResT >
217 const RhsT &f,
const RhsT &w,
218 ResT &v, ResT &r )
const ;
222 typename AType,
typename BType,
typename HType,
typename PrecondT,
223 typename RhsT,
typename ORhsT,
typename ResT,
typename OResT >
229 const PrecondT& preconditioner,
230 const RhsT &f,
const ORhsT& k,
const RhsT &w,
231 ResT &v, OResT &p, ResT &r, Scalar stepRatio = 1 )
const ;
237 Base::updateScalings() ;
243 { m_fpStepSize = size ; }
245 void setProjStepSize(
const Scalar size )
246 { m_projStepSize = size ; }
250 { m_defaultVariant = variant ; }
252 Scalar fpStepSize()
const {
return m_fpStepSize ; }
253 Scalar projStepSize()
const {
return m_projStepSize ; }
259 { m_lsIters = lsIterations ; }
264 { m_lsOptimisticFactor = lsOptimisticFactor ; }
269 { m_lsPessimisticFactor = lsPessimisticFactor ; }
271 unsigned lineSearchIterations()
const {
return m_lsIters ; }
272 Scalar lineSearchOptimisticFactor()
const {
return m_lsOptimisticFactor ; }
273 Scalar lineSearchPessimisticFactor()
const {
return m_lsPessimisticFactor ; }
277 typedef typename Base::Index Index ;
285 m_fpStepSize = 1.e-1 ;
286 m_projStepSize = 1.e-1 ;
289 m_lsOptimisticFactor = 1.25 ;
290 m_lsPessimisticFactor = .5 ;
299 Scalar m_fpStepSize ;
300 Scalar m_projStepSize ;
305 Scalar m_lsOptimisticFactor ;
306 Scalar m_lsPessimisticFactor ;
DualAMA()
Default constructor – you will have to call setMatrix() before using the solve() function.
Definition: ADMM.hpp:200
ADMM()
Default constructor – you will have to call setMatrix() before using the solve() function.
Definition: ADMM.hpp:53
Evaluation of prox_{1/c} J with J(x) = 1/2 xM'x + f'x.
Definition: ADMM.hpp:127
Definition: Traits.hpp:19
Scalar m_tol
See setTol()
Definition: BlockSolverBase.hpp:70
void setDefaultVariant(admm::Variant variant)
Sets the variant that will be used when calling solve() without template arguments.
Definition: ADMM.hpp:92
void setLineSearchPessimisticFactor(const Scalar lsPessimisticFactor)
Definition: ADMM.hpp:268
Scalar solve(const NSLaw &law, const BlockObjectBase< MatrixT > &A, const RhsT &f, const RhsT &w, ResT &v, ResT &r) const
Solve function using default variant.
void init()
Sets up the default values for all parameters.
Definition: ADMM.hpp:280
Standard ADMM.
Definition: ADMM.hpp:27
Definition: BlockSolvers.fwd.hpp:33
Variant
Variants of ADMM algorithm.
Definition: ADMM.hpp:25
void setLineSearchOptimisticFactor(const Scalar lsOptimisticFactor)
Definition: ADMM.hpp:263
ADMM(const BlockObjectBase< BlockMatrixType > &matrix)
Constructor with the system matrix.
Definition: ADMM.hpp:55
ADMM (Alternating Direction Method of Multipliers ) iterative solver.
Definition: ADMM.hpp:44
Scalar coefficient() const
Definition: ADMM.hpp:157
DualAMA & setMatrix(const BlockObjectBase< BlockMatrixType > &matrix)
Sets the problem matrix – the one defining the constraints.
Definition: ADMM.hpp:234
Derived & setMatrix(const BlockObjectBase< BlockMatrixType > &matrix)
Sets the system matrix and initializes internal structures.
Definition: ConstrainedSolverBase.hpp:62
Scalar solve(const NSLaw &law, const ProxOp &op, const RhsT &w, ResT &v, ResT &r) const
Dual AMA iterative solver (Alternating Minimization Algorithm on dual formuation of quadratic optimiz...
Definition: ADMM.hpp:191
void setFpStepSize(const Scalar size)
Sets the step size for updating the dual variable (forces).
Definition: ADMM.hpp:242
const BlockObjectBase< BlockMatrixType > * m_matrix
Pointer to the matrix of the system.
Definition: BlockSolverBase.hpp:65
QuadraticProxOp(const LinearOp &linearExpr, const Scalar lambda, const AffineVec &affinePart)
Construct the proximal evaluator of a quadratic function.
Definition: ADMM.hpp:144
ADMM & setMatrix(const BlockObjectBase< BlockMatrixType > &matrix)
Sets the problem matrix – the one defining the constraints.
Definition: ADMM.hpp:80
void setStepSize(const Scalar size)
Sets the step size for updating the dual variable (forces).
Definition: ADMM.hpp:88
unsigned m_maxIters
See setMaxIters()
Definition: BlockSolverBase.hpp:68
void setLineSearchIterations(const unsigned lsIterations)
Sets the maximum number of line-search iterations.
Definition: ADMM.hpp:258
DualAMA(const BlockObjectBase< BlockMatrixType > &matrix)
Constructor with the system matrix.
Definition: ADMM.hpp:202
void setDefaultVariant(admm::Variant variant)
Sets the variant that will be used when calling solve() without template arguments.
Definition: ADMM.hpp:249
ADDM with acceleration (see Goldstein 2014)
Definition: ADMM.hpp:29
Definition: ConstrainedSolverBase.hpp:20
void eval(RhsT &rhs, ResT &res) const
Evaluates prox_{1/coeff} J ( rhs/coeff )
void init()
Sets up the default values for all parameters.
Definition: ADMM.hpp:102
Scalar solveWithLinearConstraints(const NSLaw &law, const BlockObjectBase< AType > &A, const BlockObjectBase< BType > &B, const BlockObjectBase< HType > &H, const PrecondT &preconditioner, const RhsT &f, const ORhsT &k, const RhsT &w, ResT &v, OResT &p, ResT &r, Scalar stepRatio=1) const
Idem with constraint ( B v + k = 0 )