5 #include "CoinPragma.hpp" 
    7 #include "CoinTime.hpp" 
   12 #include "CbcModel.hpp" 
   18       CoinMessages((
int) BON_CHOOSE_MESSAGES_DUMMY_END)
 
   20     strcpy(source_,
"BON");
 
   25         "list_[%5d] = %5d, usefull_[%5d] = %.16e %.16e");
 
   27         "list_[%3d] = %3d useful_[%3d] = %e");
 
   29         "list2[%3d] = %3d useful2[%3d] = %e");
 
   31         " Starting strong branching. Obj. val = %g\n");
 
   33         "           Var    Value            DownStat    DownChange     UpStat      UpChange");
 
   35         "    %3d    %3d    %.6e      %6s    %.6e   %6s    %.6e");
 
   43       OsiChooseVariable(solver),
 
   62     options->GetEnumValue(
"candidate_sort_criterion", sortCrit, b.
prefix());
 
   63 #ifndef OLD_USEFULLNESS 
   64     sortCrit_ = (CandidateSortCriterion) sortCrit;
 
   67     int numberObjects = solver_->numberObjects();
 
   71     pseudoCosts_.setNumberBeforeTrusted(numberBeforeTrusted);
 
   88       OsiChooseVariable(rhs),
 
   89       results_(rhs.results_),
 
   90       time_limit_(rhs.time_limit_),
 
   91       start_time_(CoinCpuTime()),
 
   92       cbc_model_(rhs.cbc_model_),
 
   93       only_pseudo_when_trusted_(rhs.only_pseudo_when_trusted_),
 
   94       maxmin_crit_no_sol_(rhs.maxmin_crit_no_sol_),
 
   95       maxmin_crit_have_sol_(rhs.maxmin_crit_have_sol_),
 
   96       setup_pseudo_frac_(rhs.setup_pseudo_frac_),
 
   97       numberBeforeTrustedList_(rhs.numberBeforeTrustedList_),
 
   98       numberStrongRoot_(rhs.numberStrongRoot_),
 
  100       sortCrit_(rhs.sortCrit_),
 
  102       numberLookAhead_(rhs.numberLookAhead_),
 
  103       minNumberStrongBranch_(rhs.minNumberStrongBranch_),
 
  104       pseudoCosts_(rhs.pseudoCosts_),
 
  105       trustStrongForPseudoCosts_(rhs.trustStrongForPseudoCosts_)
 
  117       OsiChooseVariable::operator=(rhs);
 
  129 #ifndef OLD_USEFULLNESS 
  130       sortCrit_ = rhs.sortCrit_;
 
  157     roptions->AddStringOption4(
"candidate_sort_criterion",
 
  158         "Choice of the criterion to choose candidates in strong-branching",
 
  160         "best-ps-cost",
"Sort by decreasing pseudo-cost",
 
  161         "worst-ps-cost", 
"Sort by increasing pseudo-cost",
 
  162         "most-fractional", 
"Sort by decreasing integer infeasibility",
 
  163         "least-fractional", 
"Sort by increasing integer infeasibility",
"");
 
  165     roptions->setOptionExtraInfo(
"candidate_sort_criterion",63);
 
  167     roptions->AddBoundedNumberOption(
"setup_pseudo_frac", 
"Proportion of strong branching list that has to be taken from most-integer-infeasible list.",
 
  168         0., 
false, 1., 
false, 0.5);
 
  169     roptions->setOptionExtraInfo(
"setup_pseudo_frac",63);
 
  170     roptions->AddBoundedNumberOption(
"maxmin_crit_no_sol", 
"Weight towards minimum in of lower and upper branching estimates when no solution has been found yet.",
 
  171         0., 
false, 1., 
false, 0.7);
 
  172     roptions->setOptionExtraInfo(
"maxmin_crit_no_sol",63);
 
  173     roptions->AddBoundedNumberOption(
"maxmin_crit_have_sol", 
"Weight towards minimum in of lower and upper branching estimates when a solution has been found.",
 
  174         0., 
false, 1., 
false, 0.1);
 
  175     roptions->setOptionExtraInfo(
"maxmin_crit_have_sol",63);
 
  176     roptions->AddLowerBoundedIntegerOption(
"number_before_trust_list",
 
  177         "Set the number of branches on a variable before its pseudo costs are to be believed during setup of strong branching candidate list.",
 
  178         -1, 0, 
"The default value is that of \"number_before_trust\"");
 
  179     roptions->setOptionExtraInfo(
"number_before_trust_list",63);
 
  180     roptions->AddLowerBoundedIntegerOption(
"number_strong_branch_root",
 
  181         "Maximum number of variables considered for strong branching in root node.",
 
  182         0, COIN_INT_MAX, 
"");
 
  183     roptions->setOptionExtraInfo(
"number_strong_branch_root",63);
 
  185     roptions->AddLowerBoundedIntegerOption(
"min_number_strong_branch", 
"Sets minimum number of variables for strong branching (overriding trust)",
 
  187     roptions->setOptionExtraInfo(
"min_number_strong_branch",63);
 
  188     roptions->AddStringOption2(
"trust_strong_branching_for_pseudo_cost",
 
  189                                "Whether or not to trust strong branching results for updating pseudo costs.",
 
  195     roptions->setOptionExtraInfo(
"trust_strong_branching_for_pseudo_cost", 63);
 
  197     roptions->AddLowerBoundedIntegerOption(
"number_look_ahead", 
"Sets limit of look-ahead strong-branching trials",
 
  199     roptions->setOptionExtraInfo(
"number_look_ahead", 31);
 
  206     const double* upTotalChange = 
pseudoCosts_.upTotalChange();
 
  207     const double* downTotalChange = 
pseudoCosts_.downTotalChange();
 
  213     double numberDown=0.0;
 
  214     for (
int i=
pseudoCosts_.numberObjects() - 1; i >= 0; --i) {
 
  215       sumUp += upTotalChange[i];
 
  216       numberUp += upNumber[i];
 
  217       sumDown += downTotalChange[i];
 
  218       numberDown += downNumber[i];
 
  220       <<i<< upNumber[i]<< upTotalChange[i]
 
  221       << downNumber[i]<< downTotalChange[i]<<CoinMessageEol;
 
  223     upMult=(1.0+sumUp)/(1.0+numberUp);
 
  224     downMult=(1.0+sumDown)/(1.0+numberDown);
 
  227     <<upMult<< downMult<<CoinMessageEol;
 
  232       const double upMult, 
const double downMult,
 
  234       const OsiObject* 
object, 
int i,
 
  235       double& value2)
 const 
  237 #ifdef OLD_USEFULLNESS 
  240   double sumDown = 
pseudoCosts_.downTotalChange()[i]+1.0e-30;
 
  242   double upEst = 
object->upEstimate();
 
  243   double downEst = 
object->downEstimate();
 
  244   upEst = numberUp ? ((upEst*sumUp)/numberUp) : (upEst*upMult);
 
  247   downEst = numberDown ? ((downEst*sumDown)/numberDown) : (downEst*downMult);
 
  250   double useful = ( MAXMIN_CRITERION*CoinMin(upEst,downEst) +
 
  251                     (1.0-MAXMIN_CRITERION)*CoinMax(upEst,downEst) );
 
  252   value2 = -COIN_DBL_MAX;
 
  261     if (sortCrit_ >= DecrPs && sortCrit_ <= IncrPs) {
 
  263       double sumDown = 
pseudoCosts_.downTotalChange()[i]+1.0e-30;
 
  264       double upEst = 
object->upEstimate();
 
  265       double downEst = 
object->downEstimate();
 
  266       upEst = numberUp ? ((upEst*sumUp)/numberUp) : (upEst*upMult);
 
  269       downEst = numberDown ? ((downEst*sumDown)/numberDown) : (downEst*downMult);
 
  272       double useful = ( MAXMIN_CRITERION*CoinMin(upEst,downEst) +
 
  273           (1.0-MAXMIN_CRITERION)*CoinMax(upEst,downEst) );
 
  274       if (numberUp == 0 || numberDown == 0) {
 
  275         if (value == 0.) useful = 0;
 
  276         else if (MAXMIN_CRITERION >= 0.5)
 
  277           useful =  CoinMin(upEst, downEst);
 
  279           useful = CoinMax(upEst, downEst);
 
  282       value2 = -COIN_DBL_MAX;
 
  289       <<i<< useful<< upEst<< downEst<< value<< value2<< CoinMessageEol;
 
  292 #ifndef OLD_USEFULLNESS 
  293     else if (sortCrit_ >= DecrInfeas && sortCrit_ <= IncrInfeas) {
 
  294       double usefull = value;
 
  299       throw CoinError(
"BonChooseVariable", 
"computeUsefullnee",
 
  300           "Unknown criterion for soring candidates");
 
  311       return OsiChooseVariable::setupList(info, initialize);
 
  315       delete [] goodSolution_;
 
  318       numberStrongIterations_ = 0;
 
  319       numberStrongFixed_ = 0;
 
  320       goodSolution_ = NULL;
 
  321       goodObjectiveValue_ = COIN_DBL_MAX;
 
  325       throw CoinError(
CNAME,
"setupList",
"Should not be called with initialize==false");
 
  328     numberUnsatisfied_=0;
 
  329     int numberObjects = solver_->numberObjects();
 
  330     assert (numberObjects);
 
  337       int saveNumberBeforeTrusted = 
pseudoCosts_.numberBeforeTrusted();
 
  339       pseudoCosts_.setNumberBeforeTrusted(saveNumberBeforeTrusted);
 
  341     double check = -COIN_DBL_MAX;
 
  343     int bestPriority=COIN_INT_MAX;
 
  346     int putOther = numberObjects;
 
  348     for (i=0;i<numberObjects;i++) {
 
  354     double* useful2 = NULL;
 
  355     double check2 = -COIN_DBL_MAX;
 
  359       max_most_fra = CoinMax(1, max_most_fra);
 
  362       list2 = 
new int[max_most_fra];
 
  363       useful2 = 
new double[max_most_fra];
 
  364       for (i=0;i<max_most_fra;i++) {
 
  370     OsiObject ** 
object = info->solver_->objects();
 
  371     double upMultiplier, downMultiplier;
 
  375     bool feasible = 
true;
 
  376     const double MAXMIN_CRITERION = 
maxminCrit(info);
 
  377     for ( i=0;i<numberObjects;i++) {
 
  379       double value = 
object[i]->infeasibility(info,way);
 
  381         numberUnsatisfied_++;
 
  387         int priorityLevel = 
object[i]->priority();
 
  389         if (priorityLevel<bestPriority) {
 
  390           for (
int j=maximumStrong-1;
j>=0;
j--) {
 
  392               int iObject = list_[
j];
 
  395               list_[--putOther]=iObject;
 
  398           maximumStrong = CoinMin(maximumStrong,putOther);
 
  399           bestPriority = priorityLevel;
 
  402           check2=-COIN_DBL_MAX;
 
  405           if (max_most_fra>0) {
 
  406             for (
int j=0;
j<max_most_fra;
j++) {
 
  412         if (priorityLevel==bestPriority) {
 
  416               upMultiplier, downMultiplier, value,
 
  417               object[i], i, value2);
 
  420             int iObject = list_[checkIndex];
 
  422               assert (list_[putOther-1]<0);
 
  423               list_[--putOther]=iObject;  
 
  426             assert (checkIndex<putOther);
 
  427             useful_[checkIndex]=value;
 
  430             maximumStrong = CoinMin(maximumStrong,putOther);
 
  431             for (
int j=0;
j<maximumStrong;
j++) {
 
  433                 if (useful_[
j]<check) {
 
  447             assert (list_[putOther-1]<0);
 
  449             maximumStrong = CoinMin(maximumStrong,putOther);
 
  451           if (max_most_fra > 0 && value2>check2) {
 
  454             list2[checkIndex2]=i;
 
  455             useful2[checkIndex2]=value2;
 
  458             for (
int j=0;
j<max_most_fra;
j++) {
 
  460                 if (useful2[
j]<check2) {
 
  476           assert (list_[putOther-1]<0);
 
  478           maximumStrong = CoinMin(maximumStrong,putOther);
 
  483     for (
int i=0; i<maximumStrong; i++) {
 
  486       <<list_[i]<<i<<useful_[i]<<
object[list_[i]]->infeasibility(info,way)
 
  493       maximumStrong = CoinMin(maximumStrong,putOther);
 
  494       for (i=0;i<maximumStrong;i++) {
 
  496 #ifdef OLD_USEFULLNESS 
  497         list_[numberOnList_]=list_[i];
 
  498         useful_[numberOnList_++]=-useful_[i];
 
  501           list_[numberOnList_]=list_[i];
 
  502           if ((sortCrit_ & 1) == 0) {
 
  503             useful_[numberOnList_++]=-useful_[i];
 
  505           else useful_[numberOnList_++] = useful_[i];
 
  508           <<list_[numberOnList_-1]<<numberOnList_-1<<useful_[numberOnList_-1]
 
  514         if (max_most_fra > 0 && numberOnList_ >= maximumStrong) {
 
  518           for (i=0;i<max_most_fra;i++) {
 
  528             CoinSort_2(list_,list_+numberOnList_,useful_);
 
  532             for (i=0; i<numberObjects; i++) {
 
  533               bool found1 = (list_[i1]==i);
 
  534               bool found2 = (list2[i2]==i);
 
  535               if (found1 && found2) {
 
  536                 useful_[i1] = -1e150*(1.+useful2[i2]);
 
  541               if (i2==max_most_fra) 
break;
 
  545                 list_[numberOnList_+tmp_on_list] = list2[i];
 
  546                 useful_[numberOnList_+tmp_on_list] = -1e150*(1.+useful2[i]);
 
  553         CoinSort_2(useful_,useful_+numberOnList_+tmp_on_list,list_);
 
  556         for (;putOther<numberObjects;putOther++)
 
  557           list_[i++]=list_[putOther];
 
  558         assert (i==numberUnsatisfied_);
 
  565       numberUnsatisfied_=-1;
 
  568     info->defaultDual_ = -1.0; 
 
  569     delete [] info->usefulRegion_;
 
  570     delete [] info->indexRegion_;
 
  576       for (
int i=0; i<numberOnList_; i++){
 
  578         <<
object[list_[i]]->infeasibility(info,way)
 
  582     return numberUnsatisfied_;
 
  600     OsiSolverInterface * solver,
 
  601     OsiBranchingInformation *
info,
 
  608     int numberStrong = numberStrong_;
 
  612     std::vector<double> save_sol;
 
  614        save_sol.resize(info->numberColumns_);
 
  615        std::copy(info->solution_, info->solution_ + info->numberColumns_ , save_sol.begin());
 
  617     if (numberUnsatisfied_) {
 
  618       const double* upTotalChange = 
pseudoCosts_.upTotalChange();
 
  619       const double* downTotalChange = 
pseudoCosts_.downTotalChange();
 
  622       int numberBeforeTrusted = 
pseudoCosts_.numberBeforeTrusted();
 
  623       int numberLeft = CoinMin(numberStrong -numberStrongDone_,numberUnsatisfied_);
 
  626       bestObjectIndex_ = -1;
 
  628       firstForcedObjectIndex_ = -1;
 
  629       firstForcedWhichWay_ =-1;
 
  630       double bestTrusted=-COIN_DBL_MAX;
 
  631       for (
int i=0;i<numberLeft;i++) {
 
  632         int iObject = list_[i];
 
  633         if (numberBeforeTrusted == 0||
 
  637               ( !isRoot && (upNumber[iObject]<numberBeforeTrusted ||
 
  638                           downNumber[iObject]<numberBeforeTrusted ))||
 
  639               ( isRoot && (!upNumber[iObject] && !downNumber[iObject])) ) {
 
  642                                 solver->objects(), iObject));
 
  645           const OsiObject * obj = solver->object(iObject);
 
  646           double upEstimate = (upTotalChange[iObject]*obj->upEstimate())/upNumber[iObject];
 
  647           double downEstimate = (downTotalChange[iObject]*obj->downEstimate())/downNumber[iObject];
 
  649           double value = MAXMIN_CRITERION*CoinMin(upEstimate,downEstimate) + (1.0-MAXMIN_CRITERION)*CoinMax(upEstimate,downEstimate);
 
  650           if (value > bestTrusted) {
 
  651             bestObjectIndex_=iObject;
 
  652             bestWhichWay_ = upEstimate>downEstimate ? 0 : 1;
 
  661           OsiObject ** obj = solver->objects();
 
  662           const char* stat_msg[] = {
"NOTDON", 
"FEAS", 
"INFEAS", 
"NOFINI"};
 
  665           for (
unsigned int i = 0; i< 
results_.size(); i++) {
 
  666             double up_change = 
results_[i].upChange();
 
  667             double down_change = 
results_[i].downChange();
 
  668             int up_status = 
results_[i].upStatus();
 
  669             int down_status = 
results_[i].downStatus();
 
  670             int icol = obj[
results_[i].whichObject()]->columnNumber();
 
  671             double val = save_sol[icol];
 
  673             <<stat_msg[up_status+1]<< up_change<< CoinMessageEol;
 
  676         if (returnCode>=0&&returnCode<=2) {
 
  679             if (bestObjectIndex_>=0)
 
  682           for (
unsigned int i=0;i < 
results_.size();i++) {
 
  683             int iObject = 
results_[i].whichObject();
 
  690               upEstimate = 
results_[i].upChange();
 
  694               if (info->cutoff_<1.0e50)
 
  695                 upEstimate = 2.0*(info->cutoff_-info->objectiveValue_);
 
  697                 upEstimate = 2.0*fabs(info->objectiveValue_);
 
  698               if (firstForcedObjectIndex_ <0) {
 
  700                 firstForcedObjectIndex_ = iObject;
 
  701                 firstForcedWhichWay_ =0;
 
  705                 const OsiObject * obj = solver->object(iObject);
 
  706                 OsiBranchingObject * branch = obj->createBranch(solver,info,0);
 
  707                 branch->branch(solver);
 
  713               assert (
results_[i].downStatus()>=0);
 
  714               downEstimate = 
results_[i].downChange();
 
  718               if (info->cutoff_<1.0e50)
 
  719                 downEstimate = 2.0*(info->cutoff_-info->objectiveValue_);
 
  721                 downEstimate = 2.0*fabs(info->objectiveValue_);
 
  722               if (firstForcedObjectIndex_ <0) {
 
  723                 firstForcedObjectIndex_ = iObject;
 
  724                 firstForcedWhichWay_ =1;
 
  728                 const OsiObject * obj = solver->object(iObject);
 
  729                 OsiBranchingObject * branch = obj->createBranch(solver,info,1);
 
  730                 branch->branch(solver);
 
  735             double value = MAXMIN_CRITERION*CoinMin(upEstimate,downEstimate) + (1.0-MAXMIN_CRITERION)*CoinMax(upEstimate,downEstimate);
 
  736             if (value>bestTrusted) {
 
  738               bestObjectIndex_ = iObject;
 
  739               bestWhichWay_ = upEstimate>downEstimate ? 0 : 1;
 
  741               const OsiObject * obj = solver->object(iObject);
 
  742               if (obj->preferredWay()>=0&&obj->infeasibility())
 
  743                 bestWhichWay_ = obj->preferredWay();
 
  749         else if (returnCode==3) {
 
  751           bestObjectIndex_ = list_[0];
 
  757         bestObjectIndex_=list_[0];
 
  759       if ( bestObjectIndex_ >=0 ) {
 
  760         OsiObject * obj = solver->objects()[bestObjectIndex_];
 
  761         obj->setWhichWay(bestWhichWay_);
 
  766       if (numberFixed==numberUnsatisfied_&&numberFixed)
 
  788                                     OsiBranchingInformation *
info,
 
  789                                     int numberToDo, 
int returnCriterion)
 
  792     double bestLookAhead_ = -COIN_DBL_MAX;
 
  793     int trialsSinceBest_ = 0;
 
  796     double * saveLower = NULL;
 
  797     double * saveUpper = NULL;
 
  798     int numberColumns = solver->getNumCols();
 
  799     solver->markHotStart();
 
  800     const double * lower = info->lower_;
 
  801     const double * upper = info->upper_;
 
  802     saveLower = CoinCopyOfArray(info->lower_,numberColumns);
 
  803     saveUpper = CoinCopyOfArray(info->upper_,numberColumns);
 
  805     double timeStart = CoinCpuTime();
 
  807     for (;iDo<numberToDo;iDo++) {
 
  810       OsiBranchingObject * branch = result->branchingObject();
 
  811       assert (branch->numberBranches()==2);
 
  817       OsiSolverInterface * thisSolver = solver; 
 
  818       if (branch->boundBranch()) {
 
  820         branch->branch(solver);
 
  822         solver->solveFromHotStart() ;
 
  827         thisSolver = solver->
clone();
 
  828         branch->branch(thisSolver);
 
  831         thisSolver->getIntParam(OsiMaxNumIterationHotStart,limit);
 
  832         thisSolver->setIntParam(OsiMaxNumIteration,limit); 
 
  833         thisSolver->resolve();
 
  840         if (trustStrongForSolution_) {
 
  841         info->cutoff_ = goodObjectiveValue_;
 
  845       if(solver->getRowCutDebugger() && status0 == 1 ){
 
  849       numberStrongIterations_ += thisSolver->getIterationCount();
 
  850       if (solver!=thisSolver)
 
  853       for (
int j=0;
j<numberColumns;
j++) {
 
  854         if (saveLower[
j] != lower[
j])
 
  855         solver->setColLower(j,saveLower[j]);
 
  856         if (saveUpper[j] != upper[j])
 
  857         solver->setColUpper(j,saveUpper[j]);
 
  863       if (branch->boundBranch()) {
 
  865         branch->branch(solver);
 
  868         solver->solveFromHotStart() ;
 
  871         thisSolver = solver->clone();
 
  872         branch->branch(thisSolver);
 
  875         thisSolver->getIntParam(OsiMaxNumIterationHotStart,limit);
 
  876         thisSolver->setIntParam(OsiMaxNumIteration,limit); 
 
  879         thisSolver->resolve();
 
  887         if (trustStrongForSolution_) {
 
  888         info->cutoff_ = goodObjectiveValue_;
 
  892       if(solver->getRowCutDebugger() && status1 == 1){
 
  896       numberStrongIterations_ += thisSolver->getIterationCount();
 
  897       if (solver!=thisSolver)
 
  900       for (
int j=0;
j<numberColumns;
j++) {
 
  901         if (saveLower[
j] != lower[
j])
 
  902         solver->setColLower(j,saveLower[j]);
 
  903         if (saveUpper[j] != upper[j])
 
  904         solver->setColUpper(j,saveUpper[j]);
 
  916       if (status0==1&&status1==1) {
 
  920       } 
else if (status0==1||status1==1) {
 
  921         numberStrongFixed_++;
 
  924       bool hitMaxTime = ( CoinCpuTime()-timeStart > info->timeRemaining_)
 
  932         assert(status0==0 && status1==0);
 
  933         double upEstimate = result->upChange();
 
  934         double downEstimate = result->downChange();
 
  936         double value = MAXMIN_CRITERION*CoinMin(upEstimate,downEstimate) + (1.0-MAXMIN_CRITERION)*CoinMax(upEstimate,downEstimate);
 
  937         if (value > bestLookAhead_) {
 
  938           bestLookAhead_ = value;
 
  939           trialsSinceBest_ = 0;
 
  949     if(iDo < numberToDo) iDo++;
 
  950     assert(iDo <= (
int) 
results_.size());
 
  955     solver->unmarkHotStart();
 
  961     return info->depth_ == 0;
 
  970       const int stateOfSearch = 
cbc_model_->stateOfSearch();
 
  971       const int depth = info->depth_;
 
  972       if (stateOfSearch>1 && depth>10) {
 
  982       int branch, OsiHotInfo * hotInfo)
 
  985     int index = hotInfo->whichObject();
 
  986     assert (index<solver_->numberObjects());
 
  987     const OsiObject * 
object = info->solver_->object(index);
 
  988     assert (object->upEstimate()>0.0&&
object->downEstimate()>0.0);
 
  991     double* downTotalChange = 
pseudoCosts_.downTotalChange();
 
  998       if (hotInfo->upStatus()==0) {
 
  999         assert (hotInfo->upStatus()>=0);
 
 1000         upTotalChange[index] += hotInfo->upChange()/
object->upEstimate();
 
 1003       else if (hotInfo->upStatus()==1) {
 
 1006         if (info->cutoff_<1.0e50)
 
 1007           upTotalChange[index] += 2.0*(info->cutoff_-info->objectiveValue_)/object->upEstimate();
 
 1009           upTotalChange[index] += 2.0*fabs(info->objectiveValue_)/
object->upEstimate();
 
 1013       if (hotInfo->downStatus()==0) {
 
 1014         assert (hotInfo->downStatus()>=0);
 
 1015         downTotalChange[index] += hotInfo->downChange()/
object->downEstimate();
 
 1016         downNumber[index]++;
 
 1018       else if (hotInfo->downStatus()==1) {
 
 1019         downNumber[index]++;
 
 1021         if (info->cutoff_<1.0e50)
 
 1022           downTotalChange[index] += 2.0*(info->cutoff_-info->objectiveValue_)/object->downEstimate();
 
 1024           downTotalChange[index] += 2.0*fabs(info->objectiveValue_)/
object->downEstimate();
 
 1032                                       double changeInObjective, 
double changeInValue, 
 
 1036   assert (index<solver_->numberObjects()); 
 
 1039   if(fabs(changeInValue) < 1
e-6) 
return;
 
 1042   double* downTotalChange = 
pseudoCosts_.downTotalChange(); 
 
 1046     <<changeInObjective<<changeInValue<<status
 
 1052       upTotalChange[index] += changeInObjective/changeInValue; 
 
 1059       double objectiveValue = 
cbc_model_->getCurrentObjValue(); 
 
 1061         upTotalChange[index] += 2.0*(cutoff-objectiveValue)/changeInValue; 
 
 1063         upTotalChange[index] += 2.0*fabs(objectiveValue)/changeInValue; 
 
 1068       downTotalChange[index] += changeInObjective/changeInValue; 
 
 1069       downNumber[index]++; 
 
 1073       downNumber[index]++; 
 
 1075       double objectiveValue = 
cbc_model_->getCurrentObjValue(); 
 
 1077         downTotalChange[index] += 2.0*(cutoff-objectiveValue)/changeInValue; 
 
 1079         downTotalChange[index] += 2.0*fabs(objectiveValue)/changeInValue; 
 
 1089                     const OsiBranchingInformation *
info,
 
 1090                     const OsiObject * 
const * objects,
 
 1092   OsiHotInfo(solver, info, objects, whichObject),
 
 1098                                           infeasibilities_(other.infeasibilities_){
 
 1109       OsiHotInfo::operator=(rhs);
 
 1120                              const OsiBranchingInformation * 
info,
 
 1121                              OsiChooseVariable * choose){
 
 1123     int iBranch = branchingObject_->branchIndex()-1;
 
 1126     OsiObject ** objects = solver->objects();
 
 1127     int numObject = solver->numberObjects();
 
 1128     for(
int i = 0 ; i < numObject ; i++){
 
 1129        infeasibility += objects[i]->checkInfeasibility(info);
 
 1131     int status = OsiHotInfo::updateInformation(solver, info, choose);
 
 1133     if(!solver->isProvenPrimalInfeasible() && !solver->isProvenOptimal()){
 
 1135       statuses_[iBranch] = status;
 
 1137     else if(solver->isProvenPrimalInfeasible() && fabs(solver->getObjValue()) < 1
e-06) {
 
 1138       assert(solver->messageHandler() != NULL);
 
 1139       *solver->messageHandler() << 
"Very small infeasibility: " << solver->getObjValue() << CoinMessageEol;
 
 1141       statuses_[iBranch] = status;
 
int getIntParameter(const IntParameter &p) const 
Return value of integer parameter. 
 
virtual OsiHotInfo * clone() const 
Clone. 
 
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
 
HotInfo()
Default constructor. 
 
TNLPSolver::UnsolvedError * newUnsolvedError(int num, Ipopt::SmartPtr< TMINLP2TNLP > problem, std::string name)
 
virtual int setupList(OsiBranchingInformation *info, bool initialize)
Sets up strong list and clears all if initialize is true. 
 
virtual ~BonChooseVariable()
Destructor. 
 
virtual ~HotInfo()
Destructor. 
 
double setup_pseudo_frac_
fraction of branching candidates that are not trusted yet 
 
Ipopt::SmartPtr< Ipopt::Journalist > journalist()
Acces storage of Journalist for output. 
 
This class chooses a variable to branch on. 
 
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real fint fint fint fint * info
 
bool only_pseudo_when_trusted_
Flag indicating whether we don't want to mix strong branching and pseudo costs during the decision wh...
 
int trustStrongForPseudoCosts_
Wether or not to trust strong branching results for updating pseudo costs. 
 
bool isRootNode(const OsiBranchingInformation *info) const 
detecting if this is root node 
 
const TMINLP2TNLP * problem() const 
get pointer to the TMINLP2TNLP adapter 
 
Ipopt::SmartPtr< Ipopt::Journalist > jnlst_
Holding on the a pointer to the journalist. 
 
double maxmin_crit_no_sol_
maxmin weight in branching decision when no solution has been found yet 
 
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
 
double computeUsefulness(const double MAXMIN_CRITERION, const double upMult, const double dowMult, const double value, const OsiObject *object, int i, double &value2) const 
 
virtual void updateInformation(const OsiBranchingInformation *info, int branch, OsiHotInfo *hotInfo)
This is a utility function which does strong branching on a list of objects and stores the results in...
 
double maxminCrit(const OsiBranchingInformation *info) const 
Helper functions for setupList and chooseVariable. 
 
bool IsValid(const OSSmartPtr< U > &smart_ptr)
 
Number of candidates for strong branching. 
 
virtual OsiChooseVariable * clone() const 
Clone. 
 
double maxmin_crit_have_sol_
maxmin weight in branching decision when no solution has been found yet 
 
static const std::string CNAME
Stores the class name for throwing errors. 
 
int minNumberStrongBranch_
Always strong branch that many first candidate in the list regardless of numberTrusted. 
 
vector< HotInfo > results_
Stores strong branching results. 
 
HotInfo & operator=(const HotInfo &rhs)
Assignment operator. 
 
Minimum reliability before trust pseudo-costs. 
 
CoinMessageHandler & message(Messages_Types type) const 
 
void fint fint fint real fint real real real real real real real real real * e
 
A class to have all elements necessary to setup a branch-and-bound. 
 
int bb_log_level_
verbosity level 
 
CoinMessageHandler * handler_
Message handler. 
 
int number_not_trusted_
Number of variables put into the list because there were not trusted. 
 
int numberLookAhead_
number of look-ahead strong-branching steps 
 
double time_limit_
Global time limit for algorithm. 
 
CbcModel * cbc_model_
CbcModel, used to get status of search. 
 
void computeMultipliers(double &upMult, double &downMult) const 
 
int numberBeforeTrustedList_
number of times a branch has to happen so that it is trusted in setupList 
 
vector< double > infeasibilities_
infeasibilities of children 
 
#define ADD_MSG(Id, Type, Level, MSG)
 
int updateInformation(const OsiSolverInterface *solver, const OsiBranchingInformation *info, OsiChooseVariable *choose)
Fill in some usefull information after a strong branching is done: 
 
OsiPseudoCosts pseudoCosts_
Stores the pseudo costs. 
 
BonChooseVariable()
Default Constructor, forbiden for some reason. 
 
Ipopt::SmartPtr< Ipopt::OptionsList > options()
Acces list of Options. 
 
int numberStrongRoot_
number of strong branching points at root node 
 
virtual int doStrongBranching(OsiSolverInterface *solver, OsiBranchingInformation *info, int numberToDo, int returnCriterion)
This is a utility function which does strong branching on a list of objects and stores the results in...
 
const char * prefix() const 
Get prefix to use for options. 
 
BonChooseVariable & operator=(const BonChooseVariable &rhs)
Assignment operator. 
 
virtual int chooseVariable(OsiSolverInterface *solver, OsiBranchingInformation *info, bool fixVariables)
Choose a variable Returns - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All lo...
 
double start_time_
Starting time of algorithm.