Commit d50a29a5 authored by yb9976's avatar yb9976
Browse files

Assert if we try to solve an already solved PBQP.

parent ec9575be
......@@ -292,7 +292,11 @@ static void back_propagate_brute_force(pbqp_t *pbqp)
void solve_pbqp_brute_force(pbqp_t *pbqp)
{
#ifndef NDEBUG
assert(pbqp);
assert(pbqp->solution == INF_COSTS && "PBQP already solved");
pbqp->solution = 0;
#endif
/* Reduce nodes degree ... */
initial_simplify_edges(pbqp);
......
......@@ -84,7 +84,11 @@ static void apply_heuristic_reductions(pbqp_t *pbqp)
void solve_pbqp_heuristical(pbqp_t *pbqp)
{
#ifndef NDEBUG
assert(pbqp);
assert(pbqp->solution == INF_COSTS && "PBQP already solved");
pbqp->solution = 0;
#endif
/* Reduce nodes degree ... */
initial_simplify_edges(pbqp);
......
......@@ -164,8 +164,12 @@ static void apply_heuristic_reductions_co(pbqp_t *pbqp, plist_t *rpeo)
void solve_pbqp_heuristical_co(pbqp_t *pbqp, plist_t *rpeo)
{
#ifndef NDEBUG
assert(pbqp);
assert(rpeo);
assert(pbqp->solution == INF_COSTS && "PBQP already solved");
pbqp->solution = 0;
#endif
/* Reduce nodes degree ... */
initial_simplify_edges(pbqp);
......
......@@ -313,8 +313,12 @@ static void apply_heuristic_reductions_co(pbqp_t *pbqp, plist_t *rpeo)
void solve_pbqp_heuristical_co_ld(pbqp_t *pbqp, plist_t *rpeo)
{
#ifndef NDEBUG
assert(pbqp);
assert(rpeo);
assert(pbqp->solution == INF_COSTS && "PBQP already solved");
pbqp->solution = 0;
#endif
/* Reduce nodes degree ... */
initial_simplify_edges(pbqp);
......
......@@ -58,7 +58,11 @@ pbqp_t *alloc_pbqp(unsigned number_nodes)
obstack_init(&pbqp->obstack);
#ifdef NDEBUG
pbqp->solution = 0;
#else
pbqp->solution = INF_COSTS;
#endif
pbqp->num_nodes = number_nodes;
#if KAPS_DUMP
pbqp->dump_file = NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment