forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnlopt_solver.h
63 lines (48 loc) · 1.78 KB
/
nlopt_solver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once
#include <string>
#include "drake/common/drake_copyable.h"
#include "drake/solvers/solver_base.h"
namespace drake {
namespace solvers {
/**
* The NLopt solver details after calling Solve() function. The user can call
* MathematicalProgramResult::get_solver_details<NloptSolver>() to obtain the
* details.
*/
struct NloptSolverDetails {
/// The return status of NLopt solver. Please refer to
/// https://nlopt.readthedocs.io/en/latest/NLopt_Reference/#return-values.
int status{};
};
class NloptSolver final : public SolverBase {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(NloptSolver)
/// Type of details stored in MathematicalProgramResult.
using Details = NloptSolverDetails;
NloptSolver();
~NloptSolver() final;
/** The key name for the double-valued constraint tolerance.*/
static std::string ConstraintToleranceName();
/** The key name for double-valued x relative tolerance.*/
static std::string XRelativeToleranceName();
/** The key name for double-valued x absolute tolerance.*/
static std::string XAbsoluteToleranceName();
/** The key name for int-valued maximum number of evaluations. */
static std::string MaxEvalName();
/** The key name for the string-valued algorithm. */
static std::string AlgorithmName();
/// @name Static versions of the instance methods with similar names.
//@{
static SolverId id();
static bool is_available();
static bool is_enabled();
static bool ProgramAttributesSatisfied(const MathematicalProgram&);
//@}
// A using-declaration adds these methods into our class's Doxygen.
using SolverBase::Solve;
private:
void DoSolve(const MathematicalProgram&, const Eigen::VectorXd&,
const SolverOptions&, MathematicalProgramResult*) const final;
};
} // namespace solvers
} // namespace drake