Changeset 116


Ignore:
Timestamp:
Aug 11, 2008 9:11:49 PM (11 years ago)
Author:
bjarni
Message:

Print out CoinMP version in unitTest

Location:
trunk/CoinMP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CoinMP/examples/example.c

    r115 r116  
    3939void RunTestProblem(char *problemName, double optimalValue, int colCount, int rowCount,
    4040          int nonZeroCount, int rangeCount, int objectSense, double *objectCoeffs, double objectConst,
    41       double *rhsValues, double *rangeValues, char *columnType, char *rowType, int *matrixBegin,
     41          double *rhsValues, double *rangeValues, char *columnType, char *rowType, int *matrixBegin,
    4242          int *matrixCount, int *matrixIndex, double *matrixValues, double *lowerBounds, double *upperBounds,
    4343          double *initValues, char **colNames, char **rowNames)
    4444{
    45     HPROB hProb;
     45        HPROB hProb;
    4646   
    4747        fprintf(stdout, "Solve Problem: %s\n", problemName);
    48     hProb = CoinCreateProblem(problemName); 
    49     CoinLoadProblem(hProb, colCount, rowCount, nonZeroCount, rangeCount,
     48        hProb = CoinCreateProblem(problemName); 
     49        CoinLoadProblem(hProb, colCount, rowCount, nonZeroCount, rangeCount,
    5050                                        objectSense, objectCoeffs, objectConst, rhsValues, rangeValues,
    5151                                        rowType, matrixBegin, matrixCount, matrixIndex, matrixValues,
     
    5656        CoinOptimizeProblem(hProb, 0);
    5757        GetAndCheckSolution(optimalValue, hProb);
    58     CoinUnloadProblem(hProb);
     58        CoinUnloadProblem(hProb);
    5959}
    6060
     
    7575{
    7676        char *problemName = "CoinTest";
    77     int colCount=8;
    78     int rowCount=5;
    79     int nonZeroCount=14;
    80     int rangeCount = 0;
    81 
    82     int objectSense = SOLV_OBJSENS_MAX;
     77        int colCount=8;
     78        int rowCount=5;
     79        int nonZeroCount=14;
     80        int rangeCount = 0;
     81
     82        int objectSense = SOLV_OBJSENS_MAX;
    8383        double objectConst = 0.0;
    84     double objectCoeffs[8] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
     84        double objectCoeffs[8] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
    8585
    8686        double rhsValues[5] = { 14., 80., 50., 50., 50. };
    87     char rowType[5] = { 'L', 'L', 'L', 'L', 'L' };
    88 
    89     int matrixBegin[8+1]={0,2,4,6,8,10,11,12,14};
    90     int matrixCount[8]={2,2,2,2,2,1,1,2};
    91     int matrixIndex[14]={0,4,0,1,1,2,0,3,0,4,2,3,0,4};
     87        char rowType[5] = { 'L', 'L', 'L', 'L', 'L' };
     88
     89        int matrixBegin[8+1]={0,2,4,6,8,10,11,12,14};
     90        int matrixCount[8]={2,2,2,2,2,1,1,2};
     91        int matrixIndex[14]={0,4,0,1,1,2,0,3,0,4,2,3,0,4};
    9292        double matrixValues[14]={3., 5.6, 1., 2., 1.1, 1., -2., 2.8, -1., 1., 1., -1.2, -1., 1.9};
    9393   
    94     double lowerBounds[8] = { 0., 0., 0., 0., 0., 0., 0.  };
    95     double upperBounds[8] = { 1000000., 1000000., 1000000., 1000000., 1000000., 1000000., 1000000.   };
     94        double lowerBounds[8] = { 0., 0., 0., 0., 0., 0., 0.  };
     95        double upperBounds[8] = { 1000000., 1000000., 1000000., 1000000., 1000000., 1000000., 1000000.   };
    9696
    9797        double initValues[8] = { 0., 0., 0., 0., 0., 0., 0., 0.  };
    98     char * colNames[8] = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8" };
    99     char * rowNames[5] = { "r1", "r2", "r3", "r4", "r5" } ;
     98        char * colNames[8] = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8" };
     99        char * rowNames[5] = { "r1", "r2", "r3", "r4", "r5" } ;
    100100   
    101101        double optimalValue = 1428729.2857143;
     
    103103        RunTestProblem(problemName, optimalValue, colCount, rowCount,
    104104          nonZeroCount, rangeCount, objectSense, objectCoeffs, objectConst,
    105       rhsValues, NULL, NULL, rowType, matrixBegin, matrixCount,
     105          rhsValues, NULL, NULL, rowType, matrixBegin, matrixCount,
    106106          matrixIndex, matrixValues, lowerBounds, upperBounds,
    107107          initValues, colNames, rowNames);
     
    112112{
    113113        char *problemName = "Bakery";
    114     int colCount = 2;
    115     int rowCount = 3;
    116     int nonZeroCount = 4 ;
    117     int rangeCount = 0;
     114        int colCount = 2;
     115        int rowCount = 3;
     116        int nonZeroCount = 4 ;
     117        int rangeCount = 0;
    118118
    119119        int objectSense = SOLV_OBJSENS_MAX;
    120120        double objectConst = - 4000.0 / 30.0;
    121     double objectCoeffs[2] = { 0.05 , 0.08 };
     121        double objectCoeffs[2] = { 0.05 , 0.08 };
    122122
    123123        double rhsValues[3] = { 1400 , 8000 , 5000 };
    124     char rowType[3] = { 'L', 'L' , 'L' };
    125 
    126     int matrixBegin[2+1] = { 0 , 2, 4 };
    127     int matrixCount[2] = { 2 , 2 };
    128     int matrixIndex[4] = { 0, 1, 0, 2};
    129     double matrixValues[4] = { 0.1, 1, 0.2, 1};
    130 
    131     double lowerBounds[2] = { 0, 0  };
    132     double upperBounds[2] = { 1000000, 1000000   };
    133     char * colNames[2] = { "Sun", "Moon" };
    134     char * rowNames[3] = { "c1", "c2", "c3" } ;
     124        char rowType[3] = { 'L', 'L' , 'L' };
     125
     126        int matrixBegin[2+1] = { 0 , 2, 4 };
     127        int matrixCount[2] = { 2 , 2 };
     128        int matrixIndex[4] = { 0, 1, 0, 2};
     129        double matrixValues[4] = { 0.1, 1, 0.2, 1};
     130
     131        double lowerBounds[2] = { 0, 0  };
     132        double upperBounds[2] = { 1000000, 1000000   };
     133        char * colNames[2] = { "Sun", "Moon" };
     134        char * rowNames[3] = { "c1", "c2", "c3" } ;
    135135   
    136136        double optimalValue = 506.66666667;
     
    138138        RunTestProblem(problemName, optimalValue, colCount, rowCount,
    139139          nonZeroCount, rangeCount, objectSense, objectCoeffs, objectConst,
    140       rhsValues, NULL, NULL, rowType, matrixBegin, matrixCount,
    141       matrixIndex, matrixValues, lowerBounds, upperBounds,
     140          rhsValues, NULL, NULL, rowType, matrixBegin, matrixCount,
     141          matrixIndex, matrixValues, lowerBounds, upperBounds,
    142142          NULL, colNames, rowNames);
    143143}
     
    205205        RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng,
    206206          objsens, dobj, objconst, drhs, NULL, NULL, rtyp, mbeg, mcnt,
    207       midx, mval, dclo, dcup, NULL, colname, rowname);
     207          midx, mval, dclo, dcup, NULL, colname, rowname);
    208208}
    209209
     
    274274        RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng,
    275275          objsens, dobj, objconst, drhs, NULL, ctyp, rtyp, mbeg, mcnt,
    276       midx, mval, dclo, dcup, NULL, colname, rowname);
     276          midx, mval, dclo, dcup, NULL, colname, rowname);
    277277}
    278278
     
    312312        RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng,
    313313          objsens, dobj, objconst, drhs, drng, ctyp, rtyp, mbeg, mcnt,
    314       midx, mval, dclo, dcup, NULL, colname, rowname);
     314          midx, mval, dclo, dcup, NULL, colname, rowname);
    315315}
    316316
     
    319319int main (int argc, char *argv[])
    320320{
    321     CoinInitSolver("");
     321        CoinInitSolver("");
    322322        fprintf(stdout, "UnitTest: %s version %lg\n\n",CoinGetSolverName(), CoinGetVersion());
    323323        SolveProblemCoinTest();
     
    327327        SolveProblemExmip1();
    328328        fprintf(stdout, "All unit tests completed successfully\n" );
    329     CoinFreeSolver();
     329        CoinFreeSolver();
    330330        return 0;
    331331}
  • trunk/CoinMP/test/unitTest.cpp

    r115 r116  
    3939void RunTestProblem(char *problemName, double optimalValue, int colCount, int rowCount,
    4040          int nonZeroCount, int rangeCount, int objectSense, double *objectCoeffs, double objectConst,
    41       double *rhsValues, double *rangeValues, char *columnType, char *rowType, int *matrixBegin,
     41          double *rhsValues, double *rangeValues, char *columnType, char *rowType, int *matrixBegin,
    4242          int *matrixCount, int *matrixIndex, double *matrixValues, double *lowerBounds, double *upperBounds,
    4343          double *initValues, char **colNames, char **rowNames)
    4444{
    45     HPROB hProb;
     45        HPROB hProb;
    4646   
    4747        fprintf(stdout, "Solve Problem: %s\n", problemName);
    48     hProb = CoinCreateProblem(problemName); 
    49     CoinLoadProblem(hProb, colCount, rowCount, nonZeroCount, rangeCount,
     48        hProb = CoinCreateProblem(problemName); 
     49        CoinLoadProblem(hProb, colCount, rowCount, nonZeroCount, rangeCount,
    5050                                        objectSense, objectCoeffs, objectConst, rhsValues, rangeValues,
    5151                                        rowType, matrixBegin, matrixCount, matrixIndex, matrixValues,
     
    5656        CoinOptimizeProblem(hProb, 0);
    5757        GetAndCheckSolution(optimalValue, hProb);
    58     CoinUnloadProblem(hProb);
     58        CoinUnloadProblem(hProb);
    5959}
    6060
     
    7575{
    7676        char *problemName = "CoinTest";
    77     int colCount=8;
    78     int rowCount=5;
    79     int nonZeroCount=14;
    80     int rangeCount = 0;
    81 
    82     int objectSense = SOLV_OBJSENS_MAX;
     77        int colCount=8;
     78        int rowCount=5;
     79        int nonZeroCount=14;
     80        int rangeCount = 0;
     81
     82        int objectSense = SOLV_OBJSENS_MAX;
    8383        double objectConst = 0.0;
    84     double objectCoeffs[8] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
     84        double objectCoeffs[8] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
    8585
    8686        double rhsValues[5] = { 14., 80., 50., 50., 50. };
    87     char rowType[5] = { 'L', 'L', 'L', 'L', 'L' };
    88 
    89     int matrixBegin[8+1]={0,2,4,6,8,10,11,12,14};
    90     int matrixCount[8]={2,2,2,2,2,1,1,2};
    91     int matrixIndex[14]={0,4,0,1,1,2,0,3,0,4,2,3,0,4};
     87        char rowType[5] = { 'L', 'L', 'L', 'L', 'L' };
     88
     89        int matrixBegin[8+1]={0,2,4,6,8,10,11,12,14};
     90        int matrixCount[8]={2,2,2,2,2,1,1,2};
     91        int matrixIndex[14]={0,4,0,1,1,2,0,3,0,4,2,3,0,4};
    9292        double matrixValues[14]={3., 5.6, 1., 2., 1.1, 1., -2., 2.8, -1., 1., 1., -1.2, -1., 1.9};
    9393   
    94     double lowerBounds[8] = { 0., 0., 0., 0., 0., 0., 0.  };
    95     double upperBounds[8] = { 1000000., 1000000., 1000000., 1000000., 1000000., 1000000., 1000000.   };
     94        double lowerBounds[8] = { 0., 0., 0., 0., 0., 0., 0.  };
     95        double upperBounds[8] = { 1000000., 1000000., 1000000., 1000000., 1000000., 1000000., 1000000.   };
    9696
    9797        double initValues[8] = { 0., 0., 0., 0., 0., 0., 0., 0.  };
    98     char * colNames[8] = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8" };
    99     char * rowNames[5] = { "r1", "r2", "r3", "r4", "r5" } ;
     98        char * colNames[8] = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8" };
     99        char * rowNames[5] = { "r1", "r2", "r3", "r4", "r5" } ;
    100100   
    101101        double optimalValue = 1428729.2857143;
     
    103103        RunTestProblem(problemName, optimalValue, colCount, rowCount,
    104104          nonZeroCount, rangeCount, objectSense, objectCoeffs, objectConst,
    105       rhsValues, NULL, NULL, rowType, matrixBegin, matrixCount,
     105          rhsValues, NULL, NULL, rowType, matrixBegin, matrixCount,
    106106          matrixIndex, matrixValues, lowerBounds, upperBounds,
    107107          initValues, colNames, rowNames);
     
    112112{
    113113        char *problemName = "Bakery";
    114     int colCount = 2;
    115     int rowCount = 3;
    116     int nonZeroCount = 4 ;
    117     int rangeCount = 0;
     114        int colCount = 2;
     115        int rowCount = 3;
     116        int nonZeroCount = 4 ;
     117        int rangeCount = 0;
    118118
    119119        int objectSense = SOLV_OBJSENS_MAX;
    120120        double objectConst = - 4000.0 / 30.0;
    121     double objectCoeffs[2] = { 0.05 , 0.08 };
     121        double objectCoeffs[2] = { 0.05 , 0.08 };
    122122
    123123        double rhsValues[3] = { 1400 , 8000 , 5000 };
    124     char rowType[3] = { 'L', 'L' , 'L' };
    125 
    126     int matrixBegin[2+1] = { 0 , 2, 4 };
    127     int matrixCount[2] = { 2 , 2 };
    128     int matrixIndex[4] = { 0, 1, 0, 2};
    129     double matrixValues[4] = { 0.1, 1, 0.2, 1};
    130 
    131     double lowerBounds[2] = { 0, 0  };
    132     double upperBounds[2] = { 1000000, 1000000   };
    133     char * colNames[2] = { "Sun", "Moon" };
    134     char * rowNames[3] = { "c1", "c2", "c3" } ;
     124        char rowType[3] = { 'L', 'L' , 'L' };
     125
     126        int matrixBegin[2+1] = { 0 , 2, 4 };
     127        int matrixCount[2] = { 2 , 2 };
     128        int matrixIndex[4] = { 0, 1, 0, 2};
     129        double matrixValues[4] = { 0.1, 1, 0.2, 1};
     130
     131        double lowerBounds[2] = { 0, 0  };
     132        double upperBounds[2] = { 1000000, 1000000   };
     133        char * colNames[2] = { "Sun", "Moon" };
     134        char * rowNames[3] = { "c1", "c2", "c3" } ;
    135135   
    136136        double optimalValue = 506.66666667;
     
    138138        RunTestProblem(problemName, optimalValue, colCount, rowCount,
    139139          nonZeroCount, rangeCount, objectSense, objectCoeffs, objectConst,
    140       rhsValues, NULL, NULL, rowType, matrixBegin, matrixCount,
    141       matrixIndex, matrixValues, lowerBounds, upperBounds,
     140          rhsValues, NULL, NULL, rowType, matrixBegin, matrixCount,
     141          matrixIndex, matrixValues, lowerBounds, upperBounds,
    142142          NULL, colNames, rowNames);
    143143}
     
    205205        RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng,
    206206          objsens, dobj, objconst, drhs, NULL, NULL, rtyp, mbeg, mcnt,
    207       midx, mval, dclo, dcup, NULL, colname, rowname);
     207          midx, mval, dclo, dcup, NULL, colname, rowname);
    208208}
    209209
     
    274274        RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng,
    275275          objsens, dobj, objconst, drhs, NULL, ctyp, rtyp, mbeg, mcnt,
    276       midx, mval, dclo, dcup, NULL, colname, rowname);
     276          midx, mval, dclo, dcup, NULL, colname, rowname);
    277277}
    278278
     
    312312        RunTestProblem(probname, optimalValue, ncol, nrow, nels, nrng,
    313313          objsens, dobj, objconst, drhs, drng, ctyp, rtyp, mbeg, mcnt,
    314       midx, mval, dclo, dcup, NULL, colname, rowname);
     314          midx, mval, dclo, dcup, NULL, colname, rowname);
    315315}
    316316
     
    319319int main (int argc, char *argv[])
    320320{
    321     CoinInitSolver("");
     321        CoinInitSolver("");
    322322        fprintf(stdout, "UnitTest: %s version %lg\n\n",CoinGetSolverName(), CoinGetVersion());
    323323        SolveProblemCoinTest();
     
    327327        SolveProblemExmip1();
    328328        fprintf(stdout, "All unit tests completed successfully\n" );
    329     CoinFreeSolver();
     329        CoinFreeSolver();
    330330        return 0;
    331331}
Note: See TracChangeset for help on using the changeset viewer.