Bugfix. Rows not in cplex should have index -1
This commit is contained in:
6
src/lp.c
6
src/lp.c
@@ -251,7 +251,7 @@ int LP_remove_old_cuts(struct LP *lp)
|
||||
{
|
||||
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--;
|
||||
}
|
||||
|
||||
@@ -365,7 +365,6 @@ int LP_write(struct LP *lp, const char *fname)
|
||||
int compare_cuts(struct Row *cut1, struct Row *cut2)
|
||||
{
|
||||
return_if_neq(cut1->nz, cut2->nz);
|
||||
assert(cut1->nz == cut2->nz);
|
||||
|
||||
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 (!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->rmatind);
|
||||
free(cut);
|
||||
|
||||
Reference in New Issue
Block a user