forked from sammy-tri/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ibex_solver_common.cc
47 lines (37 loc) · 1.55 KB
/
ibex_solver_common.cc
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
/* clang-format off to disable clang-format-includes */
#include "drake/solvers/ibex_solver.h"
/* clang-format on */
#include "drake/common/never_destroyed.h"
#include "drake/solvers/mathematical_program.h"
// This file contains implementations that are common to both the available and
// unavailable flavor of this class.
namespace drake {
namespace solvers {
IbexSolver::IbexSolver()
: SolverBase(&id, &is_available, &is_enabled, &ProgramAttributesSatisfied) {
}
IbexSolver::~IbexSolver() = default;
SolverId IbexSolver::id() {
static const never_destroyed<SolverId> singleton{"IBEX"};
return singleton.access();
}
bool IbexSolver::is_enabled() { return true; }
bool IbexSolver::ProgramAttributesSatisfied(const MathematicalProgram& prog) {
static const never_destroyed<ProgramAttributes> solver_capabilities(
std::initializer_list<ProgramAttribute>{
ProgramAttribute::kExponentialConeConstraint,
ProgramAttribute::kGenericConstraint,
ProgramAttribute::kLinearComplementarityConstraint,
ProgramAttribute::kLinearConstraint,
ProgramAttribute::kLinearEqualityConstraint,
ProgramAttribute::kLorentzConeConstraint,
ProgramAttribute::kRotatedLorentzConeConstraint,
ProgramAttribute::kGenericCost,
ProgramAttribute::kLinearCost,
ProgramAttribute::kQuadraticCost,
});
return AreRequiredAttributesSupported(prog.required_capabilities(),
solver_capabilities.access());
}
} // namespace solvers
} // namespace drake