optimization_solver.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_OPTIMIZATION_SOLVER_H
21 #define LIBMESH_OPTIMIZATION_SOLVER_H
22 
23 // Local includes
24 #include "libmesh/libmesh_common.h"
26 #include "libmesh/libmesh.h"
28 #include "libmesh/auto_ptr.h" // deprecated
30 
31 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
32 namespace libMesh
33 {
34 enum SolverPackage : int;
35 }
36 #else
38 #endif
39 
40 // C++ includes
41 #include <cstddef>
42 #include <memory>
43 
44 namespace libMesh
45 {
46 
47 // forward declarations
48 template <typename T> class SparseMatrix;
49 template <typename T> class NumericVector;
50 template <typename T> class Preconditioner;
51 
60 template <typename T>
61 class OptimizationSolver : public ReferenceCountedObject<OptimizationSolver<T>>,
62  public ParallelObject
63 {
64 public:
69 
73  explicit
75 
79  virtual ~OptimizationSolver ();
80 
85  static std::unique_ptr<OptimizationSolver<T>> build(sys_type & s,
86  const SolverPackage solver_package = libMesh::default_solver_package());
87 
92  bool initialized () const { return _is_initialized; }
93 
97  virtual void clear () {}
98 
102  virtual void init () = 0;
103 
107  virtual void solve () = 0;
108 
114  virtual void get_dual_variables()
115  { libmesh_not_implemented(); }
116 
121  virtual void print_converged_reason() { libmesh_not_implemented(); }
122 
132  virtual int get_converged_reason() { return 0; }
133 
139 
145 
151 
157 
162 
168 
173 
178 
183  const sys_type & system () const { return _system; }
184 
189  sys_type & system () { return _system; }
190 
195 
200 
204  bool verbose;
205 
206 protected:
207 
212 
217 
218 };
219 
220 } // namespace libMesh
221 
222 
223 #endif // LIBMESH_OPTIMIZATION_SOLVER_H
OptimizationSystem::ComputeObjective * objective_object
static std::unique_ptr< OptimizationSolver< T > > build(sys_type &s, const SolverPackage solver_package=libMesh::default_solver_package())
OptimizationSystem::ComputeGradient * gradient_object
OptimizationSystem::ComputeHessian * hessian_object
OptimizationSystem::ComputeInequalityConstraints * inequality_constraints_object
SolverPackage default_solver_package()
Definition: libmesh.C:971
OptimizationSystem::ComputeEqualityConstraintsJacobian * equality_constraints_jacobian_object
unsigned int max_objective_function_evaluations
An object whose state is distributed along a set of processors.
const sys_type & system() const
OptimizationSystem::ComputeLowerAndUpperBounds * lower_and_upper_bounds_object
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
OptimizationSystem::ComputeInequalityConstraintsJacobian * inequality_constraints_jacobian_object
OptimizationSystem::ComputeEqualityConstraints * equality_constraints_object