Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cvanaret committed Dec 7, 2024
1 parent 1559eff commit 82e44e7
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ namespace uno {
// barrier terms
for (size_t variable_index: Range(this->problem.number_variables)) {
double barrier_term = 0.;
if (is_finite(problem.variable_lower_bound(variable_index))) { // lower bounded
barrier_term += -this->barrier_parameter / (iterate.primals[variable_index] - problem.variable_lower_bound(variable_index));
if (is_finite(this->problem.variable_lower_bound(variable_index))) { // lower bounded
barrier_term += -this->barrier_parameter / (iterate.primals[variable_index] - this->problem.variable_lower_bound(variable_index));
// damping
if (not is_finite(problem.variable_upper_bound(variable_index))) {
if (not is_finite(this->problem.variable_upper_bound(variable_index))) {
barrier_term += this->damping_factor * this->barrier_parameter;
}
}
if (is_finite(problem.variable_upper_bound(variable_index))) { // upper bounded
barrier_term += -this->barrier_parameter / (iterate.primals[variable_index] - problem.variable_upper_bound(variable_index));
if (is_finite(this->problem.variable_upper_bound(variable_index))) { // upper bounded
barrier_term += -this->barrier_parameter / (iterate.primals[variable_index] - this->problem.variable_upper_bound(variable_index));
// damping
if (not is_finite(problem.variable_lower_bound(variable_index))) {
if (not is_finite(this->problem.variable_lower_bound(variable_index))) {
barrier_term -= this->damping_factor * this->barrier_parameter;
}
}
Expand All @@ -41,11 +41,11 @@ namespace uno {
}

void PrimalDualInteriorPointProblem::evaluate_constraints(Iterate& iterate, std::vector<double>& constraints) const {
problem.evaluate_constraints(iterate, constraints);
this->problem.evaluate_constraints(iterate, constraints);
}

void PrimalDualInteriorPointProblem::evaluate_constraint_jacobian(Iterate& iterate, RectangularMatrix<double>& constraint_jacobian) const {
problem.evaluate_constraint_jacobian(iterate, constraint_jacobian);
this->problem.evaluate_constraint_jacobian(iterate, constraint_jacobian);
}

void PrimalDualInteriorPointProblem::evaluate_lagrangian_hessian(const Vector<double>& x, const Vector<double>& multipliers,
Expand All @@ -57,11 +57,11 @@ namespace uno {
for (size_t variable_index: Range(this->problem.number_variables)) {
double diagonal_barrier_term = 0.;
if (is_finite(this->problem.variable_lower_bound(variable_index))) { // lower bounded
const double distance_to_bound = x[variable_index] - problem.variable_lower_bound(variable_index);
const double distance_to_bound = x[variable_index] - this->problem.variable_lower_bound(variable_index);
diagonal_barrier_term += this->current_multipliers.lower_bounds[variable_index] / distance_to_bound;
}
if (is_finite(this->problem.variable_upper_bound(variable_index))) { // upper bounded
const double distance_to_bound = x[variable_index] - problem.variable_upper_bound(variable_index);
const double distance_to_bound = x[variable_index] - this->problem.variable_upper_bound(variable_index);
diagonal_barrier_term += this->current_multipliers.upper_bounds[variable_index] / distance_to_bound;
}
hessian.insert(diagonal_barrier_term, variable_index, variable_index);
Expand Down Expand Up @@ -133,17 +133,17 @@ namespace uno {
// barrier terms
for (size_t variable_index: Range(this->problem.number_variables)) {
double barrier_term = 0.;
if (is_finite(problem.variable_lower_bound(variable_index))) { // lower bounded
barrier_term += -this->barrier_parameter / (iterate.primals[variable_index] - problem.variable_lower_bound(variable_index));
if (is_finite(this->problem.variable_lower_bound(variable_index))) { // lower bounded
barrier_term += -this->barrier_parameter / (iterate.primals[variable_index] - this->problem.variable_lower_bound(variable_index));
// damping
if (not is_finite(problem.variable_upper_bound(variable_index))) {
if (not is_finite(this->problem.variable_upper_bound(variable_index))) {
barrier_term += this->damping_factor * this->barrier_parameter;
}
}
if (is_finite(problem.variable_upper_bound(variable_index))) { // upper bounded
barrier_term += -this->barrier_parameter / (iterate.primals[variable_index] - problem.variable_upper_bound(variable_index));
if (is_finite(this->problem.variable_upper_bound(variable_index))) { // upper bounded
barrier_term += -this->barrier_parameter / (iterate.primals[variable_index] - this->problem.variable_upper_bound(variable_index));
// damping
if (not is_finite(problem.variable_lower_bound(variable_index))) {
if (not is_finite(this->problem.variable_lower_bound(variable_index))) {
barrier_term -= this->damping_factor * this->barrier_parameter;
}
}
Expand Down

0 comments on commit 82e44e7

Please sign in to comment.