Loading...
Searching...
No Matches
constraint-inequality.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#ifndef __tsid_python_constriant_inequality_hpp__
18#define __tsid_python_constriant_inequality_hpp__
19
21
23
24namespace tsid
25{
26 namespace python
27 {
28 namespace bp = boost::python;
29
30 template<typename ConstraintInequality>
32 : public boost::python::def_visitor< ConstraintIneqPythonVisitor<ConstraintInequality> >
33 {
34 template<class PyClass>
35
36 void visit(PyClass& cl) const
37 {
38 cl
39 .def(bp::init<std::string>((bp::arg("name")), "Default constructor with name."))
40 .def(bp::init<std::string, unsigned int, unsigned int>((bp::arg("name"), bp::arg("row"), bp::arg("col")), "Default constructor with name and size."))
41 .def(bp::init<std::string, Eigen::MatrixXd, Eigen::VectorXd, Eigen::VectorXd>((bp::arg("name"), bp::arg("A"), bp::arg("lb"), bp::arg("ub")), "Default constructor with name and constraint."))
42
43 .add_property("rows", &ConstraintInequality::rows)
44 .add_property("cols", &ConstraintInequality::cols)
45 .def("resize",&ConstraintInequality::resize, (bp::arg("r"), bp::arg("c")),"Resize constraint size.")
46
47 .add_property("isEquality", &ConstraintInequality::isEquality)
48 .add_property("isInequality", &ConstraintInequality::isInequality)
49 .add_property("isBound", &ConstraintInequality::isBound)
50
51 .add_property("matrix", &ConstraintIneqPythonVisitor::matrix)
52 .add_property("vector", &ConstraintIneqPythonVisitor::vector)
53 .add_property("lowerBound", &ConstraintIneqPythonVisitor::lowerBound)
54 .add_property("upperBound", &ConstraintIneqPythonVisitor::upperBound)
55
56 .def("setMatrix", (bool (ConstraintInequality::*)(const Eigen::MatrixXd &) const) &ConstraintInequality::setMatrix, bp::args("matrix"), "Set Matrix")
57 .def("setVector", (bool (ConstraintInequality::*)(const Eigen::VectorXd &) const) &ConstraintInequality::setVector, bp::args("vector"), "Set Vector")
58 .def("setLowerBound", (bool (ConstraintInequality::*)(const Eigen::VectorXd &) const) &ConstraintInequality::setLowerBound, bp::args("lb"), "Set LowerBound")
59 .def("setUpperBound", (bool (ConstraintInequality::*)(const Eigen::VectorXd &) const) &ConstraintInequality::setUpperBound, bp::args("ub"), "Set UpperBound")
60 ;
61 }
62 static Eigen::MatrixXd matrix (const ConstraintInequality & self) {return self.matrix();}
63 static Eigen::VectorXd vector (const ConstraintInequality & self) {return self.vector();}
64 static Eigen::VectorXd lowerBound (const ConstraintInequality & self) {return self.lowerBound();}
65 static Eigen::VectorXd upperBound (const ConstraintInequality & self) {return self.upperBound();}
66
67 static void expose(const std::string & class_name)
68 {
69 std::string doc = "Constraint Inequality info.";
70 bp::class_<ConstraintInequality>(class_name.c_str(),
71 doc.c_str(),
72 bp::no_init)
74 }
75 };
76 }
77}
78
79
80#endif // ifndef __tsid_python_constriant_inequality_hpp__
Definition: constraint-bound.hpp:27
Definition: constraint-inequality.hpp:33
static Eigen::MatrixXd matrix(const ConstraintInequality &self)
Definition: constraint-inequality.hpp:62
static Eigen::VectorXd upperBound(const ConstraintInequality &self)
Definition: constraint-inequality.hpp:65
static Eigen::VectorXd vector(const ConstraintInequality &self)
Definition: constraint-inequality.hpp:63
void visit(PyClass &cl) const
Definition: constraint-inequality.hpp:36
static Eigen::VectorXd lowerBound(const ConstraintInequality &self)
Definition: constraint-inequality.hpp:64
static void expose(const std::string &class_name)
Definition: constraint-inequality.hpp:67