Ignore:
Timestamp:
Oct 8, 2006 7:33:47 PM (13 years ago)
Author:
forrest
Message:

towards common use with other solvers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/devel/Cbc/src/Cbc_C_Interface.cpp

    r310 r439  
    863863*/
    864864COINLIBAPI int COINLINKAGE
    865 Cbc_status(Cbc_Model * model)
    866 {
    867   const char prefix[] = "Cbc_C_Interface::Cbc_status(): ";
    868 //  const int  VERBOSE = 1;
    869   if (VERBOSE>0) printf("%s begin\n",prefix);
    870 
    871   int result = 0;
    872   result = model->model_->status();
     865Cbc_LPstatus(Cbc_Model * model)
     866{
     867  const char prefix[] = "Cbc_C_Interface::Cbc_LPstatus(): ";
     868//  const int  VERBOSE = 1;
     869  if (VERBOSE>0) printf("%s begin\n",prefix);
     870
     871  int result = 0;
     872  OsiClpSolverInterface * solver  =  dynamic_cast< OsiClpSolverInterface*> (model->model_->solver());
     873  result = solver->getModelPtr()->status();
    873874
    874875  if (VERBOSE>0) printf("%s return %i\n",prefix,result);
     
    877878/* Set problem status */
    878879COINLIBAPI void COINLINKAGE
    879 Cbc_setProblemStatus(Cbc_Model * model, int problemStatus)
    880 {
    881   const char prefix[] = "Cbc_C_Interface::Cbc_setProblemStatus(): ";
    882 //  const int  VERBOSE = 1;
    883   if (VERBOSE>0) printf("%s begin\n",prefix);
    884 
    885 // cannot find this in Cbc, Osi, or OsiClp
    886 //tbd  model->model_->setProblemStatus(problemStatus);
    887   printf("%s ERROR: NOT IMPLEMENTED\n",prefix);
     880Cbc_setProblemLPStatus(Cbc_Model * model, int problemStatus)
     881{
     882  const char prefix[] = "Cbc_C_Interface::Cbc_setLPProblemStatus(): ";
     883//  const int  VERBOSE = 1;
     884  if (VERBOSE>0) printf("%s begin\n",prefix);
     885
     886  OsiClpSolverInterface * solver  =  dynamic_cast< OsiClpSolverInterface*> (model->model_->solver());
     887  solver->getModelPtr()->setProblemStatus(problemStatus);
    888888
    889889  if (VERBOSE>0) printf("%s return\n",prefix);
     
    897897*/
    898898COINLIBAPI int COINLINKAGE
     899Cbc_secondaryLPStatus(Cbc_Model * model)
     900{
     901  const char prefix[] = "Cbc_C_Interface::Cbc_secondaryLPStatus(): ";
     902//  const int  VERBOSE = 1;
     903  if (VERBOSE>0) printf("%s begin\n",prefix);
     904
     905  int result = 0;
     906  OsiClpSolverInterface * solver  =  dynamic_cast< OsiClpSolverInterface*> (model->model_->solver());
     907  result = solver->getModelPtr()->secondaryStatus();
     908
     909  if (VERBOSE>0) printf("%s return %i\n",prefix,result);
     910  return result;
     911}
     912COINLIBAPI void COINLINKAGE
     913Cbc_setSecondaryLPStatus(Cbc_Model * model, int status)
     914{
     915  const char prefix[] = "Cbc_C_Interface::Cbc_setSecondaryLPStatus(): ";
     916//  const int  VERBOSE = 1;
     917  if (VERBOSE>0) printf("%s begin\n",prefix);
     918
     919  OsiClpSolverInterface * solver  =  dynamic_cast< OsiClpSolverInterface*> (model->model_->solver());
     920  solver->getModelPtr()->setSecondaryStatus(status);
     921
     922  if (VERBOSE>0) printf("%s return\n",prefix);
     923}
     924/* Final status of BAB problem
     925   Some of these can be found out by is...... functions
     926   -1 before branchAndBound
     927   0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
     928   (or check value of best solution)
     929   1 stopped - on maxnodes, maxsols, maxtime
     930   2 difficulties so run was abandoned
     931   (5 event user programmed event occurred)
     932*/
     933COINLIBAPI int COINLINKAGE
     934Cbc_status(Cbc_Model * model)
     935{
     936  const char prefix[] = "Cbc_C_Interface::Cbc_status(): ";
     937//  const int  VERBOSE = 1;
     938  if (VERBOSE>0) printf("%s begin\n",prefix);
     939
     940  int result = 0;
     941  result = model->model_->status();
     942
     943  if (VERBOSE>0) printf("%s return %i\n",prefix,result);
     944  return result;
     945}
     946/* Set problem status */
     947COINLIBAPI void COINLINKAGE
     948Cbc_setProblemStatus(Cbc_Model * model, int problemStatus)
     949{
     950  const char prefix[] = "Cbc_C_Interface::Cbc_setProblemStatus(): ";
     951//  const int  VERBOSE = 1;
     952  if (VERBOSE>0) printf("%s begin\n",prefix);
     953
     954  model->model_->setProblemStatus(problemStatus);
     955
     956  if (VERBOSE>0) printf("%s return\n",prefix);
     957}
     958/* Secondary status of BAB problem
     959   -1 unset (status_ will also be -1)
     960   0 search completed with solution
     961   1 linear relaxation not feasible (or worse than cutoff)
     962   2 stopped on gap
     963   3 stopped on nodes
     964   4 stopped on time
     965   5 stopped on user event
     966   6 stopped on solutions
     967   7 linear relaxation unbounded
     968*/
     969COINLIBAPI int COINLINKAGE
    899970Cbc_secondaryStatus(Cbc_Model * model)
    900971{
     
    904975
    905976  int result = 0;
    906 // cannot find this in Cbc, Osi, or OsiClp
    907 //tbd  result = model->model_->secondaryStatus();
    908   printf("%s ERROR: NOT IMPLEMENTED\n",prefix);
     977  result = model->model_->secondaryStatus();
    909978
    910979  if (VERBOSE>0) printf("%s return %i\n",prefix,result);
     
    918987  if (VERBOSE>0) printf("%s begin\n",prefix);
    919988
    920 // cannot find this in Cbc, Osi, or OsiClp
    921 //tbd  model->model_->setSecondaryStatus(status);
    922   printf("%s ERROR: NOT IMPLEMENTED\n",prefix);
     989  model->model_->setSecondaryStatus(status);
    923990
    924991  if (VERBOSE>0) printf("%s return\n",prefix);
Note: See TracChangeset for help on using the changeset viewer.