Skip to content

Commit

Permalink
use last generated column as well
Browse files Browse the repository at this point in the history
The last generated column has been computed but then ignored. Since
we seem to be a bit low on columns in practice anyway make use of
this last column as well.
  • Loading branch information
agners committed Jan 4, 2020
1 parent de457ea commit 2fa089e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/cutting_stock.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,6 @@ double **cutting_stock_compute_best_patterns(order **orders, int order_count, in
new_pattern = (double *)malloc(column_size * sizeof(double));
cutting_stock_branch_and_cut(orders, order_count, dual_column, column_size, max_width, &obj_value, new_pattern);

if (obj_value <= 1.00000999999) {
free((void *)dual_column);
free((void *)new_pattern);
break;
}

/* Add the new pattern */
if (columns_matrix) {
columns_matrix = (double **)realloc(columns_matrix, (columns_matrix_number + 1) * sizeof(double *));
Expand All @@ -160,6 +154,9 @@ double **cutting_stock_compute_best_patterns(order **orders, int order_count, in
columns_matrix_number++;

free((void *)dual_column);

if (obj_value <= 1.00000000001)
break;
}

if (columns_matrix_number == 0) {
Expand Down

0 comments on commit 2fa089e

Please sign in to comment.