* @brief Optimal reductions and helper functions.
* @date 28.12.2009
* @author Sebastian Buchwald
- * @version $Id$
*/
#include "config.h"
#include "timing.h"
pbqp_edge_t **edge_bucket;
-pbqp_edge_t **rm_bucket;
+static pbqp_edge_t **rm_bucket;
pbqp_node_t **node_buckets[4];
pbqp_node_t **reduced_bucket = NULL;
pbqp_node_t *merged_node = NULL;
unsigned *mapping;
unsigned src_len;
unsigned tgt_len;
- unsigned src_index;
unsigned tgt_index;
unsigned edge_index;
unsigned edge_len;
/* Check that each column has at most one zero entry. */
for (tgt_index = 0; tgt_index < tgt_len; ++tgt_index) {
unsigned onlyOneZero = 0;
+ unsigned src_index;
if (tgt_vec->entries[tgt_index].data == INF_COSTS)
continue;
if (pbqp->dump_file) {
char txt[100];
sprintf(txt, "Merging n%d into n%d", src_node->index, tgt_node->index);
- dump_section(pbqp->dump_file, 3, txt);
+ pbqp_dump_section(pbqp->dump_file, 3, txt);
}
#endif
vector_t *other_vec;
unsigned other_len;
unsigned other_index;
- unsigned tgt_index;
assert(old_edge);
if (old_edge == edge)
unsigned src_len;
unsigned tgt_len;
unsigned src_index;
- unsigned tgt_index;
unsigned edge_index;
unsigned edge_len;
/* Check that each row has at most one zero entry. */
for (src_index = 0; src_index < src_len; ++src_index) {
unsigned onlyOneZero = 0;
+ unsigned tgt_index;
if (src_vec->entries[src_index].data == INF_COSTS)
continue;
if (pbqp->dump_file) {
char txt[100];
sprintf(txt, "Merging n%d into n%d", tgt_node->index, src_node->index);
- dump_section(pbqp->dump_file, 3, txt);
+ pbqp_dump_section(pbqp->dump_file, 3, txt);
}
#endif
vector_t *other_vec;
unsigned other_len;
unsigned other_index;
- unsigned src_index;
assert(old_edge);
if (pbqp->dump_file) {
char txt[100];
sprintf(txt, "Simplification of Edge n%d-n%d", src_node->index, tgt_node->index);
- dump_section(pbqp->dump_file, 3, txt);
+ pbqp_dump_section(pbqp->dump_file, 3, txt);
}
#endif
#if KAPS_DUMP
if (pbqp->dump_file) {
fputs("Input:<br>\n", pbqp->dump_file);
- dump_simplifyedge(pbqp, edge);
+ pbqp_dump_simplifyedge(pbqp, edge);
}
#endif
#if KAPS_DUMP
if (pbqp->dump_file) {
fputs("<br>\nOutput:<br>\n", pbqp->dump_file);
- dump_simplifyedge(pbqp, edge);
+ pbqp_dump_simplifyedge(pbqp, edge);
}
#endif
#if KAPS_DUMP
if (pbqp->dump_file) {
pbqp_dump_input(pbqp);
- dump_section(pbqp->dump_file, 1, "2. Simplification of Cost Matrices");
+ pbqp_dump_section(pbqp->dump_file, 1, "2. Simplification of Cost Matrices");
}
#endif
file = pbqp->dump_file;
if (file) {
- dump_section(file, 1, "4. Determine Solution/Minimum");
- dump_section(file, 2, "4.1. Trivial Solution");
+ pbqp_dump_section(file, 1, "4. Determine Solution/Minimum");
+ pbqp_dump_section(file, 2, "4.1. Trivial Solution");
}
#endif
#if KAPS_DUMP
if (file) {
fprintf(file, "node n%d is set to %d<br>\n", node->index, node->solution);
- dump_node(file, node);
+ pbqp_dump_node(file, node);
}
#endif
}
#if KAPS_DUMP
if (file) {
- dump_section(file, 2, "Minimum");
+ pbqp_dump_section(file, 2, "Minimum");
#if KAPS_USE_UNSIGNED
fprintf(file, "Minimum is equal to %u.", solution);
#else
#if KAPS_DUMP
if (pbqp->dump_file) {
- dump_section(pbqp->dump_file, 2, "Back Propagation");
+ pbqp_dump_section(pbqp->dump_file, 2, "Back Propagation");
}
#endif
break;
default:
panic("Only nodes with degree one or two should be in this bucket");
- break;
}
}
}
if (pbqp->dump_file) {
char txt[100];
sprintf(txt, "RI-Reduction of Node n%d", node->index);
- dump_section(pbqp->dump_file, 2, txt);
+ pbqp_dump_section(pbqp->dump_file, 2, txt);
pbqp_dump_graph(pbqp);
fputs("<br>\nBefore reduction:<br>\n", pbqp->dump_file);
- dump_node(pbqp->dump_file, node);
- dump_node(pbqp->dump_file, other_node);
- dump_edge(pbqp->dump_file, edge);
+ pbqp_dump_node(pbqp->dump_file, node);
+ pbqp_dump_node(pbqp->dump_file, other_node);
+ pbqp_dump_edge(pbqp->dump_file, edge);
}
#endif
#if KAPS_DUMP
if (pbqp->dump_file) {
fputs("<br>\nAfter reduction:<br>\n", pbqp->dump_file);
- dump_node(pbqp->dump_file, other_node);
+ pbqp_dump_node(pbqp->dump_file, other_node);
}
#endif
if (pbqp->dump_file) {
char txt[100];
sprintf(txt, "RII-Reduction of Node n%d", node->index);
- dump_section(pbqp->dump_file, 2, txt);
+ pbqp_dump_section(pbqp->dump_file, 2, txt);
pbqp_dump_graph(pbqp);
fputs("<br>\nBefore reduction:<br>\n", pbqp->dump_file);
- dump_node(pbqp->dump_file, src_node);
- dump_edge(pbqp->dump_file, src_edge);
- dump_node(pbqp->dump_file, node);
- dump_edge(pbqp->dump_file, tgt_edge);
- dump_node(pbqp->dump_file, tgt_node);
+ pbqp_dump_node(pbqp->dump_file, src_node);
+ pbqp_dump_edge(pbqp->dump_file, src_edge);
+ pbqp_dump_node(pbqp->dump_file, node);
+ pbqp_dump_edge(pbqp->dump_file, tgt_edge);
+ pbqp_dump_node(pbqp->dump_file, tgt_node);
}
#endif
#if KAPS_DUMP
if (pbqp->dump_file) {
fputs("<br>\nAfter reduction:<br>\n", pbqp->dump_file);
- dump_edge(pbqp->dump_file, edge);
+ pbqp_dump_edge(pbqp->dump_file, edge);
}
#endif