Changeset 363


Ignore:
Timestamp:
Nov 16, 2009 11:00:50 AM (10 years ago)
Author:
bjarni
Message:

Add LoadMatrix?, LoadNames?, and LoadNamesBuf? to CoinMP, and update CoinMP.def and unitTest.cpp.

Location:
trunk/CoinMP
Files:
4 edited

Legend:

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

    r362 r363  
    174174        free(pCoin);
    175175        pCoin = NULL;
     176        return SOLV_CALL_SUCCESS;
     177}
     178
     179
     180
     181SOLVAPI int SOLVCALL CoinLoadMatrix(HPROB hProb,
     182                                int ColCount, int RowCount, int NZCount, int RangeCount,
     183                                int ObjectSense, double ObjectConst, double* ObjectCoeffs,
     184                                double* LowerBounds, double* UpperBounds, char* RowType,
     185                                double* RHSValues, double* RangeValues, int* MatrixBegin,
     186                                int* MatrixCount, int* MatrixIndex, double* MatrixValues)
     187{
     188        PCOIN pCoin = (PCOIN)hProb;
     189        PPROBLEM pProblem = pCoin->pProblem;
     190
     191        if (!coinStoreMatrix(pProblem, ColCount, RowCount, NZCount, RangeCount, ObjectSense,
     192                                                 ObjectConst, ObjectCoeffs, LowerBounds, UpperBounds, RowType,
     193                                                 RHSValues, RangeValues, MatrixBegin, MatrixCount, MatrixIndex,
     194                                                 MatrixValues)) {
     195                return SOLV_CALL_FAILED;
     196        }
     197}
     198
     199
     200SOLVAPI int SOLVCALL CoinLoadNames(HPROB hProb, char** ColNamesList, char** RowNamesList, char* ObjectName)
     201{
     202        PCOIN pCoin = (PCOIN)hProb;
     203
     204        if (!coinStoreNamesList(pCoin->pProblem, ColNamesList, RowNamesList, ObjectName)) {
     205                return SOLV_CALL_FAILED;
     206        }
     207        return SOLV_CALL_SUCCESS;
     208}
     209
     210
     211
     212SOLVAPI int SOLVCALL CoinLoadNamesBuf(HPROB hProb, char* ColNamesBuf, char* RowNamesBuf, char* ObjectName)
     213{
     214        PCOIN pCoin = (PCOIN)hProb;
     215
     216        if (!coinStoreNamesBuf(pCoin->pProblem, ColNamesBuf, RowNamesBuf, ObjectName)) {
     217                return SOLV_CALL_FAILED;
     218        }
    176219        return SOLV_CALL_SUCCESS;
    177220}
  • trunk/CoinMP/src/CoinMP.def

    r341 r363  
    1414        CoinGetInfinity
    1515        CoinCreateProblem
     16        CoinLoadMatrix
     17        CoinLoadNames
     18        CoinLoadNamesBuf
    1619        CoinLoadProblem
    1720        CoinLoadProblemBuf
     
    1922        CoinLoadInteger
    2023        CoinLoadPriority
     24        CoinLoadSos
    2125        CoinLoadSemiCont
    22         CoinLoadSos
    2326        CoinLoadQuadratic
    2427        CoinLoadNonlinear
  • trunk/CoinMP/src/CoinMP.h

    r362 r363  
    144144SOLVAPI HPROB  SOLVCALL CoinCreateProblem(const char* ProblemName);
    145145
     146SOLVAPI int SOLVCALL CoinLoadMatrix(HPROB hProb,
     147                                int ColCount, int RowCount, int NZCount, int RangeCount,
     148                                int ObjectSense, double ObjectConst, double* ObjectCoeffs,
     149                                double* LowerBounds, double* UpperBounds, char* RowType,
     150                                double* RHSValues, double* RangeValues, int* MatrixBegin,
     151                                int* MatrixCount, int* MatrixIndex, double* MatrixValues);
     152
     153SOLVAPI int SOLVCALL CoinLoadNames(HPROB hProb, char** ColNamesList,
     154                                char** RowNamesList, char* ObjectName);
     155
     156SOLVAPI int SOLVCALL CoinLoadNamesBuf(HPROB hProb, char* ColNamesBuf,
     157                                char* RowNamesBuf, char* ObjectName);
     158
    146159SOLVAPI int    SOLVCALL CoinLoadProblem(HPROB hProb,
    147160                                        int ColCount, int RowCount, int NZCount, int RangeCount,
  • trunk/CoinMP/test/unitTest.cpp

    r353 r363  
    9595        fprintf(stdout, "Solve Problem: %s (obj=%lg)\n", problemName, optimalValue);
    9696        hProb = CoinCreateProblem(problemName); 
    97         result = CoinLoadProblem(hProb, colCount, rowCount, nonZeroCount, rangeCount,
     97        result = CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount,
    9898                                        objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds,
    9999                                        rowType, rhsValues, rangeValues, matrixBegin, matrixCount,
    100                                         matrixIndex, matrixValues, colNames, rowNames, objectName);
     100                                        matrixIndex, matrixValues);
     101        result = CoinLoadNames(hProb, colNames, rowNames, objectName);
    101102        if (columnType) {
    102103                result = CoinLoadInteger(hProb, columnType);
     
    133134        fprintf(stdout, "Solve Problem: %s (obj=%lg)\n", problemName, optimalValue);
    134135        hProb = CoinCreateProblem(problemName); 
    135         result = CoinLoadProblemBuf(hProb, colCount, rowCount, nonZeroCount, rangeCount,
     136        result = CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount,
    136137                                        objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds,
    137138                                        rowType, rhsValues, rangeValues, matrixBegin, matrixCount,
    138                                         matrixIndex, matrixValues, colNamesBuf, rowNamesBuf, objectName);
     139                                        matrixIndex, matrixValues);
     140        result = CoinLoadNamesBuf(hProb, colNamesBuf, rowNamesBuf, objectName);
    139141        if (columnType) {
    140142                result = CoinLoadInteger(hProb, columnType);
     
    173175        fprintf(stdout, "Solve Problem: %s (obj=%lg)\n", problemName, optimalValue);
    174176        hProb = CoinCreateProblem(problemName);
    175         result = CoinLoadProblem(hProb, colCount, rowCount, nonZeroCount, rangeCount,
     177        result = CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount,
    176178                                        objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds,
    177179                                        rowType, rhsValues, rangeValues, matrixBegin, matrixCount,
    178                                         matrixIndex, matrixValues, colNames, rowNames, objectName);
     180                                        matrixIndex, matrixValues);
     181        result = CoinLoadNames(hProb, colNames, rowNames, objectName);
    179182        if (columnType) {
    180183                result = CoinLoadInteger(hProb, columnType);
Note: See TracChangeset for help on using the changeset viewer.