127{
130 solution_t *select1, *select2, *best, *best1, *best2, *indep;
131 int pick, lb_new,
debug;
132
133
134 stats->nodes++;
135 if (depth > stats->max_depth) stats->max_depth = depth;
136 debug = stats->debug && (depth <= stats->max_print_depth);
137
138
139 select_essential(A, select, weight, bound);
140 if (select->
cost >= bound) {
142 }
143
144
145#ifdef USE_GIMPEL
146 if ( weight ==
NIL(
int)) {
147 if (
gimpel_reduce(A, select, weight, lb, bound, depth, stats, &best)) {
148 return best;
149 }
150 }
151#endif
152
153#ifdef USE_INDEP_SET
154
156
157
159 pick = select_column(A, weight, indep);
161#else
164#endif
165
166 if (depth == 0) {
167 stats->lower_bound = lb_new + stats->gimpel;
168 }
169
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,
176 }
177
178
179 if (lb_new >= bound) {
180 if (
debug) (void) printf(
"bounded\n");
182
183
184
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,
192 }
193
194
195
197
199 A1 = L;
200 L = R;
201 R = A1;
202 }
204 stats->comp_count++;
205
206
208 stats->component++;
210 bound-select->
cost, depth+1, stats);
211 stats->component--;
214
215
218 } else {
221 }
223
224
225 best =
sm_mincov(R, select, weight, lb_new, bound, depth+1, stats);
226 }
228
229
230 } else {
231 if (
debug) (void) printf(
"pick=%d\n", pick);
232
233
237 best1 =
sm_mincov(A1, select1, weight, lb_new, bound, depth+1, stats);
240
241
244 }
245
246
247 if (stats->no_branching) {
248 return best1;
249 }
250
251
253 return best1;
254 }
255
256
260 best2 =
sm_mincov(A2, select2, weight, lb_new, bound, depth+1, stats);
263
265 }
266
267 return best;
268}
solution_t * solution_choose_best()
solution_t * solution_alloc()
solution_t * sm_maximal_independent_set()
struct solution_struct solution_t
solution_t * solution_dup()
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
struct sm_matrix_struct sm_matrix