Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handling of error cases in TrustRegionStrategy #73

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -69,15 +70,15 @@ 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 {
// take full primal-dual step
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();
Expand All @@ -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");
}
}
}

Expand Down
Loading