From fbf6a7c130f45f2f94ad2d4e3a5f1bd1a543b274 Mon Sep 17 00:00:00 2001 From: Charlie Vanaret Date: Sat, 7 Dec 2024 18:07:33 +0100 Subject: [PATCH] Fixed the warmstarted computation of the constraint bounds in QP/LP solvers --- uno/solvers/BQPD/BQPDSolver.cpp | 8 ++++---- uno/solvers/HiGHS/HiGHSSolver.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/uno/solvers/BQPD/BQPDSolver.cpp b/uno/solvers/BQPD/BQPDSolver.cpp index 17c66e9b..734777f6 100644 --- a/uno/solvers/BQPD/BQPDSolver.cpp +++ b/uno/solvers/BQPD/BQPDSolver.cpp @@ -112,12 +112,12 @@ namespace uno { problem.evaluate_constraint_jacobian(current_iterate, this->constraint_jacobian); } - // build Jacobian (objective and constraints) + // Jacobian (objective and constraints) if (warmstart_information.objective_changed || warmstart_information.constraints_changed) { this->save_gradients_to_local_format(problem.number_constraints); } - // set variable bounds + // variable bounds if (warmstart_information.variable_bounds_changed) { // bounds of original variables intersected with trust region for (size_t variable_index: Range(problem.get_number_original_variables())) { @@ -133,8 +133,8 @@ namespace uno { } } - // set constraint bounds - if (warmstart_information.constraint_bounds_changed) { + // constraint bounds + if (warmstart_information.constraint_bounds_changed || warmstart_information.constraints_changed) { for (size_t constraint_index: Range(problem.number_constraints)) { this->lower_bounds[problem.number_variables + constraint_index] = problem.constraint_lower_bound(constraint_index) - this->constraints[constraint_index]; diff --git a/uno/solvers/HiGHS/HiGHSSolver.cpp b/uno/solvers/HiGHS/HiGHSSolver.cpp index 04d13788..c9c6ca62 100644 --- a/uno/solvers/HiGHS/HiGHSSolver.cpp +++ b/uno/solvers/HiGHS/HiGHSSolver.cpp @@ -106,7 +106,7 @@ namespace uno { } // constraint bounds - if (warmstart_information.constraint_bounds_changed) { + if (warmstart_information.constraint_bounds_changed || warmstart_information.constraints_changed) { for (size_t constraint_index: Range(problem.number_constraints)) { this->model.lp_.row_lower_[constraint_index] = problem.constraint_lower_bound(constraint_index) - this->constraints[constraint_index]; this->model.lp_.row_upper_[constraint_index] = problem.constraint_upper_bound(constraint_index) - this->constraints[constraint_index];