MCPcopy Create free account
hub / github.com/davisking/dlib / test_qp4_test4

Function test_qp4_test4

dlib/test/opt_qp_solver.cpp:243–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241// ----------------------------------------------------------------------------------------
242
243 void test_qp4_test4()
244 {
245 matrix<double> A(3,2);
246 A = 1,2,
247 3,1,
248 6,7;
249
250 matrix<double,0,1> b(2);
251 b = 1,
252 2;
253
254 const double C = 2;
255
256 matrix<double,0,1> alpha(2), d(3), lambda;
257 alpha = C/2, C/2;
258
259 solve_qp4_using_smo(A, tmp(trans(A)*A), b, d, alpha, lambda, 1e-9, 800);
260 matrix<double,0,1> w = lowerbound(-A*alpha, 0);
261
262 dlog << LINFO << "*******************************************************";
263
264 dlog << LINFO << "w: " << trans(w);
265
266 const double computed_obj = compute_objective_value(w,A,b,C);
267 w = 0, 0, 0;
268 const double true_obj = compute_objective_value(w,A,b,C);
269 dlog << LINFO << "computed obj: "<< computed_obj;
270 dlog << LINFO << "with true w obj: "<< true_obj;
271
272 DLIB_TEST_MSG(abs(computed_obj - true_obj) < 1e-8, abs(computed_obj - true_obj));
273 }
274
275 void test_qp4_test6()
276 {

Callers 1

test_solve_qp4_using_smoFunction · 0.85

Calls 6

solve_qp4_using_smoFunction · 0.85
tmpFunction · 0.85
lowerboundFunction · 0.85
compute_objective_valueFunction · 0.85
absFunction · 0.85
transFunction · 0.50

Tested by

no test coverage detected