forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snopt_solver.h
51 lines (35 loc) · 1.51 KB
/
snopt_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
#pragma once
#include <string>
#include "drake/common/drake_copyable.h"
#include "drake/solvers/mathematical_program_solver_interface.h"
namespace drake {
namespace solvers {
class SnoptSolver : public MathematicalProgramSolverInterface {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(SnoptSolver)
SnoptSolver() = default;
~SnoptSolver() override = default;
// This solver is implemented in various pieces depending on if
// SNOPT was available during compilation.
bool available() const override { return is_available(); };
static bool is_available();
SolutionResult Solve(MathematicalProgram& prog) const override;
void Solve(const MathematicalProgram& prog,
const optional<Eigen::VectorXd>& initial_guess,
const optional<SolverOptions>& solver_options,
MathematicalProgramResult* result) const override;
SolverId solver_id() const override;
/// @return same as MathematicalProgramSolverInterface::solver_id()
static SolverId id();
bool AreProgramAttributesSatisfied(
const MathematicalProgram& prog) const override;
static bool ProgramAttributesSatisfied(const MathematicalProgram& prog);
/// @return if the solver is thread safe. SNOPT f2c interface uses global
/// variables, hence it is not thread safe. SNOPT fortran interface is thread
/// safe.
static bool is_thread_safe();
/// For some reason, SNOPT 7.4 fails to detect a simple LP being unbounded.
static bool is_bounded_lp_broken();
};
} // namespace solvers
} // namespace drake