Changeset 197 for trunk


Ignore:
Timestamp:
Oct 20, 2005 5:10:05 PM (14 years ago)
Author:
forrest
Message:

stuff

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/CbcBranchDynamic.cpp

    r147 r197  
    174174CbcSimpleIntegerDynamicPseudoCost::createBranch(int way)
    175175{
    176   OsiSolverInterface * solver = model_->solver();
    177176  const double * solution = model_->testSolution();
    178   const double * lower = solver->getColLower();
    179   const double * upper = solver->getColUpper();
     177  const double * lower = model_->getCbcColLower();
     178  const double * upper = model_->getCbcColUpper();
    180179  double value = solution[columnNumber_];
    181180  value = CoinMax(value, lower[columnNumber_]);
     
    214213CbcSimpleIntegerDynamicPseudoCost::infeasibility(int & preferredWay) const
    215214{
    216   OsiSolverInterface * solver = model_->solver();
    217215  const double * solution = model_->testSolution();
    218   const double * lower = solver->getColLower();
    219   const double * upper = solver->getColUpper();
     216  const double * lower = model_->getCbcColLower();
     217  const double * upper = model_->getCbcColUpper();
    220218  if (upper[columnNumber_]==lower[columnNumber_]) {
    221219    // fixed
     
    240238#ifdef INFEAS
    241239  double distanceToCutoff=0.0;
    242   double objectiveValue = solver->getObjSense()*solver->getObjValue();
     240  double objectiveValue = model_->getCurrentMinimizationObjValue();
    243241  distanceToCutoff =  model_->getCutoff()  - objectiveValue;
    244242  if (distanceToCutoff<1.0e20)
     
    250248  int number;
    251249  double downCost = CoinMax(value-below,0.0);
    252   sum = sumDownCost();
    253   number = numberTimesDown();
     250  sum = sumDownCost_;
     251  number = numberTimesDown_;
    254252#ifdef INFEAS
    255   sum += numberTimesDownInfeasible()*(distanceToCutoff/(downCost+1.0e-12));
     253  sum += numberTimesDownInfeasible_*(distanceToCutoff/(downCost+1.0e-12));
    256254#endif
    257255  if (number>0)
     
    260258    downCost  *=  downDynamicPseudoCost_;
    261259  double upCost = CoinMax((above-value),0.0);
    262   sum = sumUpCost();
    263   number = numberTimesUp();
     260  sum = sumUpCost_;
     261  number = numberTimesUp_;
    264262#ifdef INFEAS
    265   sum += numberTimesUpInfeasible()*(distanceToCutoff/(upCost+1.0e-12));
     263  sum += numberTimesUpInfeasible_*(distanceToCutoff/(upCost+1.0e-12));
    266264#endif
    267265  if (number>0)
     
    307305CbcSimpleIntegerDynamicPseudoCost::upEstimate() const
    308306{
    309   OsiSolverInterface * solver = model_->solver();
    310307  const double * solution = model_->testSolution();
    311   const double * lower = solver->getColLower();
    312   const double * upper = solver->getColUpper();
     308  const double * lower = model_->getCbcColLower();
     309  const double * upper = model_->getCbcColUpper();
    313310  double value = solution[columnNumber_];
    314311  value = CoinMax(value, lower[columnNumber_]);
     
    333330CbcSimpleIntegerDynamicPseudoCost::downEstimate() const
    334331{
    335   OsiSolverInterface * solver = model_->solver();
    336332  const double * solution = model_->testSolution();
    337   const double * lower = solver->getColLower();
    338   const double * upper = solver->getColUpper();
     333  const double * lower = model_->getCbcColLower();
     334  const double * upper = model_->getCbcColUpper();
    339335  double value = solution[columnNumber_];
    340336  value = CoinMax(value, lower[columnNumber_]);
     
    391387  } else {
    392388    OsiSolverInterface * solver = model_->solver();
    393     const double * upper = solver->getColUpper();
     389    const double * upper = model_->getCbcColUpper();
    394390    double integerTolerance =
    395391      model_->getDblParam(CbcModel::CbcIntegerTolerance);
     
    602598                                            const CbcNode * node)
    603599{
     600  assert (object_);
     601  const CbcModel * model = object_->model();
    604602  double originalValue=node->objectiveValue();
    605603  int originalUnsatisfied = node->numberUnsatisfied();
    606   double objectiveValue = solver->getObjSense()*solver->getObjValue();
     604  double objectiveValue = model->getCurrentMinimizationObjValue();
    607605  int unsatisfied=0;
    608606  int i;
    609   int numberColumns = solver->getNumCols();
     607  int numberIntegers = model->numberIntegers();;
    610608  const double * solution = solver->getColSolution();
    611609  //const double * lower = solver->getColLower();
    612610  //const double * upper = solver->getColUpper();
    613   assert (object_);
    614611  CbcDynamicPseudoCostBranchingObject * branchingObject =
    615612    dynamic_cast<CbcDynamicPseudoCostBranchingObject *>(object_);
     
    630627  if (feasible) {
    631628    double integerTolerance =
    632       object->model()->getDblParam(CbcModel::CbcIntegerTolerance);
    633     for (i=0;i<numberColumns;i++) {
    634       if (solver->isInteger(i)) {
    635         double value = solution[i];
    636         double nearest = floor(value+0.5);
    637         if (fabs(value-nearest)>integerTolerance)
    638           unsatisfied++;
    639       }
     629      model->getDblParam(CbcModel::CbcIntegerTolerance);
     630    const int * integerVariable = model->integerVariable();
     631    for (i=0;i<numberIntegers;i++) {
     632      int j=integerVariable[i];
     633      double value = solution[j];
     634      double nearest = floor(value+0.5);
     635      if (fabs(value-nearest)>integerTolerance)
     636        unsatisfied++;
    640637    }
    641638  }
  • trunk/CbcCompareActual.cpp

    r181 r197  
    225225    (model->getObjValue()-objectiveAtContinuous)/
    226226    ((double) numberInfeasibilitiesAtContinuous);
    227   weight_ = 0.98*costPerInteger;
     227  weight_ = 0.95*costPerInteger;
     228  saveWeight_ = 0.95*weight_;
    228229  numberSolutions_++;
    229230  if (numberSolutions_>5)
     
    241242  treeSize_ = model->tree()->size();
    242243#else
     244  double saveWeight=weight_;
    243245  if (numberNodes>10000)
    244246    weight_ =0.0; // this searches on objective
     
    249251  if (treeSize_>10000) {
    250252    // set weight to reduce size most of time
    251     if (treeSize_>20000)
     253    if (treeSize_>25000)
    252254      weight_=-1.0;
    253     else if ((numberNodes%4000)!=0)
     255    else if ((numberNodes%4000)==0)
    254256      weight_=-1.0;
     257    else if ((numberNodes%4000)==1000)
     258      weight_=0.0;
    255259    else
    256260      weight_=saveWeight_;
    257261  }
    258262#endif
    259   return numberNodes==11000; // resort if first time
     263  //return numberNodes==11000; // resort if first time
     264  return (weight_!=saveWeight);
    260265}
    261266
  • trunk/CbcHeuristic.cpp

    r175 r197  
    99#include <cfloat>
    1010
    11 #include "OsiSolverInterface.hpp"
     11#include "OsiClpSolverInterface.hpp"
    1212#include "CbcModel.hpp"
    1313#include "CbcMessage.hpp"
    1414#include "CbcHeuristic.hpp"
     15#include "CbcStrategy.hpp"
     16#include "CglPreProcess.hpp"
    1517
    1618// Default Constructor
     
    4446{
    4547  model_ = model;
     48}
     49// Do mini branch and bound (return 1 if solution)
     50int
     51CbcHeuristic::smallBranchAndBound(OsiSolverInterface * solver,int numberNodes,
     52                                  double * newSolution, double & newSolutionValue,
     53                                  double cutoff, std::string name) const
     54{
     55  OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (solver);
     56  if (osiclp) {
     57    // go faster stripes
     58    if (osiclp->getNumRows()<300&&osiclp->getNumCols()<500) {
     59      osiclp->setupForRepeatedUse(2,0);
     60    } else {
     61      osiclp->setupForRepeatedUse(0,0);
     62    }
     63    // Turn this off if you get problems
     64    // Used to be automatically set
     65    osiclp->setSpecialOptions(osiclp->specialOptions()|(128+64));
     66  }
     67  // Reduce printout
     68  solver->setHintParam(OsiDoReducePrint,true,OsiHintTry);
     69  solver->setHintParam(OsiDoPresolveInInitial,false,OsiHintTry);
     70  solver->setDblParam(OsiDualObjectiveLimit,cutoff);
     71  solver->initialSolve();
     72  int returnCode=1;
     73  int logLevel = model_->logLevel();
     74  if (solver->isProvenOptimal()) {
     75    CglPreProcess process;
     76    /* Do not try and produce equality cliques and
     77       do up to 5 passes */
     78    if (logLevel<=1)
     79      process.messageHandler()->setLogLevel(0);
     80    OsiSolverInterface * solver2= process.preProcess(*solver);
     81    if (!solver2) {
     82      if (logLevel>1)
     83        printf("Pre-processing says infeasible\n");
     84      returnCode=0; // so will be infeasible
     85    } else {
     86      solver2->resolve();
     87      CbcModel model(*solver2);
     88      if (logLevel==1)
     89        model.setLogLevel(0);
     90      else
     91        model.setLogLevel(logLevel);
     92      model.setCutoff(cutoff);
     93      model.setMaximumNodes(numberNodes);
     94      model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry);
     95      CbcStrategyDefaultSubTree strategy(model_,true,5,5,0);
     96      model.setStrategy(strategy);
     97      // Lightweight
     98      model.setNumberStrong(5);
     99      model.setNumberBeforeTrust(1);
     100      model.solver()->setIntParam(OsiMaxNumIterationHotStart,10);
     101      // Do search
     102      if (logLevel>1)
     103        model_->messageHandler()->message(CBC_START_SUB,model_->messages())
     104          << name
     105          << model.getMaximumNodes()
     106          <<CoinMessageEol;
     107      model.branchAndBound();
     108      if (logLevel>1)
     109        model_->messageHandler()->message(CBC_END_SUB,model_->messages())
     110          << name
     111          <<CoinMessageEol;
     112      if (model.getMinimizationObjValue()<cutoff) {
     113        // solution
     114        returnCode=1;
     115        // post process
     116        process.postProcess(*model.solver());
     117        if (solver->isProvenOptimal()) {
     118          // Solution now back in solver
     119          int numberColumns = solver->getNumCols();
     120          memcpy(newSolution,solver->getColSolution(),
     121                 numberColumns*sizeof(double));
     122          newSolutionValue = model.getMinimizationObjValue();
     123        } else {
     124          // odd - but no good
     125          returnCode=0; // so will be infeasible
     126        }
     127      } else {
     128        // no good
     129        returnCode=0; // so will be infeasible
     130      }
     131    }
     132  } else {
     133    returnCode=0;
     134  }
     135  return returnCode;
    46136}
    47137
     
    215305
    216306  double penalty=0.0;
    217  
     307  const char * integerType = model_->integerType();
    218308  // see if feasible - just using singletons
    219309  for (i=0;i<numberRows;i++) {
     
    250340              double distance = absInfeasibility/absElement;
    251341              double thisCost = -direction*objective[iColumn]*distance;
    252               if (solver->isInteger(iColumn)) {
     342              if (integerType[iColumn]) {
    253343                distance = ceil(distance-primalTolerance);
    254344                if (currentValue-distance>=lowerValue-primalTolerance) {
     
    275365              double distance = absInfeasibility/absElement;
    276366              double thisCost = direction*objective[iColumn]*distance;
    277               if (solver->isInteger(iColumn)) {
     367              if (integerType[iColumn]) {
    278368                distance = ceil(distance-1.0e-7);
    279369                assert (currentValue-distance<=upperValue+primalTolerance);
     
    311401    int iColumn;
    312402    for (iColumn=0;iColumn<numberColumns;iColumn++) {
    313       if (solver->isInteger(iColumn))
     403      if (integerType[iColumn])
    314404        continue;
    315405      double currentValue = newSolution[iColumn];
     
    458548      lastChange=0;
    459549      for (iColumn=0;iColumn<numberColumns;iColumn++) {
    460         bool isInteger = solver->isInteger(iColumn);
     550        bool isInteger = integerType[iColumn];
    461551        double currentValue = newSolution[iColumn];
    462552        double lowerValue = lower[iColumn];
  • trunk/CbcHeuristicFPump.cpp

    r186 r197  
    108108// 1. initially check 0-1
    109109  int i,j;
    110   bool zeroOne=true;
     110  int general=0;
    111111  for (i=0;i<numberIntegers;i++) {
    112112    int iColumn = integerVariable[i];
     
    116116    assert(integerObject);
    117117    if (upper[iColumn]-lower[iColumn]>1.000001) {
    118       zeroOne=false;
     118      general++;
    119119      break;
    120120    }
    121121  }
    122   if (!zeroOne) {
     122  if (general*3>numberIntegers) {
    123123    delete solver;
    124124    return 0;
     
    174174      // solution - but may not be better
    175175      // Compute using dot product
     176      solver->setDblParam(OsiObjOffset,saveOffset);
    176177      double newSolutionValue = direction*solver->OsiSolverInterface::getObjValue();
    177       printf(" - solution value of %g\n",newSolutionValue);
     178      printf(" - solution found\n");
    178179      newLineNeeded=false;
    179180      if (newSolutionValue<solutionValue) {
    180         memcpy(betterSolution,newSolution,numberColumns*sizeof(double));
     181        if (general) {
     182          int numberLeft=0;
     183          for (i=0;i<numberIntegers;i++) {
     184            int iColumn = integerVariable[i];
     185            double value = floor(newSolution[iColumn]+0.5);
     186            if(solver->isBinary(iColumn)) {
     187              solver->setColLower(iColumn,value);
     188              solver->setColUpper(iColumn,value);
     189            } else {
     190              if (fabs(value-newSolution[iColumn])>1.0e-7)
     191                numberLeft++;
     192            }
     193          }
     194          if (numberLeft) {
     195            returnCode = smallBranchAndBound(solver,200,newSolution,newSolutionValue,
     196                                         solutionValue,"CbcHeuristicFpump");
     197          }
     198        }
     199        if (returnCode) {
     200          memcpy(betterSolution,newSolution,numberColumns*sizeof(double));
     201          solutionValue=newSolutionValue;
     202        }
    181203      } else {
    182204        returnCode=0;
     
    192214          for (i = 0; i <numberIntegers; i++) {
    193215              int iColumn = integerVariable[i];
     216              if(!solver->isBinary(iColumn))
     217                continue;
    194218              if (newSolution[iColumn]!=b[iColumn]) {
    195219                matched=false;
     
    205229         for (i=0;i<numberIntegers;i++) {
    206230             int iColumn = integerVariable[i];
     231             if(!solver->isBinary(iColumn))
     232               continue;
    207233             double value = max(0.0,CoinDrand48()-0.3);
    208234             double difference = fabs(solution[iColumn]-newSolution[iColumn]);
     
    224250      for (i=0;i<numberIntegers;i++) {
    225251        int iColumn = integerVariable[i];
     252        if(!solver->isBinary(iColumn))
     253          continue;
    226254        double costValue = 1.0;
    227255        // deal with fixed variables (i.e., upper=lower)
     
    302330  for (i=0;i<numberIntegers;i++) {
    303331    int iColumn = integerVariable[i];
     332    if(!solver->isBinary(iColumn))
     333      continue;
    304334    const CbcObject * object = model_->object(i);
    305335    const CbcSimpleInteger * integerObject =
  • trunk/CbcHeuristicGreedy.cpp

    r182 r197  
    262262                 j<columnStart[iColumn]+columnLength[iColumn];j++) {
    263263              int iRow=row[j];
     264              double newActivity = element[j]*step+rowActivity[iRow];
    264265              if (rowActivity[iRow]<rowLower[iRow]-1.0e-10&&
    265                 element[j]*step+rowActivity[iRow]>=rowLower[iRow]) {
     266                newActivity>=rowLower[iRow]-1.0e-12) {
    266267                sum += element[j];
    267268              }
    268               assert (sum>0.0);
    269               double ratio = (cost/sum)*(1.0+perturb*CoinDrand48());
    270               if (ratio<bestRatio) {
    271                 bestRatio=ratio;
    272                 bestColumn=iColumn;
    273                 bestStepSize=step;
    274               }
     269            }
     270            assert (sum>0.0);
     271            double ratio = (cost/sum)*(1.0+perturb*CoinDrand48());
     272            if (ratio<bestRatio) {
     273              bestRatio=ratio;
     274              bestColumn=iColumn;
     275              bestStepSize=step;
    275276            }
    276277          }
     
    690691        newSolver->setColLower(iColumn,newSolution[iColumn]);
    691692    }
    692     // Reduce printout
    693     newSolver->setHintParam(OsiDoReducePrint,true,OsiHintTry);
    694     newSolver->setHintParam(OsiDoPresolveInInitial,true,OsiHintTry);
    695     newSolver->setDblParam(OsiDualObjectiveLimit,solutionValue);
    696     newSolver->initialSolve();
    697     if (newSolver->isProvenOptimal()) {
    698       CglPreProcess process;
    699       /* Do not try and produce equality cliques and
    700          do up to 5 passes */
    701       OsiSolverInterface * solver2= process.preProcess(*newSolver);
    702       if (!solver2) {
    703         printf("Pre-processing says infeasible\n");
    704         rhsNeeded=1.0; // so will be infeasible
    705       } else {
    706         solver2->resolve();
    707         CbcModel model(*solver2);
    708         model.setLogLevel(1);
    709         model.setCutoff(solutionValue);
    710         model.setMaximumNodes(200);
    711         model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry);
    712         CbcStrategyDefaultSubTree strategy(model_,true,5,5,0);
    713         model.setStrategy(strategy);
    714         // Lightweight
    715         model.setNumberStrong(5);
    716         model.setNumberBeforeTrust(1);
    717         model.solver()->setIntParam(OsiMaxNumIterationHotStart,10);
    718         // Do search
    719         model_->messageHandler()->message(CBC_START_SUB,model_->messages())
    720               << "CbcHeuristicGreedy"
    721               << model.getMaximumNodes()
    722               <<CoinMessageEol;
    723         model.branchAndBound();
    724         model_->messageHandler()->message(CBC_END_SUB,model_->messages())
    725               << "CbcHeuristicGreedy"
    726               <<CoinMessageEol;
    727         if (model.getMinimizationObjValue()<solutionValue) {
    728           // solution
    729           rhsNeeded=0.0;
    730           // post process
    731           process.postProcess(*model.solver());
    732           // Solution now back in newSolver
    733           memcpy(newSolution,newSolver->getColSolution(),
    734                  numberColumns*sizeof(double));
    735           newSolutionValue = model.getMinimizationObjValue();
    736         } else {
    737           // no good
    738           rhsNeeded=1.0; // so will be infeasible
    739         }
    740       }
    741     } else {
    742       rhsNeeded=1.0;
    743     }
     693    int returnCode = smallBranchAndBound(newSolver,200,newSolution,newSolutionValue,
     694                                         solutionValue,"CbcHeuristicGreedy");
     695    rhsNeeded = 1.0-returnCode;
    744696    delete newSolver;
    745697  }
  • trunk/CbcHeuristicLocal.cpp

    r182 r197  
    120120    }
    121121  }
    122   // Reduce printout
    123   newSolver->setHintParam(OsiDoReducePrint,true,OsiHintTry);
    124   newSolver->setHintParam(OsiDoPresolveInInitial,true,OsiHintTry);
    125   newSolver->setDblParam(OsiDualObjectiveLimit,objectiveValue);
    126   newSolver->initialSolve();
    127   bool betterSolution=true;
    128   if (newSolver->isProvenOptimal()) {
    129     CglPreProcess process;
    130     /* Do not try and produce equality cliques and
    131        do up to 5 passes */
    132     OsiSolverInterface * solver2= process.preProcess(*newSolver);
    133     if (!solver2) {
    134       printf("Pre-processing says infeasible\n");
    135       betterSolution=false;
    136     } else {
    137       solver2->resolve();
    138       CbcModel model(*solver2);
    139       model.setLogLevel(1);
    140       model.setCutoff(objectiveValue);
    141       model.setMaximumNodes(200);
    142       model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry);
    143       CbcStrategyDefaultSubTree strategy(model_,true,5,5,0);
    144       model.setStrategy(strategy);
    145       // Lightweight
    146       model.setNumberStrong(5);
    147       model.setNumberBeforeTrust(1);
    148       model.solver()->setIntParam(OsiMaxNumIterationHotStart,10);
    149       // Do search
    150       model_->messageHandler()->message(CBC_START_SUB,model_->messages())
    151         << "CbcHeuristicLocal"
    152         << model.getMaximumNodes()
    153         <<CoinMessageEol;
    154       model.branchAndBound();
    155       model_->messageHandler()->message(CBC_END_SUB,model_->messages())
    156         << "CbcHeuristicLocal"
    157         <<CoinMessageEol;
    158       if (model.getMinimizationObjValue()<objectiveValue) {
    159         model_->messageHandler()->message(CBC_HEURISTIC_SOLUTION,model_->messages())
    160           << model.getMinimizationObjValue()
    161           << "CbcHeuristicLocal"
    162           <<CoinMessageEol;
    163         // solution
    164         // post process
    165         process.postProcess(*model.solver());
    166         // Solution now back in newSolver
    167         memcpy(newSolution,newSolver->getColSolution(),
    168                newSolver->getNumCols()*sizeof(double));
    169         objectiveValue = model.getMinimizationObjValue();
    170       } else {
    171         // no good
    172         betterSolution=false;
    173       }
    174     }
    175   } else {
    176     // no good
    177     betterSolution=false;
    178   }
     122  int returnCode = smallBranchAndBound(newSolver,200,newSolution,objectiveValue,
     123                                         objectiveValue,"CbcHeuristicLocal");
     124
    179125  delete newSolver;
    180   if (betterSolution) {
    181     return 1;
    182   } else {
    183     return 0;
    184   }
     126  return returnCode;
    185127}
    186128/*
  • trunk/CbcMessage.cpp

    r181 r197  
    3535  {CBC_STRONGSOL,16,1,"Integer solution of %g found by strong branching after %d iterations and %d nodes"},
    3636  {CBC_TREE_SOL,24,1,"Integer solution of %g found by subtree after %d iterations and %d nodes"},
    37   {CBC_NOINT,3007,0,"No integer variables - nothing to do"},
     37  {CBC_NOINT,3007,1,"No integer variables - nothing to do"},
    3838  {CBC_VUB_PASS,17,1,"%d solved, %d variables fixed, %d tightened"},
    3939  {CBC_VUB_END,18,1,"After tightenVubs, %d variables fixed, %d tightened"},
  • trunk/CbcModel.cpp

    r196 r197  
    426426  if (numberBeforeTrust_>0)
    427427    convertToDynamic();
    428 
     428  // Set up char array to say if integer
     429  delete [] integerInfo_;
     430  {
     431    int n = solver_->getNumCols();
     432    integerInfo_ = new char [n];
     433    for (int i=0;i<n;i++) {
     434      if (solver_->isInteger(i))
     435        integerInfo_[i]=1;
     436      else
     437        integerInfo_[i]=0;
     438    }
     439  }
     440   
    429441/*
    430442  Ensure that objects on the lists of CbcObjects, heuristics, and cut
     
    488500  numberHeuristicSolutions_ = 0 ;
    489501  // Everything is minimization
     502  {
     503    // needed to sync cutoffs
     504    double value ;
     505    solver_->getDblParam(OsiDualObjectiveLimit,value) ;
     506    dblParam_[CbcCurrentCutoff]= value * solver_->getObjSense();
     507  }
    490508  double cutoff=getCutoff() ;
    491509  double direction = solver_->getObjSense() ;
     510  dblParam_[CbcOptimizationDirection]=direction;
    492511  if (cutoff < 1.0e20&&direction<0.0)
    493512    messageHandler()->message(CBC_CUTOFF_WARNING1,
     
    14981517    delete solver_ ;
    14991518    solver_ = continuousSolver_ ;
     1519    setPointers(solver_);
    15001520    continuousSolver_ = NULL ; }
    15011521/*
     
    15371557  continuousSolution_ = CoinCopyOfArray(solver_->getColSolution(),
    15381558                                             solver_->getNumCols());
     1559  setPointers(solver_);
    15391560}
    15401561
     
    16171638  currentNode_(NULL),
    16181639  integerVariable_(NULL),
     1640  integerInfo_(NULL),
    16191641  continuousSolution_(NULL),
    16201642  usedInSolution_(NULL),
     
    16581680  dblParam_[CbcAllowableFractionGap] = 0.0;
    16591681  dblParam_[CbcMaximumSeconds] = 1.0e100;
     1682  dblParam_[CbcCurrentCutoff] = 1.0e100;
     1683  dblParam_[CbcOptimizationDirection] = 1.0;
     1684  dblParam_[CbcCurrentObjectiveValue] = 1.0e100;
     1685  dblParam_[CbcCurrentMinimizationObjectiveValue] = 1.0e100;
    16601686  dblParam_[CbcStartSeconds] = 0.0;
    16611687  nodeCompare_=new CbcCompareDefault();;
     
    16651691  strategy_=NULL;
    16661692  parentModel_=NULL;
     1693  cbcColLower_ = NULL;
     1694  cbcColUpper_ = NULL;
     1695  cbcRowLower_ = NULL;
     1696  cbcRowUpper_ = NULL;
     1697  cbcColSolution_ = NULL;
     1698  cbcRowPrice_ = NULL;
     1699  cbcReducedCost_ = NULL;
     1700  cbcRowActivity_ = NULL;
    16671701  appData_=NULL;
    16681702  handler_ = new CoinMessageHandler();
     
    17051739  nextRowCut_(NULL),
    17061740  currentNode_(NULL),
     1741  integerInfo_(NULL),
    17071742  specialOptions_(0),
    17081743  subTreeModel_(NULL),
     
    17441779  dblParam_[CbcAllowableFractionGap] = 0.0;
    17451780  dblParam_[CbcMaximumSeconds] = 1.0e100;
     1781  dblParam_[CbcCurrentCutoff] = 1.0e100;
     1782  dblParam_[CbcOptimizationDirection] = 1.0;
     1783  dblParam_[CbcCurrentObjectiveValue] = 1.0e100;
     1784  dblParam_[CbcCurrentMinimizationObjectiveValue] = 1.0e100;
    17461785  dblParam_[CbcStartSeconds] = 0.0;
    17471786
     
    17581797  solver_ = rhs.clone();
    17591798  ourSolver_ = true ;
     1799  cbcColLower_ = NULL;
     1800  cbcColUpper_ = NULL;
     1801  cbcRowLower_ = NULL;
     1802  cbcRowUpper_ = NULL;
     1803  cbcColSolution_ = NULL;
     1804  cbcRowPrice_ = NULL;
     1805  cbcReducedCost_ = NULL;
     1806  cbcRowActivity_ = NULL;
    17601807
    17611808  // Initialize solution and integer variable vectors
     
    19071954  dblParam_[CbcAllowableFractionGap] = rhs.dblParam_[CbcAllowableFractionGap];
    19081955  dblParam_[CbcMaximumSeconds] = rhs.dblParam_[CbcMaximumSeconds];
     1956  dblParam_[CbcCurrentCutoff] = rhs.dblParam_[CbcCurrentCutoff];
     1957  dblParam_[CbcOptimizationDirection] = rhs.dblParam_[CbcOptimizationDirection];
     1958  dblParam_[CbcCurrentObjectiveValue] = rhs.dblParam_[CbcCurrentObjectiveValue];
     1959  dblParam_[CbcCurrentMinimizationObjectiveValue] = rhs.dblParam_[CbcCurrentMinimizationObjectiveValue];
    19091960  dblParam_[CbcStartSeconds] = dblParam_[CbcStartSeconds]; // will be overwritten hopefully
    19101961  if (rhs.emptyWarmStart_) emptyWarmStart_ = rhs.emptyWarmStart_->clone() ;
     
    19682019  tree_= rhs.tree_->clone();
    19692020  branchingMethod_=rhs.branchingMethod_;
     2021  cbcColLower_ = NULL;
     2022  cbcColUpper_ = NULL;
     2023  cbcRowLower_ = NULL;
     2024  cbcRowUpper_ = NULL;
     2025  cbcColSolution_ = NULL;
     2026  cbcRowPrice_ = NULL;
     2027  cbcReducedCost_ = NULL;
     2028  cbcRowActivity_ = NULL;
    19702029  if (rhs.strategy_)
    19712030    strategy_=rhs.strategy_->clone();
     
    19812040    integerVariable_ = new int [numberIntegers_];
    19822041    memcpy(integerVariable_,rhs.integerVariable_,numberIntegers_*sizeof(int));
     2042    integerInfo_ = CoinCopyOfArray(rhs.integerInfo_,solver_->getNumCols());
    19832043  } else {
    19842044    integerVariable_ = NULL;
     2045    integerInfo_=NULL;
    19852046  }
    19862047  if (rhs.bestSolution_&&!noTree) {
     
    21362197    dblParam_[CbcAllowableFractionGap] = rhs.dblParam_[CbcAllowableFractionGap];
    21372198    dblParam_[CbcMaximumSeconds] = rhs.dblParam_[CbcMaximumSeconds];
     2199    dblParam_[CbcCurrentCutoff] = rhs.dblParam_[CbcCurrentCutoff];
     2200    dblParam_[CbcOptimizationDirection] = rhs.dblParam_[CbcOptimizationDirection];
     2201    dblParam_[CbcCurrentObjectiveValue] = rhs.dblParam_[CbcCurrentObjectiveValue];
     2202    dblParam_[CbcCurrentMinimizationObjectiveValue] = rhs.dblParam_[CbcCurrentMinimizationObjectiveValue];
    21382203    dblParam_[CbcStartSeconds] = dblParam_[CbcStartSeconds]; // will be overwritten hopefully
    21392204    globalCuts_ = rhs.globalCuts_;
     
    22082273      memcpy(integerVariable_,rhs.integerVariable_,
    22092274             numberIntegers_*sizeof(int));
     2275      integerInfo_ = CoinCopyOfArray(rhs.integerInfo_,solver_->getNumCols());
    22102276    } else {
    22112277      integerVariable_ = NULL;
     2278      integerInfo_=NULL;
    22122279    }
    22132280    numberRowsAtContinuous_ = rhs.numberRowsAtContinuous_;
     
    22312298      walkback_ = NULL;
    22322299    synchronizeModel();
     2300    cbcColLower_ = NULL;
     2301    cbcColUpper_ = NULL;
     2302    cbcRowLower_ = NULL;
     2303    cbcRowUpper_ = NULL;
     2304    cbcColSolution_ = NULL;
     2305    cbcRowPrice_ = NULL;
     2306    cbcReducedCost_ = NULL;
     2307    cbcRowActivity_ = NULL;
    22332308  }
    22342309  return *this;
     
    22602335  delete [] currentSolution_;
    22612336  currentSolution_=NULL;
     2337  delete [] integerInfo_;
     2338  integerInfo_=NULL;
    22622339  delete [] continuousSolution_;
    22632340  continuousSolution_=NULL;
     
    34283505    /* If cuts just at root node then it will probably be faster to
    34293506       update matrix and leave all in */
    3430     bool willBeCutsInTree=false;
     3507    int willBeCutsInTree=0;
     3508    double thisObjective = solver_->getObjValue()*direction ;
     3509    if (thisObjective-startObjective<1.0e-5)
     3510      willBeCutsInTree=-1;
    34313511    // Root node or every so often - see what to turn off
    34323512    int i ;
    3433     double thisObjective = solver_->getObjValue()*direction ;
    34343513    double totalCuts = 0.0 ;
    34353514    for (i = 0;i<numberCutGenerators_;i++)
     
    34523531    for (i = 0;i<numberCutGenerators_;i++) {
    34533532      int howOften = generator_[i]->howOften() ;
     3533      if (thisObjective-startObjective<0.1*fabs(startObjective)+1.0e-5&&howOften==-98)
     3534        howOften=-99; // switch off
    34543535      if (howOften<-99)
    34553536        continue ;
    34563537      if (howOften<0||howOften >= 1000000) {
    3457         // If small number switch mostly off
    3458         double thisCuts = countRowCuts[i] + 5.0*countColumnCuts[i] ;
    3459         if (!thisCuts||howOften == -99) {
    3460           if (howOften == -99)
    3461             howOften = -100 ;
    3462           else
    3463             howOften = 1000000+SCANCUTS; // wait until next time
    3464         } else if (thisCuts<small) {
    3465           int k = (int) sqrt(small/thisCuts) ;
    3466           howOften = k+1000000 ;
    3467         } else {
    3468           howOften = 1+1000000 ;
    3469         }
     3538        if( !numberNodes_) {
     3539          // If small number switch mostly off
     3540          double thisCuts = countRowCuts[i] + 5.0*countColumnCuts[i] ;
     3541          if (!thisCuts||howOften == -99) {
     3542            if (howOften == -99||howOften == -98)
     3543              howOften = -100 ;
     3544            else
     3545              howOften = 1000000+SCANCUTS; // wait until next time
     3546          } else if (thisCuts<small) {
     3547            int k = (int) sqrt(small/thisCuts) ;
     3548            if (howOften!=-98)
     3549              howOften = k+1000000 ;
     3550            else
     3551              howOften=-100;
     3552          } else {
     3553            howOften = 1+1000000 ;
     3554          }
     3555        }
    34703556        // If cuts useless switch off
    3471         if (numberNodes_>=10&&sumChangeObjective1_>1.0e2*(sumChangeObjective2_+1.0e-12)) {
     3557        if (numberNodes_>=100000&&sumChangeObjective1_>2.0e2*(sumChangeObjective2_+1.0e-12)) {
    34723558          howOften = 1000000+SCANCUTS; // wait until next time
    3473           //printf("switch off cut %d due to lack of use\n",i);
     3559          printf("switch off cut %d due to lack of use\n",i);
    34743560        }
    34753561      }
    34763562      if (howOften>=0&&generator_[i]->generator()->mayGenerateRowCutsInTree())
    3477         willBeCutsInTree=true;
     3563        willBeCutsInTree=1;
    34783564       
    34793565      generator_[i]->setHowOften(howOften) ;
     
    35073593    delete [] count ;
    35083594    if( !numberNodes_) {
    3509       if( !willBeCutsInTree) {
     3595      if( willBeCutsInTree<=0) {
    35103596        // Take off cuts
    35113597        cuts = OsiCuts();
    35123598        numberNewCuts=0;
    3513         // update size of problem
    3514         numberRowsAtContinuous_ = solver_->getNumRows() ;
     3599        if (!willBeCutsInTree) {
     3600          // update size of problem
     3601          numberRowsAtContinuous_ = solver_->getNumRows() ;
     3602        } else {
     3603          // take off cuts
     3604          int numberRows = solver_->getNumRows();
     3605          int numberAdded = numberRows-numberRowsAtContinuous_;
     3606          if (numberAdded) {
     3607            int * added = new int[numberAdded];
     3608            for (int i=0;i<numberAdded;i++)
     3609              added[i]=i+numberRowsAtContinuous_;
     3610            solver_->deleteRows(numberAdded,added);
     3611            delete [] added;
     3612          }
     3613        }
    35153614#ifdef COIN_USE_CLP
    35163615        OsiClpSolverInterface * clpSolver
     
    37013800        solver_->setHintParam(OsiDoInBranchAndCut,true,OsiHintDo,&easy) ;
    37023801        solver_->resolve() ;
     3802        setPointers(solver_);
    37033803        solver_->setHintParam(OsiDoInBranchAndCut,true,OsiHintDo,NULL) ;
    37043804        if (solver_->getIterationCount() == 0)
     
    37853885    }
    37863886  }
     3887  setPointers(solver_);
    37873888  return feasible ; }
    37883889
     
    43704471  value += tol ; }
    43714472#endif
     4473  dblParam_[CbcCurrentCutoff]=value;
    43724474  // Solvers know about direction
    43734475  double direction = solver_->getObjSense();
     
    49225024      }
    49235025      solver->initialSolve();
     5026      setPointers(continuousSolver_);
    49245027      value = solver->getColSolution()[iColumn];
    49255028      bool change=false;
     
    60736176  }
    60746177}
     6178// Set pointers for speed
     6179void
     6180CbcModel::setPointers(const OsiSolverInterface * solver)
     6181{
     6182  /// Pointer to array[getNumCols()] (for speed) of column lower bounds
     6183  cbcColLower_ = solver_->getColLower();
     6184  /// Pointer to array[getNumCols()] (for speed) of column upper bounds
     6185  cbcColUpper_ = solver_->getColUpper();
     6186  /// Pointer to array[getNumRows()] (for speed) of row lower bounds
     6187  cbcRowLower_ = solver_->getRowLower();
     6188  /// Pointer to array[getNumRows()] (for speed) of row upper bounds
     6189  cbcRowUpper_ = solver_->getRowUpper();
     6190  /// Pointer to array[getNumCols()] (for speed) of primal solution vector
     6191  cbcColSolution_ = solver_->getColSolution();
     6192  /// Pointer to array[getNumRows()] (for speed) of dual prices
     6193  cbcRowPrice_ = solver_->getRowPrice();
     6194  /// Get a pointer to array[getNumCols()] (for speed) of reduced costs
     6195  cbcReducedCost_ = solver_->getReducedCost();
     6196  /// Pointer to array[getNumRows()] (for speed) of row activity levels.
     6197  cbcRowActivity_ = solver_->getRowActivity();
     6198  dblParam_[CbcCurrentObjectiveValue]=solver->getObjValue();
     6199  dblParam_[CbcCurrentMinimizationObjectiveValue]=
     6200    dblParam_[CbcCurrentObjectiveValue]*
     6201    dblParam_[CbcOptimizationDirection];
     6202}
  • trunk/CbcNode.cpp

    r190 r197  
    485485  // branch - do bounds
    486486  int i;
     487  solver->setColLower(lower_);
     488  solver->setColUpper(upper_);
    487489  int numberColumns = model->getNumCols();
    488   for (i=0;i<numberColumns;i++) {
    489     solver->setColBounds(i,lower_[i],upper_[i]);
    490   }
    491490  // move basis - but make sure size stays
    492491  int numberRows = basis->getNumArtificial();
     
    907906    // Some objects may compute an estimate of best solution from here
    908907    estimatedDegradation=0.0;
    909     int numberIntegerInfeasibilities=0; // without odd ones
     908    //int numberIntegerInfeasibilities=0; // without odd ones
    910909   
    911910    // We may go round this loop twice (only if we think we have solution)
     
    913912     
    914913      // compute current state
    915       int numberObjectInfeasibilities; // just odd ones
    916       model->feasibleSolution(
    917                               numberIntegerInfeasibilities,
    918                               numberObjectInfeasibilities);
     914      //int numberObjectInfeasibilities; // just odd ones
     915      //model->feasibleSolution(
     916      //                      numberIntegerInfeasibilities,
     917      //                      numberObjectInfeasibilities);
    919918      // If forcePriority > 0 then we want best solution
    920919      const double * bestSolution = NULL;
     
    16531652                    smallestNumberInfeasibilities);
    16541653        }
    1655         if (smallestNumberInfeasibilities>=numberIntegerInfeasibilities)
    1656           numberNodes=1000000; // switch off search for better solution
     1654        //if (smallestNumberInfeasibilities>=numberIntegerInfeasibilities)
     1655        //numberNodes=1000000; // switch off search for better solution
    16571656        numberNodes=1000000; // switch off anyway
    16581657        averageCostPerIteration /= totalNumberIterations;
     
    19641963        if (!ws)
    19651964          break;
     1965        double tolerance;
     1966        solver->getDblParam(OsiPrimalTolerance,tolerance);
    19661967        for (i=0;i<numberColumns;i++) {
    19671968          double value = saveSolution[i];
    1968           if (value<lower[i]) {
     1969          if (value<lower[i]-tolerance) {
    19691970            saveSolution[i]=lower[i];
    19701971            roundAgain=true;
    19711972            ws->setStructStatus(i,CoinWarmStartBasis::atLowerBound);
    1972           } else if (value>upper[i]) {
     1973          } else if (value>upper[i]+tolerance) {
    19731974            saveSolution[i]=upper[i];
    19741975            roundAgain=true;
     
    19811982          solver->setColSolution(saveSolution);
    19821983          delete ws;
     1984          bool takeHint;
     1985          OsiHintStrength strength;
     1986          solver->getHintParam(OsiDoDualInResolve,takeHint,strength);
     1987          solver->setHintParam(OsiDoDualInResolve,false,OsiHintDo) ;
    19831988          solver->resolve();
     1989          solver->setHintParam(OsiDoDualInResolve,takeHint,strength) ;
    19841990          memcpy(saveSolution,solver->getColSolution(),numberColumns*sizeof(double));
    19851991          model->reserveCurrentSolution(saveSolution);
     
    22162222        int canSkip = choice.possibleBranch->fillStrongInfo(choice);
    22172223        // For now always do
    2218         canSkip=false;
     2224        canSkip=0;
    22192225        if (model->messageHandler()->logLevel()>3)
    22202226          dynamicObject->print(1,choice.possibleBranch->value());
  • trunk/CbcStrategy.cpp

    r195 r197  
    469469      model.addCutGenerator(&mixedGen,setting,"MixedIntegerRounding2");
    470470  }
     471#if 0
    471472  // Say we want timings
    472473  int newNumberGenerators = model.numberCutGenerators();
     
    475476    generator->setTiming(true);
    476477  }
     478#endif
    477479  if (model.getNumCols()<500)
    478480    model.setMaximumCutPassesAtRoot(-100); // always do 100 if possible
  • trunk/CbcTreeLocal.cpp

    r195 r197  
    8585  model_->analyzeObjective();
    8686
     87  {
     88    // needed to sync cutoffs
     89    double value ;
     90    solver->getDblParam(OsiDualObjectiveLimit,value) ;
     91    model_->setCutoff(value * solver->getObjSense());
     92  }
    8793  bestCutoff_ = model_->getCutoff();
    8894  // save current gap
  • trunk/Test/CoinSolve.cpp

    r194 r197  
    1515#include "CoinHelperFunctions.hpp"
    1616// Same version as CBC
    17 #define CBCVERSION "0.98"
     17#define CBCVERSION "0.99"
    1818
    1919#include "CoinMpsIO.hpp"
     
    103103int CbcOrClpRead_mode=1;
    104104FILE * CbcOrClpReadCommand=stdin;
     105static int * analyze(OsiClpSolverInterface * solver, int & numberChanged)
     106{
     107  //const double *objective = solver->getObjCoefficients() ;
     108  const double *lower = solver->getColLower() ;
     109  const double *upper = solver->getColUpper() ;
     110  int numberColumns = solver->getNumCols() ;
     111  int numberRows = solver->getNumRows();
     112  //double direction = solver->getObjSense();
     113  int iRow,iColumn;
     114
     115  // Row copy
     116  CoinPackedMatrix matrixByRow(*solver->getMatrixByRow());
     117  const double * elementByRow = matrixByRow.getElements();
     118  const int * column = matrixByRow.getIndices();
     119  const CoinBigIndex * rowStart = matrixByRow.getVectorStarts();
     120  const int * rowLength = matrixByRow.getVectorLengths();
     121
     122  // Column copy
     123  CoinPackedMatrix  matrixByCol(*solver->getMatrixByCol());
     124  //const double * element = matrixByCol.getElements();
     125  const int * row = matrixByCol.getIndices();
     126  const CoinBigIndex * columnStart = matrixByCol.getVectorStarts();
     127  const int * columnLength = matrixByCol.getVectorLengths();
     128
     129  const double * rowLower = solver->getRowLower();
     130  const double * rowUpper = solver->getRowUpper();
     131
     132  char * ignore = new char [numberRows];
     133  int * changed = new int[numberColumns];
     134  memset(ignore,0,numberRows);
     135  numberChanged=0;
     136  int numberInteger=0;
     137  for (iColumn=0;iColumn<numberColumns;iColumn++) {
     138    if (upper[iColumn] > lower[iColumn]+1.0e-8&&solver->isInteger(iColumn))
     139      numberInteger++;
     140  }
     141  for (iRow=0;iRow<numberRows;iRow++) {
     142    int numberContinuous=0;
     143    double value1=0.0,value2=0.0;
     144    bool allIntegerCoeff=true;
     145    double sumFixed=0.0;
     146    int jColumn1=-1,jColumn2=-1;
     147    for (CoinBigIndex j=rowStart[iRow];j<rowStart[iRow]+rowLength[iRow];j++) {
     148      int jColumn = column[j];
     149      double value = elementByRow[j];
     150      if (upper[jColumn] > lower[jColumn]+1.0e-8) {
     151        if (!solver->isInteger(jColumn)) {
     152          if (numberContinuous==0) {
     153            jColumn1=jColumn;
     154            value1=value;
     155          } else {
     156            jColumn2=jColumn;
     157            value2=value;
     158          }
     159          numberContinuous++;
     160        } else {
     161          if (fabs(value-floor(value+0.5))>1.0e-12)
     162            allIntegerCoeff=false;
     163        }
     164      } else {
     165        sumFixed += lower[jColumn]*value;
     166      }
     167    }
     168    double low = rowLower[iRow];
     169    if (low>-1.0e20) {
     170      low -= sumFixed;
     171      if (fabs(low-floor(low+0.5))>1.0e-12)
     172        allIntegerCoeff=false;
     173    }
     174    double up = rowUpper[iRow];
     175    if (up<1.0e20) {
     176      up -= sumFixed;
     177      if (fabs(up-floor(up+0.5))>1.0e-12)
     178        allIntegerCoeff=false;
     179    }
     180    if (numberContinuous==1) {
     181      // see if really integer
     182      // This does not allow for complicated cases
     183      if (low==up) {
     184        if (fabs(value1)>1.0e-3) {
     185          value1 = 1.0/value1;
     186          if (fabs(value1-floor(value1+0.5))<1.0e-12) {
     187            // integer
     188            changed[numberChanged++]=jColumn1;
     189            solver->setInteger(jColumn1);
     190            if (upper[jColumn1]>1.0e20)
     191              solver->setColUpper(jColumn1,1.0e20);
     192            if (lower[jColumn1]<-1.0e20)
     193              solver->setColLower(jColumn1,-1.0e20);
     194          }
     195        }
     196      } else {
     197        if (fabs(value1)>1.0e-3) {
     198          value1 = 1.0/value1;
     199          if (fabs(value1-floor(value1+0.5))<1.0e-12) {
     200            // This constraint will not stop it being integer
     201            ignore[iRow]=1;
     202          }
     203        }
     204      }
     205    } else if (numberContinuous==2) {
     206      if (low==up) {
     207      }
     208    }
     209  }
     210  for (iColumn=0;iColumn<numberColumns;iColumn++) {
     211    if (upper[iColumn] > lower[iColumn]+1.0e-8&&!solver->isInteger(iColumn)) {
     212      double value;
     213      value = upper[iColumn];
     214      if (value<1.0e20&&fabs(value-floor(value+0.5))>1.0e-12)
     215        continue;
     216      value = lower[iColumn];
     217      if (value>-1.0e20&&fabs(value-floor(value+0.5))>1.0e-12)
     218        continue;
     219      bool integer=true;
     220      for (CoinBigIndex j=columnStart[iColumn];j<columnStart[iColumn]+columnLength[iColumn];j++) {
     221        int iRow = row[j];
     222        if (!ignore[iRow]) {
     223          integer=false;
     224          break;
     225        }
     226      }
     227      if (integer) {
     228        // integer
     229        changed[numberChanged++]=iColumn;
     230        solver->setInteger(iColumn);
     231        if (upper[iColumn]>1.0e20)
     232          solver->setColUpper(iColumn,1.0e20);
     233        if (lower[iColumn]<-1.0e20)
     234          solver->setColLower(iColumn,-1.0e20);
     235      }
     236    }
     237  }
     238  if (numberInteger)
     239    printf("%d integer variables",numberInteger);
     240  if (numberChanged)
     241    printf(" and %d variables made integer\n",numberChanged);
     242  else
     243    printf("\n");
     244  delete [] ignore;
     245  if (!numberChanged) {
     246    delete [] changed;
     247    return NULL;
     248  } else {
     249    return changed;
     250  }
     251}
    105252int main (int argc, const char *argv[])
    106253{
     
    119266    CbcModel * babModel = NULL;
    120267    model.setNumberBeforeTrust(5);
     268    int cutPass=-1234567;
    121269    OsiSolverInterface * solver = model.solver();
    122270    OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver);
     
    203351    CglGomory gomoryGen;
    204352    // try larger limit
    205     gomoryGen.setLimit(300);
     353    gomoryGen.setLimitAtRoot(500);
     354    gomoryGen.setLimit(100);
    206355    // set default action (0=off,1=on,2=root)
    207     int gomoryAction=1;
    208     parameters[whichParam(GOMORYCUTS,numberParameters,parameters)].setCurrentOption("on");
     356    int gomoryAction=3;
     357    parameters[whichParam(GOMORYCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    209358
    210359    CglProbing probingGen;
     
    223372    probingGen.setRowCuts(3);
    224373    // set default action (0=off,1=on,2=root)
    225     int probingAction=1;
    226     parameters[whichParam(PROBINGCUTS,numberParameters,parameters)].setCurrentOption("on");
     374    int probingAction=3;
     375    parameters[whichParam(PROBINGCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    227376
    228377    CglKnapsackCover knapsackGen;
    229378    // set default action (0=off,1=on,2=root)
    230     int knapsackAction=1;
    231     parameters[whichParam(KNAPSACKCUTS,numberParameters,parameters)].setCurrentOption("on");
     379    int knapsackAction=3;
     380    parameters[whichParam(KNAPSACKCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    232381
    233382    CglRedSplit redsplitGen;
     
    235384    // set default action (0=off,1=on,2=root)
    236385    // Off as seems to give some bad cuts
    237     int redsplitAction=0;
    238     parameters[whichParam(REDSPLITCUTS,numberParameters,parameters)].setCurrentOption("off");
    239 
    240     CglClique cliqueGen;
     386    int redsplitAction=2;
     387    parameters[whichParam(REDSPLITCUTS,numberParameters,parameters)].setCurrentOption("root");
     388
     389    CglClique cliqueGen(false,true);
    241390    cliqueGen.setStarCliqueReport(false);
    242391    cliqueGen.setRowCliqueReport(false);
     392    cliqueGen.setMinViolation(0.1);
    243393    // set default action (0=off,1=on,2=root)
    244     int cliqueAction=1;
    245     parameters[whichParam(CLIQUECUTS,numberParameters,parameters)].setCurrentOption("on");
     394    int cliqueAction=3;
     395    parameters[whichParam(CLIQUECUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    246396
    247397    CglMixedIntegerRounding2 mixedGen;
    248398    // set default action (0=off,1=on,2=root)
    249     int mixedAction=1;
    250     parameters[whichParam(MIXEDCUTS,numberParameters,parameters)].setCurrentOption("on");
     399    int mixedAction=3;
     400    parameters[whichParam(MIXEDCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    251401
    252402    CglFlowCover flowGen;
    253403    // set default action (0=off,1=on,2=root)
    254     int flowAction=1;
    255     parameters[whichParam(FLOWCUTS,numberParameters,parameters)].setCurrentOption("on");
     404    int flowAction=3;
     405    parameters[whichParam(FLOWCUTS,numberParameters,parameters)].setCurrentOption("ifmove");
    256406
    257407    CglTwomir twomirGen;
    258408    // set default action (0=off,1=on,2=root)
    259     int twomirAction=0;
     409    int twomirAction=2;
     410    parameters[whichParam(TWOMIRCUTS,numberParameters,parameters)].setCurrentOption("root");
    260411
    261412    bool useRounding=true;
    262413    parameters[whichParam(ROUNDING,numberParameters,parameters)].setCurrentOption("on");
    263     int useFpump=0;
    264     bool useGreedy=false;
    265     bool useCombine=false;
     414    bool useFpump=true;
     415    bool useGreedy=true;
     416    parameters[whichParam(GREEDY,numberParameters,parameters)].setCurrentOption("on");
     417    bool useCombine=true;
     418    parameters[whichParam(COMBINE,numberParameters,parameters)].setCurrentOption("on");
    266419    bool useLocalTree=false;
    267420   
     
    476629              else if (parameters[iParam].type()==PRINTOPTIONS)
    477630                printOptions = value;
     631              else if (parameters[iParam].type()==CUTPASS)
     632                cutPass = value;
    478633              else if (parameters[iParam].type()==FPUMPITS)
    479                 { useFpump = value;parameters[iParam].setIntValue(value);}
     634                { useFpump = true;parameters[iParam].setIntValue(value);}
    480635              else
    481636                parameters[iParam].setIntParameter(lpSolver,value);
     
    661816            case FPUMP:
    662817              defaultSettings=false; // user knows what she is doing
    663               if (action&&useFpump==0)
    664                 useFpump=parameters[whichParam(FPUMPITS,numberParameters,parameters)].intValue();
    665               else if (!action)
    666                 useFpump=0;
     818              useFpump=action;
    667819              break;
    668820            case CUTSSTRATEGY:
     
    670822              probingAction = action;
    671823              knapsackAction = action;
    672               redsplitAction = action;
     824              //redsplitAction = action;
    673825              cliqueAction = action;
    674826              flowAction = action;
     
    678830              parameters[whichParam(PROBINGCUTS,numberParameters,parameters)].setCurrentOption(action);
    679831              parameters[whichParam(KNAPSACKCUTS,numberParameters,parameters)].setCurrentOption(action);
    680               parameters[whichParam(REDSPLITCUTS,numberParameters,parameters)].setCurrentOption(action);
     832              //parameters[whichParam(REDSPLITCUTS,numberParameters,parameters)].setCurrentOption(action);
    681833              parameters[whichParam(CLIQUECUTS,numberParameters,parameters)].setCurrentOption(action);
    682834              parameters[whichParam(FLOWCUTS,numberParameters,parameters)].setCurrentOption(action);
     
    689841              useCombine = action;
    690842              //useLocalTree = action;
    691               if (action&&useFpump==0)
    692                 useFpump=parameters[whichParam(FPUMPITS,numberParameters,parameters)].intValue();
    693               else if (!action)
    694                 useFpump=0;
     843              useFpump=action;
    695844              parameters[whichParam(ROUNDING,numberParameters,parameters)].setCurrentOption(action);
    696845              parameters[whichParam(GREEDY,numberParameters,parameters)].setCurrentOption(action);
     
    9181067                // get clp itself
    9191068                ClpSimplex * modelC = si->getModelPtr();
    920                 if (si->messageHandler()->logLevel())
    921                   si->messageHandler()->setLogLevel(1);
    9221069                if (modelC->tightenPrimalBounds()!=0) {
    9231070                  std::cout<<"Problem is infeasible!"<<std::endl;
     
    9671114              babModel->assignSolver(solver3);
    9681115              clpSolver = dynamic_cast< OsiClpSolverInterface*> (babModel->solver());
     1116              int numberChanged=0;
     1117              int * changed = analyze( clpSolver,numberChanged);
     1118              if (clpSolver->messageHandler()->logLevel())
     1119                clpSolver->messageHandler()->setLogLevel(1);
     1120              int logLevel = parameters[slog].intValue();
     1121              if (logLevel)
     1122                clpSolver->messageHandler()->setLogLevel(logLevel);
    9691123              lpSolver = clpSolver->getModelPtr();
     1124              if (lpSolver->factorizationFrequency()==200) {
     1125                // User did not touch preset
     1126                int numberRows = lpSolver->numberRows();
     1127                const int cutoff1=10000;
     1128                const int cutoff2=100000;
     1129                const int base=75;
     1130                const int freq0 = 50;
     1131                const int freq1=200;
     1132                const int freq2=400;
     1133                const int maximum=1000;
     1134                int frequency;
     1135                if (numberRows<cutoff1)
     1136                  frequency=base+numberRows/freq0;
     1137                else if (numberRows<cutoff2)
     1138                  frequency=base+cutoff1/freq0 + (numberRows-cutoff1)/freq1;
     1139                else
     1140                  frequency=base+cutoff1/freq0 + (cutoff2-cutoff1)/freq1 + (numberRows-cutoff2)/freq2;
     1141                lpSolver->setFactorizationFrequency(CoinMin(maximum,frequency));
     1142              }
     1143              time2 = CoinCpuTime();
     1144              totalTime += time2-time1;
     1145              time1 = time2;
     1146              double timeLeft = babModel->getMaximumSeconds();
    9701147              if (preProcess) {
    9711148                saveSolver=babModel->solver()->clone();
    9721149                /* Do not try and produce equality cliques and
    9731150                   do up to 10 passes */
    974                 OsiSolverInterface * solver2 = process.preProcess(*saveSolver,false,10);
     1151                OsiSolverInterface * solver2 = process.preProcess(*saveSolver,true,10);
    9751152                if (!solver2) {
    9761153                  printf("Pre-processing says infeasible\n");
     
    9911168                babModel->assignSolver(solver2);
    9921169                babModel->initialSolve();
     1170                babModel->setMaximumSeconds(timeLeft-(CoinCpuTime()-time1));
    9931171              }
    9941172              if (0) {
     
    10091187              CbcHeuristicFPump heuristic4(*babModel);
    10101188              if (useFpump) {
    1011                 heuristic4.setMaximumPasses(useFpump);
     1189                heuristic4.setMaximumPasses(parameters[whichParam(FPUMPITS,numberParameters,parameters)].intValue());
    10121190                babModel->addHeuristic(&heuristic4);
    10131191              }
     
    10321210              if (probingAction==1)
    10331211                babModel->addCutGenerator(&probingGen,-1,"Probing");
    1034               else if (probingAction==2)
    1035                 babModel->addCutGenerator(&probingGen,-99,"Probing");
     1212              else if (probingAction>=2)
     1213                babModel->addCutGenerator(&probingGen,-101+probingAction,"Probing");
    10361214              if (gomoryAction==1)
    10371215                babModel->addCutGenerator(&gomoryGen,-1,"Gomory");
    1038               else if (gomoryAction==2)
    1039                 babModel->addCutGenerator(&gomoryGen,-99,"Gomory");
     1216              else if (gomoryAction>=2)
     1217                babModel->addCutGenerator(&gomoryGen,-101+gomoryAction,"Gomory");
    10401218              if (knapsackAction==1)
    10411219                babModel->addCutGenerator(&knapsackGen,-1,"Knapsack");
    1042               else if (knapsackAction==2)
    1043                 babModel->addCutGenerator(&knapsackGen,-99,"Knapsack");
     1220              else if (knapsackAction>=2)
     1221                babModel->addCutGenerator(&knapsackGen,-101+knapsackAction,"Knapsack");
    10441222              if (redsplitAction==1)
    10451223                babModel->addCutGenerator(&redsplitGen,-1,"Reduce-and-split");
    1046               else if (redsplitAction==2)
    1047                 babModel->addCutGenerator(&redsplitGen,-99,"Reduce-and-split");
     1224              else if (redsplitAction>=2)
     1225                babModel->addCutGenerator(&redsplitGen,-101+redsplitAction,"Reduce-and-split");
    10481226              if (cliqueAction==1)
    10491227                babModel->addCutGenerator(&cliqueGen,-1,"Clique");
    1050               else if (cliqueAction==2)
    1051                 babModel->addCutGenerator(&cliqueGen,-99,"Clique");
     1228              else if (cliqueAction>=2)
     1229                babModel->addCutGenerator(&cliqueGen,-101+cliqueAction,"Clique");
    10521230              if (mixedAction==1)
    10531231                babModel->addCutGenerator(&mixedGen,-1,"MixedIntegerRounding2");
    1054               else if (mixedAction==2)
    1055                 babModel->addCutGenerator(&mixedGen,-99,"MixedIntegerRounding2");
     1232              else if (mixedAction>=2)
     1233                babModel->addCutGenerator(&mixedGen,-101+mixedAction,"MixedIntegerRounding2");
    10561234              if (flowAction==1)
    10571235                babModel->addCutGenerator(&flowGen,-1,"FlowCover");
    1058               else if (flowAction==2)
    1059                 babModel->addCutGenerator(&flowGen,-99,"FlowCover");
     1236              else if (flowAction>=2)
     1237                babModel->addCutGenerator(&flowGen,-101+flowAction,"FlowCover");
    10601238              if (twomirAction==1)
    10611239                babModel->addCutGenerator(&twomirGen,-1,"TwoMirCuts");
    1062               else if (twomirAction==2)
    1063                 babModel->addCutGenerator(&twomirGen,-99,"TwoMirCuts");
     1240              else if (twomirAction>=2)
     1241                babModel->addCutGenerator(&twomirGen,-101+twomirAction,"TwoMirCuts");
    10641242              // Say we want timings
    10651243              int numberGenerators = babModel->numberCutGenerators();
     
    10741252              }
    10751253              // Could tune more
    1076               babModel->setMinimumDrop(min(1.0,
     1254              babModel->setMinimumDrop(min(5.0e-2,
    10771255                                        fabs(babModel->getMinimizationObjValue())*1.0e-3+1.0e-4));
    1078              
    1079               if (babModel->getNumCols()<500)
    1080                 babModel->setMaximumCutPassesAtRoot(-100); // always do 100 if possible
    1081               else if (babModel->getNumCols()<5000)
    1082                 babModel->setMaximumCutPassesAtRoot(100); // use minimum drop
    1083               else
    1084                 babModel->setMaximumCutPassesAtRoot(20);
    1085               babModel->setMaximumCutPasses(2);
     1256              if (cutPass==-1234567) {
     1257                if (babModel->getNumCols()<500)
     1258                  babModel->setMaximumCutPassesAtRoot(-100); // always do 100 if possible
     1259                else if (babModel->getNumCols()<5000)
     1260                  babModel->setMaximumCutPassesAtRoot(100); // use minimum drop
     1261                else
     1262                  babModel->setMaximumCutPassesAtRoot(20);
     1263              } else {
     1264                babModel->setMaximumCutPassesAtRoot(cutPass);
     1265              }
     1266              babModel->setMaximumCutPasses(1);
    10861267             
    10871268              // Do more strong branching if small
     
    11581339              }
    11591340              clpSolver = dynamic_cast< OsiClpSolverInterface*> (babModel->solver());
     1341              if (numberChanged) {
     1342                for (int i=0;i<numberChanged;i++) {
     1343                  int iColumn=changed[i];
     1344                  clpSolver->setContinuous(iColumn);
     1345                }
     1346                delete [] changed;
     1347              }
    11601348              lpSolver = clpSolver->getModelPtr();
    1161               std::cout<<"Result "<<babModel->getObjValue()<<
    1162                 " iterations "<<babModel->getIterationCount()<<
    1163                 " nodes "<<babModel->getNodeCount()<<
    1164                 " took "<<time2-time1<<" seconds - total "<<totalTime<<std::endl;
     1349              std::string statusName[]={"Finished","Stopped on ","Difficulties",
     1350                                        "","","User ctrl-c"};
     1351              std::string minor[]={"","","gap","nodes","time","","solutions"};
     1352              int iStat = babModel->status();
     1353              int iStat2 = babModel->secondaryStatus();
     1354              std::cout<<"Result - "<<statusName[iStat]<<minor[iStat2]
     1355                       <<" objective "<<babModel->getObjValue()<<
     1356                " after "<<babModel->getNodeCount()<<" nodes and "
     1357                <<babModel->getIterationCount()<<
     1358                " iterations - took "<<time2-time1<<" seconds"<<std::endl;
    11651359              time1 = time2;
    11661360            } else {
  • trunk/include/CbcHeuristic.hpp

    r88 r197  
    6666  inline int when() const
    6767  { return when_;};
     68
     69  /// Do mini branch and bound (return 1 if solution)
     70  int smallBranchAndBound(OsiSolverInterface * solver,int numberNodes,
     71                          double * newSolution, double & newSolutionValue,
     72                          double cutoff , std::string name) const;
    6873
    6974protected:
  • trunk/include/CbcModel.hpp

    r181 r197  
    131131             A double should be adequate! */
    132132  CbcMaximumSeconds,
     133  /// Cutoff - stored for speed
     134  CbcCurrentCutoff,
     135  /// Optimization direction - stored for speed
     136  CbcOptimizationDirection,
     137  /// Current objective value
     138  CbcCurrentObjectiveValue,
     139  /// Current minimization objective value
     140  CbcCurrentMinimizationObjectiveValue,
    133141  /** \brief The time at start of model.
    134142             So that other pieces of code can access */
     
    392400  /// Get the cutoff bound on the objective function - always as minimize
    393401  inline double getCutoff() const
    394   { double value ;
    395     solver_->getDblParam(OsiDualObjectiveLimit,value) ;
    396     return value * solver_->getObjSense() ; } ;
     402  { //double value ;
     403    //solver_->getDblParam(OsiDualObjectiveLimit,value) ;
     404    //assert( dblParam_[CbcCurrentCutoff]== value * solver_->getObjSense());
     405    return dblParam_[CbcCurrentCutoff];
     406  }
    397407
    398408  /// Set the \link CbcModel::CbcMaxNumNode maximum node limit \endlink
     
    499509    return 100.0*getDblParam(CbcAllowableFractionGap);
    500510  }
     511  /** Set the
     512      \link CbcModel::CbcCutoffIncrement  \endlink
     513      desired.
     514  */
     515  inline bool setCutoffIncrement( double value) {
     516    return setDblParam(CbcCutoffIncrement,value);
     517  }
     518  /** Get the
     519      \link CbcModel::CbcCutoffIncrement  \endlink
     520      desired.
     521  */
     522  inline double getCutoffIncrement() const {
     523    return getDblParam(CbcCutoffIncrement);
     524  }
    501525
    502526  /// Set the hotstart strategy
    503   void setHotstartStrategy(int value)
     527  inline void setHotstartStrategy(int value)
    504528  { hotstartStrategy_=value;};
    505529  /// Get the hotstart strategy
    506   int getHotstartStrategy() const
     530  inline int getHotstartStrategy() const
    507531  { return hotstartStrategy_;};
    508532 
     
    601625    Print frequency has very slight overhead if small.
    602626  */
    603   void setPrintFrequency(int number)
     627  inline void setPrintFrequency(int number)
    604628  { printFrequency_=number;};
    605629  /// Get the print frequency
     
    624648    bool isSolutionLimitReached() const;
    625649    /// Get how many iterations it took to solve the problem.
    626     int getIterationCount() const
     650    inline int getIterationCount() const
    627651    { return numberIterations_;};
    628652    /// Get how many Nodes it took to solve the problem.
    629     int getNodeCount() const
     653    inline int getNodeCount() const
    630654    { return numberNodes_;};
    631655    /** Final status of problem
     
    677701  //@{
    678702  /// Number of rows in continuous (root) problem.
    679   int numberRowsAtContinuous() const
     703  inline int numberRowsAtContinuous() const
    680704  { return numberRowsAtContinuous_;};
    681705
    682706  /// Get number of columns
    683   int getNumCols() const
     707  inline int getNumCols() const
    684708  { return solver_->getNumCols();};
    685709 
    686710  /// Get number of rows
    687   int getNumRows() const
     711  inline int getNumRows() const
    688712  { return solver_->getNumRows();};
    689713 
    690714  /// Get number of nonzero elements
    691   CoinBigIndex getNumElements() const
     715  inline CoinBigIndex getNumElements() const
    692716  { return solver_->getNumElements();};
    693717
     
    698722  inline const int * integerVariable() const
    699723  { return integerVariable_;};
    700  
     724  /// Whether or not integer
     725  inline const char integerType(int i) const
     726  { return integerInfo_[i];};
     727  /// Whether or not integer
     728  inline const char * integerType() const
     729  { return integerInfo_;};
     730
    701731  /// Get pointer to array[getNumCols()] of column lower bounds
    702   const double * getColLower() const
     732  inline const double * getColLower() const
    703733  { return solver_->getColLower();};
    704734 
    705735  /// Get pointer to array[getNumCols()] of column upper bounds
    706   const double * getColUpper() const
     736  inline const double * getColUpper() const
    707737  { return solver_->getColUpper();};
    708738 
     
    716746      </ul>
    717747  */
    718   const char * getRowSense() const
     748  inline const char * getRowSense() const
    719749  { return solver_->getRowSense();};
    720750 
     
    727757      </ul>
    728758  */
    729   const double * getRightHandSide() const
     759  inline const double * getRightHandSide() const
    730760  { return solver_->getRightHandSide();};
    731761 
     
    738768      </ul>
    739769  */
    740   const double * getRowRange() const
     770  inline const double * getRowRange() const
    741771  { return solver_->getRowRange();};
    742772 
    743773  /// Get pointer to array[getNumRows()] of row lower bounds
    744   const double * getRowLower() const
     774  inline const double * getRowLower() const
    745775  { return solver_->getRowLower();};
    746776 
    747777  /// Get pointer to array[getNumRows()] of row upper bounds
    748   const double * getRowUpper() const
     778  inline const double * getRowUpper() const
    749779  { return solver_->getRowUpper();};
    750780 
    751781  /// Get pointer to array[getNumCols()] of objective function coefficients
    752   const double * getObjCoefficients() const
     782  inline const double * getObjCoefficients() const
    753783  { return solver_->getObjCoefficients();};
    754784 
    755785  /// Get objective function sense (1 for min (default), -1 for max)
    756   double getObjSense() const
    757   { return solver_->getObjSense();};
     786  inline double getObjSense() const
     787  {
     788    //assert (dblParam_[CbcOptimizationDirection]== solver_->getObjSense());
     789    return dblParam_[CbcOptimizationDirection];};
    758790 
    759791  /// Return true if variable is continuous
    760   bool isContinuous(int colIndex) const
     792  inline bool isContinuous(int colIndex) const
    761793  { return solver_->isContinuous(colIndex);};
    762794 
    763795  /// Return true if variable is binary
    764   bool isBinary(int colIndex) const
     796  inline bool isBinary(int colIndex) const
    765797  { return solver_->isBinary(colIndex);};
    766798 
     
    769801      is binary or a general integer.
    770802  */
    771   bool isInteger(int colIndex) const
     803  inline bool isInteger(int colIndex) const
    772804  { return solver_->isInteger(colIndex);};
    773805 
    774806  /// Return true if variable is general integer
    775   bool isIntegerNonBinary(int colIndex) const
     807  inline bool isIntegerNonBinary(int colIndex) const
    776808  { return solver_->isIntegerNonBinary(colIndex);};
    777809 
    778810  /// Return true if variable is binary and not fixed at either bound
    779   bool isFreeBinary(int colIndex) const
     811  inline bool isFreeBinary(int colIndex) const
    780812  { return solver_->isFreeBinary(colIndex) ;};
    781813 
    782814  /// Get pointer to row-wise copy of matrix
    783   const CoinPackedMatrix * getMatrixByRow() const
     815  inline const CoinPackedMatrix * getMatrixByRow() const
    784816  { return solver_->getMatrixByRow();};
    785817 
    786818  /// Get pointer to column-wise copy of matrix
    787   const CoinPackedMatrix * getMatrixByCol() const
     819  inline const CoinPackedMatrix * getMatrixByCol() const
    788820  { return solver_->getMatrixByCol();};
    789821 
    790822  /// Get solver's value for infinity
    791   double getInfinity() const
     823  inline double getInfinity() const
    792824  { return solver_->getInfinity();};
     825  /// Get pointer to array[getNumCols()] (for speed) of column lower bounds
     826  inline const double * getCbcColLower() const
     827  { return cbcColLower_;};
     828  /// Get pointer to array[getNumCols()] (for speed) of column upper bounds
     829  inline const double * getCbcColUpper() const
     830  { return cbcColUpper_;};
     831  /// Get pointer to array[getNumRows()] (for speed) of row lower bounds
     832  inline const double * getCbcRowLower() const
     833  { return cbcRowLower_;};
     834  /// Get pointer to array[getNumRows()] (for speed) of row upper bounds
     835  inline const double * getCbcRowUpper() const
     836  { return cbcRowUpper_;};
     837  /// Get pointer to array[getNumCols()] (for speed) of primal solution vector
     838  inline const double * getCbcColSolution() const
     839  { return cbcColSolution_;};
     840  /// Get pointer to array[getNumRows()] (for speed) of dual prices
     841  inline const double * getCbcRowPrice() const
     842  { return cbcRowPrice_;};
     843  /// Get a pointer to array[getNumCols()] (for speed) of reduced costs
     844  inline const double * getCbcReducedCost() const
     845  { return cbcReducedCost_;};
     846  /// Get pointer to array[getNumRows()] (for speed) of row activity levels.
     847  inline const double * getCbcRowActivity() const
     848  { return cbcRowActivity_;};
    793849  //@}
    794850 
     
    865921  /// Get current objective function value
    866922  inline double getCurrentObjValue() const
    867   { return solver_->getObjValue();};
     923  { return dblParam_[CbcCurrentObjectiveValue]; }
     924  /// Get current minimization objective function value
     925  inline double getCurrentMinimizationObjValue() const
     926  { return dblParam_[CbcCurrentMinimizationObjectiveValue];}
    868927 
    869928  /// Get best objective function value as minimization
     
    893952  */
    894953
    895   double * bestSolution() const
     954  inline double * bestSolution() const
    896955  { return bestSolution_;};
    897956 
    898957  /// Get number of solutions
    899   int getSolutionCount() const
     958  inline int getSolutionCount() const
    900959  { return numberSolutions_;};
    901960 
    902961  /// Set number of solutions (so heuristics will be different)
    903   void setSolutionCount(int value)
     962  inline void setSolutionCount(int value)
    904963  { numberSolutions_=value;};
    905964  /** Current phase (so heuristics etc etc can find out).
     
    915974 
    916975  /// Get number of heuristic solutions
    917   int getNumberHeuristicSolutions() const { return numberHeuristicSolutions_;};
     976  inline int getNumberHeuristicSolutions() const { return numberHeuristicSolutions_;};
    918977
    919978  /// Set objective function sense (1 for min (default), -1 for max,)
    920   void setObjSense(double s) { solver_->setObjSense(s);};
     979  inline void setObjSense(double s) { dblParam_[CbcOptimizationDirection]=s;
     980  solver_->setObjSense(s);};
    921981
    922982  /// Value of objective at continuous
     
    10771137
    10781138  /// Return the list of cuts initially collected for this subproblem
    1079   CbcCountRowCut ** addedCuts() const
     1139  inline CbcCountRowCut ** addedCuts() const
    10801140  { return addedCuts_;};
    10811141  /// Number of entries in the list returned by #addedCuts()
    1082   int currentNumberCuts() const
     1142  inline int currentNumberCuts() const
    10831143  { return currentNumberCuts_;};
    10841144  /// Global cuts
     
    12911351    int getNodeCount2() const
    12921352    { return numberNodes2_;};
     1353  /// Set pointers for speed
     1354  void setPointers(const OsiSolverInterface * solver);
    12931355  //@}
    12941356
     
    14551517  /// Indices of integer variables
    14561518  int * integerVariable_;
     1519  /// Whether of not integer
     1520  char * integerInfo_;
    14571521  /// Holds solution at continuous (after cuts)
    14581522  double * continuousSolution_;
     
    14861550      2 - integer presolve (dodgy)
    14871551  */
     1552  /// Pointer to array[getNumCols()] (for speed) of column lower bounds
     1553  const double * cbcColLower_;
     1554  /// Pointer to array[getNumCols()] (for speed) of column upper bounds
     1555  const double * cbcColUpper_;
     1556  /// Pointer to array[getNumRows()] (for speed) of row lower bounds
     1557  const double * cbcRowLower_;
     1558  /// Pointer to array[getNumRows()] (for speed) of row upper bounds
     1559  const double * cbcRowUpper_;
     1560  /// Pointer to array[getNumCols()] (for speed) of primal solution vector
     1561  const double * cbcColSolution_;
     1562  /// Pointer to array[getNumRows()] (for speed) of dual prices
     1563  const double * cbcRowPrice_;
     1564  /// Get a pointer to array[getNumCols()] (for speed) of reduced costs
     1565  const double * cbcReducedCost_;
     1566  /// Pointer to array[getNumRows()] (for speed) of row activity levels.
     1567  const double * cbcRowActivity_;
    14881568  /// Pointer to user-defined data structure
    14891569  void * appData_;
     1570  /// Pointer to
    14901571  int presolve_;
    14911572  /** Maximum number of candidates to consider for strong branching.
    1492 
    14931573    To disable strong branching, set this to 0.
    14941574  */
Note: See TracChangeset for help on using the changeset viewer.