From 0ec7feb2d971eea8464e5436681000320351f6f3 Mon Sep 17 00:00:00 2001 From: Davis King Date: Thu, 2 Dec 2010 03:26:27 +0000 Subject: [PATCH] Made the rosen test a little more reasonable. --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403930 --- dlib/test/trust_region.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dlib/test/trust_region.cpp b/dlib/test/trust_region.cpp index a29eab766..c67fbe905 100644 --- a/dlib/test/trust_region.cpp +++ b/dlib/test/trust_region.cpp @@ -63,16 +63,16 @@ namespace matrix p = 100*matrix_cast(randm(2,1,rnd)) - 50; - T obj = find_min_trust_region(objective_delta_stop_strategy(0, 100), rosen_function_model(), p); + T obj = find_min_trust_region(objective_delta_stop_strategy(1e-12, 100), rosen_function_model(), p); - DLIB_TEST_MSG(obj == 0, "obj: " << obj); - DLIB_TEST_MSG(length(p-ans) == 0, "length(p): " << length(p-ans)); + DLIB_TEST_MSG(std::abs(obj) < 1e-10, "obj: " << obj); + DLIB_TEST_MSG(length(p-ans) < 1e-10, "length(p): " << length(p-ans)); matrix p2 = 100*matrix_cast(randm(2,1,rnd)) - 50; - obj = find_max_trust_region(objective_delta_stop_strategy(0, 100), neg_rosen_model(), p2); + obj = find_max_trust_region(objective_delta_stop_strategy(1e-12, 100), neg_rosen_model(), p2); - DLIB_TEST_MSG(obj == 0, "obj: " << obj); - DLIB_TEST_MSG(length(p2-ans) == 0, "length(p2): " << length(p2-ans)); + DLIB_TEST_MSG(std::abs(obj) < 1e-10, "obj: " << obj); + DLIB_TEST_MSG(length(p-ans) < 1e-10, "length(p): " << length(p-ans)); } // ----------------------------------------------------------------------------------------