Skip to content
Snippets Groups Projects
Commit 7c839d70 authored by oliver.sander_at_tu-dresden.de's avatar oliver.sander_at_tu-dresden.de
Browse files

Merge branch 'improve-finding-ipopt' into 'master'

Minor fixes for finding IPOpt

See merge request !80
parents 3c7573d3 9b38d66a
No related branches found
No related tags found
1 merge request!80Minor fixes for finding IPOpt
Pipeline #65376 failed
...@@ -9,12 +9,12 @@ find_library(DL_LIBRARY dl) ...@@ -9,12 +9,12 @@ find_library(DL_LIBRARY dl)
find_path(IPOPT_INCLUDE_DIR find_path(IPOPT_INCLUDE_DIR
NAMES "IpNLP.hpp" NAMES "IpNLP.hpp"
PATHS ${IPOPT_ROOT} PATHS ${IPOPT_ROOT}
PATH_SUFFIXES "include" "include/coin" PATH_SUFFIXES "include" "include/coin" "include/coin-or"
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
find_path(IPOPT_INCLUDE_DIR find_path(IPOPT_INCLUDE_DIR
NAMES "IpNLP.hpp" NAMES "IpNLP.hpp"
PATH_SUFFIXES "include" "include/coin" PATH_SUFFIXES "include" "include/coin" "include/coin-or"
) )
find_library(IPOPT_LIBRARY find_library(IPOPT_LIBRARY
...@@ -40,7 +40,7 @@ find_library(HSL_LIBRARY ...@@ -40,7 +40,7 @@ find_library(HSL_LIBRARY
find_package_handle_standard_args(hsl DEFAULT_MSG 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(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) if(IPOPT_FOUND)
set(HAVE_IPOPT ENABLE_IPOPT) set(HAVE_IPOPT ENABLE_IPOPT)
......
...@@ -813,10 +813,24 @@ void QuadraticIPOptSolver<MatrixType,VectorType,JacobianType>::solve() ...@@ -813,10 +813,24 @@ void QuadraticIPOptSolver<MatrixType,VectorType,JacobianType>::solve()
if (status == Ipopt::Solved_To_Acceptable_Level) if (status == Ipopt::Solved_To_Acceptable_Level)
std::cout<<"WARNING: Desired tolerance could not be reached, but still acceptable tolerance is reached.\n"; 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) { else if (status == Ipopt::Search_Direction_Becomes_Too_Small) {
std::array<Ipopt::Number,4> inf; Ipopt::Number dual_inf; // dual infeasibility (Gradient of Lagrangian not zero)
app->Statistics()->Infeasibilities(inf[0],inf[1],inf[2],inf[3]); Ipopt::Number constr_viol; // violation of constraints
if (inf[3]>std::max(1e-10,this->tolerance_)) #if IPOPT_VERSION_MAJOR>=3 && IPOPT_VERSION_MINOR>=14
DUNE_THROW(Dune::Exception,Dune::formatString("Problem could not be solved to acceptable accuracy %d",inf[3])); 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) } else if (status != Ipopt::Solve_Succeeded)
DUNE_THROW(Dune::Exception, "IPOpt: Error during optimization!"); DUNE_THROW(Dune::Exception, "IPOpt: Error during optimization!");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment