Skip to content

Commit

Permalink
SymmetricIndefiniteLinearSystem: perform the analysis only when the p…
Browse files Browse the repository at this point in the history
…roblem has changed
  • Loading branch information
cvanaret committed Dec 3, 2024
1 parent 97cf3db commit 7cb8e6a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,26 +124,6 @@ namespace uno {

void PrimalDualInteriorPointSubproblem::evaluate_functions(Statistics& statistics, const OptimizationProblem& problem, Iterate& current_iterate,
const Multipliers& current_multipliers, const WarmstartInformation& warmstart_information) {
// barrier Lagrangian Hessian
if (warmstart_information.objective_changed || warmstart_information.constraints_changed) {
// original Lagrangian Hessian
this->hessian_model->evaluate(statistics, problem, current_iterate.primals, current_multipliers.constraints);

// diagonal barrier terms (grouped by variable)
for (size_t variable_index: Range(problem.number_variables)) {
double diagonal_barrier_term = 0.;
if (is_finite(problem.variable_lower_bound(variable_index))) { // lower bounded
const double distance_to_bound = current_iterate.primals[variable_index] - problem.variable_lower_bound(variable_index);
diagonal_barrier_term += current_multipliers.lower_bounds[variable_index] / distance_to_bound;
}
if (is_finite(problem.variable_upper_bound(variable_index))) { // upper bounded
const double distance_to_bound = current_iterate.primals[variable_index] - problem.variable_upper_bound(variable_index);
diagonal_barrier_term += current_multipliers.upper_bounds[variable_index] / distance_to_bound;
}
this->hessian_model->hessian.insert(diagonal_barrier_term, variable_index, variable_index);
}
}

// barrier objective gradient
if (warmstart_information.objective_changed) {
// original objective gradient
Expand Down Expand Up @@ -175,6 +155,26 @@ namespace uno {
problem.evaluate_constraints(current_iterate, this->constraints);
problem.evaluate_constraint_jacobian(current_iterate, this->constraint_jacobian);
}

// barrier Lagrangian Hessian
if (warmstart_information.objective_changed || warmstart_information.constraints_changed) {
// original Lagrangian Hessian
this->hessian_model->evaluate(statistics, problem, current_iterate.primals, current_multipliers.constraints);

// diagonal barrier terms (grouped by variable)
for (size_t variable_index: Range(problem.number_variables)) {
double diagonal_barrier_term = 0.;
if (is_finite(problem.variable_lower_bound(variable_index))) { // lower bounded
const double distance_to_bound = current_iterate.primals[variable_index] - problem.variable_lower_bound(variable_index);
diagonal_barrier_term += current_multipliers.lower_bounds[variable_index] / distance_to_bound;
}
if (is_finite(problem.variable_upper_bound(variable_index))) { // upper bounded
const double distance_to_bound = current_iterate.primals[variable_index] - problem.variable_upper_bound(variable_index);
diagonal_barrier_term += current_multipliers.upper_bounds[variable_index] / distance_to_bound;
}
this->hessian_model->hessian.insert(diagonal_barrier_term, variable_index, variable_index);
}
}
}

void PrimalDualInteriorPointSubproblem::solve(Statistics& statistics, const OptimizationProblem& problem, Iterate& current_iterate,
Expand Down
4 changes: 2 additions & 2 deletions uno/solvers/MUMPS/MUMPSSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ namespace uno {
this->mumps_structure.icntl[1] = -1;
this->mumps_structure.icntl[2] = -1;
this->mumps_structure.icntl[3] = 0;
this->mumps_structure.icntl[5] = 0; // no scaling
this->mumps_structure.icntl[7] = 0; // no scaling
//this->mumps_structure.icntl[5] = 0; // no scaling
//this->mumps_structure.icntl[7] = 0; // no scaling

this->mumps_structure.icntl[12] = 1;
this->mumps_structure.icntl[23] = 1; // ICNTL(24) controls the detection of “null pivot rows”
Expand Down

0 comments on commit 7cb8e6a

Please sign in to comment.