Ignore:
Timestamp:
Apr 10, 2013 12:58:16 PM (8 years ago)
Author:
stefan
Message:

sync with trunk rev 1901

Location:
stable/2.8/Cbc
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • stable/2.8/Cbc

  • stable/2.8/Cbc/examples/CbcBranchFollow2.cpp

    r1574 r1902  
    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"
  • stable/2.8/Cbc/examples/CbcBranchLink.cpp

    r1574 r1902  
    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];
     
    467458// Creates a branching object
    468459CbcBranchingObject *
    469 CbcLink::createBranch(int way)
     460CbcLink::createCbcBranch(OsiSolverInterface * /*solver*/, const OsiBranchingInformation * /*info*/, int way)
    470461{
    471462  int j;
  • stable/2.8/Cbc/examples/CbcBranchLink.hpp

    r1574 r1902  
    5858  virtual void feasibleRegion();
    5959  /// Creates a branching object
    60   virtual CbcBranchingObject * createBranch(int way) ;
     60  virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
    6161
    6262  /// Number of members
  • stable/2.8/Cbc/examples/CbcBranchUser.cpp

    r1574 r1902  
    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"
  • stable/2.8/Cbc/examples/CbcCompareUser.cpp

    r1574 r1902  
    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"
  • stable/2.8/Cbc/examples/CbcSolver3.cpp

    r1574 r1902  
    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));
  • stable/2.8/Cbc/examples/CbcSolverLongThin.cpp

    r1793 r1902  
    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));
  • stable/2.8/Cbc/examples/Makefile.in

    r1854 r1902  
    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
  • stable/2.8/Cbc/examples/allCuts.cpp

    r1854 r1902  
    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;
  • stable/2.8/Cbc/examples/barrier.cpp

    r1854 r1902  
    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
  • stable/2.8/Cbc/examples/cbc_driverC_sos.c

    r1854 r1902  
    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    }
  • stable/2.8/Cbc/examples/crew.cpp

    r1574 r1902  
    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
  • stable/2.8/Cbc/examples/driver.cpp

    r1574 r1902  
    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
  • stable/2.8/Cbc/examples/driver2.cpp

    r1574 r1902  
    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
  • stable/2.8/Cbc/examples/driver3.cpp

    r1854 r1902  
    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
  • stable/2.8/Cbc/examples/driver4.cpp

    r1854 r1902  
    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);
  • stable/2.8/Cbc/examples/fast0507.cpp

    r1574 r1902  
    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
  • stable/2.8/Cbc/examples/fast0507b.cpp

    r1574 r1902  
    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:
  • stable/2.8/Cbc/examples/gear.cpp

    r1574 r1902  
    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
  • stable/2.8/Cbc/examples/hotstart.cpp

    r1574 r1902  
    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
  • stable/2.8/Cbc/examples/interrupt.cpp

    • Property svn:keywords set to Author Date Id Revision
    r1873 r1902  
    1 // $Id: interrupt.cpp 1854 2013-01-28 00:02:55Z stefan $
     1// $Id$
    22// Copyright (C) 2007, International Business Machines
    33// Corporation and others.  All Rights Reserved.
    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);
  • stable/2.8/Cbc/examples/link.cpp

    r1574 r1902  
    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
  • stable/2.8/Cbc/examples/longthin.cpp

    r1574 r1902  
    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
  • stable/2.8/Cbc/examples/lotsize.cpp

    r1574 r1902  
    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;
  • stable/2.8/Cbc/examples/minimum.cpp

    r1574 r1902  
    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");
  • stable/2.8/Cbc/examples/nway.cpp

    r1574 r1902  
    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;
  • stable/2.8/Cbc/examples/qmip.cpp

    r1574 r1902  
    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
  • stable/2.8/Cbc/examples/qmip2.cpp

    r1854 r1902  
    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
  • stable/2.8/Cbc/examples/repeat.cpp

    r1574 r1902  
    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;
  • stable/2.8/Cbc/examples/sample1.cpp

    r1660 r1902  
    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;;
  • stable/2.8/Cbc/examples/sample2.cpp

    r1660 r1902  
    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
  • stable/2.8/Cbc/examples/sample3.cpp

    r1660 r1902  
    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);
  • stable/2.8/Cbc/examples/sample4.cpp

    r1660 r1902  
    2626/************************************************************************
    2727
    28 This main program reads in an SOSr model (ltw) from an mps file.
     28This main program reads in an SOS model (rgn) from an mps file.
    2929
    3030It then solves it three ways :-
     
    3232a) As normal
    3333b) SOS 1
    34 c) SOS 2(so answer will be different)
     34c) SOS 2 (so answer will be different)
    3535
    3636************************************************************************/
     
    4646  model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry);
    4747
    48   // Read in ltw.mps
    49   // and assert that it is a clean model
    50   int numMpsReadErrors = model.solver()->readMps("./ltw.mps","");
    51   assert(numMpsReadErrors==0);
     48  // Read in rgn.mps
     49  std::string mpsFileName;
     50#if defined(MIPLIB3DIR)
     51  mpsFileName = MIPLIB3DIR "/rgn";
     52#else
     53  if (argc < 2) {
     54    fprintf(stderr, "Do not know where to find miplib3 MPS files.\n");
     55    exit(1);
     56  }
     57#endif
     58  if (argc>=2) mpsFileName = argv[1];
     59  int numMpsReadErrors = model.solver()->readMps(mpsFileName.c_str(),"");
     60  if( numMpsReadErrors != 0 )
     61  {
     62     printf("%d errors reading MPS file\n", numMpsReadErrors);
     63     return numMpsReadErrors;
     64  }
    5265
    5366  // Definition of node choice
     
    7588  }
    7689
    77  
     90  if (numberColumns!=180 || numberIntegers!=100) {
     91    printf("Incorrect model for example\n");
     92    exit(1);
     93  }
     94
    7895  double time1 = CoinCpuTime() ;
    7996
    8097  model.branchAndBound();
    8198
    82   std::cout<<"ltw.mps"<<" took "<<CoinCpuTime()-time1<<" seconds, "
     99  std::cout<<"rgn.mps"<<" took "<<CoinCpuTime()-time1<<" seconds, "
    83100           <<model.getNodeCount()<<" nodes with objective "
    84101           <<model.getObjValue()
     
    104121  model = model2;
    105122
     123  // Convert slacks to variables
     124  CoinBigIndex start[5]={0,1,2,3,4};
     125  int row[4]={0,1,2,3};
     126  double element[4]={1.0,1.0,1.0,1.0};
     127  double up[4]={1.0,1.0,1.0,1.0};
     128  model.solver()->addCols(4,start,row,element,NULL,up,NULL);
    106129  // Now use SOS1
    107   int numberSets=8;
    108   int which[28]={20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,
    109                  39,40,41,42,43,44,45,46,47};
    110   double weights[]={1.0,2.0,3.0,4.0,5.0};
    111   int starts[]={0,2,4,6,8,13,18,23,28};
    112   CbcObject ** objects = new CbcObject * [numberSets];
     130  int numberSets=4;
     131  int which[104];
     132  double weights[104];
     133  int starts[5];
     134  // load
     135  int n=0;
     136  starts[0]=0;
     137  for (int iSet=0;iSet<4;iSet++) {
     138    for (int i=0;i<25;i++) {
     139      weights[n]=i+1.0;
     140      which[n]=iSet*25+i;
     141      n++;
     142    }
     143    // slack - make sure first branch is on slack
     144    weights[n]=1000.0;
     145    which[n]=180+iSet;
     146    n++;
     147    starts[iSet+1]=n;
     148  }
    113149  for (i=0;i<numberIntegers;i++) {
    114150    int iColumn = integerVariable[i];
     
    116152    model.solver()->setContinuous(iColumn);
    117153  }
     154  // save model in this state
     155  CbcModel modelSOS = model;
     156  CbcObject ** objects = new CbcObject * [numberSets];
    118157  for (i=0;i<numberSets;i++) {
    119158    objects[i]= new CbcSOS(&model,starts[i+1]-starts[i],which+starts[i],
     
    129168  model.branchAndBound();
    130169
    131   std::cout<<"ltw.mps"<<" took "<<CoinCpuTime()-time1<<" seconds, "
     170  std::cout<<"rgn.mps"<<" took "<<CoinCpuTime()-time1<<" seconds, "
    132171           <<model.getNodeCount()<<" nodes with objective "
    133172           <<model.getObjValue()
     
    151190
    152191
    153   // Restore model
    154   model = model2;
     192  // Restore SOS model
     193  model = modelSOS;
    155194
    156195// Now use SOS2
    157196  objects = new CbcObject * [numberSets];
    158   for (i=0;i<numberIntegers;i++) {
    159     int iColumn = integerVariable[i];
    160     // Stop being integer
    161     model.solver()->setContinuous(iColumn);
    162   }
    163197  for (i=0;i<numberSets;i++) {
    164198    objects[i]= new CbcSOS(&model,starts[i+1]-starts[i],which+starts[i],
     
    174208  model.branchAndBound();
    175209
    176   std::cout<<"ltw.mps"<<" took "<<CoinCpuTime()-time1<<" seconds, "
     210  std::cout<<"rgn.mps"<<" took "<<CoinCpuTime()-time1<<" seconds, "
    177211           <<model.getNodeCount()<<" nodes with objective "
    178212           <<model.getObjValue()
  • stable/2.8/Cbc/examples/sample5.cpp

    r1660 r1902  
    4040#include "CoinModel.hpp"
    4141
    42 #include  "CoinTime.hpp"
     42#include "CoinTime.hpp"
    4343
    4444
  • stable/2.8/Cbc/examples/simpleBAB.cpp

    r1854 r1902  
    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]);
  • stable/2.8/Cbc/examples/sos.cpp

    r1574 r1902  
    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;
  • stable/2.8/Cbc/examples/sudoku.cpp

    r1574 r1902  
    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
Note: See TracChangeset for help on using the changeset viewer.