node_bucket_insert(&node_buckets[degree], node);
}
-#if KAPS_STATISTIC
-void check_melting_possibility(pbqp *pbqp, pbqp_edge *edge)
-{
- pbqp_matrix *mat;
- pbqp_node *src_node;
- pbqp_node *tgt_node;
- vector *src_vec;
- vector *tgt_vec;
- int src_len;
- int tgt_len;
- int src_index;
- int tgt_index;
-
- assert(pbqp);
- assert(edge);
-
- src_node = edge->src;
- tgt_node = edge->tgt;
- assert(src_node);
- assert(tgt_node);
-
- src_vec = src_node->costs;
- tgt_vec = tgt_node->costs;
- assert(src_vec);
- assert(tgt_vec);
-
- src_len = src_vec->len;
- tgt_len = tgt_vec->len;
- assert(src_len > 0);
- assert(tgt_len > 0);
-
- mat = edge->costs;
- assert(mat);
-
- if (src_len == 1 && tgt_len == 1) {
- //panic("Something is wrong");
- }
-
- int allRowsOk = 1;
- for (src_index = 0; src_index < src_len; ++src_index) {
- int onlyOneZero = 0;
- if (src_vec->entries[src_index].data == INF_COSTS) {
- continue;
- }
- for (tgt_index = 0; tgt_index < tgt_len; ++tgt_index) {
- if (tgt_vec->entries[tgt_index].data == INF_COSTS) {
- continue;
- }
- if (mat->entries[src_index * tgt_len + tgt_index] == 0) {
- if (onlyOneZero) {
- onlyOneZero = 0;
- break;
- } else {
- onlyOneZero = 1;
- continue;
- }
- }
- if (mat->entries[src_index * tgt_len + tgt_index] == INF_COSTS) {
- continue;
- }
- onlyOneZero = 0;
- break;
- }
- allRowsOk &= onlyOneZero;
- }
-
- int allColsOk = 1;
- for (tgt_index = 0; tgt_index < tgt_len; ++tgt_index) {
- int onlyOneZero = 0;
- if (tgt_vec->entries[tgt_index].data == INF_COSTS) {
- continue;
- }
- for (src_index = 0; src_index < src_len; ++src_index) {
- if (src_vec->entries[src_index].data == INF_COSTS) {
- continue;
- }
- if (mat->entries[src_index * tgt_len + tgt_index] == 0) {
- if (onlyOneZero) {
- onlyOneZero = 0;
- break;
- } else {
- onlyOneZero = 1;
- continue;
- }
- }
- if (mat->entries[src_index * tgt_len + tgt_index] == INF_COSTS) {
- continue;
- }
- onlyOneZero = 0;
- break;
- }
- allColsOk &= onlyOneZero;
- }
-
- if (allRowsOk || allColsOk) {
- pbqp->num_rm++;
- }
-}
-#endif
-
void simplify_edge(pbqp *pbqp, pbqp_edge *edge)
{
pbqp_matrix *mat;
void apply_RI(pbqp *pbqp);
void apply_RII(pbqp *pbqp);
-#if KAPS_STATISTIC
-void check_melting_possibility(pbqp *pbqp, pbqp_edge *edge);
-#endif
-
void back_propagate(pbqp *pbqp);
num determine_solution(pbqp *pbqp);
void fill_node_buckets(pbqp *pbqp);