Changeset 97


Ignore:
Timestamp:
Aug 4, 2008 11:36:36 PM (11 years ago)
Author:
bjarni
Message:

Moved optimalValue into SolveProblem? routines

File:
1 edited

Legend:

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

    r77 r97  
    3737
    3838
    39 void RunTestProblem(char *problemName, double optimalValue, double objectConst,
     39void RunTestProblem(char *problemName, double optimalValue,
    4040          int colCount, int rowCount, int nonZeroCount, int rangeCount, int objectSense,
    41       double *objectCoeffs, double *rhsValues, double *rangeValues, char *columnType,
     41      double *objectCoeffs, double objectConst, double *rhsValues, double *rangeValues, char *columnType,
    4242          char *rowType, int *matrixBegin, int *matrixCount, int *matrixIndex, double *matrixValues,
    4343          double *lowerBounds, double *upperBounds, double *initValues, char **colNames, char **rowNames)
     
    7272*************************************************************************/
    7373
    74 void SolveCoinTestProblem(double optimalValue)
     74void SolveProblemCoinTest(void)
    7575{
    7676        char *problemName = "CoinTest";
     
    9999    char * rowNames[5] = { "r1", "r2", "r3", "r4", "r5" } ;
    100100   
    101         RunTestProblem(problemName, optimalValue, objectConst,
     101        double optimalValue = 1428729.2857143;
     102        RunTestProblem(problemName, optimalValue,
    102103          colCount, rowCount, nonZeroCount, rangeCount,
    103       objectSense, objectCoeffs, rhsValues, NULL,
     104      objectSense, objectCoeffs, objectConst, rhsValues, NULL,
    104105          NULL, rowType, matrixBegin, matrixCount, matrixIndex,
    105106          matrixValues, lowerBounds, upperBounds, initValues,
     
    108109
    109110
    110 void SolveBakeryProblem(double optimalValue)
     111void SolveProblemBakery(void)
    111112{
    112113        char *problemName = "Bakery";
     
    133134    char * rowNames[3] = { "c1", "c2", "c3" } ;
    134135   
    135         RunTestProblem(problemName, optimalValue, objectConst,
     136        double optimalValue = 506.66666667;
     137
     138        RunTestProblem(problemName, optimalValue,
    136139          colCount, rowCount, nonZeroCount, rangeCount, objectSense,
    137       objectCoeffs, rhsValues, NULL, NULL, rowType,
     140      objectCoeffs, objectConst, rhsValues, NULL, NULL, rowType,
    138141      matrixBegin, matrixCount, matrixIndex, matrixValues,
    139142          lowerBounds, upperBounds, NULL, colNames, rowNames);
     
    141144
    142145
    143 void SolveAfiroProblem(double optimalValue)
     146void SolveProblemAfiro(void)
    144147{
    145148        char *probname = "Afiro";
     
    198201                "X43", "X45", "X46", "X47", "X48", "X49", "X50", "X51"};
    199202
    200         RunTestProblem(probname, optimalValue, objconst,
    201           ncol, nrow, nels, nrng, objsens, dobj, drhs, NULL,
     203        double optimalValue = -464.753142857;
     204
     205        RunTestProblem(probname, optimalValue,
     206          ncol, nrow, nels, nrng, objsens, dobj, objconst, drhs, NULL,
    202207      NULL, rtyp, mbeg, mcnt, midx, mval, dclo, dcup,
    203208          NULL, colname, rowname);
     
    205210
    206211
    207 void SolveP0033Problem(double optimalValue)
     212void SolveProblemP0033(void)
    208213{
    209214        char *probname = "P0033";
     
    266271                'B', 'B', 'B', 'B', 'B', 'B' };
    267272
    268         RunTestProblem(probname, optimalValue, objconst,
    269           ncol, nrow, nels, nrng, objsens, dobj, drhs, NULL,
     273        double optimalValue = 3089.0;
     274
     275        RunTestProblem(probname, optimalValue,
     276          ncol, nrow, nels, nrng, objsens, dobj, objconst, drhs, NULL,
    270277      ctyp, rtyp, mbeg, mcnt, midx, mval, dclo, dcup,
    271278          NULL, colname, rowname);
     
    273280
    274281
    275 void SolveExmip1Problem(double optimalValue)
     282void SolveProblemExmip1(void)
    276283{
    277284        char *probname = "Exmip1";
     
    303310        char ctyp[8] = { 'C', 'C', 'B', 'B', 'C', 'C', 'C', 'C'};
    304311
    305         RunTestProblem(probname, optimalValue, objconst,
    306           ncol, nrow, nels, nrng, objsens, dobj, drhs, drng,
     312        double optimalValue = 3.23684210526;
     313
     314        RunTestProblem(probname, optimalValue,
     315          ncol, nrow, nels, nrng, objsens, dobj, objconst, drhs, drng,
    307316      ctyp, rtyp, mbeg, mcnt, midx, mval, dclo, dcup,
    308317          NULL, colname, rowname);
     
    314323{
    315324    CoinInitSolver("");
    316         SolveCoinTestProblem(1428729.2857143);
    317         SolveBakeryProblem(506.66666667);
    318         SolveAfiroProblem(-464.753142857);
    319         SolveP0033Problem(3089.0);
    320         SolveExmip1Problem(3.23684210526);
     325        SolveProblemCoinTest();
     326        SolveProbleBakerym();
     327        SolveProblemAfiro();
     328        SolveProblemP0033();
     329        SolveProblemExmip1();
    321330        fprintf(stdout, "All tests completed successfully\n" );
    322331    CoinFreeSolver();
Note: See TracChangeset for help on using the changeset viewer.