Changeset 814
- Timestamp:
- Oct 2, 2007 9:16:23 AM (14 years ago)
- Location:
- trunk/Cbc/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cbc/src/CbcCompareBase.hpp
r724 r814 25 25 public: 26 26 // Default Constructor 27 CbcCompareBase () {test_=NULL; }27 CbcCompareBase () {test_=NULL;threaded_=false;} 28 28 29 29 // This allows any method to change behavior as it is called … … 53 53 // Copy constructor 54 54 CbcCompareBase ( const CbcCompareBase & rhs) 55 {test_=rhs.test_; }55 {test_=rhs.test_;threaded_=rhs.threaded_;} 56 56 57 57 // Assignment operator 58 58 CbcCompareBase & operator=( const CbcCompareBase& rhs) 59 { if (this!=&rhs) {test_=rhs.test_; }59 { if (this!=&rhs) {test_=rhs.test_;threaded_=rhs.threaded_;} 60 60 return *this; 61 61 } … … 79 79 assert (x); 80 80 assert (y); 81 #ifndef CBC_THREAD 82 CbcNodeInfo * infoX = x->nodeInfo();83 assert (infoX);84 int nodeNumberX = infoX->nodeNumber();85 CbcNodeInfo * infoY = y->nodeInfo();86 assert (infoY);87 int nodeNumberY = infoY->nodeNumber();88 assert (nodeNumberX!=nodeNumberY);89 return (nodeNumberX>nodeNumberY);90 #else 91 // doesn't work if threaded92 assert (x!=y);93 return (x>y);94 #endif 81 if (!threaded_) { 82 CbcNodeInfo * infoX = x->nodeInfo(); 83 assert (infoX); 84 int nodeNumberX = infoX->nodeNumber(); 85 CbcNodeInfo * infoY = y->nodeInfo(); 86 assert (infoY); 87 int nodeNumberY = infoY->nodeNumber(); 88 assert (nodeNumberX!=nodeNumberY); 89 return (nodeNumberX>nodeNumberY); 90 } else { 91 // doesn't work if threaded 92 assert (x!=y); 93 return (x>y); 94 } 95 95 } 96 /// Say threaded 97 inline void sayThreaded() 98 { threaded_ = true;} 96 99 protected: 97 100 CbcCompareBase * test_; 101 // If not threaded we can use better way to break ties 102 bool threaded_; 98 103 }; 99 104 class CbcCompare { -
trunk/Cbc/src/CbcModel.cpp
r810 r814 406 406 int numberColumns = solver_->getNumCols() ; 407 407 // Column copy of matrix 408 bool allPlusOnes=true; 409 bool allOnes=true; 410 int problemType=-1; 408 411 const double * element = solver_->getMatrixByCol()->getElements(); 409 412 const int * row = solver_->getMatrixByCol()->getIndices(); … … 441 444 } else { 442 445 rhs[iRow] = rowLower[iRow]-rhs[iRow]; 446 if (problemType<0) 447 problemType=3; // set cover 448 else if (problemType!=3) 449 problemType=4; 443 450 } 444 451 } else { 445 452 rhs[iRow] = rowUpper[iRow]-rhs[iRow]; 453 if (problemType<0) 454 problemType=1; // set partitioning <= 455 else if (problemType!=1) 456 problemType=4; 446 457 } 447 458 } else { 448 459 rhs[iRow] = rowUpper[iRow]-rhs[iRow]; 449 } 460 if (problemType<0) 461 problemType=3; // set partitioning == 462 else if (problemType!=2) 463 problemType=2; 464 } 465 if (fabs(rhs[iRow]-1.0)>1.0e-12) 466 problemType=4; 450 467 } 451 468 if (continuousMultiplier) { … … 460 477 for (CoinBigIndex j=start;j<end;j++) { 461 478 double value = element[j]; 462 if (value!=1.0) 479 if (value==1.0) { 480 } else if (value==-1.0) { 463 481 rhs[row[j]]=-0.5; 464 else if (value!=-1.0) 482 allPlusOnes=false; 483 } else { 465 484 rhs[row[j]]=-COIN_DBL_MAX; 485 allOnes=false; 486 } 466 487 } 467 488 } … … 576 597 } 577 598 } 599 } else { 600 // all integer 601 problemType_= problemType; 602 #ifdef COIN_DEVELOP 603 printf("Problem type is %d\n",problemType_); 604 #endif 578 605 } 579 606 } … … 895 922 eventHandler->setModel(this); 896 923 // set up for probing 897 probingInfo_ = new CglTreeProbingInfo(solver_); 924 //probingInfo_ = new CglTreeProbingInfo(solver_); 925 probingInfo_=NULL; 898 926 899 927 // Try for dominated columns … … 1548 1576 // For now just one model 1549 1577 if (numberThreads_) { 1578 nodeCompare_->sayThreaded(); // need to use addresses 1550 1579 threadId = new pthread_t [numberThreads_]; 1551 1580 threadCount = new int [numberThreads_]; … … 4756 4785 else 4757 4786 value = value -floor(value); 4787 #if 1 4788 OsiBranchingInformation usefulInfo=usefulInformation(); 4789 OsiHotInfo hotInfo(solver_,&usefulInfo,&object,0); 4790 if (branch) { 4791 hotInfo.setUpStatus(iStatus); 4792 hotInfo.setUpChange(changeInObjective); 4793 //object->setUpEstimate(value); 4794 } else { 4795 hotInfo.setDownStatus(iStatus); 4796 hotInfo.setDownChange(changeInObjective); 4797 //object->setDownEstimate(value); 4798 } 4799 branchingMethod_->chooseMethod()->updateInformation(&usefulInfo,branch,&hotInfo); 4800 #else 4758 4801 branchingMethod_->chooseMethod()->updateInformation(iObject,branch,changeInObjective, 4759 4802 value,iStatus); 4803 #endif 4760 4804 } 4761 4805 }
Note: See TracChangeset
for help on using the changeset viewer.