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

Function test_box_constrained_optimizers

dlib/test/optimization.cpp:1144–1177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1142
1143 template <typename search_strategy_type>
1144 void test_box_constrained_optimizers(search_strategy_type search_strategy)
1145 {
1146 dlib::rand rnd;
1147 running_stats<double> rs;
1148
1149 dlog << LINFO << "test find_min_box_constrained() on rosen";
1150 for (int i = 0; i < 10000; ++i)
1151 rs.add(test_bound_solver_rosen(rnd, search_strategy));
1152 dlog << LINFO << "mean rosen gradient: " << rs.mean();
1153 dlog << LINFO << "max rosen gradient: " << rs.max();
1154 DLIB_TEST(rs.mean() < 1e-12);
1155 DLIB_TEST(rs.max() < 1e-9);
1156
1157 dlog << LINFO << "test find_min_box_constrained() on brown";
1158 rs.clear();
1159 for (int i = 0; i < 1000; ++i)
1160 rs.add(test_bound_solver_brown(rnd, search_strategy));
1161 dlog << LINFO << "mean brown gradient: " << rs.mean();
1162 dlog << LINFO << "max brown gradient: " << rs.max();
1163 dlog << LINFO << "min brown gradient: " << rs.min();
1164 DLIB_TEST(rs.mean() < 4e-5);
1165 DLIB_TEST_MSG(rs.max() < 3e-2, rs.max());
1166 DLIB_TEST(rs.min() < 1e-10);
1167
1168 dlog << LINFO << "test find_max_box_constrained() on neg_rosen";
1169 rs.clear();
1170 for (int i = 0; i < 1000; ++i)
1171 rs.add(test_bound_solver_neg_rosen(rnd, search_strategy));
1172 dlog << LINFO << "mean neg_rosen gradient: " << rs.mean();
1173 dlog << LINFO << "max neg_rosen gradient: " << rs.max();
1174 DLIB_TEST(rs.mean() < 1e-12);
1175 DLIB_TEST(rs.max() < 1e-9);
1176
1177 }
1178
1179 void test_poly_min_extract_2nd()
1180 {

Callers 1

perform_testMethod · 0.85

Calls 8

test_bound_solver_rosenFunction · 0.85
test_bound_solver_brownFunction · 0.85
addMethod · 0.45
meanMethod · 0.45
maxMethod · 0.45
clearMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected