From 46217a0c6b89452fe3a5e83e200827e1857d4546 Mon Sep 17 00:00:00 2001 From: Charlie Vanaret Date: Tue, 5 Nov 2024 19:59:33 +0100 Subject: [PATCH] TrustRegionStrategy: when the subproblem solver fails, do not use the direction norm to decrease the radius --- .../globalization_mechanisms/TrustRegionStrategy.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/uno/ingredients/globalization_mechanisms/TrustRegionStrategy.cpp b/uno/ingredients/globalization_mechanisms/TrustRegionStrategy.cpp index e3f8f672..edae17a8 100644 --- a/uno/ingredients/globalization_mechanisms/TrustRegionStrategy.cpp +++ b/uno/ingredients/globalization_mechanisms/TrustRegionStrategy.cpp @@ -46,6 +46,7 @@ namespace uno { size_t number_iterations = 0; bool termination = false; while (not termination) { + bool is_acceptable = false; try { number_iterations++; DEBUG << "\n\t### Trust-region inner iteration " << number_iterations << " with radius " << this->radius << "\n\n"; @@ -69,7 +70,7 @@ namespace uno { this->set_statistics(statistics, this->direction); statistics.set("status", "solver error"); if (Logger::level == INFO) statistics.print_current_line(); - this->decrease_radius(this->direction.norm); + this->decrease_radius(); warmstart_information.set_cold_start(); } else { @@ -77,7 +78,7 @@ namespace uno { GlobalizationMechanism::assemble_trial_iterate(model, current_iterate, trial_iterate, this->direction, 1., 1.); this->reset_active_trust_region_multipliers(model, this->direction, trial_iterate); - const bool is_acceptable = this->is_iterate_acceptable(statistics, current_iterate, trial_iterate, this->direction); + is_acceptable = this->is_iterate_acceptable(statistics, current_iterate, trial_iterate, this->direction); if (is_acceptable) { this->constraint_relaxation_strategy.set_dual_residuals_statistics(statistics, trial_iterate); this->reset_radius(); @@ -98,6 +99,9 @@ namespace uno { this->decrease_radius(); warmstart_information.set_cold_start(); } + if (not is_acceptable && this->radius < this->minimum_radius) { + throw std::runtime_error("Small trust-region radius"); + } } }