20 #include <boost/test/unit_test.hpp> 21 #include <boost/utility/binary.hpp> 27 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
30 std::cout <<
"test_constraint_bounds\n";
32 using namespace Eigen;
33 const unsigned int n = 5;
43 BOOST_CHECK(bounds.
rows() ==
n);
44 BOOST_CHECK(bounds.
cols() ==
n);
50 BOOST_CHECK(!lb.isApprox(bounds.
lowerBound()));
55 BOOST_CHECK(!ub.isApprox(bounds.
upperBound()));
62 using namespace Eigen;
65 const unsigned int n = 5;
66 const unsigned int m = 2;
68 MatrixXd
A = MatrixXd::Ones(m, n);
72 BOOST_CHECK(!equality.
isBound());
76 BOOST_CHECK(equality.
rows() ==
m);
77 BOOST_CHECK(equality.
cols() ==
n);
79 BOOST_CHECK(A.isApprox(equality.
matrix()));
80 BOOST_CHECK(b.isApprox(equality.
vector()));
83 BOOST_CHECK(!b.isApprox(equality.
vector()));
85 BOOST_CHECK(b.isApprox(equality.
vector()));
88 BOOST_CHECK(!A.isApprox(equality.
matrix()));
90 BOOST_CHECK(A.isApprox(equality.
matrix()));
95 using namespace Eigen;
98 const unsigned int n = 5;
99 const unsigned int m = 2;
101 MatrixXd
A = MatrixXd::Ones(m, n);
106 BOOST_CHECK(!inequality.
isBound());
110 BOOST_CHECK(inequality.
rows() ==
m);
111 BOOST_CHECK(inequality.
cols() ==
n);
113 BOOST_CHECK(A.isApprox(inequality.
matrix()));
114 BOOST_CHECK(lb.isApprox(inequality.
lowerBound()));
115 BOOST_CHECK(ub.isApprox(inequality.
upperBound()));
118 BOOST_CHECK(!lb.isApprox(inequality.
lowerBound()));
120 BOOST_CHECK(lb.isApprox(inequality.
lowerBound()));
123 BOOST_CHECK(!A.isApprox(inequality.
matrix()));
125 BOOST_CHECK(A.isApprox(inequality.
matrix()));
128 BOOST_AUTO_TEST_SUITE_END()
bool isInequality() const
const Vector & lowerBound() const
bool setLowerBound(ConstRefVector lb)
bool setUpperBound(ConstRefVector ub)
const Vector & vector() const
unsigned int rows() const
unsigned int cols() const
BOOST_AUTO_TEST_CASE(test_constraint_bounds)
virtual bool setMatrix(ConstRefMatrix A)
bool isInequality() const
unsigned int rows() const
const Vector & upperBound() const
unsigned int rows() const
const Vector & lowerBound() const
bool setVector(ConstRefVector b)
const Vector & upperBound() const
virtual const Matrix & matrix() const
bool setLowerBound(ConstRefVector lb)
unsigned int cols() const
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorXd
unsigned int cols() const
bool isInequality() const