coin-or / Clp.old

This a mirror of the subversion repository on COIN-OR.
https://projects.coin-or.org/Clp
Other
36 stars 20 forks source link

[TRAC] Unable to handle LP without Non-GUB columns in testGub.cpp #29

Open qtothec opened 5 years ago

qtothec commented 5 years ago

Moved from TRAC as part of COIN fORgery: https://projects.coin-or.org/Clp/ticket/69

I find that line 144-150 in testGub.cpp tries to handle LP without Non-GUB columns. However, it doesn't work.

A possible fix could be recording the last GUB row we found, inserting it into the right place in 'which', and updating corresponding counters.

84a85
>      int lastGubRow = -1;
118a120
>                lastGubRow = iRow;
143,150c145,163
<           }
<           if (!numberNormal) {
<                printf("Putting back one gub row to make non-empty\n");
<                for (iColumn = gubStart[putGub]; iColumn < gubEnd[putGub]; iColumn++)
<                     mark[numberNormal++] = iColumn;
<                putGub++;
<                numberGub--;
<           }
---
>         }
>         if (!numberNormal) {
>             printf("Putting back one gub row to make non-empty\n");
>             for (iColumn = gubStart[putGub]; iColumn < gubEnd[putGub]; iColumn++)
>                 mark[numberNormal++] = iColumn;
>             putGub++;
>             numberGub--;
>             numberNonGub++;
> 
>             int index = putNonGub;
>             while (index < numberRows && which[index] < lastGubRow) {
>                 which[index - 1] = which[index];
>                 index++;
>             }
>             which[index - 1] = lastGubRow;
>             --putNonGub;
> 
>             rowIsGub[lastGubRow] = 0;
>         }