diff --git a/lib/include/idol/mixed-integer/optimizers/branch-and-bound/Optimizers_BranchAndBound.h b/lib/include/idol/mixed-integer/optimizers/branch-and-bound/Optimizers_BranchAndBound.h index 5d2f6407..addc290e 100644 --- a/lib/include/idol/mixed-integer/optimizers/branch-and-bound/Optimizers_BranchAndBound.h +++ b/lib/include/idol/mixed-integer/optimizers/branch-and-bound/Optimizers_BranchAndBound.h @@ -146,7 +146,7 @@ class idol::Optimizers::BranchAndBound : public Algorithm { [[nodiscard]] double get_var_primal(const Var &t_var) const override; - double get_var_reduced_cost(const Var &t_var) const override; + [[nodiscard]] double get_var_reduced_cost(const Var &t_var) const override; [[nodiscard]] double get_var_ray(const Var &t_var) const override; @@ -213,7 +213,10 @@ void idol::Optimizers::BranchAndBound::detect_integer_objective() { template double idol::Optimizers::BranchAndBound::get_var_reduced_cost(const idol::Var &t_var) const { - throw Exception("Not implemented get_var_reduced_cost"); + if (m_n_solved_nodes > 1) { + throw Exception("Reduced cost not available."); + } + return m_relaxations.front()->get_var_reduced_cost(t_var); } template @@ -250,7 +253,7 @@ unsigned int idol::Optimizers::BranchAndBound::get_solution_index() c template unsigned int idol::Optimizers::BranchAndBound::get_n_solutions() const { - return !!m_incumbent; + return m_incumbent; } template