Skip to content

Commit

Permalink
implement bab get_var_reduced_cost
Browse files Browse the repository at this point in the history
  • Loading branch information
hlefebvr committed Nov 29, 2024
1 parent 21fd882 commit ea6dd2c
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -213,7 +213,10 @@ void idol::Optimizers::BranchAndBound<NodeInfoT>::detect_integer_objective() {

template<class NodeInfoT>
double idol::Optimizers::BranchAndBound<NodeInfoT>::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<class NodeInfoT>
Expand Down Expand Up @@ -250,7 +253,7 @@ unsigned int idol::Optimizers::BranchAndBound<NodeInfoT>::get_solution_index() c

template<class NodeInfoT>
unsigned int idol::Optimizers::BranchAndBound<NodeInfoT>::get_n_solutions() const {
return !!m_incumbent;
return m_incumbent;
}

template<class NodeInfoT>
Expand Down

0 comments on commit ea6dd2c

Please sign in to comment.