KASKADE 7 development version
|
#include <qpmg.hh>
Public Types | |
using | Self = QPMultiGridStrict< d, Prolongation, Real, Smoother, CoarseSmoother > |
using | MatrixA = NumaBCRSMatrix< EntryA > |
using | MatrixB = NumaBCRSMatrix< Dune::FieldMatrix< Real, 1, d > > |
using | VectorX = Dune::BlockVector< Dune::FieldVector< Real, d > > |
using | VectorB = Dune::BlockVector< Dune::FieldVector< Real, 1 > > |
using | SmootherType = std::conditional_t< smoothersEqual, QPSmoother< d, double >, std::variant< QPSmoother< d, double >, QPSmoother< d, double > > > |
Public Member Functions | |
QPMultiGridStrict (MatrixA const &A, MatrixB const &B, std::vector< Prolongation > &&prolongations, Real smootherRegularization=0, bool blocks=true, bool directOnCoarse=true) | |
Constructs the solver, providing the matrices \( A \) and \( B \). More... | |
~QPMultiGridStrict () | |
Destructor. More... | |
std::tuple< VectorX, int > | solve (VectorX x, VectorX const &c, VectorB const &b, double tol, int vcycles) const |
Approximately solves the QP for the given right hand side vectors up to a given tolerance. More... | |
VectorX | step (VectorX const &x, VectorX c, VectorB b) const |
Computes a single V-cycle correction for approximately solving the QP for the given right hand side vectors. More... | |
std::tuple< VectorX, int > | solve (VectorX x, VectorX const &c, VectorB const &b, double tol, int vcycles) const |
Approximately solves the QP for the given right hand side vectors up to a given tolerance. More... | |
Self & | setCoarseLevel (int coarselevel) |
Defines the grid level to be used as coarse grid. More... | |
Self & | setSmoothings (int pre, int post) |
Self & | setCoarseCorrections (int n) |
Sets the number of coarse corrections to compute and apply. More... | |
Self & | setBulkMode (ParallelMode m) |
Defines the smoothing strategy to use for unconstrained degrees of freedom. More... | |
Self & | setLogger (MGSolverStatistics< d, double > *logger) |
Sets the logging facility for reporting solver statistics. More... | |
Static Public Attributes | |
static constexpr bool | smoothersEqual |
Protected Member Functions | |
virtual double | computeEnergy (MatrixA const &A, MatrixB const &B, VectorX const &c, VectorB const &b, VectorX const &x) const |
virtual std::tuple< VectorX, VectorB, int > | gradient (MatrixA const &A, MatrixB const &B, VectorX const &c, VectorB const &b, VectorX const &x) const |
Computes the gradient of the (non-augmented) Lagrangian. More... | |
virtual std::tuple< VectorX, VectorX, VectorX, VectorB, int > | gradient_extended (MatrixA const &A, MatrixB const &B, VectorX const &c, VectorB const &b, VectorX const &x) const |
Computes the gradient of the (non-augmented) Lagrangian. More... | |
virtual double | qpLinesearch (MatrixA const &A, MatrixB const &B, VectorX const &c, VectorB const &b, VectorX const &dx) const |
virtual double | computeEnergy (MatrixA const &A, MatrixB const &B, VectorX const &c, VectorB const &b, VectorX const &x) const=0 |
Compute the problem energy of current iterate for logging purposes. More... | |
virtual std::tuple< VectorX, VectorB, int > | gradient (MatrixA const &A, MatrixB const &B, VectorX const &c, VectorB const &b, VectorX const &x) const=0 |
Compute the problem gradient of current iterate. More... | |
virtual std::tuple< VectorX, VectorX, VectorX, VectorB, int > | gradient_extended (MatrixA const &A, MatrixB const &B, VectorX const &c, VectorB const &b, VectorX const &x) const=0 |
Computes the gradient of current iterate, giving more information on the components of the gradient. (It might be split in several terms grad0 and grad1). More... | |
virtual double | qpLinesearch (MatrixA const &A, MatrixB const &B, VectorX const &c, VectorB const &b, VectorX const &dx) const=0 |
Compute the optimal step size in direction of dx. More... | |
MatrixB const & | B () const |
Provides a reference to the fine grid constraints. More... | |
Protected Attributes | |
std::vector< SmootherType > | smoothers |
using Kaskade::QPMultiGridBase< d, Prolongation, Smoother, CoarseSmoother, Real >::MatrixA = NumaBCRSMatrix<EntryA> |
using Kaskade::QPMultiGridBase< d, Prolongation, Smoother, CoarseSmoother, Real >::MatrixB = NumaBCRSMatrix<Dune::FieldMatrix<Real,1,d> > |
using Kaskade::QPMultiGridStrict< d, Prolongation, Real, Smoother, CoarseSmoother >::Self = QPMultiGridStrict<d,Prolongation,Real,Smoother,CoarseSmoother> |
|
inherited |
using Kaskade::QPMultiGridBase< d, Prolongation, Smoother, CoarseSmoother, Real >::VectorB = Dune::BlockVector<Dune::FieldVector<Real,1> > |
using Kaskade::QPMultiGridBase< d, Prolongation, Smoother, CoarseSmoother, Real >::VectorX = Dune::BlockVector<Dune::FieldVector<Real,d> > |
Kaskade::QPMultiGridStrict< d, Prolongation, Real, Smoother, CoarseSmoother >::QPMultiGridStrict | ( | MatrixA const & | A, |
MatrixB const & | B, | ||
std::vector< Prolongation > && | prolongations, | ||
Real | smootherRegularization = 0 , |
||
bool | blocks = true , |
||
bool | directOnCoarse = true |
||
) |
Constructs the solver, providing the matrices \( A \) and \( B \).
A | the Hessian. The matrix is copied internally and need not exist after solver construction. |
B | the constraints. The matrix is referenced internally and has to exist during the lifetime of the solver. |
blocks |
|
directOnCoarse |
|
Kaskade::QPMultiGridStrict< d, Prolongation, Real, Smoother, CoarseSmoother >::~QPMultiGridStrict | ( | ) |
Destructor.
|
protectedinherited |
Provides a reference to the fine grid constraints.
|
protectedvirtual |
|
protectedpure virtualinherited |
Compute the problem energy of current iterate for logging purposes.
|
protectedvirtual |
Computes the gradient of the (non-augmented) Lagrangian.
\[ g = Ax + c \]
|
protectedpure virtualinherited |
Compute the problem gradient of current iterate.
|
protectedvirtual |
Computes the gradient of the (non-augmented) Lagrangian.
\[ g = Ax + c \]
\[ Ax + c + \gamma*B^T(Bx-b)_+ \]
\[ Ax \]
\[ \gamma*B^T(Bx-b)_+ \]
\[ (Bx-b)_+ \]
\[ | \{ i \colon (Bx-b)_i >= 0 \} | \]
|
protectedpure virtualinherited |
Computes the gradient of current iterate, giving more information on the components of the gradient. (It might be split in several terms grad0 and grad1).
|
protectedvirtual |
|
protectedpure virtualinherited |
Compute the optimal step size in direction of dx.
|
inherited |
Defines the smoothing strategy to use for unconstrained degrees of freedom.
In contact problems, those are usually the interior nodes, and the ones without potential contact partner. The smoother can operate in parallel (Jacobi) or sequentially (Gauss-Seidel). In the parallel way, an exact linesearch is performed after the smoothing in order to guarantee descent.
|
inherited |
Sets the number of coarse corrections to compute and apply.
n | number of coarse corrections |
|
inherited |
Defines the grid level to be used as coarse grid.
coarselevel | the coarse grid level, between 0 and the max grid level |
If coarselevel is outside its allowed range, it is projected onto that range.
|
inherited |
Sets the logging facility for reporting solver statistics.
logger | a pointer to the logger object. This can be a nullpointer, in which case logging is stopped. |
Ownership of the logger object remains with the caller. The logger object needs to exist for the lifetime of the QPMultiGrid class or until it is replaced by a different logger (or none).
|
inherited |
|
inherited |
Approximately solves the QP for the given right hand side vectors up to a given tolerance.
x | initial guess for the solution |
c | linear objective term |
b | constant constraint term |
tol | tolerance |
std::tuple< VectorX, int > Kaskade::QPMultiGridStrict< d, Prolongation, Real, Smoother, CoarseSmoother >::solve | ( | VectorX | x, |
VectorX const & | c, | ||
VectorB const & | b, | ||
double | tol, | ||
int | vcycles | ||
) | const |
Approximately solves the QP for the given right hand side vectors up to a given tolerance.
x | initial guess for the solution |
c | linear objective term |
b | constant constraint term |
lambda | approximate multiplier |
tol | tolerance |
|
inherited |
Computes a single V-cycle correction for approximately solving the QP for the given right hand side vectors.
x | initial guess for the solution |
c | linear objective term |
b | constant constraint term |
|
protectedinherited |
|
staticconstexprinherited |