diff --git a/cmake/modules/FindIPOpt.cmake b/cmake/modules/FindIPOpt.cmake index 69842aa4ca32cdd65fcb2f2c36ecaa4fdf57d309..f60182943d557a7e56e9a75815339956d46a87a8 100644 --- a/cmake/modules/FindIPOpt.cmake +++ b/cmake/modules/FindIPOpt.cmake @@ -9,12 +9,12 @@ find_library(DL_LIBRARY dl) find_path(IPOPT_INCLUDE_DIR NAMES "IpNLP.hpp" PATHS ${IPOPT_ROOT} - PATH_SUFFIXES "include" "include/coin" + PATH_SUFFIXES "include" "include/coin" "include/coin-or" NO_DEFAULT_PATH ) find_path(IPOPT_INCLUDE_DIR NAMES "IpNLP.hpp" - PATH_SUFFIXES "include" "include/coin" + PATH_SUFFIXES "include" "include/coin" "include/coin-or" ) find_library(IPOPT_LIBRARY @@ -40,7 +40,7 @@ find_library(HSL_LIBRARY find_package_handle_standard_args(hsl DEFAULT_MSG HSL_LIBRARY) find_package_handle_standard_args(dl DEFAULT_MSG DL_LIBRARY) -find_package_handle_standard_args(Ipopt DEFAULT_MSG IPOPT_INCLUDE_DIR IPOPT_LIBRARY) +find_package_handle_standard_args(IPOpt DEFAULT_MSG IPOPT_INCLUDE_DIR IPOPT_LIBRARY) if(IPOPT_FOUND) set(HAVE_IPOPT ENABLE_IPOPT) diff --git a/dune/solvers/solvers/quadraticipopt.hh b/dune/solvers/solvers/quadraticipopt.hh index 65b695c1942d1b7a36c391b20af6bfbbf0a05b99..5b2171bbb10440066d72e46061c46b5cc1083e38 100644 --- a/dune/solvers/solvers/quadraticipopt.hh +++ b/dune/solvers/solvers/quadraticipopt.hh @@ -813,10 +813,24 @@ void QuadraticIPOptSolver<MatrixType,VectorType,JacobianType>::solve() if (status == Ipopt::Solved_To_Acceptable_Level) std::cout<<"WARNING: Desired tolerance could not be reached, but still acceptable tolerance is reached.\n"; else if (status == Ipopt::Search_Direction_Becomes_Too_Small) { - std::array<Ipopt::Number,4> inf; - app->Statistics()->Infeasibilities(inf[0],inf[1],inf[2],inf[3]); - if (inf[3]>std::max(1e-10,this->tolerance_)) - DUNE_THROW(Dune::Exception,Dune::formatString("Problem could not be solved to acceptable accuracy %d",inf[3])); + Ipopt::Number dual_inf; // dual infeasibility (Gradient of Lagrangian not zero) + Ipopt::Number constr_viol; // violation of constraints +#if IPOPT_VERSION_MAJOR>=3 && IPOPT_VERSION_MINOR>=14 + Ipopt::Number varbounds_viol; // violation of variable bounds +#endif + Ipopt::Number complementarity; // violation of complementarity + Ipopt::Number kkt_error; // KKT error + + app->Statistics()->Infeasibilities(dual_inf, + constr_viol, +#if IPOPT_VERSION_MAJOR>=3 && IPOPT_VERSION_MINOR>=14 + varbounds_viol, +#endif + complementarity, + kkt_error); + + if (kkt_error>std::max(1e-10,this->tolerance_)) + DUNE_THROW(Dune::Exception,Dune::formatString("Problem could not be solved to acceptable accuracy %d", kkt_error)); } else if (status != Ipopt::Solve_Succeeded) DUNE_THROW(Dune::Exception, "IPOpt: Error during optimization!");