From 913fe6d88575e9ea49556be749a2b204c48286dc Mon Sep 17 00:00:00 2001 From: Guilherme Coelho Date: Fri, 10 Nov 2023 07:54:00 -0300 Subject: [PATCH] Node value is set only when the RMP is feasible. --- examples/branch-and-price.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/branch-and-price.py b/examples/branch-and-price.py index 6b115e66d1..4fe7c1d620 100644 --- a/examples/branch-and-price.py +++ b/examples/branch-and-price.py @@ -366,12 +366,9 @@ def branchAndPrice(m, vals, columns, start_time=0): mp_is_feasible, m, node = solveNode(node, columns, m) count_nodes_visited += 1 - # Prune nodes that cannot lead to optimal solution - if node.value >= best_obj: - continue - # Only add columns if the master problem is feasible - if mp_is_feasible: + # Prune nodes that cannot lead to optimal solution + if mp_is_feasible and node.value < best_obj: columns = node.final_columns count_fractional_columns = len(node.final_fractional_columns)