From d80f03f5f99faa93861a3019657db406d7293fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 4 Jul 2013 00:00:04 +0200 Subject: Discrete : 01-knapsack: improve debug strings --- 01-knapsack/ks_dp-ng.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/01-knapsack/ks_dp-ng.c b/01-knapsack/ks_dp-ng.c index c2216fc..7830651 100644 --- a/01-knapsack/ks_dp-ng.c +++ b/01-knapsack/ks_dp-ng.c @@ -105,7 +105,7 @@ static void solve(Solver* solver) if (debug > 2) { - printf("\ncurrent V(i,s,W,r)\n"); + printf("\nformat V(i,W)\n"); } /* SOLVE */ @@ -115,7 +115,6 @@ static void solve(Solver* solver) { v = item->v; w = item->w; - data = NULL; data = solver->column + solver->k; up_left = solver->column + (solver->k - w); @@ -139,10 +138,11 @@ static void solve(Solver* solver) if (debug > 2) { + printf("i=%d; j=k; j<=%d:\n", i, lower_bound); data = solver->column; for (j = 0; j <= k; j++, data++) - printf(" % 4d(% 2d % 2d)\n", - data->v, data->i, data->w); + printf(" %d : % 4d(% 2d % 2d)\n", + j, data->v, data->i, data->w); printf("\n"); } } -- cgit v1.1-2-g2b99