Changeset 1675 for stable/2.7/Cbc/test


Ignore:
Timestamp:
Jun 19, 2011 1:23:14 PM (10 years ago)
Author:
stefan
Message:

sync with trunk rev1674

Location:
stable/2.7
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • stable/2.7

    • Property svn:externals
      •  

        old new  
        1 BuildTools  https://projects.coin-or.org/svn/BuildTools/stable/0.7
        2 ThirdParty/ASL  https://projects.coin-or.org/svn/BuildTools/ThirdParty/ASL/stable/1.2
        3 ThirdParty/Blas  https://projects.coin-or.org/svn/BuildTools/ThirdParty/Blas/stable/1.2
        4 ThirdParty/Lapack  https://projects.coin-or.org/svn/BuildTools/ThirdParty/Lapack/stable/1.3
        5 ThirdParty/Glpk  https://projects.coin-or.org/svn/BuildTools/ThirdParty/Glpk/stable/1.8
        6 Data/Sample  https://projects.coin-or.org/svn/Data/Sample/stable/1.2
        7 CoinUtils  https://projects.coin-or.org/svn/CoinUtils/stable/2.8/CoinUtils
        8 Cgl  https://projects.coin-or.org/svn/Cgl/stable/0.57/Cgl
        9 Clp  https://projects.coin-or.org/svn/Clp/stable/1.14/Clp
        10 Osi  https://projects.coin-or.org/svn/Osi/stable/0.105/Osi
         1BuildTools        https://projects.coin-or.org/svn/BuildTools/stable/0.7
         2ThirdParty/ASL    https://projects.coin-or.org/svn/BuildTools/ThirdParty/ASL/stable/1.2
         3ThirdParty/Blas   https://projects.coin-or.org/svn/BuildTools/ThirdParty/Blas/stable/1.2
         4ThirdParty/Lapack https://projects.coin-or.org/svn/BuildTools/ThirdParty/Lapack/stable/1.3
         5ThirdParty/Glpk   https://projects.coin-or.org/svn/BuildTools/ThirdParty/Glpk/stable/1.8
         6ThirdParty/Metis  https://projects.coin-or.org/svn/BuildTools/ThirdParty/Metis/stable/1.2
         7ThirdParty/Mumps  https://projects.coin-or.org/svn/BuildTools/ThirdParty/Mumps/stable/1.4
         8Data/Sample       https://projects.coin-or.org/svn/Data/Sample/stable/1.2
         9Data/miplib3      https://projects.coin-or.org/svn/Data/miplib3/stable/1.2
         10CoinUtils         https://projects.coin-or.org/svn/CoinUtils/stable/2.8/CoinUtils
         11Cgl               https://projects.coin-or.org/svn/Cgl/stable/0.57/Cgl
         12Clp               https://projects.coin-or.org/svn/Clp/stable/1.14/Clp
         13Osi               https://projects.coin-or.org/svn/Osi/stable/0.105/Osi
    • Property svn:mergeinfo changed
      /trunk (added)merged: 1578,​1582-1587,​1589-1600,​1603-1614,​1620-1626,​1631-1633,​1635-1636,​1638-1646,​1650-1652,​1654-1658,​1660-1663,​1665-1671,​1673-1674
  • stable/2.7/Cbc

  • stable/2.7/Cbc/test/Makefile.am

    r1565 r1675  
    6262gamsTest_LDADD = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_LIBS)
    6363gamsTest_DEPENDENCIES = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_DEPENDENCIES)
    64 gamsTest_LDFLAGS = -rpath $(libdir)
    6564
    6665AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../src` $(COINDEPEND_CFLAGS)
    6766AM_CPPFLAGS += $(CLP_CFLAGS) $(CPX_CFLAGS) $(DYLP_CFLAGS) $(GLPK_CFLAGS) $(MSK_CFLAGS) $(VOL_CFLAGS) $(XPR_CFLAGS)
     67
     68# This line is necessary to allow VPATH compilation
     69DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src
    6870
    6971########################################################################
     
    9294# output files of a program
    9395
    94 DISTCLEANFILES = yy.mps xx.mps
     96DISTCLEANFILES = yy.mps xx.mps continuous.mps integer.mps test2.lp test2.out test.lp test.mps test.out x1.mps.mps x2.mps.mps x3.mps.mps
  • stable/2.7/Cbc/test/Makefile.in

    r1566 r1675  
    5858        $(ACLOCAL_M4)
    5959mkinstalldirs = $(install_sh) -d
    60 CONFIG_HEADER = $(top_builddir)/inc/config_cbc.h
     60CONFIG_HEADER = $(top_builddir)/src/config.h \
     61        $(top_builddir)/src/config_cbc.h
    6162CONFIG_CLEAN_FILES =
    6263am__installdirs = "$(DESTDIR)$(bindir)"
     
    6970        OsiCbcSolverInterfaceTest.$(OBJEXT)
    7071osiUnitTest_OBJECTS = $(am_osiUnitTest_OBJECTS)
    71 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/inc
    7272depcomp = $(SHELL) $(top_srcdir)/depcomp
    7373am__depfiles_maybe = depfiles
     
    416416gamsTest_LDADD = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_LIBS)
    417417gamsTest_DEPENDENCIES = ../src/libCbcSolver.la ../src/libCbc.la $(CBCLIB_DEPENDENCIES)
    418 gamsTest_LDFLAGS = -rpath $(libdir)
    419418AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../src` $(COINDEPEND_CFLAGS) \
    420419        $(CLP_CFLAGS) $(CPX_CFLAGS) $(DYLP_CFLAGS) $(GLPK_CFLAGS) \
    421420        $(MSK_CFLAGS) $(VOL_CFLAGS) $(XPR_CFLAGS) $(OSITESTS_CFLAGS) \
    422421        -I`$(CYGPATH_W) $(srcdir)/../src/OsiCbc`
     422
     423# This line is necessary to allow VPATH compilation
     424DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src
    423425
    424426########################################################################
     
    439441# Here we list everything that is not generated by the compiler, e.g.,
    440442# output files of a program
    441 DISTCLEANFILES = yy.mps xx.mps
     443DISTCLEANFILES = yy.mps xx.mps continuous.mps integer.mps test2.lp test2.out test.lp test.mps test.out x1.mps.mps x2.mps.mps x3.mps.mps
    442444all: all-am
    443445
  • stable/2.7/Cbc/test/OsiCbcSolverInterfaceTest.cpp

    r1574 r1675  
    44// This code is licensed under the terms of the Eclipse Public License (EPL).
    55
    6 #if defined(_MSC_VER)
    7 // Turn off compiler warning about long names
    8 #  pragma warning(disable:4786)
    9 #endif
    10 
    11 #ifdef NDEBUG
    12 #undef NDEBUG
    13 #endif
    14 
    15 #include "OsiConfig.h"
    16 
    17 #include <cassert>
     6#include "CoinPragma.hpp"
     7
     8//#include <cassert>
    189//#include <cstdlib>
    1910//#include <cstdio>
     
    2415#include "OsiRowCut.hpp"
    2516#include "OsiColCut.hpp"
     17#include "OsiUnitTests.hpp"
    2618#include "CoinMessage.hpp"
    2719#include "CoinModel.hpp"
    28 #ifdef COIN_HAS_OSL
    29 #include "OsiOslSolverInterface.hpp"
    30 #endif
    3120
    3221//#############################################################################
     
    6756//--------------------------------------------------------------------------
    6857// test solution methods.
    69 int
    70 OsiCbcSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir)
     58void OsiCbcSolverInterfaceUnitTest(const std::string & mpsDir, const std::string & netlibDir)
    7159{
    72  
    73  
    7460  {   
    7561    CoinRelFltEq eq;
     
    8066    {
    8167      OsiCbcSolverInterface im;   
    82      
    83       assert( im.getNumCols() == 0 );
    84      
    85       assert( im.getModelPtr()!=NULL );
     68      OSIUNITTEST_ASSERT_ERROR(im.getNumCols() == 0, {}, "cbc", "default constructor");
     69      OSIUNITTEST_ASSERT_ERROR(im.getModelPtr() != NULL, {}, "cbc", "default constructor");
    8670    }
    8771   
     
    9377       
    9478        OsiCbcSolverInterface imC1(im);
    95         assert( imC1.getModelPtr()!=im.getModelPtr() );
    96         assert( imC1.getNumCols() == im.getNumCols() );
    97         assert( imC1.getNumRows() == im.getNumRows() );   
     79        OSIUNITTEST_ASSERT_ERROR(imC1.getModelPtr() != im.getModelPtr(), {}, "cbc", "copy constructor");
     80        OSIUNITTEST_ASSERT_ERROR(imC1.getNumCols()  == im.getNumCols(),  {}, "cbc", "copy constructor");
     81        OSIUNITTEST_ASSERT_ERROR(imC1.getNumRows()  == im.getNumRows(),  {}, "cbc", "copy constructor");
    9882       
    9983        OsiCbcSolverInterface imC2(im);
    100         assert( imC2.getModelPtr()!=im.getModelPtr() );
    101         assert( imC2.getNumCols() == im.getNumCols() );
    102         assert( imC2.getNumRows() == im.getNumRows() ); 
     84        OSIUNITTEST_ASSERT_ERROR(imC2.getModelPtr() != im.getModelPtr(), {}, "cbc", "copy constructor");
     85        OSIUNITTEST_ASSERT_ERROR(imC2.getNumCols()  == im.getNumCols(),  {}, "cbc", "copy constructor");
     86        OSIUNITTEST_ASSERT_ERROR(imC2.getNumRows()  == im.getNumRows(),  {}, "cbc", "copy constructor");
     87
     88        OSIUNITTEST_ASSERT_ERROR(imC1.getModelPtr() != imC2.getModelPtr(), {}, "cbc", "copy constructor");
    10389       
    104         assert( imC2.getModelPtr()!=imC1.getModelPtr() );
    105        
    106         lhs=imC2;
    107       }
     90        lhs = imC2;
     91      }
     92
    10893      // Test that lhs has correct values even though rhs has gone out of scope
    109      
    110       assert( lhs.getModelPtr() != m.getModelPtr() );
    111       assert( lhs.getNumCols() == m.getNumCols() );
    112       assert( lhs.getNumRows() == m.getNumRows() );     
    113     }
     94      OSIUNITTEST_ASSERT_ERROR(lhs.getModelPtr() != m.getModelPtr(), {}, "cbc", "assignment operator");
     95      OSIUNITTEST_ASSERT_ERROR(lhs.getNumCols()  == m.getNumCols(),  {}, "cbc", "copy constructor");
     96      OSIUNITTEST_ASSERT_ERROR(lhs.getNumRows()  == m.getNumRows(),  {}, "cbc", "copy constructor");
     97    }
     98
    11499    // Test clone
    115100    {
    116       OsiCbcSolverInterface oslSi(m);
    117       OsiSolverInterface * siPtr = &oslSi;
     101      OsiCbcSolverInterface cbcSi(m);
     102      OsiSolverInterface * siPtr = &cbcSi;
    118103      OsiSolverInterface * siClone = siPtr->clone();
    119       OsiCbcSolverInterface * oslClone = dynamic_cast<OsiCbcSolverInterface*>(siClone);
    120       assert( oslClone != NULL );
    121       assert( oslClone->getModelPtr() != oslSi.getModelPtr() );
    122       assert( oslClone->getNumRows() == oslSi.getNumRows() );
    123       assert( oslClone->getNumCols() == m.getNumCols() );
     104      OsiCbcSolverInterface * cbcClone = dynamic_cast<OsiCbcSolverInterface*>(siClone);
     105
     106      OSIUNITTEST_ASSERT_ERROR(cbcClone != NULL, {}, "cbc", "clone");
     107      OSIUNITTEST_ASSERT_ERROR(cbcClone->getModelPtr() != cbcSi.getModelPtr(), {}, "cbc", "clone");
     108      OSIUNITTEST_ASSERT_ERROR(cbcClone->getNumRows() == cbcSi.getNumRows(),   {}, "cbc", "clone");
     109      OSIUNITTEST_ASSERT_ERROR(cbcClone->getNumCols() == m.getNumCols(),       {}, "cbc", "clone");
    124110     
    125111      delete siClone;
     
    129115    {
    130116      OsiCbcSolverInterface si;
    131       assert( eq(si.getInfinity(),OsiCbcInfinity));
     117      OSIUNITTEST_ASSERT_ERROR(si.getInfinity() == OsiCbcInfinity, {}, "cbc", "infinity");
    132118    }     
    133119   
    134     // Test setting solution
     120    // Test some catches
     121    if (!OsiCbcHasNDEBUG())
    135122    {
    136       OsiCbcSolverInterface m1(m);
    137       int i;
    138 
    139       double * cs = new double[m1.getNumCols()];
    140       for ( i = 0;  i < m1.getNumCols();  i++ )
    141         cs[i] = i + .5;
    142       m1.setColSolution(cs);
    143       for ( i = 0;  i < m1.getNumCols();  i++ )
    144         assert(m1.getColSolution()[i] == i + .5);
    145      
    146       double * rs = new double[m1.getNumRows()];
    147       for ( i = 0;  i < m1.getNumRows();  i++ )
    148         rs[i] = i - .5;
    149       m1.setRowPrice(rs);
    150       for ( i = 0;  i < m1.getNumRows();  i++ )
    151         assert(m1.getRowPrice()[i] == i - .5);
    152 
    153       delete [] cs;
    154       delete [] rs;
    155     }
    156    
    157    
    158     // Test fraction Indices
    159     {
    160       OsiCbcSolverInterface fim;
    161       std::string fn = mpsDir+"exmip1";
    162       fim.readMps(fn.c_str(),"mps");
    163       // exmip1.mps has 2 integer variables with index 2 & 3
    164       assert(  fim.isContinuous(0) );
    165       assert(  fim.isContinuous(1) );
    166       assert( !fim.isContinuous(2) );
    167       assert( !fim.isContinuous(3) );
    168       assert(  fim.isContinuous(4) );
    169      
    170       assert( !fim.isInteger(0) );
    171       assert( !fim.isInteger(1) );
    172       assert(  fim.isInteger(2) );
    173       assert(  fim.isInteger(3) );
    174       assert( !fim.isInteger(4) );
    175      
    176       assert( !fim.isBinary(0) );
    177       assert( !fim.isBinary(1) );
    178       assert(  fim.isBinary(2) );
    179       assert(  fim.isBinary(3) );
    180       assert( !fim.isBinary(4) );
    181      
    182       assert( !fim.isIntegerNonBinary(0) );
    183       assert( !fim.isIntegerNonBinary(1) );
    184       assert( !fim.isIntegerNonBinary(2) );
    185       assert( !fim.isIntegerNonBinary(3) );
    186       assert( !fim.isIntegerNonBinary(4) );
    187 
    188     }
    189     // Test some catches
    190       if (!OsiCbcHasNDEBUG())
    191     { bool thrown ;
    192 
    193       thrown = false ;
    194123      OsiCbcSolverInterface solver;
    195124      try {
    196125        solver.setObjCoeff(0,0.0);
     126        OSIUNITTEST_ADD_OUTCOME("cbc", "setObjCoeff on empty model", "should throw exception", OsiUnitTest::TestOutcome::ERROR, false);
    197127      }
    198128      catch (CoinError e) {
    199         std::cout<<"Correct throw"<<std::endl;
    200         thrown = true ;
    201       }
    202       assert( thrown == true ) ;
     129        if (OsiUnitTest::verbosity >= 1)
     130          std::cout<<"Correct throw from setObjCoeff on empty model"<<std::endl;
     131      }
    203132
    204133      std::string fn = mpsDir+"exmip1";
    205134      solver.readMps(fn.c_str(),"mps");
    206       try {
    207         solver.setObjCoeff(0,0.0);
    208       }
    209       catch (CoinError e) {
    210         std::cout<<"** Incorrect throw"<<std::endl;
    211         abort();
    212       }
    213 
    214       thrown = false ;
     135      OSIUNITTEST_CATCH_ERROR(solver.setObjCoeff(0,0.0), {}, "cbc", "setObjCoeff on nonempty model");
     136
    215137      try {
    216138        int index[]={0,20};
    217139        double value[]={0.0,0.0,0.0,0.0};
    218140        solver.setColSetBounds(index,index+2,value);
     141        OSIUNITTEST_ADD_OUTCOME("cbc", "setColSetBounds on cols not in model", "should throw exception", OsiUnitTest::TestOutcome::ERROR, false);
    219142      }
    220143      catch (CoinError e) {
    221         std::cout<<"Correct throw"<<std::endl;
    222         thrown = true ;
    223       }
    224       assert( thrown == true ) ;
    225     }
    226     // Test apply cuts method
    227     {     
    228       OsiCbcSolverInterface im(m);
    229       OsiCuts cuts;
    230      
    231       // Generate some cuts
    232       {
    233         // Get number of rows and columns in model
    234         int nr=im.getNumRows();
    235         int nc=im.getNumCols();
    236         assert( nr == 5 );
    237         assert( nc == 8 );
    238        
    239         // Generate a valid row cut from thin air
    240         int c;
    241         {
    242           int *inx = new int[nc];
    243           for (c=0;c<nc;c++) inx[c]=c;
    244           double *el = new double[nc];
    245           for (c=0;c<nc;c++) el[c]=((double)c)*((double)c);
    246          
    247           OsiRowCut rc;
    248           rc.setRow(nc,inx,el);
    249           rc.setLb(-100.);
    250           rc.setUb(100.);
    251           rc.setEffectiveness(22);
    252          
    253           cuts.insert(rc);
    254           delete[]el;
    255           delete[]inx;
    256         }
    257        
    258         // Generate valid col cut from thin air
    259         {
    260           const double * oslColLB = im.getColLower();
    261           const double * oslColUB = im.getColUpper();
    262           int *inx = new int[nc];
    263           for (c=0;c<nc;c++) inx[c]=c;
    264           double *lb = new double[nc];
    265           double *ub = new double[nc];
    266           for (c=0;c<nc;c++) lb[c]=oslColLB[c]+0.001;
    267           for (c=0;c<nc;c++) ub[c]=oslColUB[c]-0.001;
    268          
    269           OsiColCut cc;
    270           cc.setLbs(nc,inx,lb);
    271           cc.setUbs(nc,inx,ub);
    272          
    273           cuts.insert(cc);
    274           delete [] ub;
    275           delete [] lb;
    276           delete [] inx;
    277         }
    278        
    279         {
    280           // Generate a row and column cut which are ineffective
    281           OsiRowCut * rcP= new OsiRowCut;
    282           rcP->setEffectiveness(-1.);
    283           cuts.insert(rcP);
    284           assert(rcP==NULL);
    285          
    286           OsiColCut * ccP= new OsiColCut;
    287           ccP->setEffectiveness(-12.);
    288           cuts.insert(ccP);
    289           assert(ccP==NULL);
    290         }
    291         {
    292           //Generate inconsistent Row cut
    293           OsiRowCut rc;
    294           const int ne=1;
    295           int inx[ne]={-10};
    296           double el[ne]={2.5};
    297           rc.setRow(ne,inx,el);
    298           rc.setLb(3.);
    299           rc.setUb(4.);
    300           assert(!rc.consistent());
    301           cuts.insert(rc);
    302         }
    303         {
    304           //Generate inconsistent col cut
    305           OsiColCut cc;
    306           const int ne=1;
    307           int inx[ne]={-10};
    308           double el[ne]={2.5};
    309           cc.setUbs(ne,inx,el);
    310           assert(!cc.consistent());
    311           cuts.insert(cc);
    312         }
    313         {
    314           // Generate row cut which is inconsistent for model m
    315           OsiRowCut rc;
    316           const int ne=1;
    317           int inx[ne]={10};
    318           double el[ne]={2.5};
    319           rc.setRow(ne,inx,el);
    320           assert(rc.consistent());
    321           assert(!rc.consistent(im));
    322           cuts.insert(rc);
    323         }
    324         {
    325           // Generate col cut which is inconsistent for model m
    326           OsiColCut cc;
    327           const int ne=1;
    328           int inx[ne]={30};
    329           double el[ne]={2.0};
    330           cc.setLbs(ne,inx,el);
    331           assert(cc.consistent());
    332           assert(!cc.consistent(im));
    333           cuts.insert(cc);
    334         }
    335         {
    336           // Generate col cut which is infeasible
    337           OsiColCut cc;
    338           const int ne=1;
    339           int inx[ne]={0};
    340           double el[ne]={2.0};
    341           cc.setUbs(ne,inx,el);
    342           cc.setEffectiveness(1000.);
    343           assert(cc.consistent());
    344           assert(cc.consistent(im));
    345           assert(cc.infeasible(im));
    346           cuts.insert(cc);
    347         }
    348       }
    349       assert(cuts.sizeRowCuts()==4);
    350       assert(cuts.sizeColCuts()==5);
    351      
    352       OsiSolverInterface::ApplyCutsReturnCode rc = im.applyCuts(cuts);
    353       assert( rc.getNumIneffective() == 2 );
    354       assert( rc.getNumApplied() == 2 );
    355       assert( rc.getNumInfeasible() == 1 );
    356       assert( rc.getNumInconsistentWrtIntegerModel() == 2 );
    357       assert( rc.getNumInconsistent() == 2 );
    358       assert( cuts.sizeCuts() == rc.getNumIneffective() +
    359         rc.getNumApplied() +
    360         rc.getNumInfeasible() +
    361         rc.getNumInconsistentWrtIntegerModel() +
    362         rc.getNumInconsistent() );
     144        if (OsiUnitTest::verbosity >= 1)
     145          std::cout<<"Correct throw from setObjCoeff on empty model"<<std::endl;
     146      }
    363147    }
    364148   
    365149    {   
    366       OsiCbcSolverInterface oslSi(m);
    367       int nc = oslSi.getNumCols();
    368       int nr = oslSi.getNumRows();
    369       const double * cl = oslSi.getColLower();
    370       const double * cu = oslSi.getColUpper();
    371       const double * rl = oslSi.getRowLower();
    372       const double * ru = oslSi.getRowUpper();
    373       assert( nc == 8 );
    374       assert( nr == 5 );
    375       assert( eq(cl[0],2.5) );
    376       assert( eq(cl[1],0.0) );
    377       assert( eq(cu[1],4.1) );
    378       assert( eq(cu[2],1.0) );
    379       assert( eq(rl[0],2.5) );
    380       assert( eq(rl[4],3.0) );
    381       assert( eq(ru[1],2.1) );
    382       assert( eq(ru[4],15.0) );
    383      
    384       const double * cs = oslSi.getColSolution();
    385       assert( eq(cs[0],2.5) );
    386       assert( eq(cs[7],0.0) );
    387      
    388       assert( !eq(cl[3],1.2345) );
    389       oslSi.setColLower( 3, 1.2345 );
    390       assert( eq(oslSi.getColLower()[3],1.2345) );
    391      
    392       assert( !eq(cu[4],10.2345) );
    393       oslSi.setColUpper( 4, 10.2345 );
    394       assert( eq(oslSi.getColUpper()[4],10.2345) );
    395       // LH: Objective will depend on how underlying solver constructs and
    396       // LH: maintains initial solution.
    397       double objValue = oslSi.getObjValue();
    398       assert( eq(objValue,3.5) || eq(objValue,10.5) );
    399 
    400       assert( eq( oslSi.getObjCoefficients()[0],  1.0) );
    401       assert( eq( oslSi.getObjCoefficients()[1],  0.0) );
    402       assert( eq( oslSi.getObjCoefficients()[2],  0.0) );
    403       assert( eq( oslSi.getObjCoefficients()[3],  0.0) );
    404       assert( eq( oslSi.getObjCoefficients()[4],  2.0) );
    405       assert( eq( oslSi.getObjCoefficients()[5],  0.0) );
    406       assert( eq( oslSi.getObjCoefficients()[6],  0.0) );
    407       assert( eq( oslSi.getObjCoefficients()[7], -1.0) );
     150      OsiCbcSolverInterface cbcSi(m);
     151      int nc = cbcSi.getNumCols();
     152      int nr = cbcSi.getNumRows();
     153      const double * cl = cbcSi.getColLower();
     154      const double * cu = cbcSi.getColUpper();
     155      const double * rl = cbcSi.getRowLower();
     156      const double * ru = cbcSi.getRowUpper();
     157      OSIUNITTEST_ASSERT_ERROR(nc == 8, return, "cbc", "read and copy exmip1");
     158      OSIUNITTEST_ASSERT_ERROR(nr == 5, return, "cbc", "read and copy exmip1");
     159      OSIUNITTEST_ASSERT_ERROR(eq(cl[0],2.5), {}, "cbc", "read and copy exmip1");
     160      OSIUNITTEST_ASSERT_ERROR(eq(cl[1],0.0), {}, "cbc", "read and copy exmip1");
     161      OSIUNITTEST_ASSERT_ERROR(eq(cu[1],4.1), {}, "cbc", "read and copy exmip1");
     162      OSIUNITTEST_ASSERT_ERROR(eq(cu[2],1.0), {}, "cbc", "read and copy exmip1");
     163      OSIUNITTEST_ASSERT_ERROR(eq(rl[0],2.5), {}, "cbc", "read and copy exmip1");
     164      OSIUNITTEST_ASSERT_ERROR(eq(rl[4],3.0), {}, "cbc", "read and copy exmip1");
     165      OSIUNITTEST_ASSERT_ERROR(eq(ru[1],2.1), {}, "cbc", "read and copy exmip1");
     166      OSIUNITTEST_ASSERT_ERROR(eq(ru[4],15.), {}, "cbc", "read and copy exmip1");
     167     
     168      const double * cs = cbcSi.getColSolution();
     169      OSIUNITTEST_ASSERT_ERROR(eq(cs[0],2.5), {}, "cbc", "read and copy exmip1");
     170      OSIUNITTEST_ASSERT_ERROR(eq(cs[7],0.0), {}, "cbc", "read and copy exmip1");
     171     
     172      OSIUNITTEST_ASSERT_ERROR(!eq(cl[3],1.2345), {}, "cbc", "set col lower");
     173      cbcSi.setColLower( 3, 1.2345 );
     174      OSIUNITTEST_ASSERT_ERROR( eq(cbcSi.getColLower()[3],1.2345), {}, "cbc", "set col lower");
     175     
     176      OSIUNITTEST_ASSERT_ERROR(!eq(cbcSi.getColUpper()[4],10.2345), {}, "cbc", "set col upper");
     177      cbcSi.setColUpper( 4, 10.2345 );
     178      OSIUNITTEST_ASSERT_ERROR( eq(cbcSi.getColUpper()[4],10.2345), {}, "cbc", "set col upper");
     179
     180      // LH: Objective will depend on how underlying solver constructs and maintains initial solution
     181      double objValue = cbcSi.getObjValue();
     182      OSIUNITTEST_ASSERT_ERROR(eq(objValue,3.5) || eq(objValue,10.5), {}, "cbc", "getObjValue() before solve");
     183
     184      OSIUNITTEST_ASSERT_ERROR(eq(cbcSi.getObjCoefficients()[0], 1.0), {}, "cbc", "read and copy exmip1");
     185      OSIUNITTEST_ASSERT_ERROR(eq(cbcSi.getObjCoefficients()[1], 0.0), {}, "cbc", "read and copy exmip1");
     186      OSIUNITTEST_ASSERT_ERROR(eq(cbcSi.getObjCoefficients()[2], 0.0), {}, "cbc", "read and copy exmip1");
     187      OSIUNITTEST_ASSERT_ERROR(eq(cbcSi.getObjCoefficients()[3], 0.0), {}, "cbc", "read and copy exmip1");
     188      OSIUNITTEST_ASSERT_ERROR(eq(cbcSi.getObjCoefficients()[4], 2.0), {}, "cbc", "read and copy exmip1");
     189      OSIUNITTEST_ASSERT_ERROR(eq(cbcSi.getObjCoefficients()[5], 0.0), {}, "cbc", "read and copy exmip1");
     190      OSIUNITTEST_ASSERT_ERROR(eq(cbcSi.getObjCoefficients()[6], 0.0), {}, "cbc", "read and copy exmip1");
     191      OSIUNITTEST_ASSERT_ERROR(eq(cbcSi.getObjCoefficients()[7],-1.0), {}, "cbc", "read and copy exmip1");
    408192    }
    409193   
     
    412196      const OsiCbcSolverInterface si(m);
    413197      const CoinPackedMatrix * smP = si.getMatrixByRow();
    414       // LL:      const OsiCbcPackedMatrix * osmP = dynamic_cast<const OsiCbcPackedMatrix*>(smP);
    415       // LL: assert( osmP!=NULL );
     198
     199      OSIUNITTEST_ASSERT_ERROR(smP->getMajorDim()    ==  5, return, "cbc", "getMatrixByRow: major dim");
     200      OSIUNITTEST_ASSERT_ERROR(smP->getMinorDim()    ==  8, return, "cbc", "getMatrixByRow: major dim");
     201      OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "cbc", "getMatrixByRow: num elements");
     202      OSIUNITTEST_ASSERT_ERROR(smP->getSizeVectorStarts() == 6, return, "cbc", "getMatrixByRow: num elements");
    416203
    417204#ifdef OSICBC_TEST_MTX_STRUCTURE
    418 
    419205      CoinRelFltEq eq;
    420206      const double * ev = smP->getElements();
    421       assert( eq(ev[0],   3.0) );
    422       assert( eq(ev[1],   1.0) );
    423       assert( eq(ev[2],  -2.0) );
    424       assert( eq(ev[3],  -1.0) );
    425       assert( eq(ev[4],  -1.0) );
    426       assert( eq(ev[5],   2.0) );
    427       assert( eq(ev[6],   1.1) );
    428       assert( eq(ev[7],   1.0) );
    429       assert( eq(ev[8],   1.0) );
    430       assert( eq(ev[9],   2.8) );
    431       assert( eq(ev[10], -1.2) );
    432       assert( eq(ev[11],  5.6) );
    433       assert( eq(ev[12],  1.0) );
    434       assert( eq(ev[13],  1.9) );
    435      
    436       const CoinBigIndex * mi = smP->getVectorStarts();
    437       assert( mi[0]==0 );
    438       assert( mi[1]==5 );
    439       assert( mi[2]==7 );
    440       assert( mi[3]==9 );
    441       assert( mi[4]==11 );
    442       assert( mi[5]==14 );
     207      OSIUNITTEST_ASSERT_ERROR(eq(ev[0],   3.0), {}, "cbc", "getMatrixByRow: elements");
     208      OSIUNITTEST_ASSERT_ERROR(eq(ev[1],   1.0), {}, "cbc", "getMatrixByRow: elements");
     209      OSIUNITTEST_ASSERT_ERROR(eq(ev[2],  -2.0), {}, "cbc", "getMatrixByRow: elements");
     210      OSIUNITTEST_ASSERT_ERROR(eq(ev[3],  -1.0), {}, "cbc", "getMatrixByRow: elements");
     211      OSIUNITTEST_ASSERT_ERROR(eq(ev[4],  -1.0), {}, "cbc", "getMatrixByRow: elements");
     212      OSIUNITTEST_ASSERT_ERROR(eq(ev[5],   2.0), {}, "cbc", "getMatrixByRow: elements");
     213      OSIUNITTEST_ASSERT_ERROR(eq(ev[6],   1.1), {}, "cbc", "getMatrixByRow: elements");
     214      OSIUNITTEST_ASSERT_ERROR(eq(ev[7],   1.0), {}, "cbc", "getMatrixByRow: elements");
     215      OSIUNITTEST_ASSERT_ERROR(eq(ev[8],   1.0), {}, "cbc", "getMatrixByRow: elements");
     216      OSIUNITTEST_ASSERT_ERROR(eq(ev[9],   2.8), {}, "cbc", "getMatrixByRow: elements");
     217      OSIUNITTEST_ASSERT_ERROR(eq(ev[10], -1.2), {}, "cbc", "getMatrixByRow: elements");
     218      OSIUNITTEST_ASSERT_ERROR(eq(ev[11],  5.6), {}, "cbc", "getMatrixByRow: elements");
     219      OSIUNITTEST_ASSERT_ERROR(eq(ev[12],  1.0), {}, "cbc", "getMatrixByRow: elements");
     220      OSIUNITTEST_ASSERT_ERROR(eq(ev[13],  1.9), {}, "cbc", "getMatrixByRow: elements");
     221     
     222      const int * mi = smP->getVectorStarts();
     223      OSIUNITTEST_ASSERT_ERROR(mi[0] ==  0, {}, "cbc", "getMatrixByRow: vector starts");
     224      OSIUNITTEST_ASSERT_ERROR(mi[1] ==  5, {}, "cbc", "getMatrixByRow: vector starts");
     225      OSIUNITTEST_ASSERT_ERROR(mi[2] ==  7, {}, "cbc", "getMatrixByRow: vector starts");
     226      OSIUNITTEST_ASSERT_ERROR(mi[3] ==  9, {}, "cbc", "getMatrixByRow: vector starts");
     227      OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "cbc", "getMatrixByRow: vector starts");
     228      OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "cbc", "getMatrixByRow: vector starts");
    443229     
    444230      const int * ei = smP->getIndices();
    445       assert( ei[0]  ==  0 );
    446       assert( ei[1]  ==  1 );
    447       assert( ei[2]  ==  3 );
    448       assert( ei[3]  ==  4 );
    449       assert( ei[4]  ==  7 );
    450       assert( ei[5]  ==  1 );
    451       assert( ei[6]  ==  2 );
    452       assert( ei[7]  ==  2 );
    453       assert( ei[8]  ==  5 );
    454       assert( ei[9]  ==  3 );
    455       assert( ei[10] ==  6 );
    456       assert( ei[11] ==  0 );
    457       assert( ei[12] ==  4 );
    458       assert( ei[13] ==  7 );   
    459 
     231      OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "cbc", "getMatrixByRow: indices");
     232      OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "cbc", "getMatrixByRow: indices");
     233      OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "cbc", "getMatrixByRow: indices");
     234      OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "cbc", "getMatrixByRow: indices");
     235      OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "cbc", "getMatrixByRow: indices");
     236      OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "cbc", "getMatrixByRow: indices");
     237      OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "cbc", "getMatrixByRow: indices");
     238      OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "cbc", "getMatrixByRow: indices");
     239      OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "cbc", "getMatrixByRow: indices");
     240      OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "cbc", "getMatrixByRow: indices");
     241      OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "cbc", "getMatrixByRow: indices");
     242      OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "cbc", "getMatrixByRow: indices");
     243      OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "cbc", "getMatrixByRow: indices");
     244      OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "cbc", "getMatrixByRow: indices");
    460245#else   // OSICBC_TEST_MTX_STRUCTURE
    461246
    462247      CoinPackedMatrix exmip1Mtx ;
    463248      exmip1Mtx.reverseOrderedCopyOf(BuildExmip1Mtx()) ;
    464       assert( exmip1Mtx.isEquivalent(*smP) ) ;
    465 
     249      OSIUNITTEST_ASSERT_ERROR(exmip1Mtx.isEquivalent(*smP), {}, "cbc", "getMatrixByRow") ;
    466250#endif  // OSICBC_TEST_MTX_STRUCTURE
    467 
    468       assert( smP->getMajorDim() == 5 );
    469       assert( smP->getMinorDim() == 8 );
    470       assert( smP->getNumElements() == 14 );
    471       assert( smP->getSizeVectorStarts() == 6 );
    472251    }
    473252
     
    514293      const double * cs = fim.getColSolution();
    515294      CoinRelFltEq eq;
    516       assert( eq(cs[2],   1.0) );
    517       assert( eq(cs[3],   1.0) );
     295      OSIUNITTEST_ASSERT_ERROR(eq(cs[2], 1.0), {}, "cbc", "add cuts");
     296      OSIUNITTEST_ASSERT_ERROR(eq(cs[3], 1.0), {}, "cbc", "add cuts");
    518297      // check will find invalid matrix
    519298      el[0]=1.0/el[4];
     
    526305      // resolve - should get message about zero elements
    527306      fim.resolve();
    528       assert (fim.isAbandoned());
     307      OSIUNITTEST_ASSERT_WARNING(fim.isAbandoned(), {}, "cbc", "add cuts");
    529308      delete[]el;
    530309      delete[]inx;
    531310    }
    532311
    533         // Test matrixByCol method
     312    // Test matrixByCol method
    534313    {
    535  
    536314      const OsiCbcSolverInterface si(m);
    537315      const CoinPackedMatrix * smP = si.getMatrixByCol();
    538       // LL:      const OsiCbcPackedMatrix * osmP = dynamic_cast<const OsiCbcPackedMatrix*>(smP);
    539       // LL: assert( osmP!=NULL );
    540      
     316
     317      OSIUNITTEST_ASSERT_ERROR(smP->getMajorDim()    ==  8, return, "cbc", "getMatrixByCol: major dim");
     318      OSIUNITTEST_ASSERT_ERROR(smP->getMinorDim()    ==  5, return, "cbc", "getMatrixByCol: minor dim");
     319      OSIUNITTEST_ASSERT_ERROR(smP->getNumElements() == 14, return, "cbc", "getMatrixByCol: number of elements");
     320      OSIUNITTEST_ASSERT_ERROR(smP->getSizeVectorStarts() == 9, return, "cbc", "getMatrixByCol: vector starts size");
     321
    541322#ifdef OSICBC_TEST_MTX_STRUCTURE
    542 
    543323      CoinRelFltEq eq;
    544324      const double * ev = smP->getElements();
    545       assert( eq(ev[0],   3.0) );
    546       assert( eq(ev[1],   5.6) );
    547       assert( eq(ev[2],   1.0) );
    548       assert( eq(ev[3],   2.0) );
    549       assert( eq(ev[4],   1.1) );
    550       assert( eq(ev[5],   1.0) );
    551       assert( eq(ev[6],  -2.0) );
    552       assert( eq(ev[7],   2.8) );
    553       assert( eq(ev[8],  -1.0) );
    554       assert( eq(ev[9],   1.0) );
    555       assert( eq(ev[10],  1.0) );
    556       assert( eq(ev[11], -1.2) );
    557       assert( eq(ev[12], -1.0) );
    558       assert( eq(ev[13],  1.9) );
     325      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "cbc", "getMatrixByCol: elements");
     326      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 5.6), {}, "cbc", "getMatrixByCol: elements");
     327      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2], 1.0), {}, "cbc", "getMatrixByCol: elements");
     328      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3], 2.0), {}, "cbc", "getMatrixByCol: elements");
     329      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4], 1.1), {}, "cbc", "getMatrixByCol: elements");
     330      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 1.0), {}, "cbc", "getMatrixByCol: elements");
     331      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6],-2.0), {}, "cbc", "getMatrixByCol: elements");
     332      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 2.8), {}, "cbc", "getMatrixByCol: elements");
     333      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8],-1.0), {}, "cbc", "getMatrixByCol: elements");
     334      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 1.0), {}, "cbc", "getMatrixByCol: elements");
     335      OSIUNITTEST_ASSERT_ERROR(eq(ev[10], 1.0), {}, "cbc", "getMatrixByCol: elements");
     336      OSIUNITTEST_ASSERT_ERROR(eq(ev[11],-1.2), {}, "cbc", "getMatrixByCol: elements");
     337      OSIUNITTEST_ASSERT_ERROR(eq(ev[12],-1.0), {}, "cbc", "getMatrixByCol: elements");
     338      OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "cbc", "getMatrixByCol: elements");
    559339     
    560340      const CoinBigIndex * mi = smP->getVectorStarts();
    561       assert( mi[0]==0 );
    562       assert( mi[1]==2 );
    563       assert( mi[2]==4 );
    564       assert( mi[3]==6 );
    565       assert( mi[4]==8 );
    566       assert( mi[5]==10 );
    567       assert( mi[6]==11 );
    568       assert( mi[7]==12 );
    569       assert( mi[8]==14 );
     341      OSIUNITTEST_ASSERT_ERROR(mi[0] ==  0, {}, "cbc", "getMatrixByCol: vector starts");
     342      OSIUNITTEST_ASSERT_ERROR(mi[1] ==  2, {}, "cbc", "getMatrixByCol: vector starts");
     343      OSIUNITTEST_ASSERT_ERROR(mi[2] ==  4, {}, "cbc", "getMatrixByCol: vector starts");
     344      OSIUNITTEST_ASSERT_ERROR(mi[3] ==  6, {}, "cbc", "getMatrixByCol: vector starts");
     345      OSIUNITTEST_ASSERT_ERROR(mi[4] ==  8, {}, "cbc", "getMatrixByCol: vector starts");
     346      OSIUNITTEST_ASSERT_ERROR(mi[5] == 10, {}, "cbc", "getMatrixByCol: vector starts");
     347      OSIUNITTEST_ASSERT_ERROR(mi[6] == 11, {}, "cbc", "getMatrixByCol: vector starts");
     348      OSIUNITTEST_ASSERT_ERROR(mi[7] == 12, {}, "cbc", "getMatrixByCol: vector starts");
     349      OSIUNITTEST_ASSERT_ERROR(mi[8] == 14, {}, "cbc", "getMatrixByCol: vector starts");
    570350     
    571351      const int * ei = smP->getIndices();
    572       assert( ei[0]  ==  0 );
    573       assert( ei[1]  ==  4 );
    574       assert( ei[2]  ==  0 );
    575       assert( ei[3]  ==  1 );
    576       assert( ei[4]  ==  1 );
    577       assert( ei[5]  ==  2 );
    578       assert( ei[6]  ==  0 );
    579       assert( ei[7]  ==  3 );
    580       assert( ei[8]  ==  0 );
    581       assert( ei[9]  ==  4 );
    582       assert( ei[10] ==  2 );
    583       assert( ei[11] ==  3 );
    584       assert( ei[12] ==  0 );
    585       assert( ei[13] ==  4 );   
    586      
     352      OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "cbc", "getMatrixByCol: indices");
     353      OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 4, {}, "cbc", "getMatrixByCol: indices");
     354      OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 0, {}, "cbc", "getMatrixByCol: indices");
     355      OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 1, {}, "cbc", "getMatrixByCol: indices");
     356      OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 1, {}, "cbc", "getMatrixByCol: indices");
     357      OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 2, {}, "cbc", "getMatrixByCol: indices");
     358      OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 0, {}, "cbc", "getMatrixByCol: indices");
     359      OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 3, {}, "cbc", "getMatrixByCol: indices");
     360      OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 0, {}, "cbc", "getMatrixByCol: indices");
     361      OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 4, {}, "cbc", "getMatrixByCol: indices");
     362      OSIUNITTEST_ASSERT_ERROR(ei[10] == 2, {}, "cbc", "getMatrixByCol: indices");
     363      OSIUNITTEST_ASSERT_ERROR(ei[11] == 3, {}, "cbc", "getMatrixByCol: indices");
     364      OSIUNITTEST_ASSERT_ERROR(ei[12] == 0, {}, "cbc", "getMatrixByCol: indices");
     365      OSIUNITTEST_ASSERT_ERROR(ei[13] == 4, {}, "cbc", "getMatrixByCol: indices");
    587366#else // OSICBC_TEST_MTX_STRUCTURE
    588367
    589368      CoinPackedMatrix &exmip1Mtx = BuildExmip1Mtx() ;
    590       assert( exmip1Mtx.isEquivalent(*smP) ) ;
    591 
     369      OSIUNITTEST_ASSERT_ERROR(exmip1Mtx.isEquivalent(*smP), {}, "cbc", "getMatrixByCol");
    592370#endif  // OSICBC_TEST_MTX_STRUCTURE     
    593 
    594       assert( smP->getMajorDim() == 8 );
    595       assert( smP->getMinorDim() == 5 );
    596       assert( smP->getNumElements() == 14 );
    597       assert( smP->getSizeVectorStarts() == 9 );
    598371    }
    599372
     
    602375    {
    603376      OsiCbcSolverInterface lhs;
    604       {     
    605 
    606         OsiCbcSolverInterface siC1(m);     
     377      {
     378        OsiCbcSolverInterface siC1(m);
     379
    607380        const char   * siC1rs  = siC1.getRowSense();
    608         assert( siC1rs[0]=='G' );
    609         assert( siC1rs[1]=='L' );
    610         assert( siC1rs[2]=='E' );
    611         assert( siC1rs[3]=='R' );
    612         assert( siC1rs[4]=='R' );
    613        
     381        OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "cbc", "row sense");
     382        OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "cbc", "row sense");
     383        OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "cbc", "row sense");
     384        OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "cbc", "row sense");
     385        OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "cbc", "row sense");
     386
    614387        const double * siC1rhs = siC1.getRightHandSide();
    615         assert( eq(siC1rhs[0],2.5) );
    616         assert( eq(siC1rhs[1],2.1) );
    617         assert( eq(siC1rhs[2],4.0) );
    618         assert( eq(siC1rhs[3],5.0) );
    619         assert( eq(siC1rhs[4],15.) );
    620        
     388        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "cbc", "right hand side");
     389        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "cbc", "right hand side");
     390        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "cbc", "right hand side");
     391        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "cbc", "right hand side");
     392        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "cbc", "right hand side");
     393
    621394        const double * siC1rr  = siC1.getRowRange();
    622         assert( eq(siC1rr[0],0.0) );
    623         assert( eq(siC1rr[1],0.0) );
    624         assert( eq(siC1rr[2],0.0) );
    625         assert( eq(siC1rr[3],5.0-1.8) );
    626         assert( eq(siC1rr[4],15.0-3.0) );
     395        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "cbc", "row range");
     396        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "cbc", "row range");
     397        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "cbc", "row range");
     398        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "cbc", "row range");
     399        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "cbc", "row range");
    627400       
    628401        const CoinPackedMatrix * siC1mbr = siC1.getMatrixByRow();
    629         assert( siC1mbr != NULL );
     402        OSIUNITTEST_ASSERT_ERROR(siC1mbr != NULL, {}, "cbc", "matrix by row");
     403        OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMajorDim()    ==  5, return, "cbc", "matrix by row: major dim");
     404        OSIUNITTEST_ASSERT_ERROR(siC1mbr->getMinorDim()    ==  8, return, "cbc", "matrix by row: major dim");
     405        OSIUNITTEST_ASSERT_ERROR(siC1mbr->getNumElements() == 14, return, "cbc", "matrix by row: num elements");
     406        OSIUNITTEST_ASSERT_ERROR(siC1mbr->getSizeVectorStarts() == 6, return, "cbc", "matrix by row: num elements");
    630407
    631408#ifdef OSICBC_TEST_MTX_STRUCTURE
    632 
    633409        const double * ev = siC1mbr->getElements();
    634         assert( eq(ev[0],   3.0) );
    635         assert( eq(ev[1],   1.0) );
    636         assert( eq(ev[2],  -2.0) );
    637         assert( eq(ev[3],  -1.0) );
    638         assert( eq(ev[4],  -1.0) );
    639         assert( eq(ev[5],   2.0) );
    640         assert( eq(ev[6],   1.1) );
    641         assert( eq(ev[7],   1.0) );
    642         assert( eq(ev[8],   1.0) );
    643         assert( eq(ev[9],   2.8) );
    644         assert( eq(ev[10], -1.2) );
    645         assert( eq(ev[11],  5.6) );
    646         assert( eq(ev[12],  1.0) );
    647         assert( eq(ev[13],  1.9) );
    648        
     410        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "cbc", "matrix by row: elements");
     411        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "cbc", "matrix by row: elements");
     412        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "cbc", "matrix by row: elements");
     413        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "cbc", "matrix by row: elements");
     414        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "cbc", "matrix by row: elements");
     415        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "cbc", "matrix by row: elements");
     416        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "cbc", "matrix by row: elements");
     417        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "cbc", "matrix by row: elements");
     418        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "cbc", "matrix by row: elements");
     419        OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "cbc", "matrix by row: elements");
     420        OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "cbc", "matrix by row: elements");
     421        OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "cbc", "matrix by row: elements");
     422        OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "cbc", "matrix by row: elements");
     423        OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "cbc", "matrix by row: elements");
     424
    649425        const CoinBigIndex * mi = siC1mbr->getVectorStarts();
    650         assert( mi[0]==0 );
    651         assert( mi[1]==5 );
    652         assert( mi[2]==7 );
    653         assert( mi[3]==9 );
    654         assert( mi[4]==11 );
    655         assert( mi[5]==14 );
    656        
     426        OSIUNITTEST_ASSERT_ERROR(mi[0] ==  0, {}, "cbc", "matrix by row: vector starts");
     427        OSIUNITTEST_ASSERT_ERROR(mi[1] ==  5, {}, "cbc", "matrix by row: vector starts");
     428        OSIUNITTEST_ASSERT_ERROR(mi[2] ==  7, {}, "cbc", "matrix by row: vector starts");
     429        OSIUNITTEST_ASSERT_ERROR(mi[3] ==  9, {}, "cbc", "matrix by row: vector starts");
     430        OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "cbc", "matrix by row: vector starts");
     431        OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "cbc", "matrix by row: vector starts");
     432
    657433        const int * ei = siC1mbr->getIndices();
    658         assert( ei[0]  ==  0 );
    659         assert( ei[1]  ==  1 );
    660         assert( ei[2]  ==  3 );
    661         assert( ei[3]  ==  4 );
    662         assert( ei[4]  ==  7 );
    663         assert( ei[5]  ==  1 );
    664         assert( ei[6]  ==  2 );
    665         assert( ei[7]  ==  2 );
    666         assert( ei[8]  ==  5 );
    667         assert( ei[9]  ==  3 );
    668         assert( ei[10] ==  6 );
    669         assert( ei[11] ==  0 );
    670         assert( ei[12] ==  4 );
    671         assert( ei[13] ==  7 );   
    672 
     434        OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "cbc", "matrix by row: indices");
     435        OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "cbc", "matrix by row: indices");
     436        OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "cbc", "matrix by row: indices");
     437        OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "cbc", "matrix by row: indices");
     438        OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "cbc", "matrix by row: indices");
     439        OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "cbc", "matrix by row: indices");
     440        OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "cbc", "matrix by row: indices");
     441        OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "cbc", "matrix by row: indices");
     442        OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "cbc", "matrix by row: indices");
     443        OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "cbc", "matrix by row: indices");
     444        OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "cbc", "matrix by row: indices");
     445        OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "cbc", "matrix by row: indices");
     446        OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "cbc", "matrix by row: indices");
     447        OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "cbc", "matrix by row: indices");
    673448#else   // OSICBC_TEST_MTX_STRUCTURE
    674449
    675         CoinPackedMatrix exmip1Mtx ;
    676         exmip1Mtx.reverseOrderedCopyOf(BuildExmip1Mtx()) ;
    677         assert( exmip1Mtx.isEquivalent(*siC1mbr) ) ;
    678 
     450        CoinPackedMatrix exmip1Mtx ;
     451        exmip1Mtx.reverseOrderedCopyOf(BuildExmip1Mtx()) ;
     452        OSIUNITTEST_ASSERT_ERROR(exmip1Mtx.isEquivalent(*siC1mbr), {}, "cbc", "matrix by row");
    679453#endif  // OSICBC_TEST_MTX_STRUCTURE
    680454
    681         assert( siC1mbr->getMajorDim() == 5 );
    682         assert( siC1mbr->getMinorDim() == 8 );
    683         assert( siC1mbr->getNumElements() == 14 );
    684         assert( siC1mbr->getSizeVectorStarts()==6 );
    685 
    686         assert( siC1rs  == siC1.getRowSense() );
    687         assert( siC1rhs == siC1.getRightHandSide() );
    688         assert( siC1rr  == siC1.getRowRange() );
    689 
    690         // Change OSL Model by adding free row
     455        OSIUNITTEST_ASSERT_WARNING(siC1rs  == siC1.getRowSense(), {}, "cbc", "row sense");
     456        OSIUNITTEST_ASSERT_WARNING(siC1rhs == siC1.getRightHandSide(), {}, "cbc", "right hand side");
     457        OSIUNITTEST_ASSERT_WARNING(siC1rr  == siC1.getRowRange(), {}, "cbc", "row range");
     458
     459        // Change CBC Model by adding free row
    691460        OsiRowCut rc;
    692         rc.setLb(-DBL_MAX);
    693         rc.setUb( DBL_MAX);
     461        rc.setLb(-COIN_DBL_MAX);
     462        rc.setUb( COIN_DBL_MAX);
    694463        OsiCuts cuts;
    695464        cuts.insert(rc);
    696465        siC1.applyCuts(cuts);
    697              
    698        
     466
    699467        siC1rs  = siC1.getRowSense();
    700         assert( siC1rs[0]=='G' );
    701         assert( siC1rs[1]=='L' );
    702         assert( siC1rs[2]=='E' );
    703         assert( siC1rs[3]=='R' );
    704         assert( siC1rs[4]=='R' );
    705         assert( siC1rs[5]=='N' );
     468        OSIUNITTEST_ASSERT_ERROR(siC1rs[0] == 'G', {}, "cbc", "row sense after adding row");
     469        OSIUNITTEST_ASSERT_ERROR(siC1rs[1] == 'L', {}, "cbc", "row sense after adding row");
     470        OSIUNITTEST_ASSERT_ERROR(siC1rs[2] == 'E', {}, "cbc", "row sense after adding row");
     471        OSIUNITTEST_ASSERT_ERROR(siC1rs[3] == 'R', {}, "cbc", "row sense after adding row");
     472        OSIUNITTEST_ASSERT_ERROR(siC1rs[4] == 'R', {}, "cbc", "row sense after adding row");
     473        OSIUNITTEST_ASSERT_ERROR(siC1rs[5] == 'N', {}, "cbc", "row sense after adding row");
    706474
    707475        siC1rhs = siC1.getRightHandSide();
    708         assert( eq(siC1rhs[0],2.5) );
    709         assert( eq(siC1rhs[1],2.1) );
    710         assert( eq(siC1rhs[2],4.0) );
    711         assert( eq(siC1rhs[3],5.0) );
    712         assert( eq(siC1rhs[4],15.) );
    713         assert( eq(siC1rhs[5],0.0 ) );
     476        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[0],2.5), {}, "cbc", "right hand side after adding row");
     477        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[1],2.1), {}, "cbc", "right hand side after adding row");
     478        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[2],4.0), {}, "cbc", "right hand side after adding row");
     479        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[3],5.0), {}, "cbc", "right hand side after adding row");
     480        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[4],15.), {}, "cbc", "right hand side after adding row");
     481        OSIUNITTEST_ASSERT_ERROR(eq(siC1rhs[5],0.0), {}, "cbc", "right hand side after adding row");
    714482
    715483        siC1rr  = siC1.getRowRange();
    716         assert( eq(siC1rr[0],0.0) );
    717         assert( eq(siC1rr[1],0.0) );
    718         assert( eq(siC1rr[2],0.0) );
    719         assert( eq(siC1rr[3],5.0-1.8) );
    720         assert( eq(siC1rr[4],15.0-3.0) );
    721         assert( eq(siC1rr[5],0.0) );
    722    
    723         lhs=siC1;
    724       }
     484        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[0],0.0), {}, "cbc", "row range after adding row");
     485        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[1],0.0), {}, "cbc", "row range after adding row");
     486        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[2],0.0), {}, "cbc", "row range after adding row");
     487        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[3],5.0-1.8), {}, "cbc", "row range after adding row");
     488        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[4],15.0-3.0), {}, "cbc", "row range after adding row");
     489        OSIUNITTEST_ASSERT_ERROR(eq(siC1rr[5],0.0), {}, "cbc", "row range after adding row");
     490
     491        lhs = siC1;
     492      }
     493
    725494      // Test that lhs has correct values even though siC1 has gone out of scope   
    726      
    727495      const char * lhsrs  = lhs.getRowSense();
    728       assert( lhsrs[0]=='G' );
    729       assert( lhsrs[1]=='L' );
    730       assert( lhsrs[2]=='E' );
    731       assert( lhsrs[3]=='R' );
    732       assert( lhsrs[4]=='R' );
    733       assert( lhsrs[5]=='N' );
     496      OSIUNITTEST_ASSERT_ERROR(lhsrs[0] == 'G', {}, "cbc", "row sense after assignment");
     497      OSIUNITTEST_ASSERT_ERROR(lhsrs[1] == 'L', {}, "cbc", "row sense after assignment");
     498      OSIUNITTEST_ASSERT_ERROR(lhsrs[2] == 'E', {}, "cbc", "row sense after assignment");
     499      OSIUNITTEST_ASSERT_ERROR(lhsrs[3] == 'R', {}, "cbc", "row sense after assignment");
     500      OSIUNITTEST_ASSERT_ERROR(lhsrs[4] == 'R', {}, "cbc", "row sense after assignment");
     501      OSIUNITTEST_ASSERT_ERROR(lhsrs[5] == 'N', {}, "cbc", "row sense after assignment");
    734502     
    735503      const double * lhsrhs = lhs.getRightHandSide();
    736       assert( eq(lhsrhs[0],2.5) );
    737       assert( eq(lhsrhs[1],2.1) );
    738       assert( eq(lhsrhs[2],4.0) );
    739       assert( eq(lhsrhs[3],5.0) );
    740       assert( eq(lhsrhs[4],15.) );
    741       assert( eq(lhsrhs[5],0.0) );
    742      
    743       const double *lhsrr  = lhs.getRowRange();
    744       assert( eq(lhsrr[0],0.0) );
    745       assert( eq(lhsrr[1],0.0) );
    746       assert( eq(lhsrr[2],0.0) );
    747       assert( eq(lhsrr[3],5.0-1.8) );
    748       assert( eq(lhsrr[4],15.0-3.0) );
    749       assert( eq(lhsrr[5],0.0) );     
     504      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[0],2.5), {}, "cbc", "right hand side after assignment");
     505      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[1],2.1), {}, "cbc", "right hand side after assignment");
     506      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[2],4.0), {}, "cbc", "right hand side after assignment");
     507      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[3],5.0), {}, "cbc", "right hand side after assignment");
     508      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[4],15.), {}, "cbc", "right hand side after assignment");
     509      OSIUNITTEST_ASSERT_ERROR(eq(lhsrhs[5],0.0), {}, "cbc", "right hand side after assignment");
     510     
     511      const double *lhsrr = lhs.getRowRange();
     512      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[0],0.0), {}, "cbc", "row range after assignment");
     513      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[1],0.0), {}, "cbc", "row range after assignment");
     514      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[2],0.0), {}, "cbc", "row range after assignment");
     515      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[3],5.0-1.8), {}, "cbc", "row range after assignment");
     516      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[4],15.0-3.0), {}, "cbc", "row range after assignment");
     517      OSIUNITTEST_ASSERT_ERROR(eq(lhsrr[5],0.0), {}, "cbc", "row range after assignment");
    750518     
    751519      const CoinPackedMatrix * lhsmbr = lhs.getMatrixByRow();
    752       assert( lhsmbr != NULL );       
     520      OSIUNITTEST_ASSERT_ERROR(lhsmbr != NULL, {}, "cbc", "matrix by row after assignment");
     521      OSIUNITTEST_ASSERT_ERROR(lhsmbr->getMajorDim()    ==  6, return, "cbc", "matrix by row after assignment: major dim");
     522      OSIUNITTEST_ASSERT_ERROR(lhsmbr->getNumElements() == 14, return, "cbc", "matrix by row after assignment: num elements");
     523
    753524
    754525#ifdef OSICBC_TEST_MTX_STRUCTURE
    755 
    756526      const double * ev = lhsmbr->getElements();
    757       assert( eq(ev[0],   3.0) );
    758       assert( eq(ev[1],   1.0) );
    759       assert( eq(ev[2],  -2.0) );
    760       assert( eq(ev[3],  -1.0) );
    761       assert( eq(ev[4],  -1.0) );
    762       assert( eq(ev[5],   2.0) );
    763       assert( eq(ev[6],   1.1) );
    764       assert( eq(ev[7],   1.0) );
    765       assert( eq(ev[8],   1.0) );
    766       assert( eq(ev[9],   2.8) );
    767       assert( eq(ev[10], -1.2) );
    768       assert( eq(ev[11],  5.6) );
    769       assert( eq(ev[12],  1.0) );
    770       assert( eq(ev[13],  1.9) );
     527      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 0], 3.0), {}, "cbc", "matrix by row after assignment: elements");
     528      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 1], 1.0), {}, "cbc", "matrix by row after assignment: elements");
     529      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 2],-2.0), {}, "cbc", "matrix by row after assignment: elements");
     530      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 3],-1.0), {}, "cbc", "matrix by row after assignment: elements");
     531      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 4],-1.0), {}, "cbc", "matrix by row after assignment: elements");
     532      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 5], 2.0), {}, "cbc", "matrix by row after assignment: elements");
     533      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 6], 1.1), {}, "cbc", "matrix by row after assignment: elements");
     534      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 7], 1.0), {}, "cbc", "matrix by row after assignment: elements");
     535      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 8], 1.0), {}, "cbc", "matrix by row after assignment: elements");
     536      OSIUNITTEST_ASSERT_ERROR(eq(ev[ 9], 2.8), {}, "cbc", "matrix by row after assignment: elements");
     537      OSIUNITTEST_ASSERT_ERROR(eq(ev[10],-1.2), {}, "cbc", "matrix by row after assignment: elements");
     538      OSIUNITTEST_ASSERT_ERROR(eq(ev[11], 5.6), {}, "cbc", "matrix by row after assignment: elements");
     539      OSIUNITTEST_ASSERT_ERROR(eq(ev[12], 1.0), {}, "cbc", "matrix by row after assignment: elements");
     540      OSIUNITTEST_ASSERT_ERROR(eq(ev[13], 1.9), {}, "cbc", "matrix by row after assignment: elements");
    771541     
    772542      const CoinBigIndex * mi = lhsmbr->getVectorStarts();
    773       assert( mi[0]==0 );
    774       assert( mi[1]==5 );
    775       assert( mi[2]==7 );
    776       assert( mi[3]==9 );
    777       assert( mi[4]==11 );
    778       assert( mi[5]==14 );
     543      OSIUNITTEST_ASSERT_ERROR(mi[0] ==  0, {}, "cbc", "matrix by row after assignment: vector starts");
     544      OSIUNITTEST_ASSERT_ERROR(mi[1] ==  5, {}, "cbc", "matrix by row after assignment: vector starts");
     545      OSIUNITTEST_ASSERT_ERROR(mi[2] ==  7, {}, "cbc", "matrix by row after assignment: vector starts");
     546      OSIUNITTEST_ASSERT_ERROR(mi[3] ==  9, {}, "cbc", "matrix by row after assignment: vector starts");
     547      OSIUNITTEST_ASSERT_ERROR(mi[4] == 11, {}, "cbc", "matrix by row after assignment: vector starts");
     548      OSIUNITTEST_ASSERT_ERROR(mi[5] == 14, {}, "cbc", "matrix by row after assignment: vector starts");
    779549     
    780550      const int * ei = lhsmbr->getIndices();
    781       assert( ei[0]  ==  0 );
    782       assert( ei[1]  ==  1 );
    783       assert( ei[2]  ==  3 );
    784       assert( ei[3]  ==  4 );
    785       assert( ei[4]  ==  7 );
    786       assert( ei[5]  ==  1 );
    787       assert( ei[6]  ==  2 );
    788       assert( ei[7]  ==  2 );
    789       assert( ei[8]  ==  5 );
    790       assert( ei[9]  ==  3 );
    791       assert( ei[10] ==  6 );
    792       assert( ei[11] ==  0 );
    793       assert( ei[12] ==  4 );
    794       assert( ei[13] ==  7 );   
    795 
     551      OSIUNITTEST_ASSERT_ERROR(ei[ 0] == 0, {}, "cbc", "matrix by row after assignment: indices");
     552      OSIUNITTEST_ASSERT_ERROR(ei[ 1] == 1, {}, "cbc", "matrix by row after assignment: indices");
     553      OSIUNITTEST_ASSERT_ERROR(ei[ 2] == 3, {}, "cbc", "matrix by row after assignment: indices");
     554      OSIUNITTEST_ASSERT_ERROR(ei[ 3] == 4, {}, "cbc", "matrix by row after assignment: indices");
     555      OSIUNITTEST_ASSERT_ERROR(ei[ 4] == 7, {}, "cbc", "matrix by row after assignment: indices");
     556      OSIUNITTEST_ASSERT_ERROR(ei[ 5] == 1, {}, "cbc", "matrix by row after assignment: indices");
     557      OSIUNITTEST_ASSERT_ERROR(ei[ 6] == 2, {}, "cbc", "matrix by row after assignment: indices");
     558      OSIUNITTEST_ASSERT_ERROR(ei[ 7] == 2, {}, "cbc", "matrix by row after assignment: indices");
     559      OSIUNITTEST_ASSERT_ERROR(ei[ 8] == 5, {}, "cbc", "matrix by row after assignment: indices");
     560      OSIUNITTEST_ASSERT_ERROR(ei[ 9] == 3, {}, "cbc", "matrix by row after assignment: indices");
     561      OSIUNITTEST_ASSERT_ERROR(ei[10] == 6, {}, "cbc", "matrix by row after assignment: indices");
     562      OSIUNITTEST_ASSERT_ERROR(ei[11] == 0, {}, "cbc", "matrix by row after assignment: indices");
     563      OSIUNITTEST_ASSERT_ERROR(ei[12] == 4, {}, "cbc", "matrix by row after assignment: indices");
     564      OSIUNITTEST_ASSERT_ERROR(ei[13] == 7, {}, "cbc", "matrix by row after assignment: indices");
    796565#else   // OSICBC_TEST_MTX_STRUCTURE
    797566
     
    805574      CoinPackedVector freeRow ;
    806575      exmip1Mtx.appendRow(freeRow) ;
    807       assert( exmip1Mtx.isEquivalent(*lhsmbr) ) ;
    808 
     576      OSIUNITTEST_ASSERT_ERROR(exmip1Mtx.isEquivalent(*lhsmbr), {}, "cbc", "matrix by row after assignment");
    809577#endif  // OSICBC_TEST_MTX_STRUCTURE
    810      
    811       int md = lhsmbr->getMajorDim();
    812       assert(  md == 6 );
    813       assert( lhsmbr->getNumElements() == 14 );
    814     }
    815    
     578    }
    816579  }
    817580
     
    830593    double objValue = m.getObjValue();
    831594    CoinRelFltEq eq(1.0e-2);
    832     assert( eq(objValue,2520.57) );
     595    OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "cbc", "objvalue after adding col");
     596
    833597    // Try deleting first column that's nonbasic at lower bound (0).
    834598    int * d = new int[1];
    835     CoinWarmStartBasis *cwsb =
    836         dynamic_cast<CoinWarmStartBasis *>(m.getWarmStart()) ;
    837     assert(cwsb) ;
     599    CoinWarmStartBasis *cwsb = dynamic_cast<CoinWarmStartBasis *>(m.getWarmStart()) ;
     600    OSIUNITTEST_ASSERT_ERROR(cwsb != NULL, {}, "cbc", "get warmstart basis");
    838601    CoinWarmStartBasis::Status stati ;
    839602    int iCol ;
     
    848611    m.resolve();
    849612    objValue = m.getObjValue();
    850     assert( eq(objValue,2520.57) );
     613    OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "clp", "objvalue after deleting first col");
     614
    851615    // Try deleting column we added. If basic, go to initialSolve as deleting
    852616    // basic variable trashes basis required for warm start.
     
    861625    { m.resolve(); }
    862626    objValue = m.getObjValue();
    863     assert( eq(objValue,2520.57) );
    864 
    865   }
    866   // Test matt
    867   if (fopen("../Cbc/matt.mps","r")) {   
    868     OsiCbcSolverInterface m;
    869     m.readMps("../Cbc/matt","mps");
    870     m.setHintParam(OsiDoPresolveInResolve, true, OsiHintDo);
    871     m.resolve();
    872    
    873     std::vector<double *> rays = m.getDualRays(1);
    874     std::cout << "Dual Ray: " << std::endl;
    875     for(int i = 0; i < m.getNumRows(); i++){
    876       if(fabs(rays[0][i]) > 0.00001)
    877         std::cout << i << " : " << rays[0][i] << std::endl;
    878     }
    879    
    880     std::cout << "isProvenOptimal = " << m.isProvenOptimal() << std::endl;
    881     std::cout << "isProvenPrimalInfeasible = " << m.isProvenPrimalInfeasible()
    882          << std::endl;
    883    
    884     delete [] rays[0];
    885    
     627    OSIUNITTEST_ASSERT_ERROR(eq(objValue,2520.57), {}, "clp", "objvalue after deleting added col");
    886628  }
    887629
     
    997739    if (numberColumns<50)
    998740      build.setLogLevel(1);
    999     int numberErrors=model2.loadFromCoinModel(build);
    1000741    // should fail as we never set multiplier
    1001     assert (numberErrors);
     742    OSIUNITTEST_ASSERT_ERROR(model2.loadFromCoinModel(build) != 0, {}, "cbc", "build model with missing multipliers");
    1002743    build.associateElement("multiplier",0.0);
    1003     numberErrors=model2.loadFromCoinModel(build);
    1004     assert (!numberErrors);
     744    OSIUNITTEST_ASSERT_ERROR(model2.loadFromCoinModel(build) == 0, {}, "cbc", "build model");
    1005745    model2.initialSolve();
    1006746    // It then loops with multiplier going from 0.0 to 2.0 in increments of 0.1
    1007747    for (double multiplier=0.0;multiplier<2.0;multiplier+= 0.1) {
    1008748      build.associateElement("multiplier",multiplier);
    1009       numberErrors=model2.loadFromCoinModel(build,true);
    1010       assert (!numberErrors);
     749      OSIUNITTEST_ASSERT_ERROR(model2.loadFromCoinModel(build,true) == 0, {}, "cbc", "build model with increasing multiplier");
    1011750      model2.resolve();
    1012751    }
    1013752  }
     753
    1014754  // branch and bound
    1015755  {   
     
    1022762    m.branchAndBound();
    1023763  }
     764
    1024765  // branch and bound using CbcModel!!!!!!!
    1025766  {   
     
    1031772    m.branchAndBound();
    1032773  }
    1033 #ifdef COIN_HAS_OSL
    1034   // branch and bound using OSL
    1035   {   
    1036     OsiOslSolverInterface mmm;
    1037     OsiCbcSolverInterface mm(&mmm);
    1038     CbcStrategyNull strategy;
    1039     OsiCbcSolverInterface m(&mm,&strategy);
    1040     std::string fn = mpsDir+"p0033";
    1041     m.readMps(fn.c_str(),"mps");
    1042     //m.initialSolve();
    1043     m.branchAndBound();
    1044   }
    1045 #endif
    1046   int errCnt = 0;
     774
    1047775  // Do common solverInterface testing
    1048776  {
    1049777    OsiCbcSolverInterface m;
    1050     errCnt += OsiSolverInterfaceCommonUnitTest(&m, mpsDir,netlibDir);
     778    OsiSolverInterfaceCommonUnitTest(&m, mpsDir,netlibDir);
    1051779  }
    1052780  {
    1053781    OsiCbcSolverInterface mm;
    1054782    OsiCbcSolverInterface m(&mm);
    1055     errCnt += OsiSolverInterfaceCommonUnitTest(&m, mpsDir,netlibDir);
     783    OsiSolverInterfaceCommonUnitTest(&m, mpsDir,netlibDir);
    1056784  }
    1057 #ifdef COIN_HAS_OSL
    1058   {
    1059     OsiOslSolverInterface mm;
    1060     OsiCbcSolverInterface m(&mm);
    1061     errCnt += OsiSolverInterfaceCommonUnitTest(&m, mpsDir,netlibDir);
    1062   }
    1063 #endif
    1064   return errCnt;
    1065785}
  • stable/2.7/Cbc/test/osiUnitTest.cpp

    r1574 r1675  
    1 // $Id$
    21// Copyright (C) 2000, International Business Machines
    32// Corporation and others.  All Rights Reserved.
    43// This code is licensed under the terms of the Eclipse Public License (EPL).
     4// $Id$
    55
    66#include "CoinPragma.hpp"
    77
    8 #include "OsiConfig.h"
    9 
    10 #ifdef NDEBUG
    11 #undef NDEBUG
    12 #endif
    13 
    14 #include <cassert>
    15 #include <cstdio>
    168#include <iostream>
    17 #include <map>
    189
    1910#include "OsiUnitTests.hpp"
    20 
    21 #include "CoinError.hpp"
    22 
    2311#include "OsiCbcSolverInterface.hpp"
    2412
    25 namespace {
    26 
    27 // Display message on stdout and stderr. Flush cout buffer before printing the
    28 // message, so that output comes out in order in spite of buffered cout.
    29 
    30 void testingMessage( const char * const msg )
    31 {
    32   std::cout.flush() ;
    33   std::cerr <<msg;
    34   //cout <<endl <<"*****************************************"
    35   //     <<endl <<msg <<endl;
    36 }
    37 
    38 
    39 /*
    40   Utility routine to process command line parameters. An unrecognised parameter
    41   will trigger the help message and a return value of false.
    42  
    43   This should be replaced with the one of the standard CoinUtils parameter
    44   mechanisms.
    45 */
    46 bool processParameters (int argc, const char **argv,
    47                         std::map<std::string,std::string> &parms)
    48 
    49 {
    50   assert(argc >= 1);
    51   assert(argv != NULL);
    52 /*
    53   Initialise the parameter keywords.
    54 */
    55   std::set<std::string> definedKeyWords;
    56   definedKeyWords.insert("-cerr2cout");
    57   definedKeyWords.insert("-mpsDir");
    58   definedKeyWords.insert("-netlibDir");
    59   definedKeyWords.insert("-testOsiSolverInterface");
    60   definedKeyWords.insert("-nobuf");
    61 /*
    62   Set default values for data directories.
    63 */
    64   std::string dirsep(1,CoinFindDirSeparator()) ;
    65   std::string upOne = ".."+dirsep ;
    66   std::string pathTmp ;
    67 /*
    68   Establish likely defaults for the Sample and Miplib directories.
    69 */
    70 # ifdef SAMPLEDIR
    71     pathTmp = SAMPLEDIR ;
    72 # else
    73     pathTmp = upOne+upOne+"Data"+dirsep+"Sample" ;
    74 # endif
    75   parms["-mpsDir"] = pathTmp  ;
    76 # ifdef NETLIBDIR
    77     pathTmp = NETLIBDIR ;
    78 # else
    79     pathTmp = upOne+upOne+"Data"+dirsep+"Netlib" ;
    80 # endif
    81   parms["-netlibDir"] = pathTmp ;
    82 /*
    83   Read the command line parameters and fill a map of parameter keys and
    84   associated data. The parser allows for parameters which are only a keyword,
    85   or parameters of the form keyword=value (no spaces).
    86 */
    87   for (int i = 1 ; i < argc ; i++)
    88   { std::string parm(argv[i]) ;
    89     std::string key,value ;
    90     std::string::size_type eqPos = parm.find('=');
    91 
    92     if (eqPos == std::string::npos)
    93     { key = parm ; }
    94     else
    95     { key = parm.substr(0,eqPos) ;
    96       value = parm.substr(eqPos+1) ; }
    97 /*
    98   Is the specifed key valid?
    99 */
    100     if (definedKeyWords.find(key) == definedKeyWords.end())
    101     { std::cerr << "Undefined parameter \"" << key << "\"." << std::endl ;
    102       std::cerr
    103         << "Usage: " << argv[0]
    104         << " [-nobuf] [-mpsDir=V1] [-netlibDir=V2] "
    105         << "[-testOsiSolverInterface] " << std::endl ;
    106       std::cerr << "  where:" << std::endl ;
    107       std::cerr
    108         << "    "
    109         << "-cerr2cout: redirect cerr to cout; sometimes useful." << std::endl
    110         << "\t" << "to synchronise cout & cerr." << std::endl ;
    111       std::cerr
    112         << "    "
    113         << "-mpsDir: directory containing mps test files." << std::endl
    114         << "\t" << "Default value V1=\"../../Data/Sample\"" << std::endl ;
    115       std::cerr
    116         << "    "
    117         << "-netlibDir: directory containing netlib files." << std::endl
    118         << "\t" << "Default value V2=\"../../Data/Netlib\"" << std::endl ;
    119       std::cerr
    120         << "    "
    121         << "-testOsiSolverInterface: "
    122         << "run each OSI on the netlib problem set." << std::endl
    123         << "\t"
    124         << "Default is to not run the netlib problem set." << std::endl ;
    125       std::cerr
    126         << "    "
    127         << "-nobuf: use unbuffered output." << std::endl
    128         << "\t" << "Default is buffered output." << std::endl ;
    129      
    130       return (false) ; }
    131 /*
    132   Valid keyword; stash the value for later reference.
    133 */
    134     parms[key]=value ; }
    135 /*
    136   Tack the directory separator onto the data directories so we don't have to
    137   worry about it later.
    138 */
    139   parms["-mpsDir"] += dirsep ;
    140   parms["-netlibDir"] += dirsep ;
    141 /*
    142   Did the user request unbuffered i/o? It seems we need to go after this
    143   through stdio --- using pubsetbuf(0,0) on the C++ streams has no
    144   discernible affect. Nor, for that matter, did setting the unitbuf flag on
    145   the streams. Why? At a guess, sync_with_stdio connects the streams to the
    146   stdio buffers, and the C++ side isn't programmed to change them?
    147 */
    148   if (parms.find("-nobuf") != parms.end())
    149   { // std::streambuf *coutBuf, *cerrBuf ;
    150     // coutBuf = std::cout.rdbuf() ;
    151     // coutBuf->pubsetbuf(0,0) ;
    152     // cerrBuf = std::cerr.rdbuf() ;
    153     // cerrBuf->pubsetbuf(0,0) ;
    154     setbuf(stderr,0) ;
    155     setbuf(stdout,0) ; }
    156 /*
    157   Did the user request a redirect for cerr? This must occur before any i/o is
    158   performed.
    159 */
    160   if (parms.find("-cerr2cout") != parms.end())
    161   { std::cerr.rdbuf(std::cout.rdbuf()) ; }
    162 
    163   return (true) ; }
    164 
    165 
    166 }       // end file-local namespace
    167 
    168 
     13using namespace OsiUnitTest;
    16914
    17015//----------------------------------------------------------------
    171 // unitTest [-nobuf] [-mpsDir=V1] [-netlibDir=V2] [-testOsiSolverInterface]
    172 //
    173 // where:
    174 //   -nobuf: remove buffering on cout (stdout); useful to keep cout and cerr
    175 //       messages synchronised when redirecting output to a file or pipe.
    176 //   -mpsDir: directory containing mps test files
    177 //       Default value V1="../../Data/Sample"   
    178 //   -netlibDir: directory containing netlib files
    179 //       Default value V2="../../Data/Netlib"
    180 //   -testOsiSolverInterface
    181 //       If specified, then OsiSolveInterface::unitTest
    182 //       is skipped over and not run.
    183 //
    184 // All parameters are optional.
     16// to see parameter list, call unitTest -usage
    18517//----------------------------------------------------------------
    18618
    18719int main (int argc, const char *argv[])
    188 
    189 { int totalErrCnt = 0;
    190 
     20{
    19121/*
    19222  Start off with various bits of initialisation that don't really belong
    19323  anywhere else.
    19424
    195   First off, synchronise C++ stream i/o with C stdio. This makes debugging
     25  Synchronise C++ stream i/o with C stdio. This makes debugging
    19626  output a bit more comprehensible. It still suffers from interleave of cout
    19727  (stdout) and cerr (stderr), but -nobuf deals with that.
    198 */
     28 */
    19929  std::ios::sync_with_stdio() ;
    20030/*
    20131  Suppress an popup window that Windows shows in response to a crash. See
    20232  note at head of file.
    203 */
     33 */
    20434  WindowsErrorPopupBlocker();
     35
    20536/*
    20637  Process command line parameters.
    207 */
    208   std::map<std::string,std::string> parms ;
    209 
     38 */
     39  std::map<std::string,std::string> parms;
    21040  if (processParameters(argc,argv,parms) == false)
    211   { return (1) ; }
     41    return 1;
    21242
    21343  std::string mpsDir = parms["-mpsDir"] ;
    21444  std::string netlibDir = parms["-netlibDir"] ;
    21545
    216 try {
    217 /*
    218   Test Osi{Row,Col}Cut routines.
    219 */
     46  /*
     47    Test Osi{Row,Col}Cut routines.
     48   */
    22049  {
    22150    OsiCbcSolverInterface cbcSi;
    22251    testingMessage( "Testing OsiRowCut with OsiCbcSolverInterface\n" );
    223     OsiRowCutUnitTest(&cbcSi,mpsDir);
     52    OSIUNITTEST_CATCH_ERROR(OsiRowCutUnitTest(&cbcSi,mpsDir), {}, cbcSi, "rowcut unittest");
    22453  }
    22554  {
    22655    OsiCbcSolverInterface cbcSi;
    22756    testingMessage( "Testing OsiColCut with OsiCbcSolverInterface\n" );
    228     OsiColCutUnitTest(&cbcSi,mpsDir);
     57    OSIUNITTEST_CATCH_ERROR(OsiColCutUnitTest(&cbcSi,mpsDir), {}, cbcSi, "colcut unittest");
    22958  }
    23059  {
    23160    OsiCbcSolverInterface cbcSi;
    23261    testingMessage( "Testing OsiRowCutDebugger with OsiCbcSolverInterface\n" );
    233     OsiRowCutDebuggerUnitTest(&cbcSi,mpsDir);
     62    OSIUNITTEST_CATCH_ERROR(OsiRowCutDebuggerUnitTest(&cbcSi,mpsDir), {}, cbcSi, "rowcut debugger unittest");
    23463  }
    23564
    236 /*
    237   Run the OsiXXX class test. It's up to the OsiCbc implementor
    238   to decide whether or not to run OsiSolverInterfaceCommonUnitTest. Arguably
    239   this should be required.
    240 */
     65  /*
     66    Run the OsiCbc class test. This will also call OsiSolverInterfaceCommonUnitTest.
     67   */
    24168  testingMessage( "Testing OsiCbcSolverInterface\n" );
    242   OsiCbcSolverInterfaceUnitTest(mpsDir,netlibDir);
     69  OSIUNITTEST_CATCH_ERROR(OsiCbcSolverInterfaceUnitTest(mpsDir,netlibDir), {}, "cbc", "osicbc unittest");
    24370
    244 /*
    245   We have run the specialised unit test. Check now to see if we need to
    246   run through the Netlib problems.
    247 */
     71  /*
     72    We have run the specialised unit test.
     73    Check now to see if we need to run through the Netlib problems.
     74   */
    24875  if (parms.find("-testOsiSolverInterface") != parms.end())
    24976  {
     
    25279
    25380    testingMessage( "Testing OsiSolverInterface on Netlib problems.\n" );
    254     OsiSolverInterfaceMpsUnitTest(vecSi,netlibDir);
     81    OSIUNITTEST_CATCH_ERROR(OsiSolverInterfaceMpsUnitTest(vecSi,netlibDir), {}, "cbc", "netlib unittest");
    25582
    25683    delete vecSi[0];
    25784  }
    258   else {
    259     testingMessage( "***Skipped Testing of OsiCbcSolverInterface on Netlib problems***\n" );
    260     testingMessage( "***use -testOsiSolverInterface to run them.***\n" );
    261   }
    262 } catch (CoinError& error) {
     85  else
     86    testingMessage( "***Skipped Testing of OsiCbcSolverInterface on Netlib problems, use -testOsiSolverInterface to run them.***\n" );
     87
     88  /*
     89    We're done. Report on the results.
     90   */
    26391  std::cout.flush();
    264   std::cerr << "Caught CoinError exception: ";
    265   error.print(true);
    266   totalErrCnt += 1;
     92  outcomes.print();
     93
     94  int nerrors;
     95  int nerrors_expected;
     96  outcomes.getCountBySeverity(TestOutcome::ERROR, nerrors, nerrors_expected);
     97
     98  if (nerrors > nerrors_expected)
     99    std::cerr << "Tests completed with " << nerrors - nerrors_expected << " unexpected errors." << std::endl ;
     100  else
     101    std::cerr << "All tests completed successfully\n";
     102
     103  return nerrors - nerrors_expected;
    267104}
    268 /*
    269   We're done. Report on the results.
    270 */
    271   if (totalErrCnt)
    272   { std::cout.flush() ;
    273     std::cerr
    274       << "Tests completed with " << totalErrCnt << " errors." << std::endl ;
    275   } else
    276   { testingMessage("All tests completed successfully\n") ; }
    277   return totalErrCnt;
    278 }
Note: See TracChangeset for help on using the changeset viewer.