Changeset 290


Ignore:
Timestamp:
Oct 27, 2009 5:28:14 PM (10 years ago)
Author:
bjarni
Message:

Updated CoinMP.cpp and CoinMP.h in trunk to reflect changes in stable version 1.4

Location:
trunk/CoinMP/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CoinMP/src/CoinMP.cpp

    r245 r290  
    6666
    6767
    68 SOLVAPI int SOLVCALL CoinInitSolver(char* LicenseStr)
     68SOLVAPI int SOLVCALL CoinInitSolver(const char* LicenseStr)
    6969{
    7070        return SOLV_CALL_SUCCESS;
     
    8282
    8383
    84 SOLVAPI char* SOLVCALL CoinGetSolverName(void)
     84SOLVAPI const char* SOLVCALL CoinGetSolverName(void)
    8585{
    8686        return "CoinMP";
     
    9696
    9797
    98 SOLVAPI char* SOLVCALL CoinGetVersionStr(void)
     98SOLVAPI const char* SOLVCALL CoinGetVersionStr(void)
    9999{
    100100        return "1.4";
     
    160160int CBMessageHandler::print()
    161161{
    162         msgCallback_((char* )messageBuffer());
     162        msgCallback_(const_cast<char*>(messageBuffer()));
    163163        return CoinMessageHandler::print();
    164164}
     
    459459
    460460
    461 SOLVAPI HPROB SOLVCALL CoinCreateProblem(char* ProblemName)
     461SOLVAPI HPROB SOLVCALL CoinCreateProblem(const char* ProblemName)
    462462{
    463463        PCOIN pCoin;
     
    583583}
    584584
    585 int coinGetLenNameBuf(char* NameBuf, int Count)
     585int coinGetLenNameBuf(const char* NameBuf, int Count)
    586586{
    587587        int i, len;
    588588        int lenBuf;
    589         char* pName;
     589        const char* pName;
    590590
    591591        lenBuf = 0;
     
    943943       
    944944        if (pCoin) {
     945                delete pCoin->msghandler;
     946                delete pCoin->iterhandler;
     947                delete pCoin->nodehandler;
    945948                delete pCoin->clp;
     949                delete pCoin->clp_presolve;
     950                delete pCoin->cbc;
     951
    946952                if (pCoin->ObjectCoeffs) free(pCoin->ObjectCoeffs);
    947953                if (pCoin->RHSValues)    free(pCoin->RHSValues);
     
    11011107
    11021108
    1103 SOLVAPI char* SOLVCALL CoinGetProblemName(HPROB hProb)
     1109SOLVAPI const char* SOLVCALL CoinGetProblemName(HPROB hProb)
    11041110{
    11051111        PCOIN pCoin = (PCOIN)hProb;
     
    11111117SOLVAPI int SOLVCALL CoinGetProblemNameBuf(HPROB hProb, char* ProbName, int buflen)
    11121118{
    1113         PCOIN pCoin = (PCOIN)hProb;
    1114 
    11151119        strncpy(ProbName, CoinGetProblemName(hProb), buflen-1);
    11161120        ProbName[buflen-1] = '\0';
     
    11371141
    11381142
    1139 SOLVAPI char* SOLVCALL CoinGetColName(HPROB hProb, int col)
     1143SOLVAPI const char* SOLVCALL CoinGetColName(HPROB hProb, int col)
    11401144{
    11411145        PCOIN pCoin = (PCOIN)hProb;
     
    11471151SOLVAPI int SOLVCALL CoinGetColNameBuf(HPROB hProb, int col, char* ColName, int buflen)
    11481152{
    1149         PCOIN pCoin = (PCOIN)hProb;
    1150 
    11511153        strncpy(ColName, CoinGetColName(hProb, col), buflen-1);
    11521154        ColName[buflen-1] = '\0';
     
    11551157
    11561158
    1157 SOLVAPI char* SOLVCALL CoinGetRowName(HPROB hProb, int row)
     1159SOLVAPI const char* SOLVCALL CoinGetRowName(HPROB hProb, int row)
    11581160{
    11591161        PCOIN pCoin = (PCOIN)hProb;
     
    11651167SOLVAPI int SOLVCALL CoinGetRowNameBuf(HPROB hProb, int row, char* RowName, int buflen)
    11661168{
    1167         PCOIN pCoin = (PCOIN)hProb;
    1168 
    11691169        strncpy(RowName, CoinGetRowName(hProb, row), buflen-1);
    11701170        RowName[buflen-1] = '\0';
     
    11781178
    11791179
    1180 int coinWriteMsgLog(char* FormatStr, ...)
     1180int coinWriteMsgLog(const char* FormatStr, ...)
    11811181{
    11821182        va_list pVa;
     
    15221522 
    15231523
    1524 SOLVAPI char* SOLVCALL CoinGetSolutionText(HPROB hProb, int SolutionStatus)
     1524SOLVAPI const char* SOLVCALL CoinGetSolutionText(HPROB hProb, int SolutionStatus)
    15251525{
    15261526        PCOIN pCoin = (PCOIN)hProb;
     
    16751675
    16761676
    1677 SOLVAPI int SOLVCALL CoinReadFile(HPROB hProb, int FileType, char* ReadFilename)
     1677SOLVAPI int SOLVCALL CoinReadFile(HPROB hProb, int FileType, const char* ReadFilename)
    16781678{
    16791679   PCOIN pCoin = (PCOIN)hProb;
     
    16961696
    16971697
    1698 SOLVAPI int SOLVCALL CoinWriteFile(HPROB hProb, int FileType, char* WriteFilename)
     1698SOLVAPI int SOLVCALL CoinWriteFile(HPROB hProb, int FileType, const char* WriteFilename)
    16991699{
    17001700        PCOIN pCoin = (PCOIN)hProb;
     
    17181718
    17191719
    1720 SOLVAPI int SOLVCALL CoinOpenLogFile(HPROB hProb, char* logFilename)
    1721 {
    1722         PCOIN pCoin = (PCOIN)hProb;
    1723 
     1720SOLVAPI int SOLVCALL CoinOpenLogFile(HPROB hProb, const char* logFilename)
     1721{
    17241722        return SOLV_CALL_SUCCESS;
    17251723}
     
    17281726SOLVAPI int SOLVCALL CoinCloseLogFile(HPROB hProb)
    17291727{
    1730         PCOIN pCoin = (PCOIN)hProb;
    1731 
    17321728        return SOLV_CALL_SUCCESS;
    17331729}
     
    18891885          "MipSimpleRoundFrequency","SimpRoundFreq",GRP_MIPCUTS,       -1,       -1,-MAXINT,  MAXINT,  OPT_INT,    0,   COIN_INT_MIPSIMPROUND_FREQ,
    18901886
    1891           "MipUseCbcMain",          "UseCbcMain",   GRP_MIPSTRAT,       1,        1,      0,       1,  OPT_ONOFF,  0,   COIN_INT_MIPUSECBCMAIN,
     1887          "MipUseCbcMain",          "UseCbcMain",   GRP_MIPSTRAT,       1,        1,      0,       1,  OPT_ONOFF,  0,   COIN_INT_MIPUSECBCMAIN
    18921888        };
    18931889
     
    19071903SOLVAPI int SOLVCALL CoinGetOptionInfo(HPROB hProb, int OptionNr, int* OptionID, int* GroupType, int* OptionType)
    19081904{
    1909         if ((OptionNr < 0) && (OptionNr >= OPTIONCOUNT)) {
     1905        if ((OptionNr < 0) || (OptionNr >= OPTIONCOUNT)) {
    19101906                return SOLV_CALL_FAILED;
    19111907        }
     
    19171913
    19181914
    1919 SOLVAPI char* SOLVCALL CoinGetOptionName(HPROB hProb, int OptionNr)
    1920 {
    1921         if ((OptionNr < 0) && (OptionNr >= OPTIONCOUNT)) {
     1915SOLVAPI const char* SOLVCALL CoinGetOptionName(HPROB hProb, int OptionNr)
     1916{
     1917        if ((OptionNr < 0) || (OptionNr >= OPTIONCOUNT)) {
    19221918                return "";
    19231919        }
     
    19281924SOLVAPI int SOLVCALL CoinGetOptionNameBuf(HPROB hProb, int OptionNr, char* OptionName, int buflen)
    19291925{
    1930         if ((OptionNr < 0) && (OptionNr >= OPTIONCOUNT)) {
     1926        if ((OptionNr < 0) || (OptionNr >= OPTIONCOUNT)) {
    19311927                return SOLV_CALL_FAILED;
    19321928        }
     
    19391935
    19401936
    1941 SOLVAPI char* SOLVCALL CoinGetOptionShortName(HPROB hProb, int OptionNr)
    1942 {
    1943         if ((OptionNr < 0) && (OptionNr >= OPTIONCOUNT)) {
     1937SOLVAPI const char* SOLVCALL CoinGetOptionShortName(HPROB hProb, int OptionNr)
     1938{
     1939        if ((OptionNr < 0) || (OptionNr >= OPTIONCOUNT)) {
    19441940                return "";
    19451941        }
     
    19501946SOLVAPI int SOLVCALL CoinGetOptionShortNameBuf(HPROB hProb, int OptionNr, char* ShortName, int buflen)
    19511947{
    1952         if ((OptionNr < 0) && (OptionNr >= OPTIONCOUNT)) {
     1948        if ((OptionNr < 0) || (OptionNr >= OPTIONCOUNT)) {
    19531949                return SOLV_CALL_FAILED;
    19541950        }
     
    19631959SOLVAPI int SOLVCALL CoinGetIntOptionMinMax(HPROB hProb, int OptionNr, int* MinValue, int* MaxValue)
    19641960{
    1965         if ((OptionNr < 0) && (OptionNr >= OPTIONCOUNT)) {
     1961        if ((OptionNr < 0) || (OptionNr >= OPTIONCOUNT)) {
    19661962                return SOLV_CALL_FAILED;
    19671963        }
     
    19741970SOLVAPI int SOLVCALL CoinGetRealOptionMinMax(HPROB hProb, int OptionNr, double* MinValue, double* MaxValue)
    19751971{
    1976         if ((OptionNr < 0) && (OptionNr >= OPTIONCOUNT)) {
     1972        if ((OptionNr < 0) || (OptionNr >= OPTIONCOUNT)) {
    19771973                return SOLV_CALL_FAILED;
    19781974        }
     
    19981994SOLVAPI int SOLVCALL CoinGetOptionChanged(HPROB hProb, int OptionID)
    19991995{
    2000         PCOIN pCoin = (PCOIN)hProb;
    20011996        int OptionNr;
    20021997
     
    20112006SOLVAPI int SOLVCALL CoinGetIntOption(HPROB hProb,int OptionID)
    20122007{   
    2013         PCOIN pCoin = (PCOIN)hProb;
    20142008        int OptionNr;
    20152009
     
    20292023SOLVAPI int SOLVCALL CoinSetIntOption(HPROB hProb,int OptionID, int IntValue)
    20302024{
    2031         PCOIN pCoin = (PCOIN)hProb;
    20322025        int OptionNr;
    20332026
     
    20492042SOLVAPI double SOLVCALL CoinGetRealOption(HPROB hProb,int OptionID)
    20502043{
    2051         PCOIN pCoin = (PCOIN)hProb;
    20522044        int OptionNr;
    20532045
     
    20662058SOLVAPI int SOLVCALL CoinSetRealOption(HPROB hProb,int OptionID, double RealValue)
    20672059{
    2068         PCOIN pCoin = (PCOIN)hProb;
    20692060        int OptionNr;
    20702061
     
    20832074
    20842075
    2085 SOLVAPI char* SOLVCALL CoinGetStringOption(HPROB hProb, int OptionID)
    2086 {
    2087    PCOIN pCoin = (PCOIN)hProb;
    2088 
     2076SOLVAPI const char* SOLVCALL CoinGetStringOption(HPROB hProb, int OptionID)
     2077{
    20892078   return "";
    20902079}
     
    20932082SOLVAPI int SOLVCALL CoinGetStringOptionBuf(HPROB hProb, int OptionID, char* StringValue, int buflen)
    20942083{
    2095    PCOIN pCoin = (PCOIN)hProb;
    2096 
    20972084   return SOLV_CALL_FAILED;
    20982085}
    20992086
    21002087
    2101 SOLVAPI int SOLVCALL CoinSetStringOption(HPROB hProb, int OptionID, char* StringValue)
    2102 {
    2103    PCOIN pCoin = (PCOIN)hProb;
    2104 
     2088SOLVAPI int SOLVCALL CoinSetStringOption(HPROB hProb, int OptionID, const char* StringValue)
     2089{
    21052090   return SOLV_CALL_FAILED;
    21062091}
  • trunk/CoinMP/src/CoinMP.h

    r245 r290  
    114114#endif
    115115
    116 typedef int (SOLVCALL * MSGLOGCALLBACK)(char* MessageStr);
     116typedef int (SOLVCALL * MSGLOGCALLBACK)(const char* MessageStr);
    117117
    118118typedef int (SOLVCALL *ITERCALLBACK)(int    IterCount,
     
    131131#ifdef SOLV_LINK_LIB
    132132
    133 SOLVAPI int    SOLVCALL CoinInitSolver(char* LicenseStr);
     133SOLVAPI int    SOLVCALL CoinInitSolver(const char* LicenseStr);
    134134SOLVAPI int    SOLVCALL CoinFreeSolver(void);
    135135
    136 SOLVAPI char*  SOLVCALL CoinGetSolverName(void);
     136SOLVAPI const char*  SOLVCALL CoinGetSolverName(void);
    137137SOLVAPI int    SOLVCALL CoinGetSolverNameBuf(char* SolverName, int buflen);
    138 SOLVAPI char*  SOLVCALL CoinGetVersionStr(void);
     138SOLVAPI const char*  SOLVCALL CoinGetVersionStr(void);
    139139SOLVAPI int    SOLVCALL CoinGetVersionStrBuf(char* VersionStr, int buflen);
    140140SOLVAPI double SOLVCALL CoinGetVersion(void);
     
    143143SOLVAPI double SOLVCALL CoinGetInfinity(void);
    144144
    145 SOLVAPI HPROB  SOLVCALL CoinCreateProblem(char* ProblemName);
     145SOLVAPI HPROB  SOLVCALL CoinCreateProblem(const char* ProblemName);
    146146
    147147SOLVAPI int    SOLVCALL CoinLoadProblem(HPROB hProb,
     
    190190SOLVAPI int    SOLVCALL CoinSetLoadNamesType(HPROB hProb, int LoadNamesType);
    191191
    192 SOLVAPI char*  SOLVCALL CoinGetProblemName(HPROB hProb);
     192SOLVAPI const char*  SOLVCALL CoinGetProblemName(HPROB hProb);
    193193SOLVAPI int    SOLVCALL CoinGetProblemNameBuf(HPROB hProb, char* ProblemName, int buflen);
    194194
     
    196196SOLVAPI int    SOLVCALL CoinGetRowCount(HPROB hProb);
    197197
    198 SOLVAPI char*  SOLVCALL CoinGetColName(HPROB hProb, int col);
     198SOLVAPI const char*  SOLVCALL CoinGetColName(HPROB hProb, int col);
    199199SOLVAPI int    SOLVCALL CoinGetColNameBuf(HPROB hProb, int col, char* ColName, int buflen);
    200200
    201 SOLVAPI char*  SOLVCALL CoinGetRowName(HPROB hProb, int row);
     201SOLVAPI const char*  SOLVCALL CoinGetRowName(HPROB hProb, int row);
    202202SOLVAPI int    SOLVCALL CoinGetRowNameBuf(HPROB hProb, int row, char* RowName, int buflen);
    203203
     
    209209
    210210SOLVAPI int    SOLVCALL CoinGetSolutionStatus(HPROB hProb);
    211 SOLVAPI char*  SOLVCALL CoinGetSolutionText(HPROB hProb, int SolutionStatus);
     211SOLVAPI const char*  SOLVCALL CoinGetSolutionText(HPROB hProb, int SolutionStatus);
    212212SOLVAPI int    SOLVCALL CoinGetSolutionTextBuf(HPROB hProb, int SolutionStatus, char* SolutionText, int buflen);
    213213
     
    224224SOLVAPI int    SOLVCALL CoinGetSolutionBasis(HPROB hProb, int* ColStatus, double* RowStatus);
    225225
    226 SOLVAPI int    SOLVCALL CoinReadFile(HPROB hProb, int FileType, char* ReadFilename);
    227 SOLVAPI int    SOLVCALL CoinWriteFile(HPROB hProb, int FileType, char* WriteFilename);
    228 
    229 SOLVAPI int    SOLVCALL CoinOpenLogFile(HPROB hProb, char* LogFilename);
     226SOLVAPI int    SOLVCALL CoinReadFile(HPROB hProb, int FileType, const char* ReadFilename);
     227SOLVAPI int    SOLVCALL CoinWriteFile(HPROB hProb, int FileType, const char* WriteFilename);
     228
     229SOLVAPI int    SOLVCALL CoinOpenLogFile(HPROB hProb, const char* LogFilename);
    230230SOLVAPI int    SOLVCALL CoinCloseLogFile(HPROB hProb);
    231231
     
    233233SOLVAPI int    SOLVCALL CoinGetOptionInfo(HPROB hProb, int OptionNr, int* OptionID, int* GroupType, int* OptionType);
    234234
    235 SOLVAPI char*  SOLVCALL CoinGetOptionName(HPROB hProb, int OptionNr);
     235SOLVAPI const char*  SOLVCALL CoinGetOptionName(HPROB hProb, int OptionNr);
    236236SOLVAPI int    SOLVCALL CoinGetOptionNameBuf(HPROB hProb, int OptionNr, char* OptionName, int buflen);
    237237
    238 SOLVAPI char*  SOLVCALL CoinGetOptionShortName(HPROB hProb, int OptionNr);
     238SOLVAPI const char*  SOLVCALL CoinGetOptionShortName(HPROB hProb, int OptionNr);
    239239SOLVAPI int    SOLVCALL CoinGetOptionShortNameBuf(HPROB hProb, int OptionNr, char* ShortName, int buflen);
    240240
     
    250250SOLVAPI int    SOLVCALL CoinSetRealOption(HPROB hProb, int OptionID, double RealValue);
    251251
    252 SOLVAPI char*  SOLVCALL CoinGetStringOption(HPROB hProb, int OptionID);
     252SOLVAPI const char*  SOLVCALL CoinGetStringOption(HPROB hProb, int OptionID);
    253253SOLVAPI int    SOLVCALL CoinGetStringOptionBuf(HPROB hProb, int OptionID, char* StringValue, int buflen);
    254 SOLVAPI int    SOLVCALL CoinSetStringOption(HPROB hProb, int OptionID, char* StringValue);
     254SOLVAPI int    SOLVCALL CoinSetStringOption(HPROB hProb, int OptionID, const char* StringValue);
    255255
    256256
     
    260260#ifdef SOLV_LINK_DLL
    261261
    262 int    (SOLVCALL *CoinInitSolver)(char* LicenseStr);
     262int    (SOLVCALL *CoinInitSolver)(const char* LicenseStr);
    263263int    (SOLVCALL *CoinFreeSolver)(void);
    264264
    265 char*  (SOLVCALL *CoinGetSolverName)(void);
     265const char*  (SOLVCALL *CoinGetSolverName)(void);
    266266int    (SOLVCALL *CoinGetSolverNameBuf)(char* SolverName, int buflen);
    267 char*  (SOLVCALL *CoinGetVersionStr)(void);
     267const char*  (SOLVCALL *CoinGetVersionStr)(void);
    268268int    (SOLVCALL *CoinGetVersionStrBuf)(char* VersionStr, int buflen);
    269269double (SOLVCALL *CoinGetVersion)(void);
     
    272272double (SOLVCALL *CoinGetInfinity)(void);
    273273
    274 HPROB  (SOLVCALL *CoinCreateProblem)(char* ProblemName);
     274HPROB  (SOLVCALL *CoinCreateProblem)(const char* ProblemName);
    275275
    276276int    (SOLVCALL *CoinLoadProblem)(HPROB hProb,
     
    323323int    (SOLVCALL *CoinOptimizeProblem)(HPROB hProb, int Method);
    324324
    325 char*  (SOLVCALL *CoinGetProblemName)(HPROB hProb);
     325const char*  (SOLVCALL *CoinGetProblemName)(HPROB hProb);
    326326int    (SOLVCALL *CoinGetProblemNameBuf)(HPROB hProb, char* ProblemName, int buflen);
    327327
     
    329329int    (SOLVCALL *CoinGetRowCount)(HPROB hProb);
    330330
    331 char*  (SOLVCALL *CoinGetColName)(HPROB hProb, int col);
     331const char*  (SOLVCALL *CoinGetColName)(HPROB hProb, int col);
    332332int    (SOLVCALL *CoinGetColNameBuf)(HPROB hProb, int col, char* ColName, int buflen);
    333 char*  (SOLVCALL *CoinGetRowName)(HPROB hProb, int row);
     333const char*  (SOLVCALL *CoinGetRowName)(HPROB hProb, int row);
    334334int    (SOLVCALL *CoinGetRowNameBuf)(HPROB hProb, int row, char* RowName, int buflen);
    335335
    336336int    (SOLVCALL *CoinGetSolutionStatus)(HPROB hProb);
    337 int    (SOLVCALL *CoinGetSolutionText)(HPROB hProb, int SolutionStatus);
     337const char* (SOLVCALL *CoinGetSolutionText)(HPROB hProb, int SolutionStatus);
    338338int    (SOLVCALL *CoinGetSolutionTextBuf)(HPROB hProb, int SolutionStatus, char* SolutionText, int buflen);
    339339
     
    350350int    (SOLVCALL *CoinGetSolutionBasis)(HPROB hProb, int* ColStatus, double* RowStatus);
    351351
    352 void   (SOLVCALL *CoinReadFile)(HPROB hProb, int FileType, char* ReadFilename);
    353 void   (SOLVCALL *CoinWriteFile)(HPROB hProb, int FileType, char* WriteFilename);
    354 
    355 void   (SOLVCALL *CoinOpenLogFile)(HPROB hProb, char* LogFilename);
     352void   (SOLVCALL *CoinReadFile)(HPROB hProb, int FileType, const char* ReadFilename);
     353void   (SOLVCALL *CoinWriteFile)(HPROB hProb, int FileType, const char* WriteFilename);
     354
     355void   (SOLVCALL *CoinOpenLogFile)(HPROB hProb, const char* LogFilename);
    356356void   (SOLVCALL *CoinCloseLogFile)(HPROB hProb);
    357357
     
    359359int    (SOLVCALL *CoinGetOptionInfo)(HPROB hProb, int OptionNr, int* OptionID, int* GroupType, int* OptionType);
    360360
    361 char*  (SOLVCALL *CoinGetOptionName)(HPROB hProb, int OptionNr);
     361const char*  (SOLVCALL *CoinGetOptionName)(HPROB hProb, int OptionNr);
    362362int    (SOLVCALL *CoinGetOptionNameBuf)(HPROB hProb, int OptionNr, char* OptionName, int buflen);
    363 char*  (SOLVCALL *CoinGetOptionShortName)(HPROB hProb, int OptionNr);
     363const char*  (SOLVCALL *CoinGetOptionShortName)(HPROB hProb, int OptionNr);
    364364int    (SOLVCALL *CoinGetOptionShortNameBuf)(HPROB hProb, int OptionNr, char* ShortName, int buflen);
    365365
     
    375375int    (SOLVCALL *CoinSetRealOption)(HPROB hProb, int OptionID, double RealValue);
    376376
    377 char*  (SOLVCALL *CoinGetStringOption)(HPROB hProb, int OptionID);
     377const char*  (SOLVCALL *CoinGetStringOption)(HPROB hProb, int OptionID);
    378378int    (SOLVCALL *CoinGetStringOptionBuf)(HPROB hProb, int OptionID, char* StringValue, int buflen);
    379 int    (SOLVCALL *CoinSetStringOption)(HPROB hProb, int OptionID, char* StringValue);
     379int    (SOLVCALL *CoinSetStringOption)(HPROB hProb, int OptionID, const char* StringValue);
    380380
    381381#endif
Note: See TracChangeset for help on using the changeset viewer.