Changeset 1175


Ignore:
Timestamp:
Jun 12, 2009 12:24:35 PM (10 years ago)
Author:
forrest
Message:

minor change to status message and stop long Cbcnode

Location:
trunk/Cbc/src
Files:
4 edited

Legend:

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

    r1173 r1175  
    13571357      }
    13581358      // no crunch if mostly continuous
    1359       //int numberColumns = solver_->getNumCols()+1000000; // fake for testing
    1360       int numberColumns = solver_->getNumCols();
    1361       if (numberColumns>1000&&numberIntegers_*4<numberColumns)
    1362         clpSolver->setSpecialOptions(clpSolver->specialOptions()&(~1));
     1359      if ((clpSolver->specialOptions()&(1+8))!=(1+8)) {
     1360        int numberColumns = solver_->getNumCols();
     1361        if (numberColumns>1000&&numberIntegers_*4<numberColumns)
     1362          clpSolver->setSpecialOptions(clpSolver->specialOptions()&(~1));
     1363      }
    13631364      //#define NO_CRUNCH
    13641365#ifdef NO_CRUNCH
  • trunk/Cbc/src/CbcNode.cpp

    r1173 r1175  
    26572657  }
    26582658  choice.possibleBranch=choiceObject;
    2659   int kkPass=0;
     2659  numberPassesLeft = CoinMax(numberPassesLeft,2);
    26602660  while(!finished) {
    2661     kkPass++;
     2661    numberPassesLeft--;
    26622662    finished=true;
    26632663    decision->initialize(model);
     
    39593959  delete [] downEstimate;
    39603960# ifdef COIN_HAS_CLP
    3961   if (osiclp)
     3961  if (osiclp) {
    39623962    osiclp->setSpecialOptions(saveClpOptions);
     3963  }
    39633964# endif
    39643965  // restore solution
  • trunk/Cbc/src/CbcSolver.cpp

    r1173 r1175  
    3535#include "ClpPrimalColumnSteepest.hpp"
    3636#include "ClpPrimalColumnDantzig.hpp"
     37
    3738#include "ClpPresolve.hpp"
    3839#include "CbcOrClpParam.hpp"
     
    4243// Version
    4344#ifndef CBCVERSION
    44 #define CBCVERSION "2.30.00"
     45#define CBCVERSION "2.31.00"
    4546#endif
    4647//#define ORBITAL
     
    48154816            case PFI:
    48164817              lpSolver->factorization()->setForrestTomlin(action==0);
     4818              break;
     4819            case FACTORIZATION:
     4820              lpSolver->factorization()->forceOtherFactorization(action);
    48174821              break;
    48184822            case CRASH:
     
    84068410                std::string statusName[]={"Finished","Stopped on ","Difficulties",
    84078411                                          "","","User ctrl-c"};
    8408                 std::string minor[]={"","","gap","nodes","time","","solutions","user ctrl-c"};
     8412                std::string minor[]={"","","gap","nodes","time","","solutions","user ctrl-c","proven-infeasible"};
    84098413                int iStat = babModel_->status();
    84108414                int iStat2 = babModel_->secondaryStatus();
     8415                if (!iStat&&!iStat2&&!bestSolution)
     8416                  iStat2=8;
    84118417                statistics_seconds=time2-time1;
    84128418                statistics_sys_seconds=CoinSysTime();
  • trunk/Cbc/src/CoinSolve.cpp

    r1173 r1175  
    1414#include "OsiCpxSolverInterface.hpp"
    1515#endif
     16//#define CLP_DEBUG_MALLOC
     17#ifdef CLP_DEBUG_MALLOC
     18extern "C" void clp_memory(int type);
     19extern "C" void * clp_malloc(int length);
     20extern "C" void clp_free(void * array);
     21#include <malloc.h>
     22#include <exception>
     23#include <new>
     24void * operator new (size_t size) throw (std::bad_alloc)
     25{
     26  void * p = clp_malloc(size);
     27  return p;
     28}
     29void operator delete (void *p) throw()
     30{
     31  clp_free(p);
     32}
     33#endif
    1634
    1735#include <cassert>
     
    217235int main (int argc, const char *argv[])
    218236{
     237  int returnCode=0;
     238#ifdef CLP_DEBUG_MALLOC
     239  clp_memory(0);
     240#endif
     241  {
    219242#ifndef CBC_OTHER_SOLVER
    220   OsiClpSolverInterface solver1;
     243    OsiClpSolverInterface solver1;
    221244#elif CBC_OTHER_SOLVER==1
    222   OsiCpxSolverInterface solver1;
    223 #endif
    224   CbcModel model(solver1);
    225   // define TEST_MESSAGE_HANDLER at top of file to check works on all messages
     245    OsiCpxSolverInterface solver1;
     246#endif
     247    CbcModel model(solver1);
     248    // define TEST_MESSAGE_HANDLER at top of file to check works on all messages
    226249#ifdef TEST_MESSAGE_HANDLER
    227   MyMessageHandler2 messageHandler(&model);
    228   std::cout<<"Testing derived message handler"<<std::endl;
    229   model.passInMessageHandler(&messageHandler);
    230   OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model.solver());
    231   // Could use different handlers (if different log levels)
    232   clpSolver->passInMessageHandler(&messageHandler);
    233   //clpSolver->getModelPtr()->passInMessageHandler(&messageHandler);
    234 #endif
    235   // initialize
    236   CbcMain0(model);
     250    MyMessageHandler2 messageHandler(&model);
     251    std::cout<<"Testing derived message handler"<<std::endl;
     252    model.passInMessageHandler(&messageHandler);
     253    OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model.solver());
     254    // Could use different handlers (if different log levels)
     255    clpSolver->passInMessageHandler(&messageHandler);
     256    //clpSolver->getModelPtr()->passInMessageHandler(&messageHandler);
     257#endif
     258    // initialize
     259    CbcMain0(model);
    237260#ifdef TEST_MESSAGE_HANDLER
    238   // Set log levels same so can use one message handler
    239   clpSolver->messageHandler()->setLogLevel(1) ;
    240   model.messageHandler()->setLogLevel(1);
    241   // switch off some printing
    242   void setCbcOrClpPrinting(bool yesNo);
    243   setCbcOrClpPrinting(false);
    244 #endif
    245   int returnCode = CbcMain1 (argc, argv,model);
    246 #if 0
    247   /* The call to CbcClpUnitTest was moved into CbcMain1. To make sure
    248      CbcMain1 behaves as it did before for any other call, I have added one more
    249      argument to indicate that it was called from here. */
    250   if (returnCode!=777) {
    251     //const CoinWarmStartBasis* debugws =
    252     //dynamic_cast <const CoinWarmStartBasis*>(model.solver()->getWarmStart()) ;
    253     //debugws->print() ;
    254     //delete debugws ;
    255     return returnCode;
    256   } else {
    257     // do miplib
    258     CbcClpUnitTest(model);
    259     return 0;
     261    // Set log levels same so can use one message handler
     262    clpSolver->messageHandler()->setLogLevel(1) ;
     263    model.messageHandler()->setLogLevel(1);
     264    // switch off some printing
     265    void setCbcOrClpPrinting(bool yesNo);
     266    setCbcOrClpPrinting(false);
     267#endif
     268    returnCode = CbcMain1 (argc, argv,model);
    260269  }
    261 #else
     270#ifdef CLP_DEBUG_MALLOC
     271  clp_memory(1);
     272#endif
    262273  if (returnCode!=777) {
    263274    return returnCode;
     
    265276    return 0;
    266277  }
    267 #endif
    268278}
    269279#else
    270280#include "CbcSolver.hpp"
    271281void addAmplToCbc(CbcSolver *);
    272 extern bool malloc_counts_on;
    273 extern void stolen_from_ekk_memory(void * info,int type);
    274282int main (int argc, const char *argv[])
    275283{
    276284  int returnCode;
    277285  // Only active if malloc switched on in CbcSolver.cpp
    278   stolen_from_ekk_memory(NULL,0);
    279   malloc_counts_on=true;
     286#ifdef CLP_DEBUG_MALLOC
     287  clp_memory(0);
     288#endif
    280289  {
    281290    OsiClpSolverInterface solver1;
     
    288297    returnCode= control.solve (argc, argv, 1);
    289298  }
    290   stolen_from_ekk_memory(NULL,1);
    291   malloc_counts_on=false;
     299#ifdef CLP_DEBUG_MALLOC
     300  clp_memory(1);
     301#endif
    292302  return returnCode;
    293303}
Note: See TracChangeset for help on using the changeset viewer.