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

IPOpt: Name the arguments of Statistics()->Infeasibilites

This makes the code slightly longer, but also easier to understand.
parent cb4bb28d
No related branches found
No related tags found
1 merge request!80Minor fixes for finding IPOpt
......@@ -813,10 +813,18 @@ 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
Ipopt::Number complementarity; // violation of complementarity
Ipopt::Number kkt_error; // KKT error
app->Statistics()->Infeasibilities(dual_inf,
constr_viol,
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!");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment