solver-HQP-eiquadprog.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018 CNRS
3 //
4 // This file is part of tsid
5 // tsid is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 // tsid is distributed in the hope that it will be
10 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Lesser Public License for more details. You should have
13 // received a copy of the GNU Lesser General Public License along with
14 // tsid If not, see
15 // <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef __tsid_python_solver_quadprog_hpp__
19 #define __tsid_python_solver_quadprog_hpp__
20 
22 
26 #include "tsid/solvers/fwd.hpp"
28 
29 namespace tsid
30 {
31  namespace python
32  {
33  namespace bp = boost::python;
34 
35  template<typename Solver>
37  : public boost::python::def_visitor< SolverHQuadProgPythonVisitor<Solver> >
38  {
39  template<class PyClass>
40 
41  void visit(PyClass& cl) const
42  {
43  cl
44  .def(bp::init<std::string>((bp::arg("name")), "Default Constructor with name"))
45 
46  .def("resize", &SolverHQuadProgPythonVisitor::resize, bp::args("n", "neq", "nin"))
47  .add_property("ObjVal", &Solver::getObjectiveValue, "return obj value")
48  .def("solve", &SolverHQuadProgPythonVisitor::solve, bp::args("HQPData"))
49  .def("solve", &SolverHQuadProgPythonVisitor::solver_helper, bp::args("HQPData for Python"))
50 
51  ;
52  }
53 
54  static void resize(Solver & self, unsigned int n, unsigned int neq, unsigned int nin){
55  self.resize(n, neq, nin);
56  }
57  static solvers::HQPOutput solve(Solver & self, const solvers::HQPData & problemData){
58  solvers::HQPOutput output;
59  output = self.solve(problemData);
60  return output;
61  }
63  solvers::HQPOutput output;
64  solvers::HQPData data = HQPDatas.get();
65 
66  output = self.solve(data);
67 
68  return output;
69  }
70 
71  static void expose(const std::string & class_name)
72  {
73  std::string doc = "Solver EiQuadProg info.";
74  bp::class_<Solver>(class_name.c_str(),
75  doc.c_str(),
76  bp::no_init)
78  }
79  };
80  }
81 }
82 
83 
84 #endif // ifndef __tsid_python_solver_quadprog_hpp__
static solvers::HQPOutput solver_helper(Solver &self, HQPDatas &HQPDatas)
Definition: solver-HQP-eiquadprog.hpp:62
Definition: solver-HQP-output.hpp:32
void visit(PyClass &cl) const
Definition: solver-HQP-eiquadprog.hpp:41
pinocchio::container::aligned_vector< ConstraintLevel > HQPData
Definition: fwd.hpp:91
Definition: container.hpp:75
static solvers::HQPOutput solve(Solver &self, const solvers::HQPData &problemData)
Definition: solver-HQP-eiquadprog.hpp:57
static void expose(const std::string &class_name)
Definition: solver-HQP-eiquadprog.hpp:71
static void resize(Solver &self, unsigned int n, unsigned int neq, unsigned int nin)
Definition: solver-HQP-eiquadprog.hpp:54
HQPData get()
Definition: container.hpp:114
Definition: solver-HQP-eiquadprog.hpp:36
Definition: constraint-bound.hpp:26