Changeset 848
- Timestamp:
- Jan 2, 2008 11:04:26 AM (13 years ago)
- Location:
- trunk/Cbc/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cbc/src/CbcBranchActual.cpp
r838 r848 847 847 CbcSimpleInteger::createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) 848 848 { 849 CbcIntegerBranchingObject * branch = new CbcIntegerBranchingObject(model_,0,-1,0.5); 850 fillCreateBranch(branch,info,way); 851 return branch; 852 } 853 // Fills in a created branching object 854 void 855 CbcSimpleInteger::fillCreateBranch(CbcIntegerBranchingObject * branch, const OsiBranchingInformation * info, int way) 856 { 857 branch->setOriginalObject(this); 849 858 double value = info->solution_[columnNumber_]; 850 859 value = CoinMax(value, info->lower_[columnNumber_]); … … 863 872 value = targetValue+0.1; 864 873 } 865 CbcBranchingObject * branch = new CbcIntegerBranchingObject(model_,columnNumber_,way, 866 value); 867 branch->setOriginalObject(this); 868 return branch; 874 branch->fillPart(columnNumber_,way,value); 869 875 } 870 876 /* Column number if single column object -1 otherwise, … … 946 952 { 947 953 int iColumn = variable; 954 assert (model_->solver()->getNumCols()>0); 948 955 down_[0] = model_->solver()->getColLower()[iColumn]; 949 956 down_[1] = floor(value_); … … 955 962 numberExtraChangedBounds_ = 0; 956 963 #endif 964 } 965 // Does part of constructor 966 void 967 CbcIntegerBranchingObject::fillPart (int variable, 968 int way , double value) 969 { 970 //originalObject_=NULL; 971 branchIndex_=0; 972 value_=value; 973 numberBranches_=2; 974 //model_= model; 975 //originalCbcObject_=NULL; 976 variable_=variable; 977 way_=way; 978 int iColumn = variable; 979 down_[0] = model_->solver()->getColLower()[iColumn]; 980 down_[1] = floor(value_); 981 up_[0] = ceil(value_); 982 up_[1] = model_->getColUpper()[iColumn]; 957 983 } 958 984 // Useful constructor for fixing -
trunk/Cbc/src/CbcBranchActual.hpp
r838 r848 6 6 #include "CbcBranchBase.hpp" 7 7 #include "CoinPackedMatrix.hpp" 8 8 class CbcIntegerBranchingObject; 9 9 /// Define a clique class 10 10 … … 250 250 virtual CbcBranchingObject * createBranch(OsiSolverInterface * solver, 251 251 const OsiBranchingInformation * info, int way) ; 252 /// Fills in a created branching object 253 void fillCreateBranch(CbcIntegerBranchingObject * branching, const OsiBranchingInformation * info, int way) ; 252 254 253 255 using CbcObject::solverBranch ; … … 438 440 /// Destructor 439 441 virtual ~CbcIntegerBranchingObject (); 440 442 443 /// Does part of constructor 444 void fillPart ( int variable, int way , double value) ; 441 445 using CbcBranchingObject::branch ; 442 446 /** \brief Sets the bounds for the variable according to the current arm -
trunk/Cbc/src/CbcBranchDynamic.cpp
r838 r848 132 132 method_(0) 133 133 { 134 #ifdef CBC_INSTRUMENT 135 numberTimesInfeasible_=0; 136 #endif 134 137 } 135 138 … … 166 169 method_(0) 167 170 { 171 #ifdef CBC_INSTRUMENT 172 numberTimesInfeasible_=0; 173 #endif 168 174 const double * cost = model->getObjCoefficients(); 169 175 double costValue = CoinMax(1.0e-5,fabs(cost[iColumn])); … … 231 237 method_(0) 232 238 { 239 #ifdef CBC_INSTRUMENT 240 numberTimesInfeasible_=0; 241 #endif 233 242 downDynamicPseudoCost_ = downDynamicPseudoCost; 234 243 upDynamicPseudoCost_ = upDynamicPseudoCost; … … 300 309 301 310 { 311 #ifdef CBC_INSTRUMENT 312 numberTimesInfeasible_=rhs.numberTimesInfeasible_; 313 #endif 302 314 } 303 315 … … 340 352 numberTimesUpTotalFixed_ = rhs.numberTimesUpTotalFixed_; 341 353 numberTimesProbingTotal_ = rhs.numberTimesProbingTotal_; 354 #ifdef CBC_INSTRUMENT 355 numberTimesInfeasible_=rhs.numberTimesInfeasible_; 356 #endif 342 357 method_=rhs.method_; 343 358 } … … 612 627 else 613 628 distanceToCutoff = 1.0e2 + fabs(objectiveValue); 629 distanceToCutoff = CoinMax(distanceToCutoff,1.0e-12*(1.0+fabs(objectiveValue))); 614 630 #endif 615 631 double sum; … … 694 710 return 0.0; 695 711 } else { 712 #ifdef CBC_INSTRUMENT 713 numberTimesInfeasible_++; 714 #endif 696 715 int stateOfSearch = model_->stateOfSearch()%10; 697 716 double returnValue=0.0; … … 760 779 returnValue *= 1.0e-3; 761 780 } 781 #ifdef CBC_INSTRUMENT 782 int nn = numberTimesInfeasible_ - CoinMax(numberTimesUp_,numberTimesDown_); 783 assert (nn>=0); 784 if (nn) 785 returnValue *= sqrt((double) nn); 786 #endif 762 787 #ifdef COIN_DEVELOP 763 788 History hist; … … 809 834 distanceToCutoff = 1.0e2 + fabs(objectiveValue); 810 835 #endif 836 distanceToCutoff = CoinMax(distanceToCutoff,1.0e-12*(1.0+fabs(objectiveValue))); 811 837 double sum; 812 838 int number; … … 1036 1062 double change = data.change_; 1037 1063 #define TYPERATIO 0.9 1038 #define MINIMUM_MOVEMENT 0. 01064 #define MINIMUM_MOVEMENT 0.1 1039 1065 #ifdef COIN_DEVELOP 1040 1066 History hist; … … 1102 1128 if (distanceToCutoff>1.0e20) 1103 1129 distanceToCutoff=10.0+fabs(originalValue); 1104 sum += numberTimesDownInfeasible_* distanceToCutoff;1130 sum += numberTimesDownInfeasible_*CoinMax(distanceToCutoff,1.0e-12*(1.0+fabs(originalValue))); 1105 1131 number += numberTimesDownInfeasible_; 1106 1132 setDownDynamicPseudoCost(sum/(double) number); … … 1166 1192 if (distanceToCutoff>1.0e20) 1167 1193 distanceToCutoff=10.0+fabs(originalValue); 1168 sum += numberTimesUpInfeasible_* distanceToCutoff;1194 sum += numberTimesUpInfeasible_*CoinMax(distanceToCutoff,1.0e-12*(1.0+fabs(originalValue))); 1169 1195 number += numberTimesUpInfeasible_; 1170 1196 setUpDynamicPseudoCost(sum/(double) number); … … 1232 1258 numberTimesUp_,numberTimesUpInfeasible_,meanUp,devUp); 1233 1259 #else 1234 printf("%d down %d times (%d inf) mean %g up %d times (%d inf) mean %g\n", 1260 int n=0; 1261 #ifdef CBC_INSTRUMENT 1262 n=numberTimesInfeasible_; 1263 #endif 1264 printf("%d down %d times (%d inf) mean %g up %d times (%d inf) mean %g - pseudocosts %g %g - inftimes %d\n", 1235 1265 columnNumber_, 1236 1266 numberTimesDown_,numberTimesDownInfeasible_,meanDown, 1237 numberTimesUp_,numberTimesUpInfeasible_,meanUp );1267 numberTimesUp_,numberTimesUpInfeasible_,meanUp,downDynamicPseudoCost_,upDynamicPseudoCost_,n); 1238 1268 #endif 1239 1269 } else { … … 1253 1283 else 1254 1284 distanceToCutoff = 1.0e2 + fabs(objectiveValue); 1285 distanceToCutoff = CoinMax(distanceToCutoff,1.0e-12*(1.0+fabs(objectiveValue))); 1255 1286 double sum; 1256 1287 int number; … … 1298 1329 object_=object; 1299 1330 } 1331 // Does part of work for constructor 1332 void 1333 CbcDynamicPseudoCostBranchingObject::fillPart (int variable, 1334 int way , double value, 1335 CbcSimpleIntegerDynamicPseudoCost * object) 1336 { 1337 CbcIntegerBranchingObject::fillPart(variable,way,value); 1338 changeInGuessed_=1.0e-5; 1339 object_=object; 1340 } 1300 1341 // Useful constructor for fixing 1301 1342 CbcDynamicPseudoCostBranchingObject::CbcDynamicPseudoCostBranchingObject (CbcModel * model, … … 1335 1376 return (new CbcDynamicPseudoCostBranchingObject(*this)); 1336 1377 } 1337 1338 1378 1339 1379 // Destructor … … 1687 1727 else 1688 1728 distanceToCutoff = 1.0e2 + fabs(objectiveValue); 1729 distanceToCutoff = CoinMax(distanceToCutoff,1.0e-12*(1.0+fabs(objectiveValue))); 1689 1730 double continuousObjective = model->getContinuousObjective(); 1690 1731 double distanceToCutoffC = model->getCutoff() - continuousObjective; 1691 1732 if (distanceToCutoffC>1.0e20) 1692 1733 distanceToCutoffC = 1.0e2 + fabs(objectiveValue); 1734 distanceToCutoffC = CoinMax(distanceToCutoffC,1.0e-12*(1.0+fabs(objectiveValue))); 1693 1735 int numberInfC = model->getContinuousInfeasibilities(); 1694 1736 double perInf = distanceToCutoffC/((double) numberInfC); -
trunk/Cbc/src/CbcBranchDynamic.hpp
r838 r848 67 67 virtual CbcBranchingObject * createBranch(OsiSolverInterface * solver, 68 68 const OsiBranchingInformation * info, int way) ; 69 /// Fills in a created branching object 70 void fillCreateBranch(CbcIntegerBranchingObject * branching, const OsiBranchingInformation * info, int way) ; 71 69 72 70 73 /** Pass in information on branch just done and create CbcObjectUpdateData instance. … … 297 300 /// Number of times probing done 298 301 int numberTimesProbingTotal_; 302 /// Number of times infeasible when tested 303 #define CBC_INSTRUMENT 304 #ifdef CBC_INSTRUMENT 305 mutable int numberTimesInfeasible_; 306 #endif 299 307 /** Method - 300 308 0 - pseudo costs … … 354 362 /// Destructor 355 363 virtual ~CbcDynamicPseudoCostBranchingObject (); 364 365 /// Does part of constructor 366 void fillPart (int variable, 367 int way , double value, 368 CbcSimpleIntegerDynamicPseudoCost * object) ; 356 369 357 370 using CbcBranchingObject::branch ; … … 377 390 inline CbcSimpleIntegerDynamicPseudoCost * object() const 378 391 { return object_;} 392 /// Set object 393 inline void setObject(CbcSimpleIntegerDynamicPseudoCost * object) 394 { object_=object;} 379 395 protected: 380 396 /// Change in guessed objective value for next branch -
trunk/Cbc/src/unitTestClp.cpp
r843 r848 376 376 << "; error=" << fabs(objValue[m] - soln); 377 377 numberFailures++; 378 #ifdef COIN_DEVELOP378 //#ifdef COIN_DEVELOP 379 379 abort(); 380 #endif380 //#endif 381 381 } 382 382 } else {
Note: See TracChangeset
for help on using the changeset viewer.