Changeset 2021 for trunk/Cbc/src


Ignore:
Timestamp:
Mar 17, 2014 4:21:18 PM (6 years ago)
Author:
mlubin
Message:

Improved documentation. Tests for callbacks and row/column names. More restructuring.

Location:
trunk/Cbc/src
Files:
2 edited

Legend:

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

    r2020 r2021  
    44// This code is licensed under the terms of the Eclipse Public License (EPL).
    55
    6 #include <math.h>
     6#include <cmath>
    77#include <cfloat>
    88
     
    220220
    221221/* Version */
    222 COINLIBAPI double COINLINKAGE Cbc_getVersion()
    223 {
    224     double v = 1.0;
    225     return v;
     222COINLIBAPI const char* COINLINKAGE Cbc_getVersion()
     223{
     224    return CBC_VERSION;
    226225}
    227226
     
    485484    return (result) ? 1 : 0;
    486485}
    487 /* Status of problem:
    488    0 - optimal
    489    1 - primal infeasible
    490    2 - dual infeasible
    491    3 - stopped on iterations etc
    492    4 - stopped due to errors
    493 */
     486
    494487CbcGetProperty(int, status)
    495488
    496 /* Secondary status of problem - may get extended
    497    0 - none
    498    1 - primal infeasible because dual limit reached
    499    2 - scaled problem optimal - unscaled has primal infeasibilities
    500    3 - scaled problem optimal - unscaled has dual infeasibilities
    501    4 - scaled problem optimal - unscaled has both dual and primal infeasibilities
    502 */
    503489CbcGetProperty(int, secondaryStatus)
    504 
    505 COINLIBAPI void COINLINKAGE
    506 Cbc_setSecondaryStatus(Cbc_Model * /*model*/, int /*status*/)
    507 {
    508     const char prefix[] = "Cbc_C_Interface::Cbc_setSecondaryStatus(): ";
    509 //  const int  VERBOSE = 1;
    510     if (VERBOSE > 0) printf("%s begin\n", prefix);
    511 
    512 // cannot find this in Cbc, Osi, or OsiClp
    513 //tbd  model->model_->setSecondaryStatus(status);
    514     if (VERBOSE > 0) printf("%s WARNING: NOT IMPLEMENTED\n", prefix);
    515 
    516     if (VERBOSE > 0) printf("%s return\n", prefix);
    517 }
    518490
    519491/* Number of elements in matrix */
     
    558530}
    559531
    560 // Column vector lengths in matrix
    561 COINLIBAPI const int * COINLINKAGE
    562 Cbc_getVectorLengths(Cbc_Model * model)
    563 {
    564     const char prefix[] = "Cbc_C_Interface::Cbc_getVectorLengths(): ";
    565 //  const int  VERBOSE = 1;
    566     if (VERBOSE > 0) printf("%s begin\n", prefix);
    567 
    568     const int * result = NULL;
    569     const CoinPackedMatrix * matrix = NULL;
    570     matrix = model->model_->solver()->getMatrixByCol();
    571     result = (matrix == NULL) ? NULL : matrix->getVectorLengths();
    572 
    573     if (VERBOSE > 0)
    574         printf("%s return %p\n", prefix, static_cast<const void*>(result));
    575     return result;
    576 }
    577532
    578533// Element values in matrix
     
    606561    if (VERBOSE > 0) printf("%s begin\n", prefix);
    607562
    608     // reuse existing log level
    609     int oldLogLevel = model->model_->messageHandler()->logLevel();
    610563    // Will be copy of users one
    611564    delete model->handler_;
     
    614567    model->handler_->setModel(model);
    615568    model->model_->passInMessageHandler(model->handler_);
    616     model->model_->messageHandler()->setLogLevel(oldLogLevel);
    617569
    618570    if (VERBOSE > 0) printf("%s return\n", prefix);
     
    632584}
    633585/* length of names (0 means no names0 */
    634 COINLIBAPI int COINLINKAGE
    635 Cbc_lengthNames(Cbc_Model * /*model*/)
    636 {
    637     const char prefix[] = "Cbc_C_Interface::Cbc_lengthNames(): ";
    638 //  const int  VERBOSE = 1;
    639     if (VERBOSE > 0) printf("%s begin\n", prefix);
    640 
    641     int result = 0;
    642 // cannot find names in Cbc, Osi, or OsiClp
    643 //tbd  result = model->model_->lengthNames();
    644     if (VERBOSE > 0) printf("%s WARNING:  NOT IMPLEMENTED\n", prefix);
    645 
    646     if (VERBOSE > 0) printf("%s return %i\n", prefix, result);
     586COINLIBAPI size_t COINLINKAGE
     587Cbc_maxNameLength(Cbc_Model * model)
     588{
     589    size_t result = 0;
     590    OsiSolverInterface::OsiNameVec const & rownames = model->model_->solver()->getRowNames();
     591    for (size_t i = 0; i < rownames.size(); i++) {
     592        if (rownames[i].length() > result) result = rownames[i].length();
     593    }
     594    OsiSolverInterface::OsiNameVec const & colnames = model->model_->solver()->getColNames();
     595    for (size_t i = 0; i < colnames.size(); i++) {
     596        if (colnames[i].length() > result) result = colnames[i].length();
     597    }
    647598    return result;
    648599}
    649 /* Fill in array (at least lengthNames+1 long) with a row name */
    650 COINLIBAPI void COINLINKAGE
    651 Cbc_rowName(Cbc_Model * /*model*/, int iRow, char * name)
    652 {
    653     const char prefix[] = "Cbc_C_Interface::Cbc_rowName(): ";
    654 //  const int  VERBOSE = 1;
    655     if (VERBOSE > 0) printf("%s begin\n", prefix);
    656 
    657     sprintf(name, "ROW%5i", iRow);
    658 // cannot find names in Cbc, Osi, or OsiClp
    659 //tbd  std::string rowName=model->model_->rowName(iRow);
    660 //tbd  strcpy(name,rowName.c_str());
    661 
    662     if (VERBOSE > 0) printf("%s return\n", prefix);
    663 }
    664 /* Fill in array (at least lengthNames+1 long) with a column name */
    665 // cannot find names in Cbc, Osi, or OsiClp
    666 COINLIBAPI void COINLINKAGE
    667 Cbc_columnName(Cbc_Model * /*model*/, int iColumn, char * name)
    668 {
    669     const char prefix[] = "Cbc_C_Interface::Cbc_columnName(): ";
    670 //  const int  VERBOSE = 1;
    671     if (VERBOSE > 0) printf("%s begin\n", prefix);
    672 
    673     sprintf(name, "COL%5i", iColumn);
    674 //tbd  std::string columnName= model->model_->columnName(iColumn);
    675 //tbd  strcpy(name,columnName.c_str());
    676 
    677     if (VERBOSE > 0) printf("%s return\n", prefix);
    678 }
     600COINLIBAPI void COINLINKAGE
     601Cbc_getRowName(Cbc_Model * model, int iRow, char * name, size_t maxLength)
     602{
     603    std::string rowname = model->model_->solver()->getRowName(iRow);
     604    strncpy(name, rowname.c_str(), maxLength);
     605    name[maxLength-1] = '\0';
     606}
     607COINLIBAPI void COINLINKAGE
     608Cbc_getColName(Cbc_Model * model, int iRow, char * name, size_t maxLength)
     609{
     610    std::string colname = model->model_->solver()->getColName(iRow);
     611    strncpy(name, colname.c_str(), maxLength);
     612    name[maxLength-1] = '\0';
     613}
     614
     615COINLIBAPI void COINLINKAGE
     616Cbc_setColName(Cbc_Model * model, int iColumn, const char * name)
     617{
     618    model->model_->solver()->setColName(iColumn, name);
     619}
     620
     621COINLIBAPI void COINLINKAGE
     622Cbc_setRowName(Cbc_Model * model, int iRow, const char * name)
     623{
     624    model->model_->solver()->setRowName(iRow, name);
     625}
     626
    679627
    680628COINLIBAPI int COINLINKAGE
     
    782730CbcGetProperty(const double*, getColSolution)
    783731
    784 COINLIBAPI void COINLINKAGE
    785 Cbc_setColSolution(Cbc_Model * model, const double * input)
    786 {
    787     const char prefix[] = "Cbc_C_Interface::Cbc_setColSolution(): ";
    788 //  const int  VERBOSE = 1;
    789     if (VERBOSE > 0) printf("%s begin\n", prefix);
    790 
    791     OsiSolverInterface * solver = model->model_->solver();
    792     solver->setColSolution(input);
    793 
    794     if (VERBOSE > 0) printf("%s return\n", prefix);
    795     return;
    796 }
    797 
    798732CbcGetProperty(const double*, getRowLower)
    799733CbcGetProperty(const double*, getRowUpper)
     
    803737
    804738CbcGetProperty(double, getObjValue)
     739CbcGetProperty(double, getBestPossibleObjValue)
    805740
    806741/* Print model */
     
    874809}
    875810
    876 COINLIBAPI double COINLINKAGE
    877 Cbc_cpuTime(Cbc_Model * /*model*/)
    878 {
    879     const char prefix[] = "Cbc_C_Interface::Cbc_cpuTime(): ";
    880 //  const int  VERBOSE = 1;
    881     if (VERBOSE > 0) printf("%s begin\n", prefix);
    882 
    883     double result = 0;
    884     result = CoinCpuTime() ;
    885 
    886     if (VERBOSE > 0) printf("%s return %g\n", prefix, result);
    887     return result;
    888 }
    889 
    890811CbcGetProperty(int, getNodeCount)
    891812
     
    902823    result->solver_    = dynamic_cast< OsiClpSolverInterface*> (result->model_->solver());
    903824    result->handler_   = NULL;
     825    result->cmdargs_   = model->cmdargs_;
    904826
    905827    if (VERBOSE > 0) printf("%s return\n", prefix);
     
    1075997}
    1076998
    1077 /** Delete all object information */
    1078 COINLIBAPI void  COINLINKAGE
    1079 Cbc_deleteObjects(Cbc_Model * model)
    1080 {
    1081     const char prefix[] = "Cbc_C_Interface::Cbc_deleteObjects(): ";
    1082 //  const int  VERBOSE = 2;
    1083     if (VERBOSE > 0) printf("%s begin\n", prefix);
    1084 
    1085     model->model_->deleteObjects();
    1086 
    1087     if (VERBOSE > 0) printf("%s return\n", prefix);
    1088     return;
    1089 }
    1090 
    1091999/** Print the solution */
    10921000COINLIBAPI void  COINLINKAGE
  • trunk/Cbc/src/Cbc_C_Interface.h

    r2020 r2021  
    1111/* include all defines and ugly stuff */
    1212#include "Coin_C_defines.h"
    13 
    14 /** This is a first "C" interface to Cbc.
    15     It is mostly similar to the "C" interface to Clp and
    16     was contributed by Bob Entriken.
     13#include <stddef.h>
     14
     15/** This is a "C" interface to Cbc.
     16    Original verison contributed by Bob Entriken,
     17    significantly updated by Miles Lubin.
    1718*/
    1819
     
    2223
    2324    /**@name Constructors and destructor
    24        These do not have an exact analogue in C++.
    2525       The user does not need to know structure of Cbc_Model.
    26 
    27        For all functions outside this group there is an exact C++
    28        analogue created by taking the first parameter out, removing the Cbc_
    29        from name and applying the method to an object of type ClpSimplex.
    30     */
    31     /*@{*/
    32 
    33     /** Version */
    34     COINLIBAPI double COINLINKAGE Cbc_getVersion()
    35     ;
     26    */
     27    /*@{*/
     28
    3629    /** Default Cbc_Model constructor */
    3730    COINLIBAPI Cbc_Model * COINLINKAGE
    38     Cbc_newModel()
     31    Cbc_newModel(void)
    3932    ;
    4033    /** Cbc_Model Destructor */
     
    4235    Cbc_deleteModel(Cbc_Model * model)
    4336    ;
    44     /*@}*/
    45 
    46     /**@name Load model - loads some stuff and initializes others */
    47     /*@{*/
    48     /* Loads a problem (the constraints on the
     37    /** Current version of Cbc */
     38    COINLIBAPI const char* COINLINKAGE Cbc_getVersion(void)
     39    ;
     40    /*@}*/
     41
     42    /**@name Getting and setting model data */
     43    /*@{*/
     44    /** Loads a problem (the constraints on the
    4945        rows are given by lower and upper bounds). If a pointer is NULL then the
    5046        following values are the default:
     
    5753        </ul>
    5854
    59      Just like the other loadProblem() method except that the matrix is
    60      given in a standard column major ordered format (without gaps).
     55     The constraint matrix is
     56     given in standard compressed sparse column (without gaps).
     57     <ul>
     58     <li> <code>start[i]</code> stores the starting index of the ith column
     59     <li> <code>index[k]</code> stores the row index of the kth nonzero element
     60     <li> <code>value[k]</code> stores the coefficient of the kth nonzero element
     61     </ul>
    6162    */
    6263    COINLIBAPI void COINLINKAGE
     
    109110    ;
    110111
    111     /*@}*/
    112     /**@name gets and sets - you will find some synonyms at the end of this file */
    113     /*@{*/
    114     /** Set parameter "name" to value "value". Note that this
    115      * translates directly to using "-name value" as a
    116      * command-line argument to Cbc.*/
    117     COINLIBAPI void COINLINKAGE
    118     Cbc_setParameter(Cbc_Model * model, const char * name, const char * value)
    119     ;
    120112    /** Fills in array with problem name  */
    121113    COINLIBAPI void COINLINKAGE
     
    129121    Cbc_setProblemName(Cbc_Model * model, const char * array)
    130122    ;
    131     /** Status of problem:
    132         0 - optimal
    133         1 - primal infeasible
    134         2 - dual infeasible
    135         3 - stopped on iterations etc
    136         4 - stopped due to errors
    137     */
    138     COINLIBAPI int COINLINKAGE
    139     Cbc_status(Cbc_Model * model)
    140     ;
    141     /** Secondary status of problem - may get extended
    142         0 - none
    143         1 - primal infeasible because dual limit reached
    144         2 - scaled problem optimal - unscaled has primal infeasibilities
    145         3 - scaled problem optimal - unscaled has dual infeasibilities
    146         4 - scaled problem optimal - unscaled has both dual and primal infeasibilities
    147     */
    148     COINLIBAPI int COINLINKAGE
    149     Cbc_secondaryStatus(Cbc_Model * model)
    150     ;
    151     COINLIBAPI void COINLINKAGE
    152     Cbc_setSecondaryStatus(Cbc_Model * model, int status)
    153     ;
    154     /** Number of elements in matrix */
     123
     124    /** Number of nonzero elements in constraint matrix */
    155125    COINLIBAPI int COINLINKAGE
    156126    Cbc_getNumElements(Cbc_Model * model)
    157127    ;
    158     /** Column starts in matrix */
     128    /** "Column start" vector of constraint matrix. Same format as Cbc_loadProblem() */
    159129    COINLIBAPI const CoinBigIndex * COINLINKAGE
    160130    Cbc_getVectorStarts(Cbc_Model * model)
    161131    ;
    162     /** Row indices in matrix */
     132    /** "Row index" vector of constraint matrix */
    163133    COINLIBAPI const int * COINLINKAGE
    164134    Cbc_getIndices(Cbc_Model * model)
    165135    ;
    166     /** Column vector lengths in matrix */
    167     COINLIBAPI const int * COINLINKAGE
    168     Cbc_getVectorLengths(Cbc_Model * model)
    169     ;
    170     /** Element values in matrix */
     136    /** Coefficient vector of constraint matrix */
    171137    COINLIBAPI const double * COINLINKAGE
    172138    Cbc_getElements(Cbc_Model * model)
    173139    ;
    174    
    175     /*@}*/
    176     /**@name Message handling.  Call backs are handled by ONE function */
    177     /*@{*/
    178     /** Pass in Callback function.
    179      Message numbers up to 1000000 are Clp, Coin ones have 1000000 added */
    180     COINLIBAPI void COINLINKAGE
    181     Cbc_registerCallBack(Cbc_Model * model,
    182                          cbc_callback userCallBack)
    183     ;
    184     /** Unset Callback function */
    185     COINLIBAPI void COINLINKAGE
    186     Cbc_clearCallBack(Cbc_Model * model)
    187     ;
    188     /** length of names (0 means no names0 */
    189     COINLIBAPI int COINLINKAGE
    190     Cbc_lengthNames(Cbc_Model * model)
    191     ;
    192     /** Fill in array (at least lengthNames+1 long) with a row name */
    193     COINLIBAPI void COINLINKAGE
    194     Cbc_rowName(Cbc_Model * model, int iRow, char * name)
    195     ;
    196     /** Fill in array (at least lengthNames+1 long) with a column name */
    197     COINLIBAPI void COINLINKAGE
    198     Cbc_columnName(Cbc_Model * model, int iColumn, char * name)
    199     ;
    200 
    201     /*@}*/
    202 
    203 
    204     /**@name Functions most useful to user */
    205     /*@{*/
    206     /* Solve using CbcMain1. This is the recommended default solve function.
    207     */
    208     COINLIBAPI int COINLINKAGE
    209     Cbc_solve(Cbc_Model * model)
    210     ;
    211     /*@}*/
    212 
    213 
    214     /**@name most useful gets and sets */
    215     /*@{*/
    216     /** Sum of primal infeasibilities */
    217     COINLIBAPI double COINLINKAGE
    218     Cbc_sumPrimalInfeasibilities(Cbc_Model * model)
    219     ;
    220     /** Number of primal infeasibilities */
    221     COINLIBAPI int COINLINKAGE
    222     Cbc_numberPrimalInfeasibilities(Cbc_Model * model)
    223     ;
    224 
    225     /** Just check solution (for external use) - sets sum of
    226         infeasibilities etc */
    227     COINLIBAPI void COINLINKAGE
    228     Cbc_checkSolution(Cbc_Model * model)
    229     ;
    230     /*@}*/
    231 
    232     /******************** End of most useful part **************/
    233     /**@name gets and sets - some synonyms */
    234     /*@{*/
    235     /** Number of rows */
     140
     141    /** Maximum lenght of a row or column name */
     142    COINLIBAPI size_t COINLINKAGE
     143    Cbc_maxNameLength(Cbc_Model * model)
     144    ;
     145    /** Fill in first maxLength bytes of name array with a row name */
     146    COINLIBAPI void COINLINKAGE
     147    Cbc_getRowName(Cbc_Model * model, int iRow, char * name, size_t maxLength)
     148    ;
     149    /** Fill in first maxLength bytes of name array with a column name */
     150    COINLIBAPI void COINLINKAGE
     151    Cbc_getColName(Cbc_Model * model, int iColumn, char * name, size_t maxLength)
     152    ;
     153    /** Set the name of a column */
     154    COINLIBAPI void COINLINKAGE
     155    Cbc_setColName(Cbc_Model * model, int iColumn, const char * name)
     156    ;
     157    /** Set the name of a row */
     158    COINLIBAPI void COINLINKAGE
     159    Cbc_setRowName(Cbc_Model * model, int iRow, const char * name)
     160    ;
     161    /** Number of constraints in the model */
    236162    COINLIBAPI int COINLINKAGE
    237163    Cbc_getNumRows(Cbc_Model * model)
    238164    ;
    239     /** Number of columns */
     165    /** Number of variables in the model */
    240166    COINLIBAPI int COINLINKAGE
    241167    Cbc_getNumCols(Cbc_Model * model)
    242     ;
    243     /** Number of iterations */
    244     COINLIBAPI int COINLINKAGE
    245     Cbc_getIterationCount(Cbc_Model * model)
    246     ;
    247     /** Are there a numerical difficulties? */
    248     COINLIBAPI int COINLINKAGE
    249     Cbc_isAbandoned(Cbc_Model * model)
    250     ;
    251     /** Is optimality proven? */
    252     COINLIBAPI int COINLINKAGE
    253     Cbc_isProvenOptimal(Cbc_Model * model)
    254     ;
    255     /** Is infeasiblity proven (or none better than cutoff)? */
    256     COINLIBAPI int COINLINKAGE
    257     Cbc_isProvenInfeasible(Cbc_Model * model)
    258     ;
    259     /** Was continuous solution unbounded? */
    260     COINLIBAPI int COINLINKAGE
    261     Cbc_isContinuousUnbounded(Cbc_Model * model)
    262     ;
    263     /** Node limit reached? */
    264     COINLIBAPI int COINLINKAGE
    265     Cbc_isNodeLimitReached(Cbc_Model * model)
    266     ;
    267     /** Time limit reached? */
    268     COINLIBAPI int COINLINKAGE
    269     Cbc_isSecondsLimitReached(Cbc_Model * model)
    270     ;
    271     /** Solution limit reached? */
    272     COINLIBAPI int COINLINKAGE
    273     Cbc_isSolutionLimitReached(Cbc_Model * model)
    274     ;
    275     /** Are there numerical difficulties (for initialSolve) ? */
    276     COINLIBAPI int COINLINKAGE
    277     Cbc_isInitialSolveAbandoned(Cbc_Model * model)
    278     ;
    279     /** Is optimality proven (for initialSolve) ? */
    280     COINLIBAPI int COINLINKAGE
    281     Cbc_isInitialSolveProvenOptimal(Cbc_Model * model)
    282     ;
    283     /** Is primal infeasiblity proven (for initialSolve) ? */
    284     COINLIBAPI int COINLINKAGE
    285     Cbc_isInitialSolveProvenPrimalInfeasible(Cbc_Model * model)
    286168    ;
    287169    /** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore) */
     
    293175    Cbc_getObjSense(Cbc_Model * model)
    294176    ;
    295     /** Primal row solution
    296      *  This is the vector A*x, where A is the constraint matrix
    297      *  and x is the current solution. */
    298     COINLIBAPI const double * COINLINKAGE
    299     Cbc_getRowActivity(Cbc_Model * model)
    300     ;
    301     /** Primal column solution */
    302     COINLIBAPI const double * COINLINKAGE
    303     Cbc_getColSolution(Cbc_Model * model)
    304     ;
    305     COINLIBAPI void COINLINKAGE
    306     Cbc_setColSolution(Cbc_Model * model, const double * input)
    307     ;
    308     /** Row lower */
     177    /** Constraint lower bounds */
    309178    COINLIBAPI const double* COINLINKAGE
    310179    Cbc_getRowLower(Cbc_Model * model)
    311180    ;
    312     /** Row upper */
     181    /** Constraint upper bounds */
    313182    COINLIBAPI const double* COINLINKAGE
    314183    Cbc_getRowUpper(Cbc_Model * model)
    315184    ;
    316     /** Objective */
     185    /** Objective vector */
    317186    COINLIBAPI const double * COINLINKAGE
    318187    Cbc_getObjCoefficients(Cbc_Model * model)
    319188    ;
    320     /** Column Lower */
     189    /** Variable lower bounds */
    321190    COINLIBAPI const double * COINLINKAGE
    322191    Cbc_getColLower(Cbc_Model * model)
    323192    ;
    324     /** Column Upper */
     193    /** Variable upper bounds */
    325194    COINLIBAPI const double * COINLINKAGE
    326195    Cbc_getColUpper(Cbc_Model * model)
    327196    ;
    328     /** Objective value */
    329     COINLIBAPI double COINLINKAGE
    330     Cbc_getObjValue(Cbc_Model * model)
    331     ;
    332     /** Print the model */
    333     COINLIBAPI void COINLINKAGE
    334     Cbc_printModel(Cbc_Model * model, const char * argPrefix)
    335     ;
    336     /** Determine whether the variable at location i is integer restricted */
     197    /** Determine whether the ith variable is integer restricted */
    337198    COINLIBAPI int COINLINKAGE
    338199    Cbc_isInteger(Cbc_Model * model, int i)
    339200    ;
    340     /** Return CPU time */
    341     COINLIBAPI double COINLINKAGE
    342     Cbc_cpuTime(Cbc_Model * model)
    343     ;
    344     /** Number of nodes explored in B&B tree */
    345     COINLIBAPI int COINLINKAGE
    346     Cbc_getNodeCount(Cbc_Model * model)
    347     ;
    348     /** Return a copy of this model */
    349     COINLIBAPI Cbc_Model * COINLINKAGE
    350     Cbc_clone(Cbc_Model * model)
    351     ;
    352     /** Set this the variable to be continuous */
     201    /** Set this variable to be continuous */
    353202    COINLIBAPI Cbc_Model * COINLINKAGE
    354203    Cbc_setContinuous(Cbc_Model * model, int iColumn)
    355204    ;
    356     /** Set this the variable to be integer */
     205    /** Set this variable to be integer */
    357206    COINLIBAPI Cbc_Model * COINLINKAGE
    358207    Cbc_setInteger(Cbc_Model * model, int iColumn)
     
    368217                      const int * rowIndices, const double * weights, const int type)
    369218    ;
    370     /** Delete all object information */
    371     COINLIBAPI void  COINLINKAGE
    372     Cbc_deleteObjects(Cbc_Model * model)
     219    /** Print the model */
     220    COINLIBAPI void COINLINKAGE
     221    Cbc_printModel(Cbc_Model * model, const char * argPrefix)
     222    ;
     223    /** Return a copy of this model */
     224    COINLIBAPI Cbc_Model * COINLINKAGE
     225    Cbc_clone(Cbc_Model * model)
     226    ;
     227    /*@}*/
     228    /**@name Solver parameters */
     229    /*@{*/
     230    /** Set parameter "name" to value "value". Note that this
     231     * translates directly to using "-name value" as a
     232     * command-line argument to Cbc.*/
     233    COINLIBAPI void COINLINKAGE
     234    Cbc_setParameter(Cbc_Model * model, const char * name, const char * value)
     235    ;
     236
     237   
     238    /*@}*/
     239    /**@name Message handling.  Call backs are handled by ONE function */
     240    /*@{*/
     241    /** Pass in Callback function.
     242     Message numbers up to 1000000 are Clp, Coin ones have 1000000 added */
     243    COINLIBAPI void COINLINKAGE
     244    Cbc_registerCallBack(Cbc_Model * model,
     245                         cbc_callback userCallBack)
     246    ;
     247    /** Unset Callback function */
     248    COINLIBAPI void COINLINKAGE
     249    Cbc_clearCallBack(Cbc_Model * model)
     250    ;
     251
     252    /*@}*/
     253
     254
     255    /**@name Solving the model */
     256    /*@{*/
     257    /* Solve the model with Cbc (using CbcMain1).
     258    */
     259    COINLIBAPI int COINLINKAGE
     260    Cbc_solve(Cbc_Model * model)
     261    ;
     262    /*@}*/
     263
     264
     265    /**@name Accessing the solution and solution status */
     266    /*@{*/
     267
     268    /** Sum of primal infeasibilities */
     269    COINLIBAPI double COINLINKAGE
     270    Cbc_sumPrimalInfeasibilities(Cbc_Model * model)
     271    ;
     272    /** Number of primal infeasibilities */
     273    COINLIBAPI int COINLINKAGE
     274    Cbc_numberPrimalInfeasibilities(Cbc_Model * model)
     275    ;
     276
     277    /** Just check solution (for external use) - sets sum of
     278        infeasibilities etc */
     279    COINLIBAPI void COINLINKAGE
     280    Cbc_checkSolution(Cbc_Model * model)
     281    ;
     282
     283    /** Number of iterations */
     284    COINLIBAPI int COINLINKAGE
     285    Cbc_getIterationCount(Cbc_Model * model)
     286    ;
     287    /** Are there a numerical difficulties? */
     288    COINLIBAPI int COINLINKAGE
     289    Cbc_isAbandoned(Cbc_Model * model)
     290    ;
     291    /** Is optimality proven? */
     292    COINLIBAPI int COINLINKAGE
     293    Cbc_isProvenOptimal(Cbc_Model * model)
     294    ;
     295    /** Is infeasiblity proven (or none better than cutoff)? */
     296    COINLIBAPI int COINLINKAGE
     297    Cbc_isProvenInfeasible(Cbc_Model * model)
     298    ;
     299    /** Was continuous solution unbounded? */
     300    COINLIBAPI int COINLINKAGE
     301    Cbc_isContinuousUnbounded(Cbc_Model * model)
     302    ;
     303    /** Node limit reached? */
     304    COINLIBAPI int COINLINKAGE
     305    Cbc_isNodeLimitReached(Cbc_Model * model)
     306    ;
     307    /** Time limit reached? */
     308    COINLIBAPI int COINLINKAGE
     309    Cbc_isSecondsLimitReached(Cbc_Model * model)
     310    ;
     311    /** Solution limit reached? */
     312    COINLIBAPI int COINLINKAGE
     313    Cbc_isSolutionLimitReached(Cbc_Model * model)
     314    ;
     315    /** Are there numerical difficulties (for initialSolve) ? */
     316    COINLIBAPI int COINLINKAGE
     317    Cbc_isInitialSolveAbandoned(Cbc_Model * model)
     318    ;
     319    /** Is optimality proven (for initialSolve) ? */
     320    COINLIBAPI int COINLINKAGE
     321    Cbc_isInitialSolveProvenOptimal(Cbc_Model * model)
     322    ;
     323    /** Is primal infeasiblity proven (for initialSolve) ? */
     324    COINLIBAPI int COINLINKAGE
     325    Cbc_isInitialSolveProvenPrimalInfeasible(Cbc_Model * model)
     326    ;
     327    /** "row" solution
     328     *  This is the vector A*x, where A is the constraint matrix
     329     *  and x is the current solution. */
     330    COINLIBAPI const double * COINLINKAGE
     331    Cbc_getRowActivity(Cbc_Model * model)
     332    ;
     333    /** Best feasible solution vector */
     334    COINLIBAPI const double * COINLINKAGE
     335    Cbc_getColSolution(Cbc_Model * model)
     336    ;
     337    /** Objective value of best feasible solution */
     338    COINLIBAPI double COINLINKAGE
     339    Cbc_getObjValue(Cbc_Model * model)
     340    ;
     341    /** Best known bound on the optimal objective value */
     342    COINLIBAPI double COINLINKAGE
     343    Cbc_getBestPossibleObjValue(Cbc_Model * model)
     344    ;
     345    /** Number of nodes explored in B&B tree */
     346    COINLIBAPI int COINLINKAGE
     347    Cbc_getNodeCount(Cbc_Model * model)
    373348    ;
    374349    /** Print the solution */
    375350    COINLIBAPI void  COINLINKAGE
    376351    Cbc_printSolution(Cbc_Model * model)
     352    ;
     353    /** Final status of problem
     354        Some of these can be found out by is...... functions
     355        -1 before branchAndBound
     356        0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
     357        (or check value of best solution)
     358        1 stopped - on maxnodes, maxsols, maxtime
     359        2 difficulties so run was abandoned
     360        (5 event user programmed event occurred)
     361    */
     362    COINLIBAPI int COINLINKAGE
     363    Cbc_status(Cbc_Model * model)
     364    ;
     365    /** Secondary status of problem
     366        -1 unset (status_ will also be -1)
     367        0 search completed with solution
     368        1 linear relaxation not feasible (or worse than cutoff)
     369        2 stopped on gap
     370        3 stopped on nodes
     371        4 stopped on time
     372        5 stopped on user event
     373        6 stopped on solutions
     374        7 linear relaxation unbounded
     375        8 stopped on iteration limit
     376    */
     377    COINLIBAPI int COINLINKAGE
     378    Cbc_secondaryStatus(Cbc_Model * model)
    377379    ;
    378380    /*@}*/
Note: See TracChangeset for help on using the changeset viewer.