Changeset 437


Ignore:
Timestamp:
Oct 4, 2006 3:14:11 PM (13 years ago)
Author:
forrest
Message:

for c interface

Location:
trunk/Cbc/src
Files:
3 edited

Legend:

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

    r395 r437  
    692692    inline int status() const
    693693    { return status_;};
     694    inline void setProblemStatus(int value)
     695    { status_=value;};
    694696    /** Secondary status of problem
    695697        -1 unset (status_ will also be -1)
     
    701703        5 stopped on user event
    702704        6 stopped on solutions
     705        7 linear relaxation unbounded
    703706    */
    704707    inline int secondaryStatus() const
    705708    { return secondaryStatus_;};
     709    inline void setSecondaryStatus(int value)
     710    { secondaryStatus_=value;};
    706711    /// Are there numerical difficulties (for initialSolve) ?
    707712    bool isInitialSolveAbandoned() const ;
  • trunk/Cbc/src/Cbc_C_Interface.cpp

    r310 r437  
    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);
  • trunk/Cbc/src/Cbc_C_Interface.h

    r2 r437  
    130130      4 - stopped due to errors
    131131  */
    132   COINLIBAPI int COINLINKAGE Cbc_status(Cbc_Model * model);
     132  COINLIBAPI int COINLINKAGE Cbc_LPstatus(Cbc_Model * model);
    133133  /** Set problem status */
    134   COINLIBAPI void COINLINKAGE Cbc_setProblemStatus(Cbc_Model * model, int problemStatus);
     134  COINLIBAPI void COINLINKAGE Cbc_setProblemLPStatus(Cbc_Model * model, int problemStatus);
    135135  /** Secondary status of problem - may get extended
    136136      0 - none
     
    139139      3 - scaled problem optimal - unscaled has dual infeasibilities
    140140      4 - scaled problem optimal - unscaled has both dual and primal infeasibilities
     141  */
     142  COINLIBAPI int COINLINKAGE Cbc_secondaryLPStatus(Cbc_Model * model);
     143  COINLIBAPI void COINLINKAGE Cbc_setSecondaryLPStatus(Cbc_Model * model, int status);
     144  /** Final status of BAB problem
     145      Some of these can be found out by is...... functions
     146      -1 before branchAndBound
     147      0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
     148      (or check value of best solution)
     149      1 stopped - on maxnodes, maxsols, maxtime
     150      2 difficulties so run was abandoned
     151      (5 event user programmed event occurred)
     152  */
     153  COINLIBAPI int COINLINKAGE Cbc_status(Cbc_Model * model);
     154  /** Set problem status */
     155  COINLIBAPI void COINLINKAGE Cbc_setProblemStatus(Cbc_Model * model, int problemStatus);
     156  /** Secondary status of BAB problem
     157      -1 unset (status_ will also be -1)
     158      0 search completed with solution
     159      1 linear relaxation not feasible (or worse than cutoff)
     160      2 stopped on gap
     161      3 stopped on nodes
     162      4 stopped on time
     163      5 stopped on user event
     164      6 stopped on solutions
     165      7 linear relaxation unbounded
    141166  */
    142167  COINLIBAPI int COINLINKAGE Cbc_secondaryStatus(Cbc_Model * model);
Note: See TracChangeset for help on using the changeset viewer.