Use range-based loop in ApplyConstraints.

parent cfbb76c3
Pipeline #11689 passed with stages
in 30 minutes and 43 seconds
......@@ -99,16 +99,17 @@ bool SolverBase::ApplyConstraints(
bool constraints_satisfied = true;
result.results.resize(constraints_.size());
auto result_iterator = result.results.begin();
for (size_t i = 0; i != constraints_.size(); ++i) {
Constraint& c = *constraints_[i];
for (const std::unique_ptr<Constraint>& c : constraints_) {
// PrepareIteration() might change Satisfied(), and since we always want
// to iterate at least once more when a constraint is not yet satisfied,
// we evaluate Satisfied() before preparing.
constraints_satisfied = c.Satisfied() && constraints_satisfied;
c.PrepareIteration(has_previously_converged, iteration,
iteration + 1 >= GetMaxIterations());
result.results[i] = c.Apply(next_solutions, time, stat_stream);
constraints_satisfied = c->Satisfied() && constraints_satisfied;
c->PrepareIteration(has_previously_converged, iteration,
iteration + 1 >= GetMaxIterations());
*result_iterator = c->Apply(next_solutions, time, stat_stream);
++result_iterator;
}
// If still not satisfied, at least iteration+1 constrained iterations
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment