Changeset 702
- Timestamp:
- Jul 24, 2007 3:52:59 PM (14 years ago)
- Location:
- trunk/Cbc/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cbc/src/CbcBranchActual.cpp
r640 r702 1967 1967 if (beforeSolution) { 1968 1968 if (!bestObject_) { 1969 bestNumberUp_= INT_MAX;1970 bestNumberDown_= INT_MAX;1969 bestNumberUp_=COIN_INT_MAX; 1970 bestNumberDown_=COIN_INT_MAX; 1971 1971 } 1972 1972 // before solution - choose smallest number … … 2117 2117 4 - take cheapest up branch if infeasibilities same 2118 2118 */ 2119 int bestNumber= INT_MAX;2119 int bestNumber=COIN_INT_MAX; 2120 2120 double bestCriterion=-1.0e50; 2121 2121 double alternativeCriterion = -1.0; -
trunk/Cbc/src/CbcBranchDynamic.cpp
r699 r702 1266 1266 if (!bestObject_) { 1267 1267 bestCriterion_=-1.0; 1268 bestNumberUp_= INT_MAX;1269 bestNumberDown_= INT_MAX;1268 bestNumberUp_=COIN_INT_MAX; 1269 bestNumberDown_=COIN_INT_MAX; 1270 1270 } 1271 1271 if (stateOfSearch<=1&&thisOne->model()->currentNode()->depth()>=8) { -
trunk/Cbc/src/CbcCutGenerator.cpp
r687 r702 479 479 CbcCutSubsetModifier::CbcCutSubsetModifier () 480 480 : CbcCutModifier(), 481 firstOdd_( INT_MAX)481 firstOdd_(COIN_INT_MAX) 482 482 { 483 483 } -
trunk/Cbc/src/CbcFathomDynamicProgramming.cpp
r310 r702 195 195 // check size of array needed 196 196 double size=1.0; 197 double check = INT_MAX;197 double check = COIN_INT_MAX; 198 198 for (i=0;i<numberRows;i++) { 199 199 int n= (int) floor(rhs[i]+0.5); … … 224 224 // set size needed 225 225 if (size>=check) 226 size_= INT_MAX;226 size_=COIN_INT_MAX; 227 227 else 228 228 size_=(int) size; -
trunk/Cbc/src/CbcFathomDynamicProgramming.hpp
r39 r702 69 69 bool tryColumn(int numberElements, const int * rows, 70 70 const double * coefficients, float cost, 71 int upper= INT_MAX);71 int upper=COIN_INT_MAX); 72 72 /// Returns cost array 73 73 inline const float * cost() const -
trunk/Cbc/src/CbcLinked.cpp
r700 r702 669 669 double * solution2 = NULL; 670 670 int numberColumns = quadraticModel_->numberColumns(); 671 int depth =6;671 int depth = cbcModel_->currentNode() ? cbcModel_->currentNode()->depth() : 0; 672 672 if (depth<5) { 673 673 ClpSimplex qpTemp(*quadraticModel_); … … 683 683 assert (!qpTemp.problemStatus()); 684 684 if (qpTemp.objectiveValue()<bestObjectiveValue_-1.0e-3&&!qpTemp.problemStatus()) { 685 solution2 = CoinCopyOfArray(qpTemp.primalColumnSolution(),numberColumns); 685 686 } else { 686 687 printf("QP says expensive - kill\n"); 688 modelPtr_->setProblemStatus(1); 689 modelPtr_->setObjectiveValue(COIN_DBL_MAX); 690 break; 687 691 } 688 692 } 689 cbcModel_->lockThread();690 693 const double * solution = getColSolution(); 691 694 // add OA cut 692 double offset=0.0; 693 double * gradient = new double [numberColumns+1]; 694 // gradient from bilinear 695 int i; 696 CoinZeroN(gradient,numberColumns+1); 697 //const double * objective = modelPtr_->objective(); 698 assert (objectiveRow_>=0); 699 const double * element = originalRowCopy_->getElements(); 700 const int * column2 = originalRowCopy_->getIndices(); 701 const CoinBigIndex * rowStart = originalRowCopy_->getVectorStarts(); 702 //const int * rowLength = originalRowCopy_->getVectorLengths(); 703 //int numberColumns2 = coinModel_.numberColumns(); 704 for ( i=rowStart[objectiveRow_];i<rowStart[objectiveRow_+1];i++) 705 gradient[column2[i]] = element[i]; 706 //const double * columnLower = modelPtr_->columnLower(); 707 //const double * columnUpper = modelPtr_->columnUpper(); 708 for ( i =0;i<numberObjects_;i++) { 709 OsiBiLinear * obj = dynamic_cast<OsiBiLinear *> (object_[i]); 710 if (obj) { 711 int xColumn = obj->xColumn(); 712 int yColumn = obj->yColumn(); 713 if (xColumn!=yColumn) { 714 double coefficient = /* 2.0* */obj->coefficient(); 715 gradient[xColumn] += coefficient*solution[yColumn]; 716 gradient[yColumn] += coefficient*solution[xColumn]; 717 offset += coefficient*solution[xColumn]*solution[yColumn]; 718 } else { 719 double coefficient = obj->coefficient(); 720 gradient[xColumn] += 2.0*coefficient*solution[yColumn]; 721 offset += coefficient*solution[xColumn]*solution[yColumn]; 722 } 723 } 724 } 725 // assume convex 726 double rhs = 0.0; 727 int * column = new int[numberColumns+1]; 728 int n=0; 729 for (int i=0;i<numberColumns;i++) { 730 double value = gradient[i]; 731 if (fabs(value)>1.0e-12) { 732 gradient[n]=value; 733 rhs += value*solution[i]; 734 column[n++]=i; 735 } 736 } 737 gradient[n]=-1.0; 738 assert (objectiveVariable_>=0); 739 rhs -= solution[objectiveVariable_]; 740 column[n++]=objectiveVariable_; 741 if (rhs>offset+1.0e-5) { 742 gen2->addCut(-COIN_DBL_MAX,offset+1.0e-7,n,column,gradient); 743 //printf("added cut with %d elements\n",n); 744 } 695 doAOCuts(gen2, solution, solution); 745 696 if (solution2) { 746 697 doAOCuts(gen2, solution, solution2); 747 698 delete [] solution2; 748 699 } 749 delete [] gradient;750 delete [] column;751 cbcModel_->unlockThread();752 700 break; 753 701 } -
trunk/Cbc/src/CbcMessage.cpp
r687 r702 7 7 8 8 #include "CbcMessage.hpp" 9 #include <cstring> 9 10 10 11 typedef struct { -
trunk/Cbc/src/CbcModel.cpp
r699 r702 2814 2814 continuousObjective_(COIN_DBL_MAX), 2815 2815 originalContinuousObjective_(COIN_DBL_MAX), 2816 continuousInfeasibilities_( INT_MAX),2816 continuousInfeasibilities_(COIN_INT_MAX), 2817 2817 maximumCutPassesAtRoot_(20), 2818 2818 maximumCutPasses_(10), … … 2952 2952 continuousObjective_(COIN_DBL_MAX), 2953 2953 originalContinuousObjective_(COIN_DBL_MAX), 2954 continuousInfeasibilities_( INT_MAX),2954 continuousInfeasibilities_(COIN_INT_MAX), 2955 2955 maximumCutPassesAtRoot_(20), 2956 2956 maximumCutPasses_(10), … … 3375 3375 continuousObjective_=COIN_DBL_MAX; 3376 3376 originalContinuousObjective_=COIN_DBL_MAX; 3377 continuousInfeasibilities_= INT_MAX;3377 continuousInfeasibilities_=COIN_INT_MAX; 3378 3378 maximumNumberCuts_=0; 3379 3379 tree_->cleanTree(this,-COIN_DBL_MAX,bestPossibleObjective_); -
trunk/Cbc/src/CbcNode.cpp
r687 r702 1231 1231 // initialize sum of "infeasibilities" 1232 1232 sumInfeasibilities_ = 0.0; 1233 int bestPriority= INT_MAX;1233 int bestPriority=COIN_INT_MAX; 1234 1234 /* 1235 1235 Scan for branching objects that indicate infeasibility. Choose the best … … 2021 2021 double averageCostPerIteration=0.0; 2022 2022 double totalNumberIterations=1.0; 2023 int smallestNumberInfeasibilities= INT_MAX;2023 int smallestNumberInfeasibilities=COIN_INT_MAX; 2024 2024 for (i=0;i<numberStrong;i++) { 2025 2025 totalNumberIterations += choice[i].numItersDown + … … 2406 2406 // initialize sum of "infeasibilities" 2407 2407 sumInfeasibilities_ = 0.0; 2408 int bestPriority= INT_MAX;2408 int bestPriority=COIN_INT_MAX; 2409 2409 int number01 = 0; 2410 2410 const fixEntry * entry = NULL; -
trunk/Cbc/src/CbcSolver.cpp
r701 r702 99 99 #include "OsiColCut.hpp" 100 100 #ifndef COIN_HAS_LINK 101 #ifdef COIN_HAS_ASL101 //#ifdef COIN_HAS_ASL 102 102 #define COIN_HAS_LINK 103 #endif103 //#endif 104 104 #endif 105 105 #ifdef COIN_HAS_LINK … … 469 469 } 470 470 } 471 #ifdef COIN_HAS_ LINK471 #ifdef COIN_HAS_ASL 472 472 /* Returns OsiSolverInterface (User should delete) 473 473 On entry numberKnapsack is maximum number of Total entries … … 1464 1464 int * sosPriority=NULL; 1465 1465 CglStored storedAmpl; 1466 CoinModel * coinModel = NULL; 1466 1467 #ifdef COIN_HAS_ASL 1467 CoinModel * coinModel = NULL;1468 1468 ampl_info info; 1469 1469 CoinModel saveCoinModel; … … 1484 1484 noPrinting=false; 1485 1485 info.logLevel=atoi(equals+1); 1486 int log = whichParam(LOGLEVEL,numberParameters,parameters); 1487 parameters[log].setIntValue(info.logLevel); 1486 1488 // mark so won't be overWritten 1487 1489 info.numberRows=-1234567; … … 1559 1561 // need some relative granularity 1560 1562 si->setDefaultBound(100.0); 1561 si->setDefaultMeshSize(0.0 1);1563 si->setDefaultMeshSize(0.001); 1562 1564 si->setDefaultBound(100000.0); 1563 1565 si->setIntegerPriority(1000); 1564 1566 si->setBiLinearPriority(10000); 1565 1567 CoinModel * model2 = (CoinModel *) coinModel; 1566 si->load(*model2,true,info.logLevel); 1568 int logLevel = whichParam(LOGLEVEL,numberParameters,parameters); 1569 si->load(*model2,true,logLevel); 1567 1570 // redo 1568 1571 solver = model.solver(); … … 1571 1574 clpSolver->messageHandler()->setLogLevel(0) ; 1572 1575 testOsiParameters=0; 1576 parameters[whichParam(TESTOSI,numberParameters,parameters)].setIntValue(0); 1573 1577 complicatedInteger=1; 1574 1578 if (info.cut) { … … 2749 2753 // need some relative granularity 2750 2754 si->setDefaultBound(100.0); 2751 si->setDefaultMeshSize(0.0 1);2755 si->setDefaultMeshSize(0.001); 2752 2756 si->setDefaultBound(1000.0); 2753 2757 si->setIntegerPriority(1000); … … 2755 2759 si->setSpecialOptions2(2+4+8); 2756 2760 CoinModel * model2 = (CoinModel *) coinModel; 2757 si->load(*model2,true, info.logLevel);2761 si->load(*model2,true, parameters[log].intValue()); 2758 2762 // redo 2759 2763 solver = model.solver(); … … 3283 3287 } 3284 3288 int testOsiOptions = parameters[whichParam(TESTOSI,numberParameters,parameters)].intValue(); 3285 #ifdef COIN_HAS_ LINK3289 #ifdef COIN_HAS_ASL 3286 3290 // If linked then see if expansion wanted 3287 3291 { … … 4994 4998 // need some relative granularity 4995 4999 si->setDefaultBound(100.0); 4996 si->setDefaultMeshSize(0.0 1);5000 si->setDefaultMeshSize(0.001); 4997 5001 si->setDefaultBound(100.0); 4998 5002 si->setIntegerPriority(1000);
Note: See TracChangeset
for help on using the changeset viewer.