33 #ifdef BUILD_WITH_SNOPT_SUPPORT // build SNOPT interface 34 #include <snoptProblem.hpp> 35 #endif //BUILD_WITH_SNOPT_SUPPORT 40 #ifdef BUILD_WITH_SNOPT_SUPPORT // build SNOPT interface 60 typedef double Number;
61 const SnoptSolver&
self;
65 Number* xlow_ =
nullptr;
66 Number* xupp_ =
nullptr;
67 Number* xmul_ =
nullptr;
68 int* xstate_ =
nullptr;
71 Number* Flow_ =
nullptr;
72 Number* Fupp_ =
nullptr;
73 Number* Fmul_ =
nullptr;
74 int* Fstate_ =
nullptr;
77 int* iAfun_ =
nullptr;
78 int* jAvar_ =
nullptr;
81 int* iGfun_ =
nullptr;
82 int* jGvar_ =
nullptr;
84 static std::vector<SnoptMemory*> mempool;
93 SnoptMemory(
const SnoptSolver&
self);
110 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
111 typedef double Number;
113 typedef Eigen::Matrix<Number, Eigen::Dynamic, 1> VectorXd;
114 typedef Eigen::Map<VectorXd> MapVecXd;
115 typedef Eigen::Map<const VectorXd> MapConstVecXd;
116 typedef Eigen::Map<Eigen::VectorXi> MapVecXi;
125 virtual ~SnoptSolver();
137 SnoptSolver(std::shared_ptr<Nlp> nlp,
const NlpSolverSettings& settings);
163 void NLP_Function(SnoptMemory* m,
201 static void NLP_Function(
int* Status,
217 virtual void configureDerived(
const NlpSolverSettings& settings)
override;
219 virtual bool solve()
override;
221 virtual void prepareWarmStart(
size_t maxIterations)
override;
230 SnoptMemory* alloc_memory()
const {
return new SnoptMemory(*
this); }
236 inline void free_memory(SnoptMemory* mem)
const {
delete mem; }
242 void init_memory(SnoptMemory* mem)
const;
250 void fill_memory(SnoptMemory* mem)
const;
256 void setupSnoptObjects();
263 void validateSNOPTStatus(
const int& status)
const;
268 void setSolverOptions();
270 SnoptSettings settings_;
271 SnoptMemory* memoryPtr_;
273 snoptProblemA snoptApp_;
278 Number ObjAdd_ = 0.0;
280 const int Cold_ = 0, Basis_ = 1, Warm_ = 2;
281 int currStartOption_ = Cold_;
295 #else // BUILD_WITH_SNOPT_SUPPORT -- not building with SNOPT support, create dummy class 300 SnoptSolver() {
throw(std::runtime_error(
"Error - SNOPT interface not compiled.")); }
303 throw(std::runtime_error(
"Error - SNOPT interface not compiled."));
307 virtual bool solve()
override {
return false; }
311 #endif // BUILD_WITH_SNOPT_SUPPORT Abstract base class for the NLP solvers.
Definition: NlpSolver.h:21
virtual void prepareWarmStart(size_t maxIterations) override
Prepares the solver for a warmstarting scenario with available (good) initial guess.
Definition: SnoptSolver.h:308
Contains the NLP solver settings.
Definition: NlpSolverSettings.h:261
SnoptSolver(std::shared_ptr< Nlp > nlp, NlpSolverSettings settings)
Definition: SnoptSolver.h:301
tpl::NlpSolver< double > NlpSolver
Definition: NlpSolver.h:93
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
virtual void configureDerived(const NlpSolverSettings &settings) override
Forwards the settings to the corresponding nlp solver.
Definition: SnoptSolver.h:306
SnoptSolver()
Definition: SnoptSolver.h:300
Definition: SnoptSolver.h:297
virtual bool solve() override
Solves the nlp.
Definition: SnoptSolver.h:307