This allows application of optimal reduction after merging neighbors into the RN node.
[r27925]
#include "plist.h"
#include "timing.h"
-static void apply_RN_co(pbqp *pbqp, plist_t *rpeo)
+static void merge_into_RN_node(pbqp *pbqp, plist_t *rpeo)
{
pbqp_node *node = NULL;
- unsigned min_index = 0;
assert(pbqp);
#endif
/* Check whether we can merge a neighbor into the current node. */
apply_RM(pbqp, node);
+}
+
+static void apply_RN_co(pbqp *pbqp)
+{
+ pbqp_node *node = NULL;
+ unsigned min_index = 0;
+
+ assert(pbqp);
+
+ node = node_bucket_pop(&rn_bucket);
+ assert(node);
- /* Apply optimal solution for the given node, if possible. */
- if (pbqp_node_get_degree(node) < 3)
+ if (node_is_reduced(node))
return;
min_index = get_local_minimal_alternative(pbqp, node);
#if KAPS_TIMING
ir_timer_stop(t_r2);
#endif
+ } else if (node_bucket_get_length(rn_bucket) > 0) {
+ #if KAPS_TIMING
+ ir_timer_start(t_rn);
+ #endif
+
+ apply_RN_co(pbqp);
+
+ #if KAPS_TIMING
+ ir_timer_stop(t_rn);
+ #endif
} else if (node_bucket_get_length(node_buckets[3]) > 0) {
#if KAPS_TIMING
ir_timer_start(t_rn);
#endif
- apply_RN_co(pbqp, rpeo);
+ merge_into_RN_node(pbqp, rpeo);
#if KAPS_TIMING
ir_timer_stop(t_rn);
pbqp_edge **edge_bucket;
pbqp_edge **rm_bucket;
+pbqp_node **rn_bucket;
pbqp_node **node_buckets[4];
pbqp_node **reduced_bucket = NULL;
static int buckets_filled = 0;
edge_bucket_init(&edge_bucket);
edge_bucket_init(&rm_bucket);
node_bucket_init(&reduced_bucket);
+ node_bucket_init(&rn_bucket);
for (i = 0; i < 4; ++i) {
node_bucket_init(&node_buckets[i]);
edge_bucket_free(&edge_bucket);
edge_bucket_free(&rm_bucket);
node_bucket_free(&reduced_bucket);
+ node_bucket_free(&rn_bucket);
buckets_filled = 0;
}
else
merge_source_into_target(pbqp, edge);
}
+
+ node_bucket_insert(&rn_bucket, node);
}
void reorder_node(pbqp_node *node)
extern pbqp_edge **edge_bucket;
extern pbqp_node **node_buckets[4];
extern pbqp_node **reduced_bucket;
+extern pbqp_node **rn_bucket;
void apply_edge(pbqp *pbqp);