21 #ifndef __PETSC_TAO_SOLVER_H 22 #define __PETSC_TAO_SOLVER_H 32 #include <petsctaolinesearch.h> 34 #include <dolfin/parameter/Parameters.h> 35 #include <dolfin/la/PETScObject.h> 36 #include <dolfin/la/PETScVector.h> 45 class OptimisationProblem;
57 std::string tao_type=
"default",
58 std::string ksp_type=
"default",
59 std::string pc_type=
"default");
63 std::string ksp_type=
"default",
64 std::string pc_type=
"default");
109 static std::vector<std::pair<std::string, std::string>>
methods();
160 struct tao_ctx_t _tao_ctx;
166 void update_parameters(std::string tao_type,
167 std::string ksp_type,
168 std::string pc_type);
171 void set_tao_options();
172 void set_ksp_options();
175 void set_tao(std::string tao_type);
187 static const std::map<std::string,
188 std::pair<std::string, const TaoType>> _methods;
192 static PetscErrorCode FormFunctionGradient(Tao
tao, Vec x, PetscReal *fobj,
196 static PetscErrorCode FormHessian(Tao tao, Vec x, Mat H, Mat Hpre,
200 static PetscErrorCode TaoConvergenceTest(Tao tao,
void *ctx);
static std::vector< std::pair< std::string, std::string > > methods()
Return a list of available solver methods.
Definition: PETScTAOSolver.cpp:55
Definition: PETScVector.h:60
std::pair< std::size_t, bool > solve(OptimisationProblem &optimisation_problem, GenericVector &x, const GenericVector &lb, const GenericVector &ub)
Definition: PETScTAOSolver.cpp:176
Definition: PETScTAOSolver.h:51
virtual ~PETScTAOSolver()
Destructor.
Definition: PETScTAOSolver.cpp:114
Definition: PETScMatrix.h:58
void init(OptimisationProblem &optimisation_problem, PETScVector &x, const PETScVector &lb, const PETScVector &ub)
Definition: PETScTAOSolver.cpp:210
static Parameters default_parameters()
Default parameter values.
Definition: PETScTAOSolver.cpp:63
Tao tao() const
Return the TAO pointer.
Definition: PETScTAOSolver.h:118
Definition: Parameters.h:94
PETScTAOSolver(MPI_Comm comm, std::string tao_type="default", std::string ksp_type="default", std::string pc_type="default")
Create TAO solver.
Definition: PETScTAOSolver.cpp:88
Definition: PETScObject.h:33
MPI_Comm mpi_comm() const
Return the MPI communicator.
Definition: PETScTAOSolver.cpp:167
This class defines a common interface for vectors.
Definition: GenericVector.h:47
Definition: OptimisationProblem.h:38
Parameters parameters
Parameters for the PETSc TAO solver.
Definition: PETScTAOSolver.h:115