Changeset 982 for stable


Ignore:
Timestamp:
Jun 17, 2008 3:46:24 AM (11 years ago)
Author:
forrest
Message:

update gamsTest

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/2.1/Cbc/examples/gamsTest.cpp

    r978 r982  
    400400      }
    401401      }
    402       for (int i=0; i<numcols; ++i) {
    403          cout << "Reduced cost variable " << i << " in model: " << model.getReducedCost()[i]
    404         << "\t in solver: " << solver->getReducedCost()[i]
    405         << "\t expected: " << redcost[i]
    406         << endl;
    407       if (CoinAbs(model.getReducedCost()[i]-redcost[i])>testtol || CoinAbs(solver->getReducedCost()[i]-redcost[i])>testtol) {
    408          cerr << "Warning: Reduced cost incorrect." << endl;
    409          ++warning_count;
    410       }
     402      cout << "Reduced cost variable " << 0 << " in model: " << model.getReducedCost()[0]
     403        << "\t in solver: " << solver->getReducedCost()[0]
     404        << "\t expected: " << redcost[0]
     405        << endl;
     406      if (CoinAbs(model.getReducedCost()[0]-redcost[0])>testtol || CoinAbs(solver->getReducedCost()[0]-redcost[0])>testtol) {
     407      cerr << "Warning: Reduced cost incorrect." << endl;
     408      ++warning_count;
     409      }
     410      cout << "Reduced cost variable " << 3 << " in model: " << model.getReducedCost()[3]
     411        << "\t in solver: " << solver->getReducedCost()[3]
     412        << "\t expected: " << redcost[3]
     413        << endl;
     414      if (CoinAbs(model.getReducedCost()[3]-redcost[3])>testtol || CoinAbs(solver->getReducedCost()[3]-redcost[3])>testtol) {
     415      cerr << "Warning: Reduced cost incorrect." << endl;
     416      ++warning_count;
     417      }
     418      cout << "Reduced cost variable 1 plus - dual of row 0 in model: " << model.getReducedCost()[1]-model.getRowPrice()[0]
     419        << "\t expected: " << redcost[1]
     420        << endl;
     421      if (CoinAbs(model.getReducedCost()[1]-model.getRowPrice()[0]-redcost[1])>testtol) {
     422      cerr << "Warning: Reduced cost or row margin incorrect." << endl;
     423      ++warning_count;
     424      }
     425      cout << "Reduced cost variable 2 plus + dual of row 1 in model: " << model.getReducedCost()[2]+model.getRowPrice()[1]
     426        << "\t expected: " << redcost[2]
     427        << endl;
     428      if (CoinAbs(model.getReducedCost()[2]+model.getRowPrice()[1]-redcost[2])>testtol) {
     429      cerr << "Warning: Reduced cost or row margin incorrect." << endl;
     430      ++warning_count;
    411431      }
    412432     
     
    587607      }
    588608      }
    589       for (int i=0; i<numcols; ++i) {
    590          cout << "Reduced cost variable " << i << " in model: " << model.getReducedCost()[i]
    591         << "\t in solver: " << solver->getReducedCost()[i]
    592         << "\t expected: " << redcost[i]
    593         << endl;
    594       if (CoinAbs(model.getReducedCost()[i]-redcost[i])>testtol || CoinAbs(solver->getReducedCost()[i]-redcost[i])>testtol) {
    595          cerr << "Warning: Reduced cost incorrect." << endl;
     609      cout << "Reduced cost variable " << 0 << " in model: " << model.getReducedCost()[0]
     610        << "\t in solver: " << solver->getReducedCost()[0]
     611        << "\t expected: " << redcost[0]
     612        << endl;
     613      if (CoinAbs(model.getReducedCost()[0]-redcost[0])>testtol || CoinAbs(solver->getReducedCost()[0]-redcost[0])>testtol) {
     614      cerr << "Warning: Reduced cost incorrect." << endl;
     615      ++warning_count;
     616      }
     617      cout << "Reduced cost variable " << 3 << " in model: " << model.getReducedCost()[3]
     618        << "\t in solver: " << solver->getReducedCost()[3]
     619        << "\t expected: " << redcost[3]
     620        << endl;
     621      if (CoinAbs(model.getReducedCost()[3]-redcost[3])>testtol || CoinAbs(solver->getReducedCost()[3]-redcost[3])>testtol) {
     622      cerr << "Warning: Reduced cost incorrect." << endl;
     623      ++warning_count;
     624      }
     625      cout << "Row 2 marginal (price) in model: " << model.getRowPrice()[2]
     626      << "\t in solver: " << solver->getRowPrice()[2]
     627        << "\t expected: " << row2marg << endl;
     628      if (CoinAbs(model.getRowPrice()[2]-row2marg)>testtol || CoinAbs(solver->getRowPrice()[2]-row2marg)>testtol) {
     629         cerr << "Warning: Row price incorrect." << endl;
    596630         ++warning_count;
    597       }
    598631      }
    599632     
Note: See TracChangeset for help on using the changeset viewer.