From 79798c4dc36a93b21382ba730c057d567979aafc Mon Sep 17 00:00:00 2001 From: Alinson Xavier Date: Tue, 31 Mar 2015 11:50:19 -0400 Subject: [PATCH] Bugfix --- src/gtsp-comb.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/gtsp-comb.c b/src/gtsp-comb.c index 898a57d..3d89fd9 100644 --- a/src/gtsp-comb.c +++ b/src/gtsp-comb.c @@ -90,24 +90,27 @@ int add_comb_cut( #if LOG_LEVEL >= LOG_LEVEL_DEBUG log_debug("Generated cut:\n"); - for (int i = 0; i < nz; i++) + if(OPTIMAL_X) { - if (OPTIMAL_X[rmatind[i]] < LP_EPSILON) continue; - - if (rmatind[i] >= node_count) - { - struct Edge *e = &graph->edges[rmatind[i] - node_count]; - log_debug(" %.2lf x%d (%d %d %.4lf)\n", rmatval[i], rmatind[i], - e->from->index, e->to->index, OPTIMAL_X[rmatind[i]]); - } - else + for (int i = 0; i < nz; i++) { - log_debug(" %.2lf x%d (%.4lf)\n", rmatval[i], rmatind[i], - OPTIMAL_X[rmatind[i]]); + if (OPTIMAL_X[rmatind[i]] < LP_EPSILON) continue; + + if (rmatind[i] >= node_count) + { + struct Edge *e = &graph->edges[rmatind[i] - node_count]; + log_debug(" %.2lf x%d (%d %d %.4lf)\n", rmatval[i], rmatind[i], + e->from->index, e->to->index, OPTIMAL_X[rmatind[i]]); + } + else + { + log_debug(" %.2lf x%d (%.4lf)\n", rmatval[i], rmatind[i], + OPTIMAL_X[rmatind[i]]); + } } + log_debug(" %c %.2lf\n", sense, rhs); } - log_debug(" %c %.2lf\n", sense, rhs); - #endif +#endif if (OPTIMAL_X) { @@ -492,4 +495,4 @@ int write_shrunken_graph( CLEANUP: return rval; -} \ No newline at end of file +}