+#endif
+
+#if KAPS_STATISTIC
+ dump++;
+#endif
+
+ min_index = get_minimal_alternative(pbqp, node);
+ node = pbqp->nodes[node->index];
+
+#if KAPS_DUMP
+ if (pbqp->dump_file) {
+ fprintf(pbqp->dump_file, "node n%d is set to %d<br><br>\n",
+ node->index, min_index);
+ }
+#endif
+
+#if KAPS_STATISTIC
+ dump--;
+ if (dump == 0) {
+ FILE *fh = fopen("solutions.pb", "a");
+ fprintf(fh, "[%u]", min_index);
+ fclose(fh);
+ pbqp->num_bf++;
+ }
+#endif
+
+ /* Now that we found the minimum set all other costs to infinity. */
+ select_alternative(node, min_index);
+}
+
+void solve_pbqp_brute_force(pbqp *pbqp)
+{
+ /* Reduce nodes degree ... */
+ initial_simplify_edges(pbqp);
+
+ /* ... and put node into bucket representing their degree. */
+ fill_node_buckets(pbqp);
+
+#if KAPS_STATISTIC
+ FILE *fh = fopen("solutions.pb", "a");
+ fprintf(fh, "Solution");
+ fclose(fh);
+#endif
+
+ apply_brute_force_reductions(pbqp);
+
+ pbqp->solution = determine_solution(pbqp);
+
+#if KAPS_STATISTIC
+ fh = fopen("solutions.pb", "a");
+ fprintf(fh, ": %lld RE:%u R0:%u R1:%u R2:%u RN/BF:%u\n", pbqp->solution,
+ pbqp->num_edges, pbqp->num_r0, pbqp->num_r1, pbqp->num_r2,
+ pbqp->num_bf);
+ fclose(fh);
+#endif
+
+ /* Solve reduced nodes. */
+ back_propagate(pbqp);
+
+ free_buckets();