From ecb3978f060bcfeefa24d781a94cdbcc4bc6a54e Mon Sep 17 00:00:00 2001 From: Florian Fontan Date: Thu, 14 Nov 2024 07:29:22 +0100 Subject: [PATCH] Improve minknap sub-instance capacity --- src/knapsack/algorithms/dynamic_programming_primal_dual.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/knapsack/algorithms/dynamic_programming_primal_dual.cpp b/src/knapsack/algorithms/dynamic_programming_primal_dual.cpp index 96c2e3e..e9ceeff 100644 --- a/src/knapsack/algorithms/dynamic_programming_primal_dual.cpp +++ b/src/knapsack/algorithms/dynamic_programming_primal_dual.cpp @@ -594,7 +594,7 @@ const DynamicProgrammingPrimalDualOutput knapsacksolver::knapsack::dynamic_progr // Build new instance. InstanceBuilder sub_instance_builder; std::vector sub2original; - Weight sub_capacity = instance.capacity() - solution.weight(); + Weight sub_capacity = data.best_state.weight - solution.weight(); sub_instance_builder.set_capacity(sub_capacity); for (ItemPos item_pos = data.s + 1; item_pos <= data.partial_sort.last_sorted_item_pos();