Changeset 1937


Ignore:
Timestamp:
Apr 9, 2013 6:32:15 AM (6 years ago)
Author:
forrest
Message:

fixes so sprint will work on unsuitable problems and testGub have no memory leaks

Location:
trunk/Clp/examples
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/examples/sprint.cpp

    r1662 r1937  
    121121     int smallNumberColumns = CoinMin(3 * numberRows, numberColumns);
    122122     smallNumberColumns = CoinMax(smallNumberColumns, 3000);
     123     // To stop seg faults on unsuitable problems
     124     smallNumberColumns = CoinMin(smallNumberColumns,numberColumns);
    123125     // We will be using all rows
    124126     int * whichRows = new int [numberRows];
  • trunk/Clp/examples/sprint2.cpp

    r1662 r1937  
    7272     // Just take this number of columns in small problem
    7373     int smallNumberColumns = 3 * numberRows;
     74     // To stop seg faults on unsuitable problems
     75     smallNumberColumns = CoinMin(smallNumberColumns,numberColumns);
    7476     // And we want number of rows to be this
    7577     int smallNumberRows = numberRows / 4;
     
    101103               double ratio = ((double) smallNumberRows) / ((double) model2->numberRows());
    102104               smallNumberColumns = (int)(smallNumberColumns * ratio);
     105               // deal with pathological case
     106               smallNumberColumns = CoinMax(smallNumberColumns,0);
    103107          }
    104108          delete model2;
  • trunk/Clp/examples/testGub.cpp

    r1935 r1937  
    245245                         start2, row2, element2, cost2,
    246246                         lowerColumn2, upperColumn2);
    247                model2.replaceMatrix(newMatrix);
     247               model2.replaceMatrix(newMatrix,true);
    248248               newMatrix->switchOffCheck();
    249249               newMatrix->setRefreshFrequency(1000);
     
    275275                                lowerColumn2, upperColumn2,
    276276                                oldMatrix->gubRowStatus(), oldMatrix->dynamicStatus());
    277                model3.replaceMatrix(newMatrix);
     277               model3.replaceMatrix(newMatrix,true);
    278278               // and ordinary status (but only NON gub rows)
    279279               memcpy(model3.statusArray(), model2.statusArray(),
     
    293293                                       oldMatrix->gubRowStatus(), oldMatrix->dynamicStatus(),
    294294                                       oldMatrix->numberGubColumns(), oldMatrix->idGen());
    295                model3.replaceMatrix(newMatrix);
     295               model3.replaceMatrix(newMatrix,true);
    296296               // and ordinary status (but only NON gub rows)
    297297               memcpy(model3.statusArray(), model2.statusArray(),
Note: See TracChangeset for help on using the changeset viewer.