diff --git a/src/cpp/benders/factories/BendersFactory.cpp b/src/cpp/benders/factories/BendersFactory.cpp index f636e9d99..8247df49d 100644 --- a/src/cpp/benders/factories/BendersFactory.cpp +++ b/src/cpp/benders/factories/BendersFactory.cpp @@ -16,27 +16,18 @@ BENDERSMETHOD DeduceBendersMethod(size_t coupling_map_size, size_t batch_size, bool external_loop) { - /* - classical benders: 0*100 + 0*10 = 0 - classical benders + external loop: 0*100 + 1*10 = 10 - benders by batch: 1*100 + 0*10 = 100 - benders by batch + external loop: 1*100 + 1*10 = 110 - */ - - auto benders_algo_score = - (batch_size == 0 || batch_size == coupling_map_size - 1) ? 0 : 1; - auto external_loop_score = external_loop ? 1 : 0; - auto total_score = 100 * benders_algo_score + 10 * external_loop_score; - switch (total_score) { - case 0: - default: - return BENDERSMETHOD::BENDERS; - case 10: + if (batch_size == 0 || batch_size == coupling_map_size - 1) { + if (external_loop) { return BENDERSMETHOD::BENDERS_EXTERNAL_LOOP; - case 100: - return BENDERSMETHOD::BENDERS_BY_BATCH; - case 110: + } else { + return BENDERSMETHOD::BENDERS; + } + } else { + if (external_loop) { return BENDERSMETHOD::BENDERS_BY_BATCH_EXTERNAL_LOOP; + } else { + return BENDERSMETHOD::BENDERS_BY_BATCH; + } } }