Changeset 1956 for trunk


Ignore:
Timestamp:
Aug 17, 2013 11:28:45 AM (6 years ago)
Author:
forrest
Message:

correct some printing and allow RINS to start more easily in mini B&B

Location:
trunk/Cbc/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcHeuristic.cpp

    r1952 r1956  
    2424#include "CbcHeuristic.hpp"
    2525#include "CbcHeuristicFPump.hpp"
     26#include "CbcHeuristicRINS.hpp"
    2627#include "CbcEventHandler.hpp"
    2728#include "CbcStrategy.hpp"
     
    10171018                    model.setMaximumCutPassesAtRoot(CoinMin(20, CoinAbs(model_->getMaximumCutPassesAtRoot())));
    10181019                    model.setMaximumCutPasses(CoinMin(10, model_->getMaximumCutPasses()));
     1020                    // Set best solution (even if bad for this submodel)
     1021                    if (model_->bestSolution()) {
     1022                      const double * bestSolution = model_->bestSolution();
     1023                      int numberColumns2 = model.solver()->getNumCols();
     1024                      double * bestSolution2 = new double [numberColumns2];
     1025                      const int * originalColumns = process.originalColumns();
     1026                      for (int iColumn=0;iColumn<numberColumns2;iColumn++) {
     1027                        int jColumn = originalColumns[iColumn];
     1028                        bestSolution2[iColumn] = bestSolution[jColumn];
     1029                      }
     1030                      model.setBestSolution(bestSolution2,numberColumns2,
     1031                                            1.0e50,
     1032                                            false);
     1033                      model.setSolutionCount(1);
     1034                      maximumSolutions++;
     1035                      delete [] bestSolution2;
     1036                    }
    10191037                } else {
    10201038                    model.setSpecialOptions(saveModelOptions);
     
    11761194                  }
    11771195                }
     1196                // modify heuristics
     1197                for (int i = 0; i < model.numberHeuristics(); i++) {
     1198                  // reset lastNode
     1199                  CbcHeuristicRINS * rins =
     1200                    dynamic_cast<CbcHeuristicRINS*>(model.heuristic(i));
     1201                  if (rins) {
     1202                    rins->setLastNode(-1000);
     1203                    rins->setSolutionCount(0);
     1204                  }
     1205                }
    11781206                //printf("sol %x\n",inputSolution_);
    11791207                if (inputSolution_) {
     
    12631291                        // Not fast stuff
    12641292                        model.setFastNodeDepth(-1);
     1293                        //model.solver()->writeMps("before");
    12651294                    } else if (model.fastNodeDepth() >= 1000000) {
    12661295                        // already set
     
    19301959        int iColumn = integerVariable[i];
    19311960        double value = newSolution[iColumn];
    1932         double thisTolerance = integerTolerance;
     1961        //double thisTolerance = integerTolerance;
    19331962        if (fabs(floor(value + 0.5) - value) > integerTolerance) {
    19341963            double below = floor(value);
  • trunk/Cbc/src/CbcHeuristicDW.cpp

    r1955 r1956  
    335335  if (bestSolutionIn&&objectiveValue(bestSolutionIn)<bestObjective_-1.0e-5)
    336336    passInSolution(bestSolutionIn);
    337   printf("Before PASSes objective is %g\n",
    338          bestObjective_);
     337  char dwPrint[200];
     338  sprintf(dwPrint,"Before PASSes objective is %g",
     339          bestObjective_);
     340  model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     341    << dwPrint
     342    << CoinMessageEol;
    339343  double startTime = CoinCpuTime();
    340344  double startTimeElapsed = CoinGetTimeOfDay();
     
    344348  bool goodSolution=true;
    345349  int numberColumns = solver_->getNumCols();
     350  int logLevel = model_->messageHandler()->logLevel();
    346351  // For moment just OsiClp
    347352  OsiClpSolverInterface * solver = dynamic_cast<OsiClpSolverInterface *>
     
    375380  // Number of times block has helped improve solution
    376381  int * goodBlock = bigDjBlock+numberBlocks_;
    377   int * priorityBlock = goodBlock+numberBlocks_;
     382                                        int * priorityBlock = goodBlock+numberBlocks_;
    378383  int * orderBlock = priorityBlock+numberBlocks_;
    379384  // block can be fixed if nothing in master rows, maybe always same as continuous
     
    456461    }
    457462  }
    458   if (numberNoMaster)
    459     printf("*** %d blocks have no elements in master - can be solved seperately\n",
    460            numberNoMaster);
    461   printf("With initial best solution %d blocks were same as continuous, %d when just looking at integers\n",
    462          numberSameAsContinuous,numberSameAsContinuousJustInts);
     463  if (numberNoMaster) {
     464    sprintf(dwPrint,"*** %d blocks have no elements in master - can be solved seperately",
     465            numberNoMaster);
     466    model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     467      << dwPrint
     468      << CoinMessageEol;
     469  }
     470  sprintf(dwPrint,"With initial best solution %d blocks were same as continuous, %d when just looking at integers",
     471          numberSameAsContinuous,numberSameAsContinuousJustInts);
     472  model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     473    << dwPrint
     474    << CoinMessageEol;
    463475  for (pass_=0;pass_<numberPasses_;pass_++) {
    464476    double endTime2 = CoinCpuTime();
     
    467479#define SCALE_FACTOR 1.0
    468480#endif
    469     if (pass_)
    470       printf("PASS %d changed objective from %g to %g in %g seconds (%g elapsed) - total %g (%g elapsed) - current needed %d nodes %d - %s\n",
    471              pass_,lastObjective_*SCALE_FACTOR,
    472              bestObjective_*SCALE_FACTOR,endTime2-startTime2,
    473              endTime2Elapsed-startTime2Elapsed,
    474              endTime2-startTime,endTime2Elapsed-startTimeElapsed,
    475              nNeeded_,nNodes_,
    476              lastObjective_>bestObjective_+1.0e-3 ? "improving" : "");
     481    if (pass_) {
     482      sprintf(dwPrint,"PASS %d changed objective from %g to %g in %g seconds (%g elapsed) - total %g (%g elapsed) - current needed %d nodes %d - %s",
     483              pass_,lastObjective_*SCALE_FACTOR,
     484              bestObjective_*SCALE_FACTOR,endTime2-startTime2,
     485              endTime2Elapsed-startTime2Elapsed,
     486              endTime2-startTime,endTime2Elapsed-startTimeElapsed,
     487              nNeeded_,nNodes_,
     488              lastObjective_>bestObjective_+1.0e-3 ? "improving" : "");
     489      model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     490        << dwPrint
     491        << CoinMessageEol;
     492    }
    477493    if ((pass_%10)==9) {
    478494      for (int iImp=CoinMax(1,numberImproving-10);iImp<numberImproving;iImp++) {
     
    480496        int nBlocks = blocks[0];
    481497        blocks++;
    482         printf("Pass %d improved objective by %g using %d blocks - ",
     498        sprintf(dwPrint,"Pass %d improved objective by %g using %d blocks - ",
    483499               whenBetter[iImp],improvement[iImp],nBlocks);
    484         for (int i=0;i<nBlocks;i++)
    485           printf("%d ",blocks[i]);
    486         printf("\n");
    487       }
    488       int * count = new int [numberImproving+1];
    489       memset(count,0,(numberImproving+1)*sizeof(int));
    490       for (int i=0;i<numberBlocks_;i++)
    491         count[goodBlock[i]]++;
    492       for (int i=0;i<numberImproving;i++) {
    493         if (count[i])
    494           printf("%d blocks were involved in improvement %d times\n",
    495                  count[i],i);
    496       }
    497       delete [] count;
     500        model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     501          << dwPrint
     502          << CoinMessageEol;
     503        if (logLevel>1) {
     504          for (int i=0;i<nBlocks;i++)
     505            printf("%d ",blocks[i]);
     506          printf("\n");
     507        }
     508      }
     509      if (logLevel>1) {
     510        int * count = new int [numberImproving+1];
     511        memset(count,0,(numberImproving+1)*sizeof(int));
     512        for (int i=0;i<numberBlocks_;i++)
     513          count[goodBlock[i]]++;
     514        for (int i=0;i<numberImproving;i++) {
     515          if (count[i])
     516            printf("%d blocks were involved in improvement %d times\n",
     517                   count[i],i);
     518        }
     519        delete [] count;
     520      }
    498521    }
    499522    startTime2 = CoinCpuTime();
     
    501524    if (model_->getNodeCount()>=model_->getMaximumNodes()||
    502525        model_->maximumSecondsReached()) {
    503       printf("Exiting on time or interrupt\n");
     526      sprintf(dwPrint,"Exiting on time or interrupt");
     527      model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     528        << dwPrint
     529        << CoinMessageEol;
    504530      break;
    505531    }
     
    510536      if (solveState_<2) {
    511537              // more in
    512         printf("No improvement - think we need more variables ");
     538        sprintf(dwPrint,"No improvement - think we need more variables ");
     539        model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     540          << dwPrint
     541          << CoinMessageEol;
    513542        nNeeded_ += nNeeded_/10;
    514543        nNeeded_ = CoinMin(nNeeded_,800);
     
    517546      } else {
    518547        // more nodes fewer in
    519         printf("No improvement - stopped on nodes - think we need more nodes ");
     548        sprintf(dwPrint,"No improvement - stopped on nodes - think we need more nodes ");
     549        model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     550          << dwPrint
     551          << CoinMessageEol;
    520552        if (phase_) {
    521553          nNodes_ += nNodes_/5;
     
    540572      (*(functionPointer_))(this,NULL,8);
    541573    }
    542     printf("new needed %d, nodes %d\n",nNeeded_,nNodes_);
     574    sprintf(dwPrint,"new needed %d, nodes %d",nNeeded_,nNodes_);
     575    model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     576      << dwPrint
     577      << CoinMessageEol;
    543578    for ( int i=0 ; i<numberColumns ; ++i ) {
    544579      if (solver_->isInteger(i)) {
     
    692727          modelX.setLogLevel(0);
    693728          modelX.branchAndBound();
    694           printf("Block %d contobj %g intobj %g convdual %g\n",
    695                  iBlock,cObj,modelX.getObjValue(),convexityDual);
     729          sprintf(dwPrint,"Block %d contobj %g intobj %g convdual %g",
     730                  iBlock,cObj,modelX.getObjValue(),convexityDual);
     731          model_->messageHandler()->message(CBC_FPUMP2, model_->messages())
     732            << dwPrint
     733            << CoinMessageEol;
    696734          const double * bestSolutionX = modelX.bestSolution();
    697735          if (bestSolutionX) {
     
    834872        } else {
    835873          // free up
    836           printf("freeing block %d (already freed %d times) - dj %g, diff %g, diffint %g - %d columns (%d integer)\n",
    837                  iBlock,doneBlock[iBlock],blockDj[iBlock],
    838                  blockDiff[iBlock],blockDiffInt[iBlock],
    839                  startColumnBlock_[iBlock+1]-startColumnBlock_[iBlock],
    840                  intsInBlock_[iBlock]);
     874          sprintf(dwPrint,"freeing block %d (already freed %d times) - dj %g, diff %g, diffint %g - %d columns (%d integer)",
     875                  iBlock,doneBlock[iBlock],blockDj[iBlock],
     876                  blockDiff[iBlock],blockDiffInt[iBlock],
     877                  startColumnBlock_[iBlock+1]-startColumnBlock_[iBlock],
     878                  intsInBlock_[iBlock]);
     879          model_->messageHandler()->message(CBC_FPUMP2, model_->messages())
     880            << dwPrint
     881            << CoinMessageEol;
    841882          numberBlocksIn++;
    842883          doneBlock[iBlock]++;
     
    863904        }
    864905      }
    865       printf("%d big dj blocks found\n",nBigDjBlock);
     906      sprintf(dwPrint,"%d big dj blocks found",nBigDjBlock);
     907      model_->messageHandler()->message(CBC_FPUMP2, model_->messages())
     908        << dwPrint
     909        << CoinMessageEol;
    866910      if (nFreed)
    867911        break;
    868912      phase_=1; // round again
    869       printf("Changing phase\n");
     913      sprintf(dwPrint,"Changing phase");
     914      model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     915        << dwPrint
     916        << CoinMessageEol;
    870917      for (int i=0;i<numberBlocks_;i++)
    871918        whichBlock[i] += 1000000;
     
    909956      }
    910957    }
    911     printf("Fixed %d ints, %d c, %d m - free %d, %d, %d\n",
    912            nFixedInts,nFixedContinuous,nFixedMaster,
    913            nFreeInts,nFreeContinuous,nFreeMaster);
     958    sprintf(dwPrint,"Fixed %d ints, %d c, %d m - free %d, %d, %d",
     959            nFixedInts,nFixedContinuous,nFixedMaster,
     960            nFreeInts,nFreeContinuous,nFreeMaster);
     961    model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     962      << dwPrint
     963      << CoinMessageEol;
    914964    // But free up and then fix again
    915965    for ( int i=0 ; i<numberColumns ; ++i ) {
     
    934984    if (solver->getObjValue()>bestObjective_+1.0e-5*(1.0+fabs(bestObjective_))) {
    935985      // trouble
    936       for (int i=0;i<numberBlocks_;i++) {
    937         if (whenBlock[i]==pass_) {
    938           printf("Block %d free\n",i);
     986      if (logLevel>1) {
     987        for (int i=0;i<numberBlocks_;i++) {
     988          if (whenBlock[i]==pass_) {
     989            printf("Block %d free\n",i);
     990          }
    939991        }
    940992      }
     
    942994      const double * lower = solver->getColLower();
    943995      const double * upper = solver->getColUpper();
    944       printf("best obj %g\n",objectiveValue(bestSolution_));
    945       for ( int i=0 ; i<numberColumns ; ++i ) {
    946         double value = bestSolution_[i];
    947         if (value<lower[i]-1.0e-5||value>upper[i]+1.0e-5)
    948           printf("column %d (block %d) %g %g <= %g <= %g %g\n",
    949                  i,whichColumnBlock_[i],saveLower_[i],
    950                  lower[i],value,upper[i],saveUpper_[i]);
     996      if (logLevel>1) {
     997        printf("best obj %g\n",objectiveValue(bestSolution_));
     998        for ( int i=0 ; i<numberColumns ; ++i ) {
     999          double value = bestSolution_[i];
     1000          if (value<lower[i]-1.0e-5||value>upper[i]+1.0e-5)
     1001            printf("column %d (block %d) %g %g <= %g <= %g %g\n",
     1002                   i,whichColumnBlock_[i],saveLower_[i],
     1003                   lower[i],value,upper[i],saveUpper_[i]);
     1004        }
    9511005      }
    9521006      abort();
     
    9811035      abort();
    9821036    } else {
    983       printf("Reduced model has %d rows and %d columns\n",
     1037      sprintf(dwPrint,"Reduced model has %d rows and %d columns",
    9841038             model2->numberRows(),model2->numberColumns());
     1039      model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     1040        << dwPrint
     1041        << CoinMessageEol;
    9851042      //model2->setLogLevel(0);
    9861043      OsiClpSolverInterface solver2(model2);
     
    10461103        delete [] hotPriorities;
    10471104#endif
    1048         if (nFix)
    1049           printf("Fixed another %d integers\n",nFix);
     1105        if (logLevel>1) {
     1106          if (nFix)
     1107            printf("Fixed another %d integers\n",nFix);
     1108        }
    10501109        {
    10511110          // priorities
     
    11061165        (*(functionPointer_))(this,&model,2);
    11071166        model.branchAndBound();
    1108         printf("After B&B status %d objective %g\n",model.status(),
    1109                model.getMinimizationObjValue());
     1167        if (logLevel>1) {
     1168          printf("After B&B status %d objective %g\n",model.status(),
     1169                 model.getMinimizationObjValue());
     1170        }
    11101171        int modelStatus = model.status();
    11111172        model.solver()->setHintParam(OsiDoReducePrint, false, OsiHintDo, 0) ;
     
    11201181              double value =floor(bestSolution2[i]+0.5);
    11211182              if (fabs(bestSolution2[i]-value)>1.0e-5) {
    1122                 printf("bad %d %g\n",i,bestSolution2[i]);
     1183                if (logLevel>1) {
     1184                  printf("bad %d %g\n",i,bestSolution2[i]);
     1185                }
    11231186              } else {
    11241187                solver->setColLower(iColumn,value);
     
    11541217                   numberColumns*sizeof(double));
    11551218            bestObjective_ = model.getObjValue();
    1156             for (int i=0;i<numberColumns;i++) {
    1157               if (simplex->isInteger(i)) {
    1158                 if (fabs(bestSolution_[i]-floor(bestSolution_[i]+0.5))>1.0e-5) {
    1159                   printf("bad after %d %g\n",i,bestSolution_[i]);
     1219            if (logLevel>1) {
     1220              for (int i=0;i<numberColumns;i++) {
     1221                if (simplex->isInteger(i)) {
     1222                  if (fabs(bestSolution_[i]-floor(bestSolution_[i]+0.5))>1.0e-5) {
     1223                    printf("bad after %d %g\n",i,bestSolution_[i]);
     1224                  }
    11601225                }
    11611226              }
     
    11921257  delete [] improvingBlocks;
    11931258  delete basis;
     1259  if (bestObjective_<solutionValue) {
     1260    solutionValue = bestObjective_;
     1261    memcpy(betterSolution,bestSolution_,
     1262           solver_->getNumCols()*sizeof(double));
     1263  }
    11941264  return returnCode;
    11951265}
     
    12271297  int firstMaster=-1;
    12281298  int lastMaster=-2;
     1299  char dwPrint[200];
    12291300  // Column copy
    12301301  const CoinPackedMatrix * columnCopy = solver_->getMatrixByCol();
     
    13431414  numberBlocks_=0;
    13441415  if (firstMaster<lastMaster) {
    1345     printf("%d master rows %d <= < %d\n",lastMaster-firstMaster,
    1346            firstMaster,lastMaster);
     1416    sprintf(dwPrint,"%d master rows %d <= < %d",lastMaster-firstMaster,
     1417            firstMaster,lastMaster);
     1418    model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     1419      << dwPrint
     1420      << CoinMessageEol;
    13471421    for (int i=0;i<numberRows+2*numberColumns;i++)
    13481422      blockStart[i]=-1;
     
    14391513    if (numberMaster>halfway||largestRows*3>numberRows)
    14401514      useful=false;
    1441     printf("%s %d blocks (largest %d,%d), %d master rows (%d empty) out of %d, %d master columns (%d empty, %d integer) out of %d\n",
    1442            useful ? "**Useful" : "NoGood",
    1443            numberBlocks,largestRows,largestColumns,numberMaster,numberEmpty,numberRows,
    1444            numberMasterColumns,numberEmptyColumns,numberMasterIntegers,
    1445            numberColumns);
     1515    sprintf(dwPrint,"%s %d blocks (largest %d,%d), %d master rows (%d empty) out of %d, %d master columns (%d empty, %d integer) out of %d",
     1516            useful ? "**Useful" : "NoGood",
     1517            numberBlocks,largestRows,largestColumns,numberMaster,numberEmpty,numberRows,
     1518            numberMasterColumns,numberEmptyColumns,numberMasterIntegers,
     1519            numberColumns);
     1520    model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     1521      << dwPrint
     1522      << CoinMessageEol;
    14461523    // columnBlock is columnBlock and blockStart is rowBlock
    14471524    // See if we want to compress
     
    14501527      int newNumber=0;
    14511528      for (int i=0;i<numberBlocks;i++) {
    1452         printf("Block %d has %d rows and %d columns (%d elements, %d integers)\n",
     1529        sprintf(dwPrint,"Block %d has %d rows and %d columns (%d elements, %d integers)",
    14531530               i,blockCount[i],nextColumn[i],blockEls[i],countIntegers[i]);
     1531        model_->messageHandler()->message(CBC_FPUMP2, model_->messages())
     1532          << dwPrint
     1533          << CoinMessageEol;
    14541534        if (countIntegers[i]) {
    14551535          blockEls[i]=newNumber;
     
    14691549          columnBlock[i]=blockEls[iBlock];
    14701550      }
    1471       if (newNumber<numberBlocks)
    1472         printf("Number of blocks reduced from %d to %d\n",
     1551      if (newNumber<numberBlocks) {
     1552        sprintf(dwPrint,"Number of blocks reduced from %d to %d",
    14731553               numberBlocks,newNumber);
     1554        model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     1555          << dwPrint
     1556          << CoinMessageEol;
     1557      }
    14741558      numberBlocks=newNumber;
    14751559    }
     
    16851769          }
    16861770        }         
    1687         //printf("Block %d has affinity %d but zero with %d blocks\n",
     1771        //printf("Block %d has affinity %d but zero with %d blocks",
    16881772        //     iBlock,aff,nZero);
    16891773        nTotalZero+=nZero;
    16901774        base+=numberBlocks;
    16911775      }
    1692       printf("Total not affinity %d - average %g%%\n",
     1776      sprintf(dwPrint,"Total not affinity %d - average %g%%",
    16931777             nTotalZero,100.0*(static_cast<double>(nTotalZero)
    16941778                               /(numberBlocks*numberBlocks)));
     1779      model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     1780        << dwPrint
     1781        << CoinMessageEol;
    16951782     
    16961783      delete [] starts;
    16971784      delete [] build;
    16981785    } else {
    1699       printf("Too many blocks - no affinity\n");
     1786      sprintf(dwPrint,"Too many blocks - no affinity");
     1787      model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     1788        << dwPrint
     1789        << CoinMessageEol;
    17001790    }
    17011791    if (fullDWEverySoOften_>0) {
     
    17101800                      const int * whichBlocks)
    17111801{
     1802  char dwPrint[200];
    17121803  if (numberDW_+numberBlocksUsed>maximumDW_) {
    17131804    // extend
     
    17981889    }
    17991890    // see if already in
    1800     printf("block %d nel %d nelInt %d nelInt1 %d - weight %g (%g)\n",
     1891    sprintf(dwPrint,"block %d nel %d nelInt %d nelInt1 %d - weight %g (%g)",
    18011892           iBlock,nElInMaster,nElIntInMaster,nElIntInMaster1,
    18021893           thisWeight,thisWeightC);
     1894    model_->messageHandler()->message(CBC_FPUMP2, model_->messages())
     1895      << dwPrint
     1896      << CoinMessageEol;
    18031897    int iProposal;
    18041898    for (iProposal=0;iProposal<numberDW_;iProposal++) {
     
    18071901    }
    18081902    if (iProposal<numberDW_) {
    1809       printf("above looks like duplicate\n");
     1903      sprintf(dwPrint,"above looks like duplicate");
     1904      model_->messageHandler()->message(CBC_FPUMP2, model_->messages())
     1905        << dwPrint
     1906        << CoinMessageEol;
    18101907      memset(build,0,numberMasterRows_*sizeof(double));
    18111908      //iProposal=numberDW;
     
    18361933    }
    18371934    if (nEls+numberMasterRows_>MAX_ADD) {
    1838       printf("Adding %d proposals with %d elements - out of room\n",
     1935      sprintf(dwPrint,"Adding %d proposals with %d elements - out of room",
    18391936             nAdd,nEls);
     1937      model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     1938        << dwPrint
     1939        << CoinMessageEol;
    18401940      dwSolver_->addCols(nAdd,startsDW,rowDW,elementDW,newLower,
    18411941                        newUpper,newCost);
     
    18471947  }
    18481948  if (nAdd) {
    1849     printf("Adding %d proposals with %d elements\n",
     1949    sprintf(dwPrint,"Adding %d proposals with %d elements",
    18501950           nAdd,nEls);
     1951    model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     1952      << dwPrint
     1953      << CoinMessageEol;
    18511954    dwSolver_->addCols(nAdd,startsDW,rowDW,elementDW,newLower,
    1852                      newUpper,newCost);
     1955                       newUpper,newCost);
    18531956    nTotalAdded+=nAdd;
    18541957    numberDW_+=nAdd;
     
    19082011  int numberColumns = solver_->getNumCols();
    19092012  const double * objective = solver_->getObjCoefficients();
     2013  int logLevel = model_->messageHandler()->logLevel();
    19102014  for (int i=0;i<numberColumns;i++) {
    19112015    double value = solution[i];
    1912     if (solver_->isInteger(i)) {
    1913       if (fabs(value-floor(value+0.5))>1.0e-7)
    1914         printf("Bad integer value for %d of %g\n",i,value);
     2016    if (logLevel>1) {
     2017      if (solver_->isInteger(i)) {
     2018        if (fabs(value-floor(value+0.5))>1.0e-7)
     2019          printf("Bad integer value for %d of %g\n",i,value);
     2020      }
    19152021    }
    19162022    objectiveValue += objective[i]*value;
     
    20072113CbcHeuristicDW::setupDWStructures()
    20082114{
     2115  char dwPrint[200];
    20092116  random_=new double [numberMasterRows_];
    20102117  for (int i=0;i<numberMasterRows_;i++)
     
    20442151  clpSolver->getModelPtr()->setDualObjectiveLimit(COIN_DBL_MAX);
    20452152  dwSolver_ = clpSolver;
    2046   printf("DW model has %d master rows, %d master columns and %d convexity rows\n",
    2047          numberMasterRows,numberMasterColumns,numberBlocks_);
     2153  sprintf(dwPrint,"DW model has %d master rows, %d master columns and %d convexity rows",
     2154          numberMasterRows,numberMasterColumns,numberBlocks_);
     2155  model_->messageHandler()->message(CBC_FPUMP1, model_->messages())
     2156    << dwPrint
     2157    << CoinMessageEol;
    20482158  // do master integers
    20492159  for (int i=0;i<numberMasterColumns;i++) {
  • trunk/Cbc/src/CbcHeuristicRINS.hpp

    r1899 r1956  
    7272        lastNode_ = value;
    7373    }
     74    /// Resets number of solutions
     75    inline void setSolutionCount(int value) {
     76        numberSolutions_ = value;
     77    }
    7478
    7579protected:
  • trunk/Cbc/src/CbcSolverHeuristics.cpp

    r1955 r1956  
    3131#include "CbcHeuristicRINS.hpp"
    3232#include "CbcHeuristicDW.hpp"
     33#include "CbcHeuristicVND.hpp"
    3334
    3435#include "CbcHeuristicDiveCoefficient.hpp"
     
    11661167    int useRINS = parameters_[whichParam(CBC_PARAM_STR_RINS, numberParameters_, parameters_)].currentOptionAsInteger();
    11671168    int useRENS = parameters_[whichParam(CBC_PARAM_STR_RENS, numberParameters_, parameters_)].currentOptionAsInteger();
     1169    int useVND = parameters_[whichParam(CBC_PARAM_STR_VND, numberParameters_, parameters_)].currentOptionAsInteger();
    11681170    int useDINS = parameters_[whichParam(CBC_PARAM_STR_DINS, numberParameters_, parameters_)].currentOptionAsInteger();
    11691171    int useDIVING2 = parameters_[whichParam(CBC_PARAM_STR_DIVINGS, numberParameters_, parameters_)].currentOptionAsInteger();
     
    13901392    }
    13911393    if (useRENS >= kType && useRENS <= kType + 1) {
    1392 #ifndef JJF_ONE
    13931394        CbcHeuristicRENS heuristic6(*model);
    13941395        heuristic6.setHeuristicName("RENS");
     
    13971398        int nodes [] = { -2, 50, 50, 50, 200, 1000, 10000};
    13981399        heuristic6.setNumberNodes(nodes[useRENS]);
    1399 #else
    1400         CbcHeuristicVND heuristic6(*model);
    1401         heuristic6.setHeuristicName("VND");
    1402         heuristic5.setFractionSmall(0.5);
    1403         heuristic5.setDecayFactor(5.0);
    1404 #endif
    14051400        model->addHeuristic(&heuristic6) ;
     1401        anyToDo = true;
     1402    }
     1403    if (useVND >= kType && useVND <= kType + 1) {
     1404        CbcHeuristicVND heuristic6b(*model);
     1405        heuristic6b.setHeuristicName("VND");
     1406        heuristic6b.setFractionSmall(0.4);
     1407        heuristic6b.setFeasibilityPumpOptions(1008003);
     1408        int nodes [] = { -2, 50, 50, 50, 200, 1000, 10000};
     1409        heuristic6b.setNumberNodes(nodes[useVND]);
     1410        model->addHeuristic(&heuristic6b) ;
    14061411        anyToDo = true;
    14071412    }
     
    16201625        anyToDo = true;
    16211626    }
    1622     if ((useProximity >= kType && useProximity <= kType + 1)||
    1623         (kType == 1 && useProximity >= 4)) {
     1627    if ((useProximity >= kType && useProximity <= kType + 1) ||
     1628        (kType == 1 && useProximity > 3) ){
    16241629        CbcHeuristicProximity heuristic2a(*model);
    16251630        heuristic2a.setHeuristicName("Proximity Search");
     
    16331638          if (useProximity==6)
    16341639            heuristic2a.setFeasibilityPumpOptions(-3);
     1640        } else {
     1641          int proximityNumber;
     1642          parameters_[whichParam(CBC_PARAM_STR_PROXIMITY, numberParameters_, parameters_)].currentOptionAsInteger(proximityNumber);
     1643          if (proximityNumber>0) {
     1644            heuristic2a.setNumberNodes(proximityNumber);
     1645            // more print out and stronger feasibility pump
     1646            if (proximityNumber>=300)
     1647              heuristic2a.setFeasibilityPumpOptions(-3);
     1648          }
    16351649        }
    16361650        model->addHeuristic(&heuristic2a);
Note: See TracChangeset for help on using the changeset viewer.