Skip to content

Commit

Permalink
Merge branch 'main' of github.com:hlefebvr/idol
Browse files Browse the repository at this point in the history
  • Loading branch information
hlefebvr committed Oct 1, 2024
2 parents 1c7e362 + 1738042 commit 3b5f8c7
Showing 1 changed file with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ void idol::Optimizers::PADM::hook_optimize() {

++m_outer_loop_iteration;

if (is_terminated()) {
break;
}

check_outer_iteration_limit();
check_time_limit();
check_feasibility();
Expand Down Expand Up @@ -240,12 +244,12 @@ void idol::Optimizers::PADM::run_inner_loop() {

check_time_limit();

log_inner_loop(inner_loop_iteration);

if (is_terminated()) {
break;
}

log_inner_loop(inner_loop_iteration);

if (!has_changed) {
break;
}
Expand Down Expand Up @@ -281,9 +285,19 @@ bool idol::Optimizers::PADM::solve_sub_problem(unsigned int t_sub_problem_id) {
const auto status = model.get_status();

if (status != Optimal && status != Feasible) {

const auto& reason = model.get_reason();

Solution::Primal sub_problem_solution;
sub_problem_solution.set_status(status);
sub_problem_solution.set_reason(reason);
m_last_solutions[t_sub_problem_id] = std::move(sub_problem_solution);

set_status(status);
set_reason(NotSpecified);
set_reason(reason);

terminate();

return true;
}

Expand Down Expand Up @@ -321,12 +335,14 @@ void idol::Optimizers::PADM::log_inner_loop(unsigned int t_inner_loop_iteration)

const unsigned int n_sub_problems = m_formulation.n_sub_problems();

std::cout << std::setw(5) << m_inner_loop_iterations << '\t'
std::cout << std::setw(10) << std::fixed << std::setprecision(5) << time().count() << '\t'
<< std::setw(5) << m_inner_loop_iterations << '\t'
<< std::setw(5) << m_outer_loop_iteration << '\t'
<< std::setw(5) << t_inner_loop_iteration << '\t';

for (unsigned int i = 0 ; i < n_sub_problems ; ++i) {
std::cout << std::setw(20) << std::setprecision(12) << feasibility_measure(i) << '\t';
std::cout << std::setw(12) << m_last_solutions[i].status() << '\t';
std::cout << std::setw(12) << std::fixed << std::setprecision(3) << feasibility_measure(i) << '\t';
}

std::cout << std::endl;
Expand Down

0 comments on commit 3b5f8c7

Please sign in to comment.