Changeset 2200 for trunk


Ignore:
Timestamp:
Jun 13, 2015 3:52:17 AM (4 years ago)
Author:
forrest
Message:

add changes from stable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcModel.cpp

    r2198 r2200  
    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_) {
     
    73177326            cutsToDrop = new int[currentNumberCuts] ;
    73187327            assert (currentNumberCuts + numberRowsAtContinuous_ <= lastws->getNumArtificial());
     7328#undef NDEBUG
     7329            assert (currentNumberCuts <= maximumWhich_); // we will read from whichGenerator_[0..currentNumberCuts-1] below, so should have all these entries
     7330            // the above assert fails in certain situations, which indicates a bug in the code below
     7331            // as a workaround, resize whichGenerator_ to make sure we can read all entries without an invalid read from valgrind (and subsequent crash somewhere, seems so)
    73197332            resizeWhichGenerator(maximumWhich_, currentNumberCuts);
    73207333            for (i = 0; i < currentNumberCuts; i++) {
     
    73297342                           numberRowsAtContinuous_ + numberToAdd);
    73307343#         endif
     7344                    assert (i<maximumWhich_);
    73317345                    whichGenerator_[numberToAdd] = whichGenerator_[i];
    73327346                    addCuts[numberToAdd++] = addedCuts_[i];
     
    76427656{
    76437657    if (numberAfter > maximumWhich_) {
    7644         maximumWhich_ = CoinMax(maximumWhich_ * 2 + 100, numberAfter) ;
     7658#define MAXIMUM_WHICH_INCREMENT 100
     7659#define MAXIMUM_WHICH_MULTIPLIER 2
     7660      //printf("maximumWhich from %d to %d (%d needed)\n",maximumWhich_,
     7661      //   CoinMax(maximumWhich_ * MAXIMUM_WHICH_MULTIPLIER + MAXIMUM_WHICH_INCREMENT, numberAfter),
     7662      //   numberAfter);
     7663        maximumWhich_ = CoinMax(maximumWhich_ * MAXIMUM_WHICH_MULTIPLIER + MAXIMUM_WHICH_INCREMENT, numberAfter) ;
     7664        //maximumWhich_ = numberAfter ;
    76457665        int * temp = new int[2*maximumWhich_] ;
    76467666        memcpy(temp, whichGenerator_, numberNow*sizeof(int)) ;
     
    1249512515                //OsiHintStrength saveStrength;
    1249612516                //bool savePrintHint;
    12497                 //solver_->writeMps("infeas");
     12517                //solver_->writeMpsNative("infeas.mps", NULL, NULL, 2);
    1249812518                //bool gotHint = (solver_->getHintParam(OsiDoReducePrint,savePrintHint,saveStrength));
    1249912519                //gotHint = (solver_->getHintParam(OsiDoScale,saveTakeHint,saveStrength));
     
    1272412744#if CBC_FEASIBILITY_INVESTIGATE==0
    1272512745                }
     12746#else
     12747                solver_->writeMpsNative("BFeasible.mps",NULL,NULL,2);
    1272612748#endif
    1272712749                //if (fabs(objValue-objectiveValue)>1.0e-7*fabs(objectiveValue)) {
     
    1791417936                delete [] newSolution;
    1791517937                // Space for type of cuts
    17916                 maximumWhich_ = 1000;
     17938                maximumWhich_ = INITIAL_MAXIMUM_WHICH;
    1791717939                delete [] whichGenerator_ ;
    1791817940                whichGenerator_ = new int[maximumWhich_];
     
    1848718509      that produced a given cut.
    1848818510    */
    18489     maximumWhich_ = 1000 ;
     18511    maximumWhich_ = INITIAL_MAXIMUM_WHICH ;
    1849018512    delete [] whichGenerator_ ;
    1849118513    whichGenerator_ = new int[maximumWhich_] ;
Note: See TracChangeset for help on using the changeset viewer.