Ignore:
Timestamp:
Jun 26, 2007 5:17:15 AM (12 years ago)
Author:
forrest
Message:

trunk from branches/devel

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:externals
      •  

        old new  
        1 MSVisualStudio   https://projects.coin-or.org/svn/MSVisualStudio/trunk/ExternalsDirs/Cbc
        2 BuildTools    https://projects.coin-or.org/svn/BuildTools/stable/0.5
         1MSVisualStudio   https://projects.coin-or.org/svn/MSVisualStudio/branches/devel/ExternalsDirs/Cbc
         2BuildTools    https://projects.coin-or.org/svn/BuildTools/trunk
        33ThirdParty/ASL https://projects.coin-or.org/svn/BuildTools/ThirdParty/ASL/stable/1.0
         4ThirdParty/Blas https://projects.coin-or.org/svn/BuildTools/ThirdParty/Blas/stable/1.0
         5ThirdParty/Lapack https://projects.coin-or.org/svn/BuildTools/ThirdParty/Lapack/stable/1.0
        46Data/Netlib   https://projects.coin-or.org/svn/Data/stable/1.0/Netlib
        57Data/Sample   https://projects.coin-or.org/svn/Data/stable/1.0/Sample
  • trunk/Cbc/src/CbcHeuristicLocal.cpp

    r356 r640  
    6060  fprintf(fp,"0#include \"CbcHeuristicLocal.hpp\"\n");
    6161  fprintf(fp,"3  CbcHeuristicLocal heuristicLocal(*cbcModel);\n");
     62  CbcHeuristic::generateCpp(fp,"heuristicLocal");
    6263  if (swap_!=other.swap_)
    6364    fprintf(fp,"3  heuristicLocal.setSearchType(%d);\n",swap_);
     
    7576  swap_(rhs.swap_)
    7677{
    77   setWhen(rhs.when());
    7878  if (model_&&rhs.used_) {
    7979    int numberColumns = model_->solver()->getNumCols();
     
    8484  }
    8585}
     86
     87// Assignment operator
     88CbcHeuristicLocal &
     89CbcHeuristicLocal::operator=( const CbcHeuristicLocal& rhs)
     90{
     91  if (this!=&rhs) {
     92    CbcHeuristic::operator=(rhs);
     93    matrix_ = rhs.matrix_;
     94    numberSolutions_ = rhs.numberSolutions_;
     95    swap_ = rhs.swap_;
     96    delete [] used_;
     97    if (model_&&rhs.used_) {
     98      int numberColumns = model_->solver()->getNumCols();
     99      used_ = new char[numberColumns];
     100      memcpy(used_,rhs.used_,numberColumns);
     101    } else {
     102      used_=NULL;
     103    }
     104  }
     105  return *this;
     106}
     107
    86108// Resets stuff if model changes
    87109void
     
    121143  for (i=0;i<numberIntegers;i++) {
    122144    int iColumn=integerVariable[i];
    123     const CbcObject * object = model_->object(i);
    124     const CbcSimpleInteger * integerObject =
    125       dynamic_cast<const  CbcSimpleInteger *> (object);
    126     assert(integerObject);
     145    const OsiObject * object = model_->object(i);
    127146    // get original bounds
    128     double originalLower = integerObject->originalLowerBound();
     147    double originalLower;
     148    double originalUpper;
     149    getIntegerInformation( object,originalLower, originalUpper);
    129150    newSolver->setColLower(iColumn,CoinMax(colLower[iColumn],originalLower));
    130151    if (!used_[iColumn]) {
     
    133154    }
    134155  }
    135   int returnCode = smallBranchAndBound(newSolver,200,newSolution,objectiveValue,
     156  int returnCode = smallBranchAndBound(newSolver,numberNodes_,newSolution,objectiveValue,
    136157                                         objectiveValue,"CbcHeuristicLocal");
     158  if ((returnCode&2)!=0) {
     159    // could add cut
     160    returnCode &= ~2;
     161  }
    137162
    138163  delete newSolver;
     
    200225  for (i=0;i<numberIntegers;i++) {
    201226    int iColumn = integerVariable[i];
    202     const CbcObject * object = model_->object(i);
    203     const CbcSimpleInteger * integerObject =
    204       dynamic_cast<const  CbcSimpleInteger *> (object);
    205     assert(integerObject);
     227    const OsiObject * object = model_->object(i);
    206228    // get original bounds
    207     double originalLower = integerObject->originalLowerBound();
    208     double originalUpper = integerObject->originalUpperBound();
    209 
     229    double originalLower;
     230    double originalUpper;
     231    getIntegerInformation( object,originalLower, originalUpper);
    210232    double value=newSolution[iColumn];
    211233    if (value<originalLower) {
     
    463485        newSolution[kColumn] += wayK;
    464486        // See if k can go further ?
    465         const CbcObject * object = model_->object(goodK);
    466         const CbcSimpleInteger * integerObject =
    467           dynamic_cast<const  CbcSimpleInteger *> (object);
     487        const OsiObject * object = model_->object(goodK);
    468488        // get original bounds
    469         double originalLower = integerObject->originalLowerBound();
    470         double originalUpper = integerObject->originalUpperBound();
     489        double originalLower;
     490        double originalUpper;
     491        getIntegerInformation( object,originalLower, originalUpper);
    471492       
    472493        double value=newSolution[kColumn];
     
    512533        for (i=0;i<numberIntegers;i++) {
    513534          int iColumn = integerVariable[i];
    514           const CbcObject * object = model_->object(i);
    515           const CbcSimpleInteger * integerObject =
    516             dynamic_cast<const  CbcSimpleInteger *> (object);
     535          const OsiObject * object = model_->object(i);
    517536          // get original bounds
    518           double originalLower = integerObject->originalLowerBound();
    519           //double originalUpper = integerObject->originalUpperBound();
     537          double originalLower;
     538          double originalUpper;
     539          getIntegerInformation( object,originalLower, originalUpper);
    520540         
    521541          double value=newSolution[iColumn];
Note: See TracChangeset for help on using the changeset viewer.