From 3770dc09c8cce5abb29727f3f379a7379c768f1e Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Fri, 7 Mar 2008 14:33:29 +0000 Subject: [PATCH] accept also solutions if IPOpt returns only Ipopt::Solved_To_Acceptable_Level [[Imported from SVN: r2045]] --- src/averageinterface.hh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/averageinterface.hh b/src/averageinterface.hh index 1c80de6a..bc4e2b8c 100644 --- a/src/averageinterface.hh +++ b/src/averageinterface.hh @@ -34,7 +34,7 @@ public: const Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> >* massMatrix, const Dune::BlockVector<Dune::FieldVector<double,1> >* nodalWeights, const Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> >* constraintJacobian) - : jacobianCutoff_(-1), patch_(patch), x_(result), + : jacobianCutoff_(1e-12), patch_(patch), x_(result), massMatrix_(massMatrix), nodalWeights_(nodalWeights), constraintJacobian_(constraintJacobian), resultantForce_(resultantForce), resultantTorque_(resultantTorque) @@ -543,8 +543,8 @@ void computeAveragePressureIPOpt(const Dune::FieldVector<double,GridType::dimens Ipopt::SmartPtr<Ipopt::IpoptApplication> app = new Ipopt::IpoptApplication(); // Change some options - app->Options()->SetNumericValue("tol", 1e-10); - app->Options()->SetIntegerValue("max_iter", 20); + app->Options()->SetNumericValue("tol", 1e-8); + app->Options()->SetIntegerValue("max_iter", 1000); app->Options()->SetStringValue("mu_strategy", "adaptive"); app->Options()->SetStringValue("output_file", "ipopt.out"); app->Options()->SetStringValue("hessian_approximation", "limited-memory"); @@ -553,7 +553,7 @@ void computeAveragePressureIPOpt(const Dune::FieldVector<double,GridType::dimens // Intialize the IpoptApplication and process the options Ipopt::ApplicationReturnStatus status; status = app->Initialize(); - if (status != Ipopt::Solve_Succeeded) + if (status != Ipopt::Solve_Succeeded) DUNE_THROW(SolverError, "Error during IPOpt initialization!"); // Ask Ipopt to solve the problem @@ -567,7 +567,8 @@ void computeAveragePressureIPOpt(const Dune::FieldVector<double,GridType::dimens &constraints); status = app->OptimizeTNLP(defectSolverSmart); - if (status != Ipopt::Solve_Succeeded) + if (status != Ipopt::Solve_Succeeded + && status != Ipopt::Solved_To_Acceptable_Level) DUNE_THROW(SolverError, "Solving the defect problem failed!"); // ////////////////////////////////////////////////////////////////////////////// -- GitLab