diff --git a/src/cpp/benders/benders_core/BendersBase.cpp b/src/cpp/benders/benders_core/BendersBase.cpp index 0b01db04e..4a3067d12 100644 --- a/src/cpp/benders/benders_core/BendersBase.cpp +++ b/src/cpp/benders/benders_core/BendersBase.cpp @@ -1028,6 +1028,7 @@ void BendersBase::init_data(double external_loop_lambda, bool BendersBase::isExceptionRaised() const { return exception_raised_; } + /* * after the 1st loop of the outer loop, we must re-build the objective * function and costs @@ -1041,6 +1042,7 @@ void BendersBase::UpdateOverallCosts() { relevantIterationData_.best._invest_cost = _data.invest_cost; } + void BendersBase::SetBilevelBestub(double bilevel_best_ub) { _data.outer_loop_current_iteration_data.outer_loop_bilevel_best_ub = bilevel_best_ub; diff --git a/src/cpp/benders/factories/BendersFactory.cpp b/src/cpp/benders/factories/BendersFactory.cpp index 7b3cededf..bdf62d07f 100644 --- a/src/cpp/benders/factories/BendersFactory.cpp +++ b/src/cpp/benders/factories/BendersFactory.cpp @@ -102,9 +102,11 @@ pBendersBase BendersMainFactory::PrepareForExecution(bool external_loop) { writer_->write_log_level(options_.LOG_LEVEL); writer_->write_master_name(options_.MASTER_NAME); writer_->write_solver_name(options_.SOLVER_NAME); - benders->setCriterionComputationInputs( - std::get( - criterion_input_holder_)); + benders->setCriterionComputationInputs(std::visit( + [](auto&& the_variant) { + return (Benders::Criterion::CriterionInputData)the_variant; + }, + criterion_input_holder_)); return benders; } @@ -132,15 +134,16 @@ void BendersMainFactory::AddCriterionOutput( std::shared_ptr math_log_driver) { const std::filesystem::path output_root(options_.OUTPUTROOT); - const auto& criterion_input_data = - std::get(criterion_input_holder_); - - const auto& headers = criterion_input_data.PatternBodies(); + const auto& headers = + std::visit([](auto&& the_variant) { return the_variant.PatternBodies(); }, + criterion_input_holder_); math_log_driver->add_logger( output_root / LOLD_FILE, headers, &OuterLoopCurrentIterationData::outer_loop_criterion); - positive_unsupplied_file_ = criterion_input_data.PatternsPrefix() + ".txt"; + positive_unsupplied_file_ = std::visit( + [](auto&& the_variant) { return the_variant.PatternsPrefix(); }, + criterion_input_holder_); math_log_driver->add_logger( output_root / positive_unsupplied_file_, headers, &OuterLoopCurrentIterationData::outer_loop_patterns_values);