Changeset 1464 for trunk/Cbc/examples


Ignore:
Timestamp:
Jun 7, 2010 8:27:42 AM (8 years ago)
Author:
stefan
Message:

merge split branch into trunk; fix some examples

Location:
trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:externals
      •  

        old new  
        1 BuildTools        https://projects.coin-or.org/svn/BuildTools/stable/0.5
        2 ThirdParty/ASL    https://projects.coin-or.org/svn/BuildTools/ThirdParty/ASL/stable/1.0
        3 ThirdParty/Blas   https://projects.coin-or.org/svn/BuildTools/ThirdParty/Blas/stable/1.0
        4 ThirdParty/Lapack https://projects.coin-or.org/svn/BuildTools/ThirdParty/Lapack/stable/1.0
        5 ThirdParty/Glpk   https://projects.coin-or.org/svn/BuildTools/ThirdParty/Glpk/stable/1.5
        6 Data/Sample       https://projects.coin-or.org/svn/Data/stable/1.0/Sample
        7 CoinUtils         https://projects.coin-or.org/svn/CoinUtils/stable/2.6/CoinUtils
        8 Cgl               https://projects.coin-or.org/svn/Cgl/stable/0.55/Cgl
        9 Clp               https://projects.coin-or.org/svn/Clp/stable/1.12/Clp
        10 Osi               https://projects.coin-or.org/svn/Osi/stable/0.103/Osi
        11 Vol               https://projects.coin-or.org/svn/Vol/stable/1.1/Vol
         1BuildTools        https://projects.coin-or.org/svn/BuildTools/trunk
         2ThirdParty/ASL    https://projects.coin-or.org/svn/BuildTools/ThirdParty/ASL/trunk
         3ThirdParty/Blas   https://projects.coin-or.org/svn/BuildTools/ThirdParty/Blas/trunk
         4ThirdParty/Lapack https://projects.coin-or.org/svn/BuildTools/ThirdParty/Lapack/trunk
         5ThirdParty/Glpk   https://projects.coin-or.org/svn/BuildTools/ThirdParty/Glpk/trunk
         6Data/Sample       https://projects.coin-or.org/svn/Data/trunk/Sample
         7#Data/miplib3      https://projects.coin-or.org/svn/Data/trunk/miplib3
         8CoinUtils         https://projects.coin-or.org/svn/CoinUtils/trunk/CoinUtils
         9Cgl               https://projects.coin-or.org/svn/Cgl/trunk/Cgl
         10Clp               https://projects.coin-or.org/svn/Clp/trunk/Clp
         11Osi               https://projects.coin-or.org/svn/Osi/trunk/Osi
         12#Vol               https://projects.coin-or.org/svn/Vol/trunk/Vol
    • Property svn:mergeinfo changed
      /branches/split (added)merged: 1437-1439,​1444-1448,​1463
  • trunk/Cbc

  • trunk/Cbc/examples/CbcBranchLink.hpp

    r932 r1464  
    124124  virtual void print();
    125125  /** Return the type (an integer identifier) of \c this */
    126   virtual int type() const
    127   { return -1;}
     126  virtual CbcBranchObjType type() const
     127  { return CbcBranchObjType(0);} /*FIXME what type() should be returned here? */
    128128
    129129  /** Compare the \c this with \c brObj. \c this and \c brObj must be os the
  • trunk/Cbc/examples/CbcSolver3.cpp

    r705 r1464  
    1919#include "CbcCompareUser.hpp"
    2020#include "CbcCompareActual.hpp"
     21#include "CbcCompareObjective.hpp"
    2122// Cuts
    2223
  • trunk/Cbc/examples/Makefile.in

    r865 r1464  
    4949
    5050# C++ Compiler options
    51 CXXFLAGS = @CXXFLAGS@
     51CXXFLAGS = @CXXFLAGS@ -DSAMPLEDIR=\"@SAMPLE_DATA@\" -DMIPLIB3DIR=\"@MIPLIB3_DATA@\"
     52
     53# C Compiler options
     54CFLAGS = @CFLAGS@ -DSAMPLEDIR=\"@SAMPLE_DATA@\"
    5255
    5356# additional C++ Compiler options for linking
     
    5861
    5962# Directory with COIN libraries
    60 COINLIBDIR = @abs_lib_dir@
     63COINLIBDIR = @abs_lib_dir@/coin
    6164
    62 # Libraries necessary to link with Clp
    63 LIBS = -L$(COINLIBDIR) -lCbcSolver -lCbc -lCgl -lOsiClp -lOsiCbc -lOsi -lClp -lCoinUtils \
    64         @ADDLIBS@ \
    65         `cat @CGLDOCDIR@/cgl_addlibs.txt` \
    66         `cat @OSIDOCDIR@/osi_addlibs.txt` \
    67         `cat @CLPDOCDIR@/clp_addlibs.txt` \
    68         `cat @COINUTILSDOCDIR@/coinutils_addlibs.txt`
     65# Libraries necessary to link with Cbc
     66LIBS = @COINDEPEND_LIBS@ @CLP_LIBS@ -L$(COINLIBDIR) -lCbcSolver -lCbc -lOsiCbc @ADDLIBS@
    6967
    7068# Necessary Include dirs (we use the CYGPATH_W variables to allow
    7169# compilation with Windows compilers)
    72 INCL = -I`$(CYGPATH_W) $(COININCDIR)` $(ADDINCFLAGS)
     70INCL = @COINDEPEND_CFLAGS@ @CLP_CFLAGS@ -I`$(CYGPATH_W) $(COININCDIR)` $(ADDINCFLAGS)
    7371
    7472# The following is necessary under cygwin, if native compilers are used
  • trunk/Cbc/examples/allCuts.cpp

    r953 r1464  
    240240  // Read in model using argv[1]
    241241  // and assert that it is a clean model
    242   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     242  std::string mpsFileName;
     243#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     244  mpsFileName = SAMPLEDIR "/p0033.mps";
     245#else
     246  if (argc < 2) {
     247    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     248    exit(1);
     249  }
     250#endif
    243251  if (argc>=2) mpsFileName = argv[1];
    244252  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/barrier.cpp

    r462 r1464  
    5858  // Read in model using argv[1]
    5959  // and assert that it is a clean model
    60   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     60  std::string mpsFileName;
     61#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     62  mpsFileName = SAMPLEDIR "/p0033.mps";
     63#else
     64  if (argc < 2) {
     65    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     66    exit(1);
     67  }
     68#endif
    6169  if (argc>=2) mpsFileName = argv[1];
    6270  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/cbc_driverC_sos.c

    r713 r1464  
    44/* This example shows the use of the "C" interface for CBC. */
    55
     6#include "CbcConfig.h"
    67#include "Cbc_C_Interface.h"
    78#include <stdio.h>
     
    1011#include <assert.h>
    1112
    12 // prototypes
     13/* prototypes */
    1314void printSolution(Cbc_Model *cbc_model);
    1415Cbc_Model * getDefaultModel(int argc, const char *argv[]);
     
    1617
    1718/* Call back function - just says whenever it gets Clp0005 or Coin0002 */
    18 // TODO: It seems that Cbc gives callbacks but not Coin
     19/* TODO: It seems that Cbc gives callbacks but not Coin */
    1920static void callBack(Cbc_Model * model, int messageNumber,
    2021                     int nDouble, const double * vDouble,
     
    6667  Cbc_setLogLevel(model, 1);
    6768  if (VERBOSE>0) printf("%s Log Level %i\n", prefix, Cbc_logLevel(model));
    68   // register callback
     69  /* register callback */
    6970  Cbc_registerCallBack(model,callBack);
    70   // Keep names when reading an mps file
    71   if (argc<2)
    72     // status=Cbc_readMps(model,"../../../../../Data/Sample/ltw.mps");
    73     status=Cbc_readMps(model,"../../../../../Data/Sample/p0033.mps");
     71  /* Keep names when reading an mps file */
     72  if (argc<2) {
     73#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     74    status=Cbc_readMps(model, SAMPLEDIR "/p0033.mps");
     75#else
     76    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     77    exit(1);
     78#endif
     79  }
    7480  else
    7581    status=Cbc_readMps(model,argv[1]);
     
    8389  if (1) Cbc_setIntegerTolerance(model,  1.0e-5);
    8490
    85   /// Solve initial LP relaxation
     91  /* Solve initial LP relaxation */
    8692  Cbc_initialSolve(model);
    8793
    8894  if (VERBOSE>0) printf("%s return\n",prefix);
    8995  return model;
    90 } //  getDefaultModel()
     96} /* getDefaultModel() */
    9197
    9298void printSolution(Cbc_Model *cbc_model) {
    93   //
    94   //  Now to print out solution.  The methods used return modifiable
    95   //  arrays while the alternative names return const pointers -
    96   //  which is of course much more virtuous.
    97   // 
    98   //  This version just does non-zero column and row values.
    99   //
    100   //
    101 
    102   // If we have not kept names (parameter to readMps) this will be 0
    103   //   assert(Cbc_lengthNames(cbc_model));
     99 
     100  /*  Now to print out solution.  The methods used return modifiable
     101      arrays while the alternative names return const pointers -
     102      which is of course much more virtuous.
     103    
     104      This version just does non-zero column and row values.
     105  */
     106
     107  /* If we have not kept names (parameter to readMps) this will be 0
     108      assert(Cbc_lengthNames(cbc_model));
     109  */
    104110  {
    105111    int  name_length = 256;
     
    118124  printf("Is Dual Objective Limit Reached = %i\n",Cbc_isDualObjectiveLimitReached(cbc_model));
    119125  printf("Is Iteration Limit Reached = %i\n",Cbc_isIterationLimitReached(cbc_model));
    120   printf("Objective Sense = %g\n",Cbc_getObjSense(cbc_model));  // (1 - minimize, -1 - maximize, 0 - ignore)
     126  printf("Objective Sense = %g\n",Cbc_getObjSense(cbc_model));  /* (1 - minimize, -1 - maximize, 0 - ignore) */
    121127  printf("Primal Feasible = %i\n",Cbc_primalFeasible(cbc_model));
    122128  printf("Dual Feasible = %i\n",Cbc_dualFeasible(cbc_model));
     
    132138  printf("--------------------------------------\n");
    133139
    134   //  Rows
     140  /*  Rows */
    135141  {
    136142    int numberRows = Cbc_numberRows(cbc_model);
     
    164170  }
    165171  printf("--------------------------------------\n");
    166   // Columns
     172  /* Columns */
    167173  {
    168174    int numberColumns = Cbc_numberColumns(cbc_model);
     
    188194        char name[20];
    189195        sprintf(name," Col%-4i",iColumn);
    190         //      Cbc_columnName(cbc_model,iColumn,name);
     196        /*      Cbc_columnName(cbc_model,iColumn,name); */
    191197        printf("%6d %8s",iColumn,name);
    192198        printf(" %13g",columnPrimal[iColumn]);
     
    200206  }
    201207  printf("--------------------------------------\n");
    202 } //  printSolution()
     208} /*  printSolution() */
    203209
    204210int main (int argc, const char *argv[])
     
    215221  if (VERBOSE>0) printf("%s Version %g\n",prefix,Cbc_getVersion());
    216222
    217   // set model using the local routine for reading an MPS file
     223  /* set model using the local routine for reading an MPS file */
    218224  model = getDefaultModel(argc, argv);
    219   model2 = NULL;  // used to keep model around
    220 
    221   // This clause ought to set the initial basis, but does not yet work.
     225  model2 = NULL;  /* used to keep model around */
     226
     227  /* This clause ought to set the initial basis, but does not yet work. */
    222228  {
    223229    int i;
     
    227233    int elem_length = Cbc_getNumElements(model);
    228234
    229     int * cbc_rowStatus    = NULL; //(int *) malloc(row_length*sizeof(int));
    230     int * cbc_columnStatus = NULL; //(int *) malloc(col_length*sizeof(int));
    231     //    Cbc_getBasisStatus(model, cbc_columnStatus, cbc_rowStatus);
     235    int * cbc_rowStatus    = NULL;
     236    int * cbc_columnStatus = NULL;
    232237
    233238    if (0) {
     
    238243      fflush(stdout);
    239244    }
    240     // print solution status variables
     245    /* print solution status variables */
    241246    if (0) {
    242247      if (cbc_rowStatus) {
     
    246251        }
    247252      } else {
    248         fprintf(stdout,"%s cbc_rowStatus = %p\n", prefix, cbc_rowStatus);
     253        fprintf(stdout,"%s cbc_rowStatus = %p\n", prefix, (void*)cbc_rowStatus);
    249254        fflush(stdout);
    250255      }
     
    255260        }
    256261      } else {
    257         fprintf(stdout,"%s cbc_columnStatus = %p\n", prefix, cbc_columnStatus);
     262        fprintf(stdout,"%s cbc_columnStatus = %p\n", prefix, (void*)cbc_columnStatus);
    258263        fflush(stdout);
    259264      }
    260265    }
    261     //    free( cbc_rowStatus );
    262     //    free( cbc_columnStatus );
    263   }
    264 
    265   // Save model as a clone (does not work as of 2004).
     266  }
     267
     268  /* Save model as a clone (does not work as of 2004). */
    266269  model2 = Cbc_clone(model);
    267270
    268   // Store which variables are integer as defined in the MPS file.
    269   // They will be set to Continuous before adding the SOS constraints.
     271  /* Store which variables are integer as defined in the MPS file.
     272     They will be set to Continuous before adding the SOS constraints. */
    270273
    271274  {
     
    284287  Cbc_problemName(model,80,modelName);
    285288
    286   // Solve the MPS version of the problem
     289  /* Solve the MPS version of the problem */
    287290  if (1) { 
    288291    if (VERBOSE>1) {
     
    291294        prefix, Cbc_optimizationDirection(model));
    292295    }
    293     //    Cbc_setLogLevel(model, VERBOSE); // 4 is verbose
     296    /*    Cbc_setLogLevel(model, VERBOSE); // 4 is verbose */
    294297    time1 = Cbc_cpuTime(model) ;
    295298    Cbc_branchAndBound(model);
     
    304307  }
    305308  {
    306     //
    307     // SOS specification data
    308     // specify numberSets, numPoints, and whichRanges explicitly
    309     // NOTE: These need to be commented according to the MPS file.
    310     //   Example_1_1: Cbc0004I MPS reads 1081 only columns out of 1085
    311     //                Then the 4th range goes out of bounds
    312     //   Example_2: Cbc0006I The LP relaxation is infeasible or too expensive
    313     //   Mod_RT_1: Cbc0006I The LP relaxation is infeasible or too expensive
    314     //
     309   
     310    /* SOS specification data
     311      specify numberSets, numPoints, and whichRanges explicitly
     312      NOTE: These need to be commented according to the MPS file.
     313         Example_1_1: Cbc0004I MPS reads 1081 only columns out of 1085
     314                      Then the 4th range goes out of bounds
     315         Example_2: Cbc0006I The LP relaxation is infeasible or too expensive
     316         Mod_RT_1: Cbc0006I The LP relaxation is infeasible or too expensive
     317    */
    315318    const int numberSets =
    316       1; // dummy
     319      1; /* dummy
    317320    //    4; // Example_1_1
    318321    //    2;  // Example_2
    319322    //    2;  // Mod_RT_1
    320     //    2;  // SITH
     323    //    2;  // SITH */
    321324    const int numPoints =
    322       1; // dummy
     325      1; /* dummy
    323326    //    257; // Example_1_1
    324327    //    256;  // Example_2
    325328    //    257;  // Mod_RT_1
    326     //    257;  // SITH
    327 
    328     //const int whichRanges[numberSets][2]
    329     const int whichRanges[1][2] = { // counting from zero?
    330       {0,0} // dummy
    331       //    {56,312}, {313, 569}, {572, 828}, {829, 1085} // Example_1_1
    332       //    {48, 303}, {304, 559} // Example_2
    333       //    {45, 301}, {302, 558} // Mod_RT_1
    334       //    {45, 301}, {302, 558} // SITH
     329    //    257;  // SITH */
     330
     331    const int whichRanges[1][2] = { /* counting from zero? */
     332      {0,0} /* dummy */
     333      /*   {56,312}, {313, 569}, {572, 828}, {829, 1085} // Example_1_1
     334           {48, 303}, {304, 559} // Example_2
     335           {45, 301}, {302, 558} // Mod_RT_1
     336           {45, 301}, {302, 558} // SITH
     337      */
    335338    };
    336     // the rest is determined parametrically
     339    /* the rest is determined parametrically */
    337340    int *len = malloc(numberSets* sizeof(int[1]));
    338     //int **which = new int * [numberSets];
    339341    int **which = malloc(numberSets* sizeof(int[1]));
    340342    int setNum, pointNum;
     
    350352      which[setNum] = malloc(numPoints*sizeof(int[1]));
    351353      for (j = 0; j < len[setNum]; j++)
    352         //      which[setNum][j] = whichRanges[setNum][0] + j - 6; // hack for missing columns in example 1_1
    353         which[setNum][j] = whichRanges[setNum][0] + j; // Example_2
     354        which[setNum][j] = whichRanges[setNum][0] + j; /* Example_2 */
    354355    }
    355356    weights = malloc(numPoints*sizeof(double[1])); 
    356357    for (pointNum = 0; pointNum < numPoints; pointNum++) weights[pointNum] = pointNum+1;
    357358
    358     // Now use SOS2
    359     // NOTE: Only enable this if known good SOS Specification (above)
     359    /* Now use SOS2
     360       NOTE: Only enable this if known good SOS Specification (above)
     361    */
    360362    if (1) { 
    361363      if (VERBOSE>1) printf("%s Use SOS2\n",prefix);
    362364
    363       // Restore model
     365      /* Restore model */
    364366      Cbc_deleteModel(model);
    365367      if (0) {
     
    368370        model = getDefaultModel(argc, argv);
    369371      }
    370       //    Cbc_setLogLevel(model, 4); // 4 is verbose
     372      /*    Cbc_setLogLevel(model, 4); // 4 is verbose */
    371373      if (VERBOSE>1) printf("%s Model %s has %d rows and %d columns\n",
    372374        prefix, modelName,Cbc_numberRows(model),Cbc_numberColumns(model));
    373375
    374       // make SOS cuts
     376      /* make SOS cuts */
    375377      for (i=0;i<numberIntegers;i++) {
    376378        int iColumn = integerVariable[i];
    377         // Stop being integer
     379        /* Stop being integer */
    378380        Cbc_setContinuous(model, iColumn);
    379381      }
    380       // add cut (0 - use dense, 1 - use sparse (TODO: test this))
     382      /* add cut (0 - use dense, 1 - use sparse (TODO: test this)) */
    381383      if (0) for (i=0;i<numberSets;i++) {
    382384        printf(
    383385          "%s calling Cbc_addSOS(), len[%i] = %i, which[%i][0] = %i, which[%i][%i] = %i,\n  weights[0] = %g, weights[%i] = %g\n",
    384386          prefix, i, len[i], i, which[i][0], i, len[i]-1, which[i][len[i]-1], weights[0], len[i]-1, weights[len[i]-1]);
    385         //      Cbc_addSOS_Sparse(model,len[i],which[i],weights,i,2);
     387        /*      Cbc_addSOS_Sparse(model,len[i],which[i],weights,i,2); */
    386388      } else {
    387         int numObjects = numberSets; // cannot pass const int
     389        int numObjects = numberSets; /* cannot pass const int */
    388390        Cbc_addSOS_Dense(model, numObjects, len, (const int**)which, (const double*)weights, 2);
    389391      }
    390392    }
    391393
    392     Cbc_setOptimizationDirection(model, 1); // 1 minimize
     394    Cbc_setOptimizationDirection(model, 1); /* 1 minimize */
    393395    if (VERBOSE>1) {
    394396      printf("%s Solve MPS version of the problem\n",prefix);
     
    414416  if (VERBOSE>0) printf("%s return 0\n",prefix);
    415417  return 0;
    416 } //  main()
     418} /*  main() */
  • trunk/Cbc/examples/crew.cpp

    r333 r1464  
    1010
    1111
     12#include "CbcConfig.h"
    1213// For Branch and bound
    1314#include "OsiClpSolverInterface.hpp"
     
    3536  // Read in model using argv[1]
    3637  // and assert that it is a clean model
    37   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     38  std::string mpsFileName;
     39#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     40  mpsFileName = SAMPLEDIR "/p0033.mps";
     41#else
     42  if (argc < 2) {
     43    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     44    exit(1);
     45  }
     46#endif
    3847  if (argc>=2) mpsFileName = argv[1];
    3948  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/driver.cpp

    r333 r1464  
    3636  // Read in model using argv[1]
    3737  // and assert that it is a clean model
    38   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     38  std::string mpsFileName;
     39#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     40  mpsFileName = SAMPLEDIR "/p0033.mps";
     41#else
     42  if (argc < 2) {
     43    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     44    exit(1);
     45  }
     46#endif
    3947  if (argc>=2) mpsFileName = argv[1];
    4048  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/driver2.cpp

    r333 r1464  
    1212// For Branch and bound
    1313//#include "CbcStrategy.hpp"
     14#include "CbcConfig.h"
    1415#include "OsiCbcSolverInterface.hpp"
    1516
     
    3637  // Read in model using argv[1]
    3738  // and assert that it is a clean model
    38   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     39  std::string mpsFileName;
     40#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     41  mpsFileName = SAMPLEDIR "/p0033.mps";
     42#else
     43  if (argc < 2) {
     44    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     45    exit(1);
     46  }
     47#endif
    3948  if (argc>=2) mpsFileName = argv[1];
    4049  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/driver3.cpp

    r697 r1464  
    99#include <iomanip>
    1010
    11 
     11#include "CbcConfig.h"
    1212#include "CbcModel.hpp"
    1313#include "OsiClpSolverInterface.hpp"
     
    4242  // Read in model using argv[1]
    4343  // and assert that it is a clean model
    44   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     44  std::string mpsFileName;
     45#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     46  mpsFileName = SAMPLEDIR "/p0033.mps";
     47#else
     48  if (argc < 2) {
     49    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     50    exit(1);
     51  }
     52#endif
    4553  if (argc>=2) mpsFileName = argv[1];
    4654  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/driver4.cpp

    r1111 r1464  
    1010
    1111
     12#include "CbcConfig.h"
    1213#include "CbcModel.hpp"
    1314#include "OsiClpSolverInterface.hpp"
     
    208209  // Read in model using argv[1]
    209210  // and assert that it is a clean model
    210   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     211  std::string mpsFileName;
     212#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     213  mpsFileName = SAMPLEDIR "/p0033.mps";
     214#else
     215  if (argc < 2) {
     216    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     217    exit(1);
     218  }
     219#endif
    211220  if (argc>=2) mpsFileName = argv[1];
    212221  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/fast0507.cpp

    r1067 r1464  
    1616#include "CbcBranchUser.hpp"
    1717#include "CbcBranchCut.hpp"
     18#include "CbcBranchToFixLots.hpp"
    1819#include "CbcCompareUser.hpp"
    1920#include "CbcCutGenerator.hpp"
     
    7071  // Read in model using argv[1]
    7172  // and assert that it is a clean model
    72   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     73  std::string mpsFileName;
    7374  if (argc>=2) mpsFileName = argv[1];
    7475  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/fast0507b.cpp

    r1067 r1464  
    7777  // Read in model using argv[1]
    7878  // and assert that it is a clean model
    79   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     79  std::string mpsFileName;
    8080  if (argc>=2) mpsFileName = argv[1];
    8181  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/hotstart.cpp

    r333 r1464  
    1010
    1111
     12#include "CbcConfig.h"
    1213// For Branch and bound
    1314#include "OsiSolverInterface.hpp"
     
    6061  // Read in model using argv[1]
    6162  // and assert that it is a clean model
    62   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     63  std::string mpsFileName;
     64#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     65  mpsFileName = SAMPLEDIR "/p0033.mps";
     66#else
     67  if (argc < 2) {
     68    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     69    exit(1);
     70  }
     71#endif
    6372  if (argc>=2) mpsFileName = argv[1];
    6473  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/longthin.cpp

    r719 r1464  
    1010
    1111
     12#include "CbcConfig.h"
    1213// For Branch and bound
    1314#include "OsiSolverInterface.hpp"
     
    4445  // Read in model using argv[1]
    4546  // and assert that it is a clean model
    46   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     47  std::string mpsFileName;
     48#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     49  mpsFileName = SAMPLEDIR "/p0033.mps";
     50#else
     51  if (argc < 2) {
     52    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     53    exit(1);
     54  }
     55#endif
    4756  if (argc>=2) mpsFileName = argv[1];
    4857  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/lotsize.cpp

    r333 r1464  
    1010
    1111
     12#include "CbcConfig.h"
    1213// For Branch and bound
    1314#include "CbcModel.hpp"
     
    3637  // Read in model using argv[1]
    3738  // and assert that it is a clean model
    38   std::string mpsFileName = "../../Data/miplib3/10teams";
     39  std::string mpsFileName;
     40#if defined(COIN_HAS_MIPLIB3) && defined(MIPLIB3DIR)
     41  mpsFileName = MIPLIB3DIR "/10teams";
     42#else
     43  if (argc < 2) {
     44    fprintf(stderr, "Do not know where to find miplib3 MPS files.\n");
     45    exit(1);
     46  }
     47#endif
    3948  if (argc>=2) mpsFileName = argv[1];
    4049  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/minimum.cpp

    r333 r1464  
    22// Corporation and others.  All Rights Reserved.
    33
     4#include "CbcConfig.h"
    45#include "CbcModel.hpp"
    56
     
    1213  // Read in example model
    1314  // and assert that it is a clean model
    14   int numMpsReadErrors = solver1.readMps("../../Data/Sample/p0033.mps","");
     15#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     16  int numMpsReadErrors = solver1.readMps(SAMPLEDIR "/p0033.mps","");
    1517  assert(numMpsReadErrors==0);
     18#else
     19  fprintf(stderr, "Do not know where to find sample MPS files.\n");
     20  exit(1);
     21#endif
    1622
    1723  // Pass data and solver to CbcModel
  • trunk/Cbc/examples/nway.cpp

    r333 r1464  
    1010
    1111
     12#include "CbcConfig.h"
    1213// For Branch and bound
    1314#include "CbcModel.hpp"
     
    3536  // Read in model using argv[1]
    3637  // and assert that it is a clean model
    37   std::string mpsFileName = "../../Data/miplib3/10teams";
     38  std::string mpsFileName;
     39#if defined(COIN_HAS_MIPLIB3) && defined(MIPLIB3DIR)
     40  mpsFileName = MIPLIB3DIR "/10teams";
     41#else
     42  if (argc < 2) {
     43    fprintf(stderr, "Do not know where to find miplib3 MPS files.\n");
     44    exit(1);
     45  }
     46#endif
    3847  if (argc>=2) mpsFileName = argv[1];
    3948  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/repeat.cpp

    r333 r1464  
    6565  // Read in model using argv[1]
    6666  // and assert that it is a clean model
    67   std::string mpsFileName = "../../Data/Sample/p0033.mps";
     67  std::string mpsFileName;
     68#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     69  mpsFileName = SAMPLEDIR "/p0033.mps";
     70#else
     71  if (argc < 2) {
     72    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     73    exit(1);
     74  }
     75#endif
    6876  if (argc>=2) mpsFileName = argv[1];
    6977  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/sample2.cpp

    r1335 r1464  
    1010
    1111
     12#include "CbcConfig.h"
    1213// For Branch and bound
    1314#include "OsiSolverInterface.hpp"
     
    7576  const char dirsep =  CoinFindDirSeparator();
    7677  std::string mpsFileName;
    77   if (dirsep == '/')
    78           mpsFileName = "../../Data/Sample/p0033.mps";
    79   else
    80           mpsFileName = "..\\..\\..\\..\\Data\\Sample\\p0033.mps";
     78#if defined(COIN_HAS_SAMPLE) && defined(SAMPLEDIR)
     79  mpsFileName = SAMPLEDIR "/p0033.mps";
     80#else
     81  if (argc < 2) {
     82    fprintf(stderr, "Do not know where to find sample MPS files.\n");
     83    exit(1);
     84  }
     85#endif
    8186  if (argc>=2) mpsFileName = argv[1];
    8287  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/sample3.cpp

    r1067 r1464  
    6868  value=-123456;
    6969  for (int i=1;i<argc;i++) {
    70     if (char * x = strstr(argv[i],check)) {
     70    if (const char * x = strstr(argv[i],check)) {
    7171      // see if at beginning
    7272      if (x==argv[i]||(x==argv[i]+1&&argv[i][0]=='-')) {
  • trunk/Cbc/examples/sos.cpp

    r333 r1464  
    1010
    1111
     12#include "CbcConfig.h"
    1213// For Branch and bound
    1314#include "CbcModel.hpp"
     
    3536  // Read in model using argv[1]
    3637  // and assert that it is a clean model
    37   std::string mpsFileName = "../../Data/miplib3/10teams";
     38  std::string mpsFileName;
     39#if defined(COIN_HAS_MIPLIB3) && defined(MIPLIB3DIR)
     40  mpsFileName = MIPLIB3DIR "/10teams";
     41#else
     42  if (argc < 2) {
     43    fprintf(stderr, "Do not know where to find miplib3 MPS files.\n");
     44    exit(1);
     45  }
     46#endif
    3847  if (argc>=2) mpsFileName = argv[1];
    3948  int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),"");
  • trunk/Cbc/examples/sudoku.cpp

    r218 r1464  
    1717#include "CbcBranchCut.hpp"
    1818#include "CbcBranchActual.hpp"
     19#include "CbcBranchAllDifferent.hpp"
    1920#include "CbcCutGenerator.hpp"
    2021#include "CglAllDifferent.hpp"
Note: See TracChangeset for help on using the changeset viewer.