| 63 | } |
| 64 | |
| 65 | void HomogeneousEqualityConstrainedModel::evaluate_constraints(const Vector<double>& x, Vector<double>& constraints) const { |
| 66 | this->model.evaluate_constraints(x, constraints); |
| 67 | // inequality constraints: add the slacks |
| 68 | for (const auto [constraint_index, slack_index]: this->get_slacks()) { |
| 69 | constraints[constraint_index] -= x[slack_index]; |
| 70 | } |
| 71 | |
| 72 | // equality constraints: make sure they are homogeneous (c(x) = 0) |
| 73 | for (const size_t constraint_index: this->model.get_equality_constraints()) { |
| 74 | const double fixed_bound = this->model.get_constraints_lower_bounds()[constraint_index]; |
| 75 | constraints[constraint_index] -= fixed_bound; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | void HomogeneousEqualityConstrainedModel::evaluate_objective_gradient(const Vector<double>& x, Vector<double>& gradient) const { |
| 80 | this->model.evaluate_objective_gradient(x, gradient); |
nothing calls this directly
no outgoing calls
no test coverage detected