Skip to content

Commit

Permalink
TR strategy: properly reset the duals AND the feasibility duals if TR…
Browse files Browse the repository at this point in the history
… constraints are active
  • Loading branch information
cvanaret committed Nov 11, 2024
1 parent 7831b52 commit 372ad25
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions uno/ingredients/globalization_mechanisms/TrustRegionStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ namespace uno {

void TrustRegionStrategy::reset_active_trust_region_multipliers(const Model& model, const Direction& direction, Iterate& trial_iterate) const {
assert(0 < this->radius && "The trust-region radius should be positive");
// set multipliers for bound constraints active at trust region to 0 (except if one of the original bounds is active)
for (size_t variable_index: direction.active_bounds.at_lower_bound) {
if (variable_index < model.number_variables && std::abs(direction.primals[variable_index] + this->radius) <= this->activity_tolerance &&
this->activity_tolerance < std::abs(trial_iterate.primals[variable_index] - model.variable_lower_bound(variable_index))) {
// reset multipliers for bound constraints active at trust region (except if one of the original bounds is active)
for (size_t variable_index: Range(model.number_variables)) {
if (std::abs(direction.primals[variable_index] + this->radius) <= this->activity_tolerance &&
this->activity_tolerance < std::abs(trial_iterate.primals[variable_index] - model.variable_lower_bound(variable_index))) {
trial_iterate.multipliers.lower_bounds[variable_index] = 0.;
trial_iterate.feasibility_multipliers.lower_bounds[variable_index] = 0.;
}
}
for (size_t variable_index: direction.active_bounds.at_upper_bound) {
if (variable_index < model.number_variables && std::abs(direction.primals[variable_index] - this->radius) <= this->activity_tolerance &&
this->activity_tolerance < std::abs(model.variable_upper_bound(variable_index) - trial_iterate.primals[variable_index])) {
if (std::abs(direction.primals[variable_index] - this->radius) <= this->activity_tolerance &&
this->activity_tolerance < std::abs(model.variable_upper_bound(variable_index) - trial_iterate.primals[variable_index])) {
trial_iterate.multipliers.upper_bounds[variable_index] = 0.;
trial_iterate.feasibility_multipliers.upper_bounds[variable_index] = 0.;
}
}
}
Expand Down

0 comments on commit 372ad25

Please sign in to comment.