Skip to content

Commit c2bdf04

Browse files
committed
Fix knapsack bound in rectangle solver
1 parent 8b6bfff commit c2bdf04

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/rectangle/optimize.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,6 @@ packingsolver::rectangle::Output packingsolver::rectangle::optimize(
420420
algorithm_formatter.start();
421421
algorithm_formatter.print_header();
422422

423-
algorithm_formatter.update_knapsack_bound(instance.item_profit());
424-
425423
// Select algorithms to run.
426424
ItemPos mean_number_of_items_in_bins
427425
= largest_bin_space(instance) / mean_item_space(instance);
@@ -551,6 +549,9 @@ packingsolver::rectangle::Output packingsolver::rectangle::optimize(
551549
}
552550
}
553551

552+
if (instance.objective() == Objective::Knapsack)
553+
algorithm_formatter.update_knapsack_bound(instance.item_profit());
554+
554555
if (instance.objective() == Objective::BinPacking) {
555556
if (instance.number_of_bin_types() == 1
556557
&& instance.number_of_items() <= 100) {

0 commit comments

Comments
 (0)