lemon/cbc.cc
changeset 577 5563527bcc8d
parent 567 3314f58e7b25
child 746 e4554cd6b2bf
child 973 ee581a0ecfbf
equal deleted inserted replaced
0:70254dfb8693 1:4d624687930e
    53   CbcMip::CbcMip() {
    53   CbcMip::CbcMip() {
    54     _prob = new CoinModel();
    54     _prob = new CoinModel();
    55     _prob->setProblemName("LEMON");
    55     _prob->setProblemName("LEMON");
    56     _osi_solver = 0;
    56     _osi_solver = 0;
    57     _cbc_model = 0;
    57     _cbc_model = 0;
       
    58     messageLevel(MESSAGE_NOTHING);
    58   }
    59   }
    59 
    60 
    60   CbcMip::CbcMip(const CbcMip& other) {
    61   CbcMip::CbcMip(const CbcMip& other) {
    61     _prob = new CoinModel(*other._prob);
    62     _prob = new CoinModel(*other._prob);
       
    63     _prob->setProblemName("LEMON");
    62     _osi_solver = 0;
    64     _osi_solver = 0;
    63     _cbc_model = 0;
    65     _cbc_model = 0;
       
    66     messageLevel(MESSAGE_NOTHING);
    64   }
    67   }
    65 
    68 
    66   CbcMip::~CbcMip() {
    69   CbcMip::~CbcMip() {
    67     delete _prob;
    70     delete _prob;
    68     if (_osi_solver) delete _osi_solver;
    71     if (_osi_solver) delete _osi_solver;
   268     if (_cbc_model) {
   271     if (_cbc_model) {
   269       delete _cbc_model;
   272       delete _cbc_model;
   270     }
   273     }
   271     _cbc_model= new CbcModel(*_osi_solver);
   274     _cbc_model= new CbcModel(*_osi_solver);
   272 
   275 
   273     switch (_message_level) {
   276     _osi_solver->messageHandler()->setLogLevel(_message_level);
   274     case MESSAGE_NO_OUTPUT:
   277     _cbc_model->setLogLevel(_message_level);
   275       _osi_solver->messageHandler()->setLogLevel(0);
       
   276       _cbc_model->setLogLevel(0);
       
   277       break;
       
   278     case MESSAGE_ERROR_MESSAGE:
       
   279       _osi_solver->messageHandler()->setLogLevel(1);
       
   280       _cbc_model->setLogLevel(1);
       
   281       break;
       
   282     case MESSAGE_NORMAL_OUTPUT:
       
   283       _osi_solver->messageHandler()->setLogLevel(2);
       
   284       _cbc_model->setLogLevel(2);
       
   285       break;
       
   286     case MESSAGE_FULL_OUTPUT:
       
   287       _osi_solver->messageHandler()->setLogLevel(3);
       
   288       _cbc_model->setLogLevel(3);
       
   289       break;
       
   290     }
       
   291 
   278 
   292     _cbc_model->initialSolve();
   279     _cbc_model->initialSolve();
   293     _cbc_model->solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry);
   280     _cbc_model->solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry);
   294 
   281 
   295     if (!_cbc_model->isInitialSolveAbandoned() &&
   282     if (!_cbc_model->isInitialSolveAbandoned() &&
   451     _prob = new CoinModel();
   438     _prob = new CoinModel();
   452     rows.clear();
   439     rows.clear();
   453     cols.clear();
   440     cols.clear();
   454   }
   441   }
   455 
   442 
   456   void CbcMip::messageLevel(MessageLevel m) {
   443   void CbcMip::_messageLevel(MessageLevel level) {
   457     _message_level = m;
   444     switch (level) {
       
   445     case MESSAGE_NOTHING:
       
   446       _message_level = 0;
       
   447       break;
       
   448     case MESSAGE_ERROR:
       
   449       _message_level = 1;
       
   450       break;
       
   451     case MESSAGE_WARNING:
       
   452       _message_level = 1;
       
   453       break;
       
   454     case MESSAGE_NORMAL:
       
   455       _message_level = 2;
       
   456       break;
       
   457     case MESSAGE_VERBOSE:
       
   458       _message_level = 3;
       
   459       break;
       
   460     }
   458   }
   461   }
   459 
   462 
   460 } //END OF NAMESPACE LEMON
   463 } //END OF NAMESPACE LEMON