Changeset 1664 for stable


Ignore:
Timestamp:
Jun 10, 2011 12:03:06 PM (8 years ago)
Author:
forrest
Message:

changes for bonmin (and gcc 4.6)

Location:
stable/2.7/Cbc/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable/2.7/Cbc/src/CbcEventHandler.hpp

    r1573 r1664  
    147147    /*! \brief Default constructor. */
    148148
    149     CbcEventHandler(CbcModel *model = NULL) ;
     149    CbcEventHandler(CbcModel *model = 0) ;
    150150
    151151    /*! \brief Copy constructor. */
  • stable/2.7/Cbc/src/CbcModel.cpp

    r1573 r1664  
    23842384    stoppedOnGap_ = false ;
    23852385    // See if can stop on gap
     2386#ifdef COIN_HAS_BONMIN // With some heuristics solver needs a resolve here (don't know if this is bug in heuristics)
     2387    solver_->resolve();
     2388    if(!isProvenOptimal()){
     2389      solver_->initialSolve();
     2390    }
     2391#endif
    23862392    bestPossibleObjective_ = solver_->getObjValue() * solver_->getObjSense();
    23872393    double testGap = CoinMax(dblParam_[CbcAllowableGap],
     
    70647070            << CoinMessageEol ;
    70657071        }
     7072
     7073#ifdef COIN_HAS_BONMIN  //Is Necessary for Bonmin? Always keepGoing if cuts have been generated in last iteration (taken from similar code in Cbc-2.4)
     7074        if (solverCharacteristics_->solutionAddsCuts()&&numberViolated) {
     7075          for (i = 0;i<numberCutGenerators_;i++) {
     7076            if (generator_[i]->mustCallAgain()) {
     7077              keepGoing=true; // say must go round
     7078              break;
     7079            }
     7080          }
     7081        }
     7082        if(!keepGoing){
     7083#endif
    70667084        // Status for single pass of cut generation
    70677085        int status = 0;
     
    70867104        if (!feasible)
    70877105            violated = -2;
     7106#ifdef COIN_HAS_BONMIN  //Is Necessary for Bonmin? Always keepGoing if cuts have been generated in last iteration (taken from similar code in Cbc-2.4)
     7107        }
     7108#endif
    70887109        //if (!feasible)
    70897110        //break;
     
    1080310824            delete [] saveLower;
    1080410825            delete [] saveUpper;
     10826            solver_->resolve();
    1080510827        }
    1080610828        //If the variables were fixed the cutting plane procedure may have believed that the node could be fathomed
     
    1227312295      variable.
    1227412296    */
     12297#ifdef COIN_HAS_BONMIN // Remember number of rows to restore at the end of the loop
     12298    int saveNumberRows=solver_->getNumRows();
     12299#endif
    1227512300    while (anyAction == -1) {
    1227612301        // Set objective value (not so obvious if NLP etc)
     
    1236212387            resolve(solver_);
    1236312388            double objval = solver_->getObjValue();
    12364             int saveNumberRows=solver_->getNumRows();
     12389#ifndef COIN_HAS_BONMIN
     12390            int saveNumberRows = solver_->getNumRows();
     12391#endif
    1236512392            lastHeuristic_ = NULL;
    1236612393            setBestSolution(CBC_SOLUTION, objval,
     
    1238012407                feasible = false; // pretend infeasible
    1238112408            }
     12409#ifndef COIN_HAS_BONMIN
    1238212410            if( saveNumberRows<solver_->getNumRows()) {
    1238312411                // delete rows - but leave solution
     
    1238912417                delete [] del;
    1239012418            }
     12419#endif
    1239112420            if (feasible)
    1239212421                anyAction = -1;
     
    1242912458        }
    1243012459    }
     12460#ifdef COIN_HAS_BONMIN //A candidate has been found; restore the subproblem.
     12461    if( saveNumberRows<solver_->getNumRows()) {
     12462        // delete rows - but leave solution
     12463        int n = solver_->getNumRows();
     12464        int * del = new int [n-saveNumberRows];
     12465        for (int i=saveNumberRows;i<n;i++)
     12466            del[i-saveNumberRows]=i;
     12467        solver_->deleteRows(n-saveNumberRows,del);
     12468        delete [] del;
     12469    }
     12470#endif
    1243112471    /*
    1243212472      End main loop to choose a branching variable.
Note: See TracChangeset for help on using the changeset viewer.