Changeset 1132 for trunk/Cbc/src/CbcCutGenerator.cpp
 Timestamp:
 Mar 16, 2009 6:30:25 AM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Cbc/src/CbcCutGenerator.cpp
r1121 r1132 41 41 timing_(false), 42 42 timeInCutGenerator_(0.0), 43 inaccuracy_(0), 43 44 numberTimes_(0), 44 45 numberCuts_(0), … … 64 65 timing_(false), 65 66 timeInCutGenerator_(0.0), 67 inaccuracy_(0), 66 68 numberTimes_(0), 67 69 numberCuts_(0), … … 110 112 timing_ = rhs.timing_; 111 113 timeInCutGenerator_ = rhs.timeInCutGenerator_; 114 inaccuracy_ = rhs.inaccuracy_; 112 115 numberTimes_ = rhs.numberTimes_; 113 116 numberCuts_ = rhs.numberCuts_; … … 142 145 timing_ = rhs.timing_; 143 146 timeInCutGenerator_ = rhs.timeInCutGenerator_; 147 inaccuracy_ = rhs.inaccuracy_; 144 148 numberTimes_ = rhs.numberTimes_; 145 149 numberCuts_ = rhs.numberCuts_; … … 566 570 // nCuts,nEls); 567 571 int nElsNow = solver>getMatrixByCol()>getNumElements(); 568 int nAdd = model_>parentModel() ? 200 : 10000;569 572 int numberColumns = solver>getNumCols(); 570 int nAdd2 = model_>parentModel() ? 2*numberColumns : 5*numberColumns; 573 int numberRows = solver>getNumRows(); 574 //double averagePerRow = static_cast<double>(nElsNow)/ 575 //static_cast<double>(numberRows); 576 int nAdd; 577 int nAdd2; 578 int nReasonable; 579 if (!model_>parentModel()&&depth<2) { 580 if (inaccuracy_<3) { 581 nAdd=10000; 582 if (pass>0&&numberColumns>500) 583 nAdd = CoinMin(nAdd,nElsNow+2*numberRows); 584 } else { 585 nAdd=10000; 586 if (pass>0) 587 nAdd = CoinMin(nAdd,nElsNow+2*numberRows); 588 } 589 nAdd2 = 5*numberColumns; 590 nReasonable = CoinMax(nAdd2,nElsNow/8+nAdd); 591 } else { 592 nAdd = 200; 593 nAdd2 = 2*numberColumns; 594 nReasonable = CoinMax(nAdd2,nElsNow/8+nAdd); 595 } 596 //#define UNS_WEIGHT 0.1 597 #ifdef UNS_WEIGHT 598 const double * colLower = solver>getColLower(); 599 const double * colUpper = solver>getColUpper(); 600 #endif 571 601 if (/*nEls>CoinMax(nAdd2,nElsNow/8+nAdd)*/nCuts&&feasible) { 572 602 //printf("need to remove cuts\n"); 573 603 // just add most effective 574 int nReasonable = CoinMax(nAdd2,nElsNow/8+nAdd);575 604 int nDelete = nEls  nReasonable; 576 605 … … 589 618 const double * element = thisCut>row().getElements(); 590 619 assert (n); 591 double norm=0.0; 620 #ifdef UNS_WEIGHT 621 double normU=0.0; 622 double norm=1.0e3; 623 int nU=0; 624 for (int i=0;i<n;i++) { 625 double value = element[i]; 626 int iColumn = column[i]; 627 double solValue = solution[iColumn]; 628 sum += value*solValue; 629 value *= value; 630 norm += value; 631 if (solValue>colLower[iColumn]+1.0e6&& 632 solValue<colUpper[iColumn]1.0e6) { 633 normU += value; 634 nU++; 635 } 636 } 637 #if 0 638 int nS=nnU; 639 if (numberColumns>20000) { 640 if (nS>50) { 641 double ratio = 50.0/nS; 642 normU /= ratio; 643 } 644 } 645 #endif 646 norm += UNS_WEIGHT*(normUnorm); 647 #else 648 double norm=1.0e3; 592 649 for (int i=0;i<n;i++) { 593 650 double value = element[i]; … … 595 652 norm += value*value; 596 653 } 654 #endif 597 655 if (sum>thisCut>ub()) { 598 656 sum= sumthisCut>ub(); … … 604 662 // normalize 605 663 sum /= sqrt(norm); 664 //sum /= pow(norm,0.3); 606 665 // adjust for length 666 //sum /= pow(reinterpret_cast<double>(n),0.2); 607 667 //sum /= sqrt((double) n); 608 668 // randomize
Note: See TracChangeset
for help on using the changeset viewer.