Bugfix. Rows not in cplex should have index -1

master
Alinson S. Xavier 11 years ago
parent 188367e189
commit f8943fb1ec

@ -251,7 +251,7 @@ int LP_remove_old_cuts(struct LP *lp)
{ {
struct Row *cut = lp->cut_pool[j]; struct Row *cut = lp->cut_pool[j];
if (cut->cplex_row_index == i - count) cut->cplex_row_index = 0; if (cut->cplex_row_index == i - count) cut->cplex_row_index = -1;
else if (cut->cplex_row_index > i - count) cut->cplex_row_index--; else if (cut->cplex_row_index > i - count) cut->cplex_row_index--;
} }
@ -365,7 +365,6 @@ int LP_write(struct LP *lp, const char *fname)
int compare_cuts(struct Row *cut1, struct Row *cut2) int compare_cuts(struct Row *cut1, struct Row *cut2)
{ {
return_if_neq(cut1->nz, cut2->nz); return_if_neq(cut1->nz, cut2->nz);
assert(cut1->nz == cut2->nz);
for (int i = 0; i < cut1->nz; i++) for (int i = 0; i < cut1->nz; i++)
{ {
@ -390,6 +389,9 @@ int LP_add_cut(struct LP *lp, struct Row *cut)
if (lp->cut_pool[i]->hash != cut->hash) continue; if (lp->cut_pool[i]->hash != cut->hash) continue;
if (!compare_cuts(lp->cut_pool[i], cut)) if (!compare_cuts(lp->cut_pool[i], cut))
{ {
log_verbose("Discarding duplicate cut (same as cplex row %d)\n",
lp->cut_pool[i]->cplex_row_index);
free(cut->rmatval); free(cut->rmatval);
free(cut->rmatind); free(cut->rmatind);
free(cut); free(cut);