55 stats.debug = debug_level > 0;
56 stats.max_print_depth = debug_level;
59 stats.component = stats.comp_count = 0;
60 stats.gimpel = stats.gimpel_count = 0;
61 stats.no_branching = heuristic != 0;
62 stats.lower_bound = -1;
69 sparsity = (double) nelem / (
double) (A->
nrows * A->
ncols);
74 bound += WEIGHT(weight, pcol->
col_num);
80 best =
sm_mincov(dup_A, select, weight, 0, bound, 0, &stats);
85 if (stats.no_branching) {
86 (void) printf(
"**** heuristic covering ...\n");
87 (void) printf(
"lower bound = %d\n", stats.lower_bound);
89 (void) printf(
"matrix = %d by %d with %d elements (%4.3f%%)\n",
91 (void) printf(
"cover size = %d elements\n", best->
row->
length);
92 (void) printf(
"cover cost = %d\n", best->
cost);
93 (void) printf(
"time = %s\n",
95 (void) printf(
"components = %d\n", stats.comp_count);
96 (void) printf(
"gimpel = %d\n", stats.gimpel_count);
97 (void) printf(
"nodes = %d\n", stats.nodes);
98 (void) printf(
"max_depth = %d\n", stats.max_depth);
102 if (! verify_cover(A, sol)) {
103 fail(
"mincov: internal error -- cover verification failed\n");
130 solution_t *select1, *select2, *best, *best1, *best2, *indep;
131 int pick, lb_new,
debug;
135 if (depth > stats->max_depth) stats->max_depth = depth;
136 debug = stats->debug && (depth <= stats->max_print_depth);
139 select_essential(A, select, weight, bound);
140 if (select->
cost >= bound) {
146 if ( weight ==
NIL(
int)) {
147 if (
gimpel_reduce(A, select, weight, lb, bound, depth, stats, &best)) {
159 pick = select_column(A, weight, indep);
167 stats->lower_bound = lb_new + stats->gimpel;
171 (void) printf(
"ABSMIN[%2d]%s", depth, stats->component ?
"*" :
" ");
172 (void) printf(
" %3dx%3d sel=%3d bnd=%3d lb=%3d %12s ",
174 bound + stats->gimpel, lb_new + stats->gimpel,
179 if (lb_new >= bound) {
180 if (
debug) (void) printf(
"bounded\n");
185 }
else if (A->
nrows == 0) {
187 if (
debug) (void) printf(
"BEST\n");
188 if (stats->debug && stats->component == 0) {
189 (void) printf(
"new 'best' solution %d at level %d (time is %s)\n",
190 best->
cost + stats->gimpel, depth,
210 bound-select->
cost, depth+1, stats);
225 best =
sm_mincov(R, select, weight, lb_new, bound, depth+1, stats);
231 if (
debug) (void) printf(
"pick=%d\n", pick);
237 best1 =
sm_mincov(A1, select1, weight, lb_new, bound, depth+1, stats);
247 if (stats->no_branching) {
260 best2 =
sm_mincov(A2, select2, weight, lb_new, bound, depth+1, stats);
328select_essential(A, select, weight, bound)