Ignore:
Timestamp:
Jun 4, 2015 1:10:17 PM (4 years ago)
Author:
forrest
Message:

fix resizeWhichGenerator bug hopefully

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/2.9/Cbc/src/CbcModel.cpp

    r2193 r2199  
    16441644    dblParam_[CbcLargestChange] = 0.0;
    16451645    intParam_[CbcNumberBranches] = 0;
     1646    double lastBestPossibleObjective=-COIN_DBL_MAX;
    16461647    // when to check for restart
    16471648    int nextCheckRestart=50;
     
    24522453      that produced a given cut.
    24532454    */
    2454     maximumWhich_ = 1000 ;
     2455#define INITIAL_MAXIMUM_WHICH 1000
     2456    maximumWhich_ = INITIAL_MAXIMUM_WHICH ;
    24552457    delete [] whichGenerator_;
    24562458    whichGenerator_ = new int[maximumWhich_] ;
     
    36153617      // mark all cuts as globally valid
    36163618      int numberCuts=cuts.sizeRowCuts();
     3619      resizeWhichGenerator(0,numberCuts);
    36173620      for (int i=0;i<numberCuts;i++) {
    36183621        cuts.rowCutPtr(i)->setGloballyValid();
     
    46544657#endif
    46554658            if (!intParam_[CbcPrinting]) {
     4659                // Parallel may not have any nodes
     4660                if (!nNodes)
     4661                  bestPossibleObjective_ = lastBestPossibleObjective;
     4662                else
     4663                  lastBestPossibleObjective = bestPossibleObjective_;
    46564664                messageHandler()->message(CBC_STATUS, messages())
    4657                 << numberNodes_ << nNodes << bestObjective_ << bestPossibleObjective_
     4665                  << numberNodes_ << CoinMax(nNodes,1) << bestObjective_ << bestPossibleObjective_
    46584666                << getCurrentSeconds()
    46594667                << CoinMessageEol ;
     
    55095517        preferredWay_(0),
    55105518        currentPassNumber_(0),
    5511         maximumWhich_(1000),
     5519        maximumWhich_(INITIAL_MAXIMUM_WHICH),
    55125520        maximumRows_(0),
    55135521        randomSeed_(-1),
     
    56795687        preferredWay_(0),
    56805688        currentPassNumber_(0),
    5681         maximumWhich_(1000),
     5689        maximumWhich_(INITIAL_MAXIMUM_WHICH),
    56825690        maximumRows_(0),
    56835691        randomSeed_(-1),
     
    71427150        }
    71437151    }
     7152    resizeWhichGenerator(currentNumberCuts_,currentNumberCuts);
    71447153    currentNumberCuts_ = currentNumberCuts;
    71457154    if (currentNumberCuts > maximumNumberCuts_) {
     
    73327341                           numberRowsAtContinuous_ + numberToAdd);
    73337342#         endif
     7343                    assert (i<maximumWhich_);
    73347344                    whichGenerator_[numberToAdd] = whichGenerator_[i];
    73357345                    addCuts[numberToAdd++] = addedCuts_[i];
     
    76457655{
    76467656    if (numberAfter > maximumWhich_) {
    7647         maximumWhich_ = CoinMax(maximumWhich_ * 2 + 100, numberAfter) ;
     7657#define MAXIMUM_WHICH_INCREMENT 100
     7658#define MAXIMUM_WHICH_MULTIPLIER 2
     7659      //printf("maximumWhich from %d to %d (%d needed)\n",maximumWhich_,
     7660      //     CoinMax(maximumWhich_ * MAXIMUM_WHICH_MULTIPLIER + MAXIMUM_WHICH_INCREMENT, numberAfter),
     7661      //     numberAfter);
     7662        maximumWhich_ = CoinMax(maximumWhich_ * MAXIMUM_WHICH_MULTIPLIER + MAXIMUM_WHICH_INCREMENT, numberAfter) ;
     7663        //maximumWhich_ = numberAfter ;
    76487664        int * temp = new int[2*maximumWhich_] ;
    76497665        memcpy(temp, whichGenerator_, numberNow*sizeof(int)) ;
     
    1791917935                delete [] newSolution;
    1792017936                // Space for type of cuts
    17921                 maximumWhich_ = 1000;
     17937                maximumWhich_ = INITIAL_MAXIMUM_WHICH;
    1792217938                delete [] whichGenerator_ ;
    1792317939                whichGenerator_ = new int[maximumWhich_];
     
    1849218508      that produced a given cut.
    1849318509    */
    18494     maximumWhich_ = 1000 ;
     18510    maximumWhich_ = INITIAL_MAXIMUM_WHICH ;
    1849518511    delete [] whichGenerator_ ;
    1849618512    whichGenerator_ = new int[maximumWhich_] ;
Note: See TracChangeset for help on using the changeset viewer.