Go to the documentation of this file.
   20 #ifndef LIBMESH_NLOPT_OPTIMIZATION_SOLVER_H 
   21 #define LIBMESH_NLOPT_OPTIMIZATION_SOLVER_H 
   23 #include "libmesh/libmesh_config.h" 
   26 #if defined(LIBMESH_HAVE_NLOPT) && !defined(LIBMESH_USE_COMPLEX_NUMBERS) 
   29 #include "libmesh/optimization_solver.h" 
   93   virtual void clear () 
override;
 
   98   virtual void init () 
override;
 
  108   virtual void solve () 
override;
 
  182   static std::map<std::string, nlopt_algorithm> 
build_map()
 
  184     std::map<std::string, nlopt_algorithm> ret;
 
  185     ret[
"LD_SLSQP"]                   = NLOPT_LD_SLSQP;
 
  186     ret[
"LD_MMA"]                     = NLOPT_LD_MMA;
 
  187     ret[
"LD_CCSAQ"]                   = NLOPT_LD_CCSAQ;
 
  188     ret[
"LD_LBFGS"]                   = NLOPT_LD_LBFGS;
 
  189     ret[
"LD_LBFGS_NOCEDAL"]           = NLOPT_LD_LBFGS_NOCEDAL;
 
  190     ret[
"LD_TNEWTON"]                 = NLOPT_LD_TNEWTON;
 
  191     ret[
"LD_TNEWTON_RESTART"]         = NLOPT_LD_TNEWTON_RESTART;
 
  192     ret[
"LD_TNEWTON_PRECOND"]         = NLOPT_LD_TNEWTON_PRECOND;
 
  193     ret[
"LD_TNEWTON_PRECOND_RESTART"] = NLOPT_LD_TNEWTON_PRECOND_RESTART;
 
  194     ret[
"LD_AUGLAG"]                  = NLOPT_LD_AUGLAG;
 
  195     ret[
"LD_VAR1"]                    = NLOPT_LD_VAR1;
 
  196     ret[
"LD_VAR2"]                    = NLOPT_LD_VAR2;
 
  197     ret[
"LN_COBYLA"]                  = NLOPT_LN_COBYLA;
 
  198     ret[
"LN_BOBYQA"]                  = NLOPT_LN_BOBYQA;
 
  199     ret[
"LN_PRAXIS"]                  = NLOPT_LN_PRAXIS;
 
  200     ret[
"LN_NELDERMEAD"]              = NLOPT_LN_NELDERMEAD;
 
  201     ret[
"LN_SBPLX"]                   = NLOPT_LN_SBPLX;
 
  202     ret[
"GN_ISRES"]                   = NLOPT_GN_ISRES;
 
  212 template <
typename T>
 
  213 std::map<std::string, nlopt_algorithm>
 
  219 #endif // #if defined(LIBMESH_HAVE_NLOPT) && !defined(LIBMESH_USE_COMPLEX_NUMBERS) 
  220 #endif // LIBMESH_NLOPT_OPTIMIZATION_SOLVER_H 
  
This System subclass enables us to assemble an objective function, gradient, Hessian and bounds for o...
 
virtual void print_converged_reason() override
Prints a useful message about why the latest optimization solve con(di)verged.
 
virtual void solve() override
Call the NLopt solver.
 
void __libmesh_nlopt_equality_constraints(unsigned m, double *result, unsigned n, const double *x, double *gradient, void *data)
 
The libMesh namespace provides an interface to certain functionality in the library.
 
nlopt_opt get_nlopt_object()
 
friend double __libmesh_nlopt_objective(unsigned n, const double *x, double *gradient, void *data)
 
unsigned & get_iteration_count()
 
nlopt_result _result
Store the result (i.e.
 
This base class can be inherited from to provide interfaces to optimization solvers from different pa...
 
virtual void clear() override
Release all memory and clear data structures.
 
virtual int get_converged_reason() override
 
friend void __libmesh_nlopt_equality_constraints(unsigned m, double *result, unsigned n, const double *x, double *gradient, void *data)
 
virtual void init() override
Initialize data structures if not done so already.
 
static std::map< std::string, nlopt_algorithm > _nlopt_algorithms
 
const sys_type & system() const
 
void __libmesh_nlopt_inequality_constraints(unsigned m, double *result, unsigned n, const double *x, double *gradient, void *data)
 
double _constraints_tolerance
NLopt requires us to specify a tolerance for the constraints.
 
static std::map< std::string, nlopt_algorithm > build_map()
 
~NloptOptimizationSolver()
Destructor.
 
friend void __libmesh_nlopt_inequality_constraints(unsigned m, double *result, unsigned n, const double *x, double *gradient, void *data)
 
unsigned _iteration_count
Stores the current iteration index (incremented at each call of __libmesh_nlopt_objective).
 
double __libmesh_nlopt_objective(unsigned n, const double *x, double *gradient, void *data)
 
OptimizationSystem sys_type
The type of system that we use in conjunction with this solver.
 
IterBase * data
Ideally this private member data should have protected access.
 
This class provides an interface to the NLopt optimization solvers.
 
nlopt_opt _opt
Optimization solver context.
 
NloptOptimizationSolver(sys_type &system)
Constructor.