From aa99ac92f07aeab76583d6d3d02e2b90b9457699 Mon Sep 17 00:00:00 2001 From: Dave-Poissant Date: Wed, 6 Mar 2024 16:51:51 -0500 Subject: [PATCH] Fix test build of nlopt algo --- tests/nlopt.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/tests/nlopt.cpp b/tests/nlopt.cpp index 605baabf7..7aac48d31 100644 --- a/tests/nlopt.cpp +++ b/tests/nlopt.cpp @@ -381,34 +381,3 @@ BOOST_AUTO_TEST_CASE(nlopt_loc_opt) algo.evolve(pop); BOOST_CHECK(algo.extract()->get_last_opt_result() >= 0); } - -BOOST_AUTO_TEST_CASE(nlopt_initial_population_not_respecting_bounds_throw_test) -{ - // We test that the algorithm throws if the initial population does not respect the bounds - auto pop = population{hs71{}, 1}; - auto a = nlopt{"slsqp"}; - auto dv = pop.get_x()[0]; - dv[0] = prob.get_bounds().first[0] - 1.; - pop.set_x(0, dv); - BOOST_CHECK_THROW(nlopt.evolve(pop), std::invalid_argument); - - dv = pop.get_x()[0]; - dv[0] = prob.get_bounds().second[0] + 2.; - pop.set_x(0, dv); - BOOST_CHECK_THROW(nlopt.evolve(pop), std::invalid_argument); - - dv = pop.get_x()[0]; - dv[0] = std::numeric_limits::quiet_NaN(); - pop.set_x(0, dv); - BOOST_CHECK_THROW(nlopt.evolve(pop), std::invalid_argument); - - dv = pop.get_x()[0]; - dv[0] = std::numeric_limits::infinity(); - pop.set_x(0, dv); - BOOST_CHECK_THROW(nlopt.evolve(pop), std::invalid_argument); - - dv = pop.get_x()[0]; - dv[0] = prob.get_bounds().first[0] + prob.get_bounds().second[0] / 2.0; - pop.set_x(0, dv); - BOOST_CHECK_NO_THROW(nlopt.evolve(pop)); -}