From c5e156c6f27d046f590dc35114980e3f9c573ca6 Mon Sep 17 00:00:00 2001 From: Nai-Yuan Chiang Date: Fri, 13 Oct 2023 13:13:53 -0700 Subject: [PATCH] Fix the approach used to update mu (#664) * fix mu update * update example solutions * remove typo --- src/Drivers/MDS/NlpMdsEx1Driver.cpp | 2 +- src/Drivers/MDS/NlpMdsEx1RajaDriver.cpp | 2 +- src/Optimization/hiopAlgFilterIPM.cpp | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Drivers/MDS/NlpMdsEx1Driver.cpp b/src/Drivers/MDS/NlpMdsEx1Driver.cpp index d03499ce3..610dd1928 100644 --- a/src/Drivers/MDS/NlpMdsEx1Driver.cpp +++ b/src/Drivers/MDS/NlpMdsEx1Driver.cpp @@ -146,7 +146,7 @@ int main(int argc, char **argv) if(selfCheck) { // && has_empty_sp_row) { - if(fabs(obj_value-(-4.9994888159755632e+01))>1e-6) { + if(fabs(obj_value-(-4.9994906229741609e+01))>1e-6) { printf("selfcheck: objective mismatch for MDS Ex1 problem with 400 sparse variables and 100 " "dense variables did. BTW, obj=%18.12e was returned by HiOp.\n", obj_value); ret_code = -1; diff --git a/src/Drivers/MDS/NlpMdsEx1RajaDriver.cpp b/src/Drivers/MDS/NlpMdsEx1RajaDriver.cpp index 1ef86b651..05e90d9af 100644 --- a/src/Drivers/MDS/NlpMdsEx1RajaDriver.cpp +++ b/src/Drivers/MDS/NlpMdsEx1RajaDriver.cpp @@ -160,7 +160,7 @@ int main(int argc, char **argv) obj_value = solver.getObjective(); if(selfCheck && has_empty_sp_row) { - if(fabs(obj_value-(-4.9994888159755632e+01))>1e-6) { + if(fabs(obj_value-(-4.9994906229741609e+01))>1e-6) { printf("selfcheck: objective mismatch for MDS Ex1 problem with 400 sparse variables and 100 " "dense variables did. BTW, obj=%18.12e was returned by HiOp.\n", obj_value); return -1; diff --git a/src/Optimization/hiopAlgFilterIPM.cpp b/src/Optimization/hiopAlgFilterIPM.cpp index e0802cb6c..d3bbee0a8 100644 --- a/src/Optimization/hiopAlgFilterIPM.cpp +++ b/src/Optimization/hiopAlgFilterIPM.cpp @@ -547,7 +547,9 @@ bool hiopAlgFilterIPMBase::update_log_barrier_params(hiopIterate& it, double& mu_new, double& tau_new) { - double new_mu = fmax(eps_tol/10, fmin(kappa_mu*mu_curr, pow(mu_curr,theta_mu))); + const double target_comp_tol = comp_tol_/nlp->get_obj_scale(); + double new_mu = std::fmax(0.0, std::fmin(kappa_mu*mu_curr, std::pow(mu_curr,theta_mu))); + new_mu = std::fmax(new_mu, std::fmin(eps_tol, target_comp_tol)/(10.+1.) ); if(fabs(new_mu-mu_curr)<1e-16) { return false; } @@ -555,7 +557,7 @@ bool hiopAlgFilterIPMBase::update_log_barrier_params(hiopIterate& it, tau_new = fmax(tau_min,1.0-mu_new); if(elastic_mode_on) { - const double target_mu = nlp->options->GetNumeric("tolerance"); + const double target_mu = eps_tol; const double bound_relax_perturb_init = nlp->options->GetNumeric("elastic_mode_bound_relax_initial"); const double bound_relax_perturb_min = nlp->options->GetNumeric("elastic_mode_bound_relax_final"); double bound_relax_perturb = bound_relax_perturb_init;