1 #include "gmock/gmock.h" 2 #include "gtest/gtest.h" 4 #include "../third-party/Goldfarb_Optimizer/QuadProg++.hh" 7 TEST(Goldfarb_Optimizer, Goldfarb_opt_test) {
18 GMatr<double> G(2, 2);
28 GMatr<double> CE(0., 2, 1);
34 GMatr<double> CI(0., 2, 4);
47 double f = solve_quadprog(G, g0, CE, ce0, CI, ci0, x);
49 printf(
"cost: %f\n", f);
50 printf(
"solution: %6.3f, %6.3f\n", x[0], x[1]);
52 EXPECT_TRUE(
fpEqual(x[0], .3, .0001));
53 EXPECT_TRUE(
fpEqual(x[1], .7, .0001));
bool fpEqual(T a, T b, T tol)
TEST(Goldfarb_Optimizer, Goldfarb_opt_test)
MX f(const MX &x, const MX &u)