Changeset 1898


Ignore:
Timestamp:
Apr 9, 2013 2:06:04 PM (6 years ago)
Author:
stefan
Message:

fixup examples

Location:
trunk/Cbc
Files:
40 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/examples/CbcBranchFollow2.cpp

    r1574 r1898  
    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
    106#include <cassert>
    117#include <cmath>
     
    139//#define CBC_DEBUG
    1410
     11#include "CoinPragma.hpp"
    1512#include "OsiSolverInterface.hpp"
    1613#include "CbcModel.hpp"
  • trunk/Cbc/examples/CbcBranchLink.cpp

    r1574 r1898  
    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
    106#include <cassert>
    117#include <cmath>
     
    139//#define CBC_DEBUG
    1410
     11#include "CoinPragma.hpp"
    1512#include "OsiSolverInterface.hpp"
    1613#include "CbcModel.hpp"
     
    5249    // weights must be increasing
    5350    int i;
    54     double last=-COIN_DBL_MAX;
    55     for (i=0;i<numberMembers_;i++) {
    56       assert (weights_[i]>last+1.0e-12);
    57       last=weights_[i];
    58     }
     51    for (i=0;i<numberMembers_;i++)
     52      assert (i == 0 || weights_[i]>weights_[i-1]+1.0e-12);
    5953    for (i=0;i<numberMembers_*numberLinks_;i++) {
    6054      which_[i]=first+i;
     
    8680    // weights must be increasing
    8781    int i;
    88     double last=-COIN_DBL_MAX;
    89     for (i=0;i<numberMembers_;i++) {
    90       assert (weights_[i]>last+1.0e-12);
    91       last=weights_[i];
    92     }
     82    for (i=0;i<numberMembers_;i++)
     83      assert (i == 0 || weights_[i]>weights_[i-1]+1.0e-12);
    9384    for (i=0;i<numberMembers_*numberLinks_;i++) {
    9485      which_[i]= which[i];
  • trunk/Cbc/examples/CbcBranchUser.cpp

    r1574 r1898  
    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
    106#include <cassert>
    117#include <cmath>
    128#include <cfloat>
    139
     10#include "CoinPragma.hpp"
    1411#include "OsiSolverInterface.hpp"
    1512#include "CbcModel.hpp"
  • trunk/Cbc/examples/CbcCompareUser.cpp

    r1574 r1898  
    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
    106#include <cassert>
    117#include <cmath>
     
    139//#define CBC_DEBUG
    1410
     11#include "CoinPragma.hpp"
    1512#include "CbcMessage.hpp"
    1613#include "CbcModel.hpp"
  • trunk/Cbc/examples/CbcSolver3.cpp

    r1574 r1898  
    246246    assert(!modelPtr_->specialOptions());
    247247    int saveOptions = modelPtr_->specialOptions();
    248     int startFinishOptions;
    249248    bool takeHint;
    250249    OsiHintStrength strength;
    251     bool gotHint = (getHintParam(OsiDoInBranchAndCut,takeHint,strength));
    252     assert (gotHint);
     250    getHintParam(OsiDoInBranchAndCut,takeHint,strength);
    253251    if (strength!=OsiHintIgnore&&takeHint) {
    254252      // could do something - think about it
     
    256254    }
    257255    if((specialOptions_&1)==0) {
    258       startFinishOptions=0;
    259256      modelPtr_->setSpecialOptions(saveOptions|(64|1024));
    260257    } else {
    261       startFinishOptions=1+2+4;
    262258      if((specialOptions_&4)==0)
    263259        modelPtr_->setSpecialOptions(saveOptions|(64|128|512|1024|4096));
  • trunk/Cbc/examples/CbcSolverLongThin.cpp

    r1793 r1898  
    473473    assert(!modelPtr_->specialOptions());
    474474    int saveOptions = modelPtr_->specialOptions();
    475     int startFinishOptions;
    476475    bool takeHint;
    477476    OsiHintStrength strength;
    478     bool gotHint = (getHintParam(OsiDoInBranchAndCut,takeHint,strength));
    479     assert (gotHint);
     477    getHintParam(OsiDoInBranchAndCut,takeHint,strength);
    480478    if (strength!=OsiHintIgnore&&takeHint) {
    481479      // could do something - think about it
     
    483481    }
    484482    if((specialOptions_&1)==0) {
    485       startFinishOptions=0;
    486483      modelPtr_->setSpecialOptions(saveOptions|(64|1024));
    487484    } else {
    488       startFinishOptions=1+2+4;
    489485      if((specialOptions_&4)==0)
    490486        modelPtr_->setSpecialOptions(saveOptions|(64|128|512|1024|4096));
  • trunk/Cbc/examples/Makefile.in

    r1854 r1898  
    2121OBJS =  $(DRIVER).@OBJEXT@
    2222
    23 #       CbcCompareUser.@OBJEXT@ \
    24 #       CbcSolver2.@OBJEXT@ \
    25 #       CbcSolver3.@OBJEXT@ \
    26 #       ClpQuadInterface.@OBJEXT@ \
    27 #       CbcBranchFollow2.@OBJEXT@ \
    28 #       CbcBranchUser.@OBJEXT@ \
    29 #       CbcBranchLink.@OBJEXT@
     23# extra object files that are required by some examples (we just link them into each one)
     24EXTRAOBJS = \
     25        CbcCompareUser.@OBJEXT@ \
     26        CbcSolver2.@OBJEXT@ \
     27        CbcSolver3.@OBJEXT@ \
     28        CbcSolverLongThin.@OBJEXT@ \
     29        ClpQuadInterface.@OBJEXT@ \
     30        CbcBranchFollow2.@OBJEXT@ \
     31        CbcBranchUser.@OBJEXT@ \
     32        CbcBranchLink.@OBJEXT@
    3033
    3134# CHANGEME: Additional libraries
     35# e.g., for driver2, put -lOsiCbc here
    3236ADDLIBS =
    3337
     
    8993  INCL = @CBCLIB_CFLAGS_INSTALLED@
    9094endif
    91 INCL += $(ADDINCFLAGS)
     95INCL += -I@srcdir@ $(ADDINCFLAGS)
    9296
    9397# Linker flags
     
    106110
    107111# Here we list all possible generated objects or executables to delete them
    108 CLEANFILES = \
     112CLEANFILES = $(EXTRAOBJS) \
     113        allCuts.@OBJEXT@ allCuts@EXEEXT@ \
     114        barrier.@OBJEXT@ barrier@EXEEXT@ \
     115        cbc_driverC_sos.@OBJEXT@ cbc_driverC_sos@EXEEXT@ \
    109116        crew.@OBJEXT@ crew@EXEEXT@ \
    110         barrier.@OBJEXT@ barrier@EXEEXT@ \
     117        driver.@OBJEXT@ driver@EXEEXT@ \
    111118        driver2.@OBJEXT@ driver2@EXEEXT@ \
    112         driver.@OBJEXT@ driver@EXEEXT@ \
    113         dynamic.@OBJEXT@ dynamic@EXEEXT@ \
     119        driver3.@OBJEXT@ driver3@EXEEXT@ \
     120        driver4.@OBJEXT@ driver4@EXEEXT@ \
    114121        fast0507b.@OBJEXT@ fast0507b@EXEEXT@ \
    115122        fast0507.@OBJEXT@ fast0507@EXEEXT@ \
    116123        gear.@OBJEXT@ gear@EXEEXT@ \
    117124        hotstart.@OBJEXT@ hotstart@EXEEXT@ \
     125        interrupt.@OBJEXT@ interrupt@EXEEXT@ \
    118126        link.@OBJEXT@ link@EXEEXT@ \
    119127        longthin.@OBJEXT@ longthin@EXEEXT@ \
    120128        lotsize.@OBJEXT@ lotsize@EXEEXT@ \
    121129        minimum.@OBJEXT@ minimum@EXEEXT@ \
     130        modify.@OBJEXT@ modify@EXEEXT@ \
    122131        nway.@OBJEXT@ nway@EXEEXT@ \
    123132        qmip.@OBJEXT@ qmip@EXEEXT@ \
     
    129138        sample4.@OBJEXT@ sample4@EXEEXT@ \
    130139        sample5.@OBJEXT@ sample5@EXEEXT@ \
     140        simpleBAB.@OBJEXT@ simpleBAB@EXEEXT@ \
    131141        sos.@OBJEXT@ sos@EXEEXT@ \
    132142        sudoku.@OBJEXT@ sudoku@EXEEXT@
     
    136146.SUFFIXES: .cpp .c .o .obj
    137147
    138 $(EXE): $(OBJS)
     148$(EXE): $(OBJS) $(EXTRAOBJS)
    139149        bla=;\
    140         for file in $(OBJS); do bla="$$bla `$(CYGPATH_W) $$file`"; done; \
     150        for file in $(OBJS) $(EXTRAOBJS); do bla="$$bla `$(CYGPATH_W) $$file`"; done; \
    141151        $(CXX) $(CXXLINKFLAGS) $(CXXFLAGS) -o $@ $$bla $(LIBS) $(ADDLIBS)
    142152
  • trunk/Cbc/examples/allCuts.cpp

    r1854 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
    149
     10#include "CoinPragma.hpp"
    1511// For Branch and bound
    1612#include "OsiSolverInterface.hpp"
     
    4238#include "CbcHeuristic.hpp"
    4339
    44 #include  "CoinTime.hpp"
     40#include "CoinTime.hpp"
    4541// Need stored cuts
    4642
     
    254250  if (argc>=2) mpsFileName = argv[1];
    255251  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    256   assert(numMpsReadErrors==0);
     252  if( numMpsReadErrors != 0 )
     253  {
     254     printf("%d errors reading MPS file\n", numMpsReadErrors);
     255     return numMpsReadErrors;
     256  }
    257257  double time1 = CoinCpuTime();
    258258  OsiClpSolverInterface solverSave = solver1;
  • trunk/Cbc/examples/barrier.cpp

    r1854 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
    149
     10#include "CoinPragma.hpp"
    1511#include "OsiClpSolverInterface.hpp"
    16 #include  "CoinTime.hpp"
     12#include "CoinTime.hpp"
    1713
    1814//#############################################################################
     
    7268  if (argc>=2) mpsFileName = argv[1];
    7369  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    74   assert(numMpsReadErrors==0);
     70  if( numMpsReadErrors != 0 )
     71  {
     72     printf("%d errors reading MPS file\n", numMpsReadErrors);
     73     return numMpsReadErrors;
     74  }
    7575  double time1 = CoinCpuTime();
    7676
  • trunk/Cbc/examples/cbc_driverC_sos.c

    r1891 r1898  
    44  This code is licensed under the terms of the Eclipse Public License (EPL).
    55
    6   $Id#
     6  $Id$
    77*/
    88
     
    7777#if defined(SAMPLEDIR)
    7878  /*
    79     SAMPLEDIR should be something like "path/to/mps/directory/", including the
    80     quotes and final directory separator. Don't forget to properly escape
     79    SAMPLEDIR should be something like "path/to/mps/directory", including the
     80    quotes and excluding the final directory separator. Don't forget to properly escape
    8181    '\' when using native Windows path syntax.
    8282  */
    83     status=Cbc_readMps(model, SAMPLEDIR"p0033.mps") ;
     83    status=Cbc_readMps(model, SAMPLEDIR "/p0033.mps") ;
    8484#else
    8585    fprintf(stderr, "Please specify the full path to an MPS file on the command line\n");
     
    397397      } else {
    398398        int numObjects = numberSets; /* cannot pass const int */
    399         Cbc_addSOS_Dense(model, numObjects, len, (const int**)which, (const double*)weights, 2);
     399        Cbc_addSOS_Dense(model, numObjects, len, (const int* const *)which, (const double*)weights, 2);
    400400      }
    401401    }
  • trunk/Cbc/examples/crew.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
    14 
     9#include "CoinPragma.hpp"
    1510// For Branch and bound
    1611#include "OsiClpSolverInterface.hpp"
     
    1914#include "CbcCompareUser.hpp"
    2015
    21 #include  "CoinTime.hpp"
     16#include "CoinTime.hpp"
    2217
    2318/************************************************************************
     
    4944  if (argc>=2) mpsFileName = argv[1];
    5045  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    51   assert(numMpsReadErrors==0);
     46  if( numMpsReadErrors != 0 )
     47  {
     48     printf("%d errors reading MPS file\n", numMpsReadErrors);
     49     return numMpsReadErrors;
     50  }
    5251  double time1 = CoinCpuTime();
    5352
     
    6059  // Point to solver
    6160  OsiSolverInterface * solver3 = model.solver();
    62   OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (solver3);
    63   assert (osiclp);
     61  assert (dynamic_cast< OsiClpSolverInterface*> (solver3));
    6462
    6563  // Definition of node choice
  • trunk/Cbc/examples/driver.cpp

    r1574 r1898  
    33// Corporation and others.  All Rights Reserved.
    44// This code is licensed under the terms of the Eclipse Public License (EPL).
    5 
    6 #if defined(_MSC_VER)
    7 // Turn off compiler warning about long names
    8 #  pragma warning(disable:4786)
    9 #endif
    105
    116#include <cassert>
     
    149
    1510// For Branch and bound
     11#include "CoinPragma.hpp"
    1612#include "CbcModel.hpp"
    1713#include "CbcStrategy.hpp"
     
    2016#include "CglPreProcess.hpp"
    2117
    22 #include  "CoinTime.hpp"
     18#include "CoinTime.hpp"
    2319
    2420//#############################################################################
     
    5046  if (argc>=2) mpsFileName = argv[1];
    5147  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    52   assert(numMpsReadErrors==0);
     48  if( numMpsReadErrors != 0 )
     49  {
     50     printf("%d errors reading MPS file\n", numMpsReadErrors);
     51     return numMpsReadErrors;
     52  }
    5353  double time1 = CoinCpuTime();
    5454
  • trunk/Cbc/examples/driver2.cpp

    r1574 r1898  
    33// Corporation and others.  All Rights Reserved.
    44// This code is licensed under the terms of the Eclipse Public License (EPL).
    5 
    6 #if defined(_MSC_VER)
    7 // Turn off compiler warning about long names
    8 #  pragma warning(disable:4786)
    9 #endif
    105
    116#include <cassert>
     
    1510// For Branch and bound
    1611//#include "CbcStrategy.hpp"
     12#include "CoinPragma.hpp"
    1713#include "OsiCbcSolverInterface.hpp"
    1814
    19 #include  "CoinTime.hpp"
     15#include "CoinTime.hpp"
    2016
    2117//#############################################################################
     
    5046  if (argc>=2) mpsFileName = argv[1];
    5147  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    52   assert(numMpsReadErrors==0);
     48  if( numMpsReadErrors != 0 )
     49  {
     50     printf("%d errors reading MPS file\n", numMpsReadErrors);
     51     return numMpsReadErrors;
     52  }
    5353  double time1 = CoinCpuTime();
    5454  // Do complete search
  • trunk/Cbc/examples/driver3.cpp

    r1854 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
     9#include "CoinPragma.hpp"
    1410#include "CbcModel.hpp"
    1511#include "OsiClpSolverInterface.hpp"
    1612#include "CbcBranchDynamic.hpp"
    1713
    18 #include  "CoinTime.hpp"
     14#include "CoinTime.hpp"
    1915
    2016//#############################################################################
     
    5551  if (argc>=2) mpsFileName = argv[1];
    5652  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    57   assert(numMpsReadErrors==0);
     53  if( numMpsReadErrors != 0 )
     54  {
     55     printf("%d errors reading MPS file\n", numMpsReadErrors);
     56     return numMpsReadErrors;
     57  }
    5858
    5959  // Strip off integer information and save
  • trunk/Cbc/examples/driver4.cpp

    r1854 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
    149
     10#include "CoinPragma.hpp"
    1511#include "CbcModel.hpp"
    1612#include "OsiClpSolverInterface.hpp"
    1713#include "CbcSolver.hpp"
    1814
    19 #include  "CoinTime.hpp"
     15#include "CoinTime.hpp"
    2016
    2117//#############################################################################
     
    221217  if (argc>=2) mpsFileName = argv[1];
    222218  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    223   assert(numMpsReadErrors==0);
     219  if( numMpsReadErrors != 0 )
     220  {
     221     printf("%d errors reading MPS file\n", numMpsReadErrors);
     222     return numMpsReadErrors;
     223  }
    224224  // Tell solver to return fast if presolve or initial solve infeasible
    225225  solver1.getModelPtr()->setMoreSpecialOptions(3);
  • trunk/Cbc/examples/fast0507.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
     9#include "CoinPragma.hpp"
    1410
    1511// For Branch and bound
     
    3935#include "CglPreProcess.hpp"
    4036
    41 #include  "CoinTime.hpp"
     37#include "CoinTime.hpp"
    4238
    4339//#############################################################################
     
    7773  if (argc>=2) mpsFileName = argv[1];
    7874  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    79   assert(numMpsReadErrors==0);
     75  if( numMpsReadErrors != 0 )
     76  {
     77     printf("%d errors reading MPS file\n", numMpsReadErrors);
     78     return numMpsReadErrors;
     79  }
    8080  double time1 = CoinCpuTime();
    8181
  • trunk/Cbc/examples/fast0507b.cpp

    r1574 r1898  
    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 
    116#include "CbcConfig.h"
    127
     
    149#include <iomanip>
    1510
     11#include "CoinPragma.hpp"
    1612
    1713// For Branch and bound
     
    3935#include "CglPreProcess.hpp"
    4036
    41 #include  "CoinTime.hpp"
     37#include "CoinTime.hpp"
    4238
    4339//#############################################################################
     
    8379  if (argc>=2) mpsFileName = argv[1];
    8480  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    85   assert(numMpsReadErrors==0);
     81  if( numMpsReadErrors != 0 )
     82  {
     83     printf("%d errors reading MPS file\n", numMpsReadErrors);
     84     return numMpsReadErrors;
     85  }
    8686  double time1 = CoinCpuTime();
    8787  /* Options are:
  • trunk/Cbc/examples/gear.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
     9#include "CoinPragma.hpp"
    1410
    1511// For Branch and bound
     
    2117#include "OsiClpSolverInterface.hpp"
    2218
    23 #include  "CoinTime.hpp"
     19#include "CoinTime.hpp"
    2420
    2521
  • trunk/Cbc/examples/hotstart.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
     9#include "CoinPragma.hpp"
    1410
    1511// For Branch and bound
     
    3834#include "CbcHeuristic.hpp"
    3935
    40 #include  "CoinTime.hpp"
     36#include "CoinTime.hpp"
    4137
    4238//#############################################################################
     
    7470  if (argc>=2) mpsFileName = argv[1];
    7571  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    76   assert(numMpsReadErrors==0);
     72  if( numMpsReadErrors != 0 )
     73  {
     74     printf("%d errors reading MPS file\n", numMpsReadErrors);
     75     return numMpsReadErrors;
     76  }
    7777  double time1 = CoinCpuTime();
    7878
  • trunk/Cbc/examples/interrupt.cpp

    r1866 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
    149
     10#include "CoinPragma.hpp"
    1511#include "CbcModel.hpp"
    1612#include "OsiClpSolverInterface.hpp"
    1713#include "CbcSolver.hpp"
    1814
    19 #include  "CoinTime.hpp"
     15#include "CoinTime.hpp"
    2016
    2117//#############################################################################
     
    359355  if (argc>=2) mpsFileName = argv[1];
    360356  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    361   assert(numMpsReadErrors==0);
     357  if( numMpsReadErrors != 0 )
     358  {
     359     printf("%d errors reading MPS file\n", numMpsReadErrors);
     360     return numMpsReadErrors;
     361  }
    362362  // Tell solver to return fast if presolve or initial solve infeasible
    363363  solver1.getModelPtr()->setMoreSpecialOptions(3);
  • trunk/Cbc/examples/link.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
    14 
     9#include "CoinPragma.hpp"
    1510// For Branch and bound
    1611#include "OsiSolverInterface.hpp"
     
    2116#include "OsiClpSolverInterface.hpp"
    2217
    23 #include  "CoinTime.hpp"
     18#include "CoinTime.hpp"
    2419
    2520
  • trunk/Cbc/examples/longthin.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
    149
     10#include "CoinPragma.hpp"
    1511// For Branch and bound
    1612#include "OsiSolverInterface.hpp"
     
    2824#include "CglProbing.hpp"
    2925
    30 #include  "CoinTime.hpp"
     26#include "CoinTime.hpp"
    3127
    3228/************************************************************************
     
    5854  if (argc>=2) mpsFileName = argv[1];
    5955  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    60   assert(numMpsReadErrors==0);
     56  if( numMpsReadErrors != 0 )
     57  {
     58     printf("%d errors reading MPS file\n", numMpsReadErrors);
     59     return numMpsReadErrors;
     60  }
    6161  double time1 = CoinCpuTime();
    6262
  • trunk/Cbc/examples/lotsize.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
    14 
     9#include "CoinPragma.hpp"
    1510// For Branch and bound
    1611#include "CbcModel.hpp"
     
    5045  if (argc>=2) mpsFileName = argv[1];
    5146  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    52   assert(numMpsReadErrors==0);
     47  if( numMpsReadErrors != 0 )
     48  {
     49     printf("%d errors reading MPS file\n", numMpsReadErrors);
     50     return numMpsReadErrors;
     51  }
    5352 
    5453  int iColumn;
  • trunk/Cbc/examples/minimum.cpp

    r1574 r1898  
    1616#if defined(SAMPLEDIR)
    1717  int numMpsReadErrors = solver1.readMps(SAMPLEDIR "/p0033.mps","");
    18   assert(numMpsReadErrors==0);
     18  if( numMpsReadErrors != 0 )
     19  {
     20     printf("%d errors reading MPS file\n", numMpsReadErrors);
     21     return numMpsReadErrors;
     22  }
    1923#else
    2024  fprintf(stderr, "Do not know where to find sample MPS files.\n");
  • trunk/Cbc/examples/nway.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
    149
     10#include "CoinPragma.hpp"
    1511// For Branch and bound
    1612#include "CbcModel.hpp"
     
    4945  if (argc>=2) mpsFileName = argv[1];
    5046  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    51   assert(numMpsReadErrors==0);
     47  if( numMpsReadErrors != 0 )
     48  {
     49     printf("%d errors reading MPS file\n", numMpsReadErrors);
     50     return numMpsReadErrors;
     51  }
    5252 
    5353  int iRow, iColumn;
  • trunk/Cbc/examples/qmip.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
     9
     10#include "CoinPragma.hpp"
    1411
    1512// For Branch and bound
     
    6764
    6865  // Read in model using argv[1]
     66  if (argc <= 1) {
     67     printf("using %s <modelfile>\n", argv[0]);
     68     return 1;
     69  }
    6970  // must use clp to get a quadratic model
    7071  ClpSimplex * clp = solver1.getModelPtr();
    7172  int numMpsReadErrors = clp->readMps(argv[1]);
    7273  // and assert that it is a clean model
    73   assert(numMpsReadErrors==0);
     74  if( numMpsReadErrors != 0 )
     75  {
     76     printf("%d errors reading MPS file\n", numMpsReadErrors);
     77     return numMpsReadErrors;
     78  }
    7479
    7580  // This clones solver
  • trunk/Cbc/examples/qmip2.cpp

    r1854 r1898  
    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 
    116#include <cassert>
     7
     8#include "CoinPragma.hpp"
    129
    1310// For Branch and bound
  • trunk/Cbc/examples/repeat.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
     9#include "CoinPragma.hpp"
    1410
    1511// For Branch and bound
     
    3935#include "CbcHeuristic.hpp"
    4036
    41 #include  "CoinTime.hpp"
     37#include "CoinTime.hpp"
    4238
    4339//#############################################################################
     
    7975  if (argc>=2) mpsFileName = argv[1];
    8076  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    81   assert(numMpsReadErrors==0);
     77  if( numMpsReadErrors != 0 )
     78  {
     79     printf("%d errors reading MPS file\n", numMpsReadErrors);
     80     return numMpsReadErrors;
     81  }
    8282  double time1 = CoinCpuTime();
    8383
     
    301301    OsiSolverInterface * refSolver = model.referenceSolver();
    302302    const double * bestSolution = model.bestSolution();
     303#ifndef NDEBUG
    303304    const double * originalLower = refSolver->getColLower();
    304305    const double * originalUpper = refSolver->getColUpper();
     306#endif
    305307    CoinPackedVector cut;
    306308    double rhs = 1.0;
  • trunk/Cbc/examples/sample1.cpp

    r1660 r1898  
    4343  struct rusage usage;
    4444  getrusage(RUSAGE_SELF,&usage);
    45   cpu_temp = usage.ru_utime.tv_sec;
     45  cpu_temp = (double)usage.ru_utime.tv_sec;
    4646  cpu_temp += 1.0e-6*((double) usage.ru_utime.tv_usec);
    4747#endif
     
    8787  // and assert that it is a clean model
    8888
    89   assert(!simplex.readMps(argv[1],""));
     89  if (argc <= 1) {
     90     printf("using %s <modelfile>\n", argv[0]);
     91     return 1;
     92  }
     93  int numMpsReadErrors = simplex.readMps(argv[1],"");
     94  if( numMpsReadErrors != 0 )
     95  {
     96     printf("%d errors reading MPS file\n", numMpsReadErrors);
     97     return numMpsReadErrors;
     98  }
    9099  time2 = cpuTime();
    91100  std::cout<<"Input took "<<time2-time1<<" seconds"<<std::endl;;
  • trunk/Cbc/examples/sample2.cpp

    r1660 r1898  
    3535#include "CbcHeuristic.hpp"
    3636
    37 #include  "CoinTime.hpp"
     37#include "CoinTime.hpp"
    3838
    3939//#############################################################################
     
    8585  if (argc>=2) mpsFileName = argv[1];
    8686  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    87   assert(numMpsReadErrors==0);
     87  if( numMpsReadErrors != 0 )
     88  {
     89     printf("%d errors reading MPS file\n", numMpsReadErrors);
     90     return numMpsReadErrors;
     91  }
    8892  double time1 = CoinCpuTime();
    8993
  • trunk/Cbc/examples/sample3.cpp

    r1660 r1898  
    9191  solver1.getModelPtr()->setDualBound(1.0e10);
    9292
     93  if (argc <= 1) {
     94     printf("using %s <modelfile>\n", argv[0]);
     95     return 1;
     96  }
     97
    9398  // Read in model using argv[1]
    9499  // and assert that it is a clean model
    95100  int numMpsReadErrors = solver1.readMps(argv[1],"");
    96   assert(numMpsReadErrors==0);
     101  if( numMpsReadErrors != 0 )
     102  {
     103     printf("%d errors reading MPS file\n", numMpsReadErrors);
     104     return numMpsReadErrors;
     105  }
    97106  // do here so integers correct
    98107  CbcModel model(solver1);
  • trunk/Cbc/examples/sample4.cpp

    r1660 r1898  
    4949  // and assert that it is a clean model
    5050  int numMpsReadErrors = model.solver()->readMps("./ltw.mps","");
    51   assert(numMpsReadErrors==0);
     51  if( numMpsReadErrors != 0 )
     52  {
     53     printf("%d errors reading MPS file\n", numMpsReadErrors);
     54     return numMpsReadErrors;
     55  }
    5256
    5357  // Definition of node choice
  • trunk/Cbc/examples/sample5.cpp

    r1660 r1898  
    4040#include "CoinModel.hpp"
    4141
    42 #include  "CoinTime.hpp"
     42#include "CoinTime.hpp"
    4343
    4444
  • trunk/Cbc/examples/simpleBAB.cpp

    r1854 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
    149
     10#include "CoinPragma.hpp"
    1511#include "OsiClpSolverInterface.hpp"
    1612#include "CoinPackedVector.hpp"
     
    4137  model.setInteger(0);
    4238  model.setObjSense(-1.0);
    43   bool optimal;
     39  //bool optimal;
    4440 
    4541#ifndef USE_CBC
     
    5450  model.getDblParam(OsiDualObjectiveLimit,objLimit);
    5551  model.branchAndBound();
    56   optimal = model.isProvenOptimal();
     52  //optimal = model.isProvenOptimal();
    5753  const double *val = model.getColSolution(); // x0 = 3, x1 = 0.45
    5854  printf("Solution %g %g\n",val[0],val[1]);
     
    6561    CbcModel model2(model);
    6662    model2.branchAndBound();
    67     optimal = model2.isProvenOptimal();
     63    //optimal = model2.isProvenOptimal();
    6864    const double *val = model2.getColSolution(); // x0 = 3, x1 = 0.45
    6965    printf("Solution %g %g\n",val[0],val[1]);
     
    7975#ifndef USE_CBC
    8076  model.branchAndBound();
    81   optimal = model.isProvenOptimal(); // should be x0 = 2, x1 = 0.95
     77  //optimal = model.isProvenOptimal(); // should be x0 = 2, x1 = 0.95
    8278  // Address of solution will be same as only adding rows - but be safe
    8379  val = model.getColSolution();
     
    8783    CbcModel model2(model);
    8884    model2.branchAndBound();
    89     optimal = model2.isProvenOptimal(); // should be x0 = 2, x1 = 0.95
     85    //optimal = model2.isProvenOptimal(); // should be x0 = 2, x1 = 0.95
    9086    const double *val = model2.getColSolution();
    9187    printf("Solution %g %g\n",val[0],val[1]);
  • trunk/Cbc/examples/sos.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
     9
     10#include "CoinPragma.hpp"
    1411
    1512// For Branch and bound
     
    4946  if (argc>=2) mpsFileName = argv[1];
    5047  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
    51   assert(numMpsReadErrors==0);
     48  if( numMpsReadErrors != 0 )
     49  {
     50     printf("%d errors reading MPS file\n", numMpsReadErrors);
     51     return numMpsReadErrors;
     52  }
    5253 
    5354  int iRow, iColumn;
  • trunk/Cbc/examples/sudoku.cpp

    r1574 r1898  
    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 
    116#include <cassert>
    127#include <iomanip>
    138
    149
     10#include "CoinPragma.hpp"
    1511// For Branch and bound
    1612#include "OsiSolverInterface.hpp"
     
    2622#include "CglStored.hpp"
    2723
    28 #include  "CoinTime.hpp"
     24#include "CoinTime.hpp"
    2925
    3026
  • trunk/Cbc/src/Cbc_C_Interface.cpp

    r1886 r1898  
    22662266COINLIBAPI void  COINLINKAGE
    22672267Cbc_addSOS_Dense(Cbc_Model * model, int numObjects, const int * len,
    2268                  const int ** which, const double * weights, const int type)
     2268                 const int * const* which, const double * weights, const int type)
    22692269{
    22702270    const char prefix[] = "Cbc_C_Interface::Cbc_addSOS_Dense(): ";
  • trunk/Cbc/src/Cbc_C_Interface.h

    r1600 r1898  
    629629    COINLIBAPI void  COINLINKAGE
    630630    Cbc_addSOS_Dense(Cbc_Model * model, int numObjects, const int * len,
    631                      const int ** which, const double * weights, const int type)
     631                     const int * const * which, const double * weights, const int type)
    632632    ;
    633633    /** Add SOS constraints to the model using row-order matrix */
  • trunk/Cbc/src/Makefile.am

    r1840 r1898  
    193193        CbcBranchDynamic.hpp \
    194194        CbcBranchCut.hpp \
    195         CbcBranchDecision.hpp \
     195        CbcBranchDecision.hpp \
    196196        CbcBranchDefaultDecision.hpp \
    197197        CbcBranchingObject.hpp \
     
    214214        CbcFathom.hpp \
    215215        CbcEventHandler.hpp \
     216        CbcFathomDynamicProgramming.hpp \
    216217        CbcFeasibilityBase.hpp \
    217218        CbcFixVariable.hpp \
  • trunk/Cbc/src/Makefile.in

    r1840 r1898  
    653653        CbcBranchDynamic.hpp \
    654654        CbcBranchCut.hpp \
    655         CbcBranchDecision.hpp \
     655        CbcBranchDecision.hpp \
    656656        CbcBranchDefaultDecision.hpp \
    657657        CbcBranchingObject.hpp \
     
    674674        CbcFathom.hpp \
    675675        CbcEventHandler.hpp \
     676        CbcFathomDynamicProgramming.hpp \
    676677        CbcFeasibilityBase.hpp \
    677678        CbcFixVariable.hpp \
Note: See TracChangeset for help on using the changeset viewer.