+ /* now compute the best set out of the unsafe nodes*/
+ best = bitset_alloca(unsafe_count);
+
+ if (unsafe_count > MIS_HEUR_TRIGGER) {
+ /* Heuristic: Greedy trial and error form index 0 to unsafe_count-1 */
+ for (i=0; i<unsafe_count; ++i) {
+ bitset_set(best, i);
+ /* check if it is a stable set */
+ for (o=bitset_next_set(best, 0); o!=-1 && o<=i; o=bitset_next_set(best, o+1))
+ if (qnode_are_conflicting(qn, unsafe[i], unsafe[o])) {
+ bitset_clear(best, i); /* clear the bit and try next one */
+ break;
+ }
+ }
+ /* compute the weight */
+ bitset_foreach(best, pos)
+ best_weight += unsafe_costs[pos];
+ } else {
+ /* Exact Algorithm: Brute force */
+ curr = bitset_alloca(unsafe_count);
+ bitset_set_all(curr);
+ while ((max = bitset_popcnt(curr)) != 0) {
+ /* check if curr is a stable set */
+ for (i=bitset_next_set(curr, 0); i!=-1; i=bitset_next_set(curr, i+1))
+ for (o=bitset_next_set(curr, i); o!=-1; o=bitset_next_set(curr, o+1)) /* !!!!! difference to ou_max_ind_set_costs(): NOT (curr, i+1) */
+ if (qnode_are_conflicting(qn, unsafe[i], unsafe[o]))
+ goto no_stable_set;
+
+ /* if we arrive here, we have a stable set */
+ /* compute the weigth of the stable set*/