From 638c8a96fdb9f81db9a266aec4817d194cff7e39 Mon Sep 17 00:00:00 2001 From: Hongkai Dai Date: Wed, 8 Jan 2025 13:12:43 -0800 Subject: [PATCH] Relax the tolerance in IpoptSolver. Previously we set the tolerance to 1.05E-10, this tolerance is too tight and causing numeric problems. We switch back to IPOPT default tolerance. --- solvers/ipopt_solver.cc | 8 -------- solvers/test/ipopt_solver_test.cc | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/solvers/ipopt_solver.cc b/solvers/ipopt_solver.cc index 297c8387d611..b94d1e2181df 100644 --- a/solvers/ipopt_solver.cc +++ b/solvers/ipopt_solver.cc @@ -61,14 +61,6 @@ void SetAppOptions(const std::string& default_linear_solver, set_string_option("linear_solver", default_linear_solver); } - // The default tolerance. - const double tol = 1.05e-10; // Note: SNOPT is only 1e-6, but in #3712 we - // diagnosed that the CompareMatrices tolerance needed to be the sqrt of the - // constr_viol_tol - set_double_option("tol", tol); - set_double_option("constr_viol_tol", tol); - set_double_option("acceptable_tol", tol); - set_double_option("acceptable_constr_viol_tol", tol); set_string_option("hessian_approximation", "limited-memory"); // Any user-supplied options handled below will overwrite the above defaults. diff --git a/solvers/test/ipopt_solver_test.cc b/solvers/test/ipopt_solver_test.cc index 6518bc2553c7..a515c191ecbf 100644 --- a/solvers/test/ipopt_solver_test.cc +++ b/solvers/test/ipopt_solver_test.cc @@ -206,7 +206,7 @@ GTEST_TEST(IpoptSolverTest, AcceptableResult) { GTEST_TEST(IpoptSolverTest, QPDualSolution1) { IpoptSolver solver; ConfigureIpopt(&solver); - TestQPDualSolution1(solver, {} /* solver_options */, 1e-5); + TestQPDualSolution1(solver, {} /* solver_options */, /*tol=*/1e-4); } GTEST_TEST(IpoptSolverTest, QPDualSolution2) { @@ -273,7 +273,7 @@ GTEST_TEST(IpoptSolverTest, TestNonconvexQP) { IpoptSolver solver; ConfigureIpopt(&solver); if (solver.available()) { - TestNonconvexQP(solver, false); + TestNonconvexQP(solver, false, /*tol=*/1E-4); } }