Ignore:
Timestamp:
Dec 9, 2009 2:59:30 PM (10 years ago)
Author:
lou
Message:

Yet another try at cleaning CbcSolver?. This is an intermediate commit to
reconcile Bjarni's changes with my changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/Cbc/src/CbcSolver.cpp

    r1383 r1386  
    5252#define CBCVERSION "2.4.01"
    5353#endif
    54 //#define ORBITAL
    55 #ifdef ORBITAL
    56 #include "CbcOrbital.hpp"
    57 #endif
    5854//#define USER_HAS_FAKE_CLP
    5955//#define USER_HAS_FAKE_CBC
     56
    6057//#define CLP_MALLOC_STATISTICS
     58
    6159#ifdef CLP_MALLOC_STATISTICS
    6260#include <malloc.h>
     
    8179        }
    8280    }
    83 #ifdef DEBUG_MALLOC
     81# ifdef DEBUG_MALLOC
    8482    void *p;
    8583    if (malloc_counts_on)
     
    8785    else
    8886        p = malloc(size);
    89 #else
     87# else
    9088    void * p = malloc(size);
    91 #endif
     89# endif
    9290    //char * xx = (char *) p;
    9391    //memset(xx,0,size);
     
    9896void operator delete (void *p) throw()
    9997{
    100 #ifdef DEBUG_MALLOC
     98# ifdef DEBUG_MALLOC
    10199    if (malloc_counts_on)
    102100        stolen_from_ekk_freeBase(p);
    103101    else
    104102        free(p);
    105 #else
     103# else
    106104    free(p);
    107 #endif
     105# endif
    108106}
    109107static void malloc_stats2()
     
    119117    // print results
    120118}
    121 #else
     119#else   //CLP_MALLOC_STATISTICS
    122120//void stolen_from_ekk_memory(void * dummy,int type)
    123121//{
    124122//}
    125123//bool malloc_counts_on=false;
    126 #endif
     124#endif  //CLP_MALLOC_STATISTICS
     125
    127126//#define DMALLOC
    128127#ifdef DMALLOC
    129128#include "dmalloc.h"
    130129#endif
     130
    131131#ifdef WSSMP_BARRIER
    132132#define FOREIGN_BARRIER
    133133#endif
     134
    134135#ifdef UFL_BARRIER
    135136#define FOREIGN_BARRIER
    136137#endif
     138
    137139#ifdef TAUCS_BARRIER
    138140#define FOREIGN_BARRIER
    139141#endif
     142
    140143static int initialPumpTune = -1;
    141144#include "CoinWarmStartBasis.hpp"
     
    145148#include "OsiRowCut.hpp"
    146149#include "OsiColCut.hpp"
     150
    147151#ifndef COIN_HAS_LINK
    148152#define COIN_HAS_LINK
     
    151155#include "CbcLinked.hpp"
    152156#endif
     157
    153158#include "CglPreProcess.hpp"
    154159#include "CglCutGenerator.hpp"
     
    165170#include "CglLandP.hpp"
    166171#include "CglResidualCapacity.hpp"
     172
    167173#ifdef ZERO_HALF_CUTS
    168174#include "CglZeroHalf.hpp"
     
    194200
    195201#include "OsiClpSolverInterface.hpp"
     202
    196203#include "CbcSolver.hpp"
     204
    197205//#define IN_BRANCH_AND_BOUND (0x01000000|262144)
    198206#define IN_BRANCH_AND_BOUND (0x01000000|262144|128|1024|2048)
    199207//#define IN_BRANCH_AND_BOUND (0x01000000|262144|128)
     208
     209/*
     210  CbcStopNow class definitions.
     211*/
     212
     213CbcStopNow::CbcStopNow()
     214{
     215}
     216CbcStopNow::~CbcStopNow()
     217{
     218}
     219// Copy constructor
     220CbcStopNow::CbcStopNow ( const CbcStopNow & )
     221{
     222}
     223// Assignment operator
     224CbcStopNow &
     225CbcStopNow::operator=(const CbcStopNow & rhs)
     226{
     227    if (this != &rhs) {
     228    }
     229    return *this;
     230}
     231// Clone
     232CbcStopNow *
     233CbcStopNow::clone() const
     234{
     235    return new CbcStopNow(*this);
     236}
     237
     238/*
     239  CbcUser class definitions.
     240*/
     241
     242// User stuff (base class)
     243CbcUser::CbcUser()
     244        : coinModel_(NULL),
     245        userName_("null")
     246{
     247}
     248CbcUser::~CbcUser()
     249{
     250    delete coinModel_;
     251}
     252// Copy constructor
     253CbcUser::CbcUser ( const CbcUser & rhs)
     254{
     255    if (rhs.coinModel_)
     256        coinModel_ = new CoinModel(*rhs.coinModel_);
     257    else
     258        coinModel_ = NULL;
     259    userName_ = rhs.userName_;
     260}
     261// Assignment operator
     262CbcUser &
     263CbcUser::operator=(const CbcUser & rhs)
     264{
     265    if (this != &rhs) {
     266        if (rhs.coinModel_)
     267            coinModel_ = new CoinModel(*rhs.coinModel_);
     268        else
     269            coinModel_ = NULL;
     270        userName_ = rhs.userName_;
     271    }
     272    return *this;
     273}
     274
     275/*
     276  CbcSolver class definitions
     277*/
     278
    200279CbcSolver::CbcSolver()
    201280        : babModel_(NULL),
     
    657736    cutGenerator_[numberCutGenerators_++] = generator->clone();
    658737}
    659 // User stuff (base class)
    660 CbcUser::CbcUser()
    661         : coinModel_(NULL),
    662         userName_("null")
    663 {
    664 }
    665 CbcUser::~CbcUser()
    666 {
    667     delete coinModel_;
    668 }
    669 // Copy constructor
    670 CbcUser::CbcUser ( const CbcUser & rhs)
    671 {
    672     if (rhs.coinModel_)
    673         coinModel_ = new CoinModel(*rhs.coinModel_);
    674     else
    675         coinModel_ = NULL;
    676     userName_ = rhs.userName_;
    677 }
    678 // Assignment operator
    679 CbcUser &
    680 CbcUser::operator=(const CbcUser & rhs)
    681 {
    682     if (this != &rhs) {
    683         if (rhs.coinModel_)
    684             coinModel_ = new CoinModel(*rhs.coinModel_);
    685         else
    686             coinModel_ = NULL;
    687         userName_ = rhs.userName_;
    688     }
    689     return *this;
    690 }
    691 /* Updates model_ from babModel_ according to returnMode
    692    returnMode -
    693    0 model and solver untouched - babModel updated
    694    1 model updated - just with solution basis etc
    695    2 model updated i.e. as babModel (babModel NULL) (only use without preprocessing!)
     738
     739/*
     740  The only other solver that's ever been used is cplex, and the use is very
     741  limited -- do the root with clp and all the cbc smarts, then give the
     742  problem over to cplex to finish. Although the defines can be read in some
     743  places to allow other options, nothing's been tested and success is
     744  unlikely.
     745
     746  CBC_OTHER_SOLVER == 1 is cplex.
    696747*/
    697 void
    698 CbcSolver::updateModel(ClpSimplex * model2, int returnMode)
    699 {
    700     if (!returnMode)
    701         return;
    702     if (returnMode == 2 && babModel_)
    703         model_ = *babModel_;
    704     if (model2) {
    705         // Only continuous valid
    706         // update with basis etc
    707         // map states
    708         /* clp status
    709            -1 - unknown e.g. before solve or if postSolve says not optimal
    710            0 - optimal
    711            1 - primal infeasible
    712            2 - dual infeasible
    713            3 - stopped on iterations or time
    714            4 - stopped due to errors
    715            5 - stopped by event handler (virtual int ClpEventHandler::event()) */
    716         /* cbc status
    717            -1 before branchAndBound
    718            0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
    719            (or check value of best solution)
    720            1 stopped - on maxnodes, maxsols, maxtime
    721            2 difficulties so run was abandoned
    722            (5 event user programmed event occurred) */
    723         /* clp secondary status of problem - may get extended
    724            0 - none
    725            1 - primal infeasible because dual limit reached OR probably primal
    726            infeasible but can't prove it (main status 4)
    727            2 - scaled problem optimal - unscaled problem has primal infeasibilities
    728            3 - scaled problem optimal - unscaled problem has dual infeasibilities
    729            4 - scaled problem optimal - unscaled problem has primal and dual infeasibilities
    730            5 - giving up in primal with flagged variables
    731            6 - failed due to empty problem check
    732            7 - postSolve says not optimal
    733            8 - failed due to bad element check
    734            9 - status was 3 and stopped on time
    735            100 up - translation of enum from ClpEventHandler
    736         */
    737         /* cbc secondary status of problem
    738            -1 unset (status_ will also be -1)
    739            0 search completed with solution
    740            1 linear relaxation not feasible (or worse than cutoff)
    741            2 stopped on gap
    742            3 stopped on nodes
    743            4 stopped on time
    744            5 stopped on user event
    745            6 stopped on solutions
    746            7 linear relaxation unbounded
    747         */
    748         int iStatus = model2->status();
    749         int iStatus2 = model2->secondaryStatus();
    750         if (iStatus == 0) {
    751             iStatus2 = 0;
    752         } else if (iStatus == 1) {
    753             iStatus = 0;
    754             iStatus2 = 1; // say infeasible
    755         } else if (iStatus == 2) {
    756             iStatus = 0;
    757             iStatus2 = 7; // say unbounded
    758         } else if (iStatus == 3) {
    759             iStatus = 1;
    760             if (iStatus2 == 9)
    761                 iStatus2 = 4;
    762             else
    763                 iStatus2 = 3; // Use nodes - as closer than solutions
    764         } else if (iStatus == 4) {
    765             iStatus = 2; // difficulties
    766             iStatus2 = 0;
    767         }
    768         model_.setProblemStatus(iStatus);
    769         model_.setSecondaryStatus(iStatus2);
    770         OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model_.solver());
    771         ClpSimplex * lpSolver = clpSolver->getModelPtr();
    772         if (model2 != lpSolver) {
    773             lpSolver->moveInfo(*model2);
    774         }
    775         clpSolver->setWarmStart(NULL); // synchronize bases
    776         if (originalSolver_) {
    777             ClpSimplex * lpSolver2 = originalSolver_->getModelPtr();
    778             assert (model2 != lpSolver2);
    779             lpSolver2->moveInfo(*model2);
    780             originalSolver_->setWarmStart(NULL); // synchronize bases
    781         }
    782     } else if (returnMode == 1) {
    783         OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (model_.solver());
    784         ClpSimplex * lpSolver = clpSolver->getModelPtr();
    785         if (babModel_) {
    786             model_.moveInfo(*babModel_);
    787             int numberColumns = babModel_->getNumCols();
    788             if (babModel_->bestSolution())
    789                 model_.setBestSolution(babModel_->bestSolution(), numberColumns, babModel_->getMinimizationObjValue());
    790             OsiClpSolverInterface * clpSolver1 = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver());
    791             ClpSimplex * lpSolver1 = clpSolver1->getModelPtr();
    792             if (lpSolver1 != lpSolver && model_.bestSolution()) {
    793                 lpSolver->moveInfo(*lpSolver1);
    794             }
    795         }
    796         clpSolver->setWarmStart(NULL); // synchronize bases
    797     }
    798     if (returnMode == 2) {
    799         delete babModel_;
    800         babModel_ = NULL;
    801     }
    802 }
    803 // Stop now stuff (base class)
    804 CbcStopNow::CbcStopNow()
    805 {
    806 }
    807 CbcStopNow::~CbcStopNow()
    808 {
    809 }
    810 // Copy constructor
    811 CbcStopNow::CbcStopNow ( const CbcStopNow & )
    812 {
    813 }
    814 // Assignment operator
    815 CbcStopNow &
    816 CbcStopNow::operator=(const CbcStopNow & rhs)
    817 {
    818     if (this != &rhs) {
    819     }
    820     return *this;
    821 }
    822 // Clone
    823 CbcStopNow *
    824 CbcStopNow::clone() const
    825 {
    826     return new CbcStopNow(*this);
    827 }
    828 #ifndef NEW_STYLE_SOLVER
    829 #define NEW_STYLE_SOLVER 0
    830 #endif
     748
    831749#ifdef CPX_KEEP_RESULTS
    832750#define CBC_OTHER_SOLVER 1
    833751#endif
     752
    834753#ifdef COIN_HAS_CPX
    835754#include "OsiCpxSolverInterface.hpp"
    836755#endif
     756
    837757#ifdef CBC_OTHER_SOLVER
    838758#if CBC_OTHER_SOLVER==1
    839759#include "OsiCpxSolverInterface.hpp"
    840760#endif
    841 #undef NEW_STYLE_SOLVER
    842 #define NEW_STYLE_SOLVER 0
    843 #endif
     761#endif
     762
    844763#ifdef COIN_HAS_ASL
    845764#include "Cbc_ampl.h"
    846765#endif
     766
    847767static double totalTime = 0.0;
    848768static void statistics(ClpSimplex * originalModel, ClpSimplex * model);
     
    850770                        std::string & check);
    851771static void generateCode(CbcModel * model, const char * fileName, int type, int preProcess);
    852 //#ifdef NDEBUG
    853 //#undef NDEBUG
    854 //#endif
    855 // define (probably dummy fake main programs for UserClp and UserCbc
     772
     773// dummy fake main programs for UserClp and UserCbc
    856774void fakeMain (ClpSimplex & model, OsiSolverInterface & osiSolver, CbcModel & babSolver);
    857775void fakeMain2 (ClpSimplex & model, OsiClpSolverInterface & osiSolver, int options);
    858776
    859777// Allow for interrupts
    860 // But is this threadsafe ? (so switched off by option)
     778// But is this threadsafe? (so switched off by option)
    861779
    862780#include "CoinSignal.hpp"
     
    872790    }
    873791}
     792
    874793//#define CBC_SIG_TRAP
    875794#ifdef CBC_SIG_TRAP
     
    882801}
    883802#endif
    884 #if 0
    885 /* Updates model_ from babModel_ according to returnMode
    886    returnMode -
    887    0 model and solver untouched
    888    1 model updated - just with solution basis etc
    889 */
    890 static void updateModel(CbcModel & model_, int returnMode)
    891 {
    892     if (!returnMode)
    893         return;
    894     assert (returnMode == 1);
    895 }
    896 #endif
     803
    897804int CbcOrClpRead_mode = 1;
    898805FILE * CbcOrClpReadCommand = stdin;
    899806extern int CbcOrClpEnvironmentIndex;
    900807static bool noPrinting = false;
     808
    901809#ifndef CBC_OTHER_SOLVER
    902 #if NEW_STYLE_SOLVER
    903 int * CbcSolver::analyze(OsiClpSolverInterface * solverMod, int & numberChanged, double & increment,
    904                          bool changeInt,  CoinMessageHandler * generalMessageHandler)
    905 #else
    906810static int * analyze(OsiClpSolverInterface * solverMod, int & numberChanged, double & increment,
    907811                     bool changeInt,  CoinMessageHandler * generalMessageHandler)
    908 #endif
    909812{
    910 #if NEW_STYLE_SOLVER==0
    911813    bool noPrinting_ = noPrinting;
    912 #endif
    913814    OsiSolverInterface * solver = solverMod->clone();
    914815    char generalPrint[200];
     
    12081109    }
    12091110}
    1210 #endif
    1211 
     1111#endif  // ifndef CBC_OTHER_SOLVER
    12121112
    12131113#ifdef COIN_HAS_LINK
     
    17101610    }
    17111611}
    1712 #if NEW_STYLE_SOLVER
    1713 // Fills in original solution (coinModel length)
    1714 static void
    1715 afterKnapsack(const CoinModel & coinModel2, const int * whichColumn, const int * knapsackStart,
    1716               const int * knapsackRow, int numberKnapsack,
    1717               const double * knapsackSolution, double * solution, int logLevel)
    1718 {
    1719     CoinModel coinModel = coinModel2;
    1720     int numberColumns = coinModel.numberColumns();
    1721     int iColumn;
    1722     // associate all columns to stop possible error messages
    1723     for (iColumn = 0; iColumn < numberColumns; iColumn++) {
    1724         coinModel.associateElement(coinModel.columnName(iColumn), 1.0);
    1725     }
    1726     CoinZeroN(solution, numberColumns);
    1727     int nCol = knapsackStart[0];
    1728     for (iColumn = 0; iColumn < nCol; iColumn++) {
    1729         int jColumn = whichColumn[iColumn];
    1730         solution[jColumn] = knapsackSolution[iColumn];
    1731     }
    1732     int * buildRow = new int [numberColumns]; // wild overkill
    1733     double * buildElement = new double [numberColumns];
    1734     int iKnapsack;
    1735     for (iKnapsack = 0; iKnapsack < numberKnapsack; iKnapsack++) {
    1736         int k = -1;
    1737         double value = 0.0;
    1738         for (iColumn = knapsackStart[iKnapsack]; iColumn < knapsackStart[iKnapsack+1]; iColumn++) {
    1739             if (knapsackSolution[iColumn] > 1.0e-5) {
    1740                 if (k >= 0) {
    1741                     printf("Two nonzero values for knapsack %d at (%d,%g) and (%d,%g)\n", iKnapsack,
    1742                            k, knapsackSolution[k], iColumn, knapsackSolution[iColumn]);
    1743                     abort();
    1744                 }
    1745                 k = iColumn;
    1746                 value = floor(knapsackSolution[iColumn] + 0.5);
    1747                 assert (fabs(value - knapsackSolution[iColumn]) < 1.0e-5);
    1748             }
    1749         }
    1750         if (k >= 0) {
    1751             int iRow = knapsackRow[iKnapsack];
    1752             int nCreate = 10000;
    1753             int nel = coinModel.expandKnapsack(iRow, nCreate, NULL, NULL, buildRow, buildElement, k - knapsackStart[iKnapsack]);
    1754             assert (nel);
    1755             if (logLevel > 0)
    1756                 printf("expanded column %d in knapsack %d has %d nonzero entries:\n",
    1757                        k - knapsackStart[iKnapsack], iKnapsack, nel);
    1758             for (int i = 0; i < nel; i++) {
    1759                 int jColumn = buildRow[i];
    1760                 double value = buildElement[i];
    1761                 if (logLevel > 0)
    1762                     printf("%d - original %d has value %g\n", i, jColumn, value);
    1763                 solution[jColumn] = value;
    1764             }
    1765         }
    1766     }
    1767     delete [] buildRow;
    1768     delete [] buildElement;
    1769 #if 0
    1770     for (iColumn = 0; iColumn < numberColumns; iColumn++) {
    1771         if (solution[iColumn] > 1.0e-5 && coinModel.isInteger(iColumn))
    1772             printf("%d %g\n", iColumn, solution[iColumn]);
    1773     }
    1774 #endif
    1775 }
    1776 #endif
    1777 #endif
    1778 #if 0
    1779 static int outDupRow(OsiSolverInterface * solver)
    1780 {
    1781     CglDuplicateRow dupCuts(solver);
    1782     CglTreeInfo info;
    1783     info.level = 0;
    1784     info.pass = 0;
    1785     int numberRows = solver->getNumRows();
    1786     info.formulation_rows = numberRows;
    1787     info.inTree = false;
    1788     info.strengthenRow = NULL;
    1789     info.pass = 0;
    1790     OsiCuts cs;
    1791     dupCuts.generateCuts(*solver, cs, info);
    1792     const int * duplicate = dupCuts.duplicate();
    1793     // Get rid of duplicate rows
    1794     int * which = new int[numberRows];
    1795     int numberDrop = 0;
    1796     for (int iRow = 0; iRow < numberRows; iRow++) {
    1797         if (duplicate[iRow] == -2 || duplicate[iRow] >= 0)
    1798             which[numberDrop++] = iRow;
    1799     }
    1800     if (numberDrop) {
    1801         solver->deleteRows(numberDrop, which);
    1802     }
    1803     delete [] which;
    1804     // see if we have any column cuts
    1805     int numberColumnCuts = cs.sizeColCuts() ;
    1806     const double * columnLower = solver->getColLower();
    1807     const double * columnUpper = solver->getColUpper();
    1808     for (int k = 0; k < numberColumnCuts; k++) {
    1809         OsiColCut * thisCut = cs.colCutPtr(k) ;
    1810         const CoinPackedVector & lbs = thisCut->lbs() ;
    1811         const CoinPackedVector & ubs = thisCut->ubs() ;
    1812         int j ;
    1813         int n ;
    1814         const int * which ;
    1815         const double * values ;
    1816         n = lbs.getNumElements() ;
    1817         which = lbs.getIndices() ;
    1818         values = lbs.getElements() ;
    1819         for (j = 0; j < n; j++) {
    1820             int iColumn = which[j] ;
    1821             if (values[j] > columnLower[iColumn])
    1822                 solver->setColLower(iColumn, values[j]) ;
    1823         }
    1824         n = ubs.getNumElements() ;
    1825         which = ubs.getIndices() ;
    1826         values = ubs.getElements() ;
    1827         for (j = 0; j < n; j++) {
    1828             int iColumn = which[j] ;
    1829             if (values[j] < columnUpper[iColumn])
    1830                 solver->setColUpper(iColumn, values[j]) ;
    1831         }
    1832     }
    1833     return numberDrop;
    1834 }
    1835 #endif
     1612#endif  //COIN_HAS_LINK
     1613
     1614/*
     1615  Debug checks on special ordered sets.
     1616*/
    18361617#ifdef COIN_DEVELOP
    18371618void checkSOS(CbcModel * babModel, const OsiSolverInterface * solver)
     
    19301711        }
    19311712    }
    1932 #endif
     1713#endif  // COIN_DEVELOP
    19331714}
    1934 #if NEW_STYLE_SOLVER==0
     1715
     1716static int dummyCallBack(CbcModel * /*model*/, int /*whereFrom*/)
     1717{
     1718    return 0;
     1719}
     1720
     1721/*
     1722  Various overloads of callCbc1, in rough order, followed by the main definition.
     1723*/
     1724
     1725int callCbc1(const std::string input2, CbcModel & babSolver)
     1726{
     1727    char * input3 = CoinStrdup(input2.c_str());
     1728    int returnCode = callCbc1(input3, babSolver);
     1729    free(input3);
     1730    return returnCode;
     1731}
     1732
     1733int callCbc1(const char * input2, CbcModel & model)
     1734{
     1735    return callCbc1(input2, model, dummyCallBack);
     1736}
     1737
     1738int callCbc1(const std::string input2, CbcModel & babSolver, int callBack(CbcModel * currentSolver, int whereFrom))
     1739{
     1740    char * input3 = CoinStrdup(input2.c_str());
     1741    int returnCode = callCbc1(input3, babSolver, callBack);
     1742    free(input3);
     1743    return returnCode;
     1744}
     1745
    19351746int callCbc1(const char * input2, CbcModel & model, int callBack(CbcModel * currentSolver, int whereFrom))
    19361747{
     
    19901801    return returnCode;
    19911802}
    1992 int callCbc1(const std::string input2, CbcModel & babSolver)
    1993 {
    1994     char * input3 = CoinStrdup(input2.c_str());
    1995     int returnCode = callCbc1(input3, babSolver);
    1996     free(input3);
    1997     return returnCode;
    1998 }
     1803
     1804
    19991805int callCbc(const char * input2, CbcModel & babSolver)
    20001806{
     
    20021808    return callCbc1(input2, babSolver);
    20031809}
     1810
    20041811int callCbc(const std::string input2, CbcModel & babSolver)
    20051812{
     
    20101817    return returnCode;
    20111818}
     1819
    20121820int callCbc(const char * input2, OsiClpSolverInterface& solver1)
    20131821{
     
    20151823    return callCbc(input2, model);
    20161824}
     1825
    20171826int callCbc(const char * input2)
    20181827{
     
    20221831    }
    20231832}
     1833
    20241834int callCbc(const std::string input2, OsiClpSolverInterface& solver1)
    20251835{
     
    20291839    return returnCode;
    20301840}
     1841
    20311842int callCbc(const std::string input2)
    20321843{
     
    20371848    return returnCode;
    20381849}
    2039 static int dummyCallBack(CbcModel * /*model*/, int /*whereFrom*/)
    2040 {
    2041     return 0;
    2042 }
     1850
     1851#define CBCMAXPARAMETERS 200
     1852static CbcOrClpParam parameters[CBCMAXPARAMETERS];
     1853static int numberParameters = 0 ;
     1854
     1855int CbcClpUnitTest (const CbcModel & saveModel,
     1856                    std::string& dirMiplib, int testSwitch,
     1857                    double * stuff);
     1858
    20431859int CbcMain1 (int argc, const char *argv[],
    20441860              CbcModel  & model)
     
    20461862    return CbcMain1(argc, argv, model, dummyCallBack);
    20471863}
    2048 int callCbc1(const std::string input2, CbcModel & babSolver, int callBack(CbcModel * currentSolver, int whereFrom))
    2049 {
    2050     char * input3 = CoinStrdup(input2.c_str());
    2051     int returnCode = callCbc1(input3, babSolver, callBack);
    2052     free(input3);
    2053     return returnCode;
    2054 }
    2055 int callCbc1(const char * input2, CbcModel & model)
    2056 {
    2057     return callCbc1(input2, model, dummyCallBack);
    2058 }
    2059 int CbcMain (int argc, const char *argv[],
    2060              CbcModel  & model)
    2061 {
    2062     CbcMain0(model);
    2063     return CbcMain1(argc, argv, model);
    2064 }
    2065 #define CBCMAXPARAMETERS 200
    2066 static CbcOrClpParam parameters[CBCMAXPARAMETERS];
    2067 static int numberParameters = 0 ;
    2068 
    2069 
    2070 void CbcMain0 (CbcModel  & model)
    2071 {
    2072 #ifndef CBC_OTHER_SOLVER
    2073     OsiClpSolverInterface * originalSolver = dynamic_cast<OsiClpSolverInterface *> (model.solver());
    2074 #elif CBC_OTHER_SOLVER==1
    2075     OsiCpxSolverInterface * originalSolver = dynamic_cast<OsiCpxSolverInterface *> (model.solver());
    2076     // Dummy solvers
    2077     OsiClpSolverInterface dummySolver;
    2078     ClpSimplex * lpSolver = dummySolver.getModelPtr();
    2079     OsiCpxSolverInterface * clpSolver = originalSolver;
    2080 #endif
    2081     assert (originalSolver);
    2082     CoinMessageHandler * generalMessageHandler = originalSolver->messageHandler();
    2083     generalMessageHandler->setPrefix(true);
    2084 #ifndef CBC_OTHER_SOLVER
    2085     OsiSolverInterface * solver = model.solver();
    2086     OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver);
    2087     ClpSimplex * lpSolver = clpSolver->getModelPtr();
    2088     lpSolver->setPerturbation(50);
    2089     lpSolver->messageHandler()->setPrefix(false);
    2090 #endif
    2091     establishParams(numberParameters, parameters) ;
    2092     const char dirsep =  CoinFindDirSeparator();
    2093     std::string directory;
    2094     std::string dirSample;
    2095     std::string dirNetlib;
    2096     std::string dirMiplib;
    2097     if (dirsep == '/') {
    2098         directory = "./";
    2099         dirSample = "../../Data/Sample/";
    2100         dirNetlib = "../../Data/Netlib/";
    2101         dirMiplib = "../../Data/miplib3/";
    2102     } else {
    2103         directory = ".\\";
    2104         dirSample = "..\\..\\..\\..\\Data\\Sample\\";
    2105         dirNetlib = "..\\..\\..\\..\\Data\\Netlib\\";
    2106         dirMiplib = "..\\..\\..\\..\\Data\\miplib3\\";
    2107     }
    2108     std::string defaultDirectory = directory;
    2109     std::string importFile = "";
    2110     std::string exportFile = "default.mps";
    2111     std::string importBasisFile = "";
    2112     std::string importPriorityFile = "";
    2113     std::string debugFile = "";
    2114     std::string printMask = "";
    2115     std::string exportBasisFile = "default.bas";
    2116     std::string saveFile = "default.prob";
    2117     std::string restoreFile = "default.prob";
    2118     std::string solutionFile = "stdout";
    2119     std::string solutionSaveFile = "solution.file";
    2120     int doIdiot = -1;
    2121     int outputFormat = 2;
    2122     int substitution = 3;
    2123     int dualize = 3;
    2124     int preSolve = 5;
    2125     int doSprint = -1;
    2126     int testOsiParameters = -1;
    2127     parameters[whichParam(CLP_PARAM_ACTION_BASISIN, numberParameters, parameters)].setStringValue(importBasisFile);
    2128     parameters[whichParam(CBC_PARAM_ACTION_PRIORITYIN, numberParameters, parameters)].setStringValue(importPriorityFile);
    2129     parameters[whichParam(CLP_PARAM_ACTION_BASISOUT, numberParameters, parameters)].setStringValue(exportBasisFile);
    2130     parameters[whichParam(CLP_PARAM_ACTION_DEBUG, numberParameters, parameters)].setStringValue(debugFile);
    2131     parameters[whichParam(CLP_PARAM_ACTION_PRINTMASK, numberParameters, parameters)].setStringValue(printMask);
    2132     parameters[whichParam(CLP_PARAM_ACTION_DIRECTORY, numberParameters, parameters)].setStringValue(directory);
    2133     parameters[whichParam(CLP_PARAM_ACTION_DIRSAMPLE, numberParameters, parameters)].setStringValue(dirSample);
    2134     parameters[whichParam(CLP_PARAM_ACTION_DIRNETLIB, numberParameters, parameters)].setStringValue(dirNetlib);
    2135     parameters[whichParam(CBC_PARAM_ACTION_DIRMIPLIB, numberParameters, parameters)].setStringValue(dirMiplib);
    2136     parameters[whichParam(CLP_PARAM_DBL_DUALBOUND, numberParameters, parameters)].setDoubleValue(lpSolver->dualBound());
    2137     parameters[whichParam(CLP_PARAM_DBL_DUALTOLERANCE, numberParameters, parameters)].setDoubleValue(lpSolver->dualTolerance());
    2138     parameters[whichParam(CLP_PARAM_ACTION_EXPORT, numberParameters, parameters)].setStringValue(exportFile);
    2139     parameters[whichParam(CLP_PARAM_INT_IDIOT, numberParameters, parameters)].setIntValue(doIdiot);
    2140     parameters[whichParam(CLP_PARAM_ACTION_IMPORT, numberParameters, parameters)].setStringValue(importFile);
    2141     parameters[whichParam(CLP_PARAM_DBL_PRESOLVETOLERANCE, numberParameters, parameters)].setDoubleValue(1.0e-8);
    2142     int slog = whichParam(CLP_PARAM_INT_SOLVERLOGLEVEL, numberParameters, parameters);
    2143     int log = whichParam(CLP_PARAM_INT_LOGLEVEL, numberParameters, parameters);
    2144     parameters[slog].setIntValue(1);
    2145     clpSolver->messageHandler()->setLogLevel(1) ;
    2146     model.messageHandler()->setLogLevel(1);
    2147     lpSolver->setLogLevel(1);
    2148     parameters[log].setIntValue(1);
    2149     parameters[whichParam(CLP_PARAM_INT_MAXFACTOR, numberParameters, parameters)].setIntValue(lpSolver->factorizationFrequency());
    2150     parameters[whichParam(CLP_PARAM_INT_MAXITERATION, numberParameters, parameters)].setIntValue(lpSolver->maximumIterations());
    2151     parameters[whichParam(CLP_PARAM_INT_OUTPUTFORMAT, numberParameters, parameters)].setIntValue(outputFormat);
    2152     parameters[whichParam(CLP_PARAM_INT_PRESOLVEPASS, numberParameters, parameters)].setIntValue(preSolve);
    2153     parameters[whichParam(CLP_PARAM_INT_PERTVALUE, numberParameters, parameters)].setIntValue(lpSolver->perturbation());
    2154     parameters[whichParam(CLP_PARAM_DBL_PRIMALTOLERANCE, numberParameters, parameters)].setDoubleValue(lpSolver->primalTolerance());
    2155     parameters[whichParam(CLP_PARAM_DBL_PRIMALWEIGHT, numberParameters, parameters)].setDoubleValue(lpSolver->infeasibilityCost());
    2156     parameters[whichParam(CLP_PARAM_ACTION_RESTORE, numberParameters, parameters)].setStringValue(restoreFile);
    2157     parameters[whichParam(CLP_PARAM_ACTION_SAVE, numberParameters, parameters)].setStringValue(saveFile);
    2158     //parameters[whichParam(CLP_PARAM_DBL_TIMELIMIT,numberParameters,parameters)].setDoubleValue(1.0e8);
    2159     parameters[whichParam(CBC_PARAM_DBL_TIMELIMIT_BAB, numberParameters, parameters)].setDoubleValue(1.0e8);
    2160     parameters[whichParam(CLP_PARAM_ACTION_SOLUTION, numberParameters, parameters)].setStringValue(solutionFile);
    2161     parameters[whichParam(CLP_PARAM_ACTION_SAVESOL, numberParameters, parameters)].setStringValue(solutionSaveFile);
    2162     parameters[whichParam(CLP_PARAM_INT_SPRINT, numberParameters, parameters)].setIntValue(doSprint);
    2163     parameters[whichParam(CLP_PARAM_INT_SUBSTITUTION, numberParameters, parameters)].setIntValue(substitution);
    2164     parameters[whichParam(CLP_PARAM_INT_DUALIZE, numberParameters, parameters)].setIntValue(dualize);
    2165     model.setNumberBeforeTrust(10);
    2166     parameters[whichParam(CBC_PARAM_INT_NUMBERBEFORE, numberParameters, parameters)].setIntValue(5);
    2167     parameters[whichParam(CBC_PARAM_INT_MAXNODES, numberParameters, parameters)].setIntValue(model.getMaximumNodes());
    2168     model.setNumberStrong(5);
    2169     parameters[whichParam(CBC_PARAM_INT_STRONGBRANCHING, numberParameters, parameters)].setIntValue(model.numberStrong());
    2170     parameters[whichParam(CBC_PARAM_DBL_INFEASIBILITYWEIGHT, numberParameters, parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcInfeasibilityWeight));
    2171     parameters[whichParam(CBC_PARAM_DBL_INTEGERTOLERANCE, numberParameters, parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcIntegerTolerance));
    2172     parameters[whichParam(CBC_PARAM_DBL_INCREMENT, numberParameters, parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcCutoffIncrement));
    2173     parameters[whichParam(CBC_PARAM_INT_TESTOSI, numberParameters, parameters)].setIntValue(testOsiParameters);
    2174     parameters[whichParam(CBC_PARAM_INT_FPUMPTUNE, numberParameters, parameters)].setIntValue(1003);
    2175     initialPumpTune = 1003;
    2176 #ifdef CBC_THREAD
    2177     parameters[whichParam(CBC_PARAM_INT_THREADS, numberParameters, parameters)].setIntValue(0);
    2178 #endif
    2179     // Set up likely cut generators and defaults
    2180     parameters[whichParam(CBC_PARAM_STR_PREPROCESS, numberParameters, parameters)].setCurrentOption("sos");
    2181     parameters[whichParam(CBC_PARAM_INT_MIPOPTIONS, numberParameters, parameters)].setIntValue(1057);
    2182     parameters[whichParam(CBC_PARAM_INT_CUTPASSINTREE, numberParameters, parameters)].setIntValue(1);
    2183     parameters[whichParam(CBC_PARAM_INT_MOREMIPOPTIONS, numberParameters, parameters)].setIntValue(-1);
    2184     parameters[whichParam(CBC_PARAM_INT_MAXHOTITS, numberParameters, parameters)].setIntValue(100);
    2185     parameters[whichParam(CBC_PARAM_STR_CUTSSTRATEGY, numberParameters, parameters)].setCurrentOption("on");
    2186     parameters[whichParam(CBC_PARAM_STR_HEURISTICSTRATEGY, numberParameters, parameters)].setCurrentOption("on");
    2187     parameters[whichParam(CBC_PARAM_STR_NODESTRATEGY, numberParameters, parameters)].setCurrentOption("fewest");
    2188     parameters[whichParam(CBC_PARAM_STR_GOMORYCUTS, numberParameters, parameters)].setCurrentOption("ifmove");
    2189     parameters[whichParam(CBC_PARAM_STR_PROBINGCUTS, numberParameters, parameters)].setCurrentOption("ifmove");
    2190     parameters[whichParam(CBC_PARAM_STR_KNAPSACKCUTS, numberParameters, parameters)].setCurrentOption("ifmove");
    2191 #ifdef ZERO_HALF_CUTS
    2192     parameters[whichParam(CBC_PARAM_STR_ZEROHALFCUTS, numberParameters, parameters)].setCurrentOption("off");
    2193 #endif
    2194     parameters[whichParam(CBC_PARAM_STR_REDSPLITCUTS, numberParameters, parameters)].setCurrentOption("off");
    2195     parameters[whichParam(CBC_PARAM_STR_CLIQUECUTS, numberParameters, parameters)].setCurrentOption("ifmove");
    2196     parameters[whichParam(CBC_PARAM_STR_MIXEDCUTS, numberParameters, parameters)].setCurrentOption("ifmove");
    2197     parameters[whichParam(CBC_PARAM_STR_FLOWCUTS, numberParameters, parameters)].setCurrentOption("ifmove");
    2198     parameters[whichParam(CBC_PARAM_STR_TWOMIRCUTS, numberParameters, parameters)].setCurrentOption("root");
    2199     parameters[whichParam(CBC_PARAM_STR_LANDPCUTS, numberParameters, parameters)].setCurrentOption("off");
    2200     parameters[whichParam(CBC_PARAM_STR_RESIDCUTS, numberParameters, parameters)].setCurrentOption("off");
    2201     parameters[whichParam(CBC_PARAM_STR_ROUNDING, numberParameters, parameters)].setCurrentOption("on");
    2202     parameters[whichParam(CBC_PARAM_STR_FPUMP, numberParameters, parameters)].setCurrentOption("on");
    2203     parameters[whichParam(CBC_PARAM_STR_GREEDY, numberParameters, parameters)].setCurrentOption("on");
    2204     parameters[whichParam(CBC_PARAM_STR_COMBINE, numberParameters, parameters)].setCurrentOption("on");
    2205     parameters[whichParam(CBC_PARAM_STR_CROSSOVER2, numberParameters, parameters)].setCurrentOption("off");
    2206     parameters[whichParam(CBC_PARAM_STR_PIVOTANDCOMPLEMENT, numberParameters, parameters)].setCurrentOption("off");
    2207     parameters[whichParam(CBC_PARAM_STR_PIVOTANDFIX, numberParameters, parameters)].setCurrentOption("off");
    2208     parameters[whichParam(CBC_PARAM_STR_RANDROUND, numberParameters, parameters)].setCurrentOption("off");
    2209     parameters[whichParam(CBC_PARAM_STR_NAIVE, numberParameters, parameters)].setCurrentOption("off");
    2210     parameters[whichParam(CBC_PARAM_STR_RINS, numberParameters, parameters)].setCurrentOption("off");
    2211     parameters[whichParam(CBC_PARAM_STR_DINS, numberParameters, parameters)].setCurrentOption("off");
    2212     parameters[whichParam(CBC_PARAM_STR_RENS, numberParameters, parameters)].setCurrentOption("off");
    2213     parameters[whichParam(CBC_PARAM_STR_LOCALTREE, numberParameters, parameters)].setCurrentOption("off");
    2214     parameters[whichParam(CBC_PARAM_STR_COSTSTRATEGY, numberParameters, parameters)].setCurrentOption("off");
    2215 }
    2216 #endif
    2217 /* 1 - add heuristics to model
    2218    2 - do heuristics (and set cutoff and best solution)
    2219    3 - for miplib test so skip some
    2220 */
    2221 int CbcClpUnitTest (const CbcModel & saveModel,
    2222                     std::string& dirMiplib, int testSwitch,
    2223                     double * stuff);
    2224 #if NEW_STYLE_SOLVER
    2225 /* This takes a list of commands, does "stuff" and returns
    2226    returnMode -
    2227    0 model and solver untouched - babModel updated
    2228    1 model updated - just with solution basis etc
    2229    2 model updated i.e. as babModel (babModel NULL) (only use without preprocessing)
    2230 */
    2231 int
    2232 CbcSolver::solve(const char * input2, int returnMode)
    2233 {
    2234     char * input = CoinStrdup(input2);
    2235     int length = strlen(input);
    2236     bool blank = input[0] == '0';
    2237     int n = blank ? 0 : 1;
    2238     for (int i = 0; i < length; i++) {
    2239         if (blank) {
    2240             // look for next non blank
    2241             if (input[i] == ' ') {
    2242                 continue;
    2243             } else {
    2244                 n++;
    2245                 blank = false;
    2246             }
    2247         } else {
    2248             // look for next blank
    2249             if (input[i] != ' ') {
    2250                 continue;
    2251             } else {
    2252                 blank = true;
    2253             }
    2254         }
    2255     }
    2256     char ** argv = new char * [n+2];
    2257     argv[0] = CoinStrdup("cbc");
    2258     int i = 0;
    2259     while (input[i] == ' ')
    2260         i++;
    2261     for (int j = 0; j < n; j++) {
    2262         int saveI = i;
    2263         for (; i < length; i++) {
    2264             // look for next blank
    2265             if (input[i] != ' ') {
    2266                 continue;
    2267             } else {
    2268                 break;
    2269             }
    2270         }
    2271         char save = input[i];
    2272         input[i] = '\0';
    2273         argv[j+1] = CoinStrdup(input + saveI);
    2274         input[i] = save;
    2275         while (input[i] == ' ')
    2276             i++;
    2277     }
    2278     argv[n+1] = CoinStrdup("-quit");
    2279     free(input);
    2280     int returnCode = solve(n + 2, const_cast<const char **>(argv), returnMode);
    2281     for (int k = 0; k < n + 2; k++)
    2282         free(argv[k]);
    2283     delete [] argv;
    2284     return returnCode;
    2285 }
    2286 #endif
     1864
     1865
    22871866/* Meaning of whereFrom:
    22881867   1 after initial solve by dualsimplex etc
     
    22941873*/
    22951874
    2296 #if NEW_STYLE_SOLVER==0
    22971875int CbcMain1 (int argc, const char *argv[],
    22981876              CbcModel  & model,
    22991877              int callBack(CbcModel * currentSolver, int whereFrom))
    2300 #else
    2301 /* This takes a list of commands, does "stuff" and returns
    2302    returnMode -
    2303    0 model and solver untouched - babModel updated
    2304    1 model updated - just with solution basis etc
    2305    2 model updated i.e. as babModel (babModel NULL)
    2306 */
    2307 int
    2308 CbcSolver::solve (int argc, const char *argv[], int returnMode)
    2309 #endif
    23101878{
    2311 #if NEW_STYLE_SOLVER==0
    23121879    CbcOrClpParam * parameters_ = parameters;
    23131880    int numberParameters_ = numberParameters;
     
    23181885    int statusUserFunction_[1];
    23191886    int numberUserFunctions_ = 1; // to allow for ampl
    2320 #else
    2321     delete babModel_;
    2322     babModel_ = NULL;
    2323     CbcOrClpRead_mode = 1;
    2324     delete [] statusUserFunction_;
    2325     statusUserFunction_ = new int [numberUserFunctions_];
    2326     int iUser;
    2327 #endif
    23281887    // Statistics
    23291888    double statistics_seconds = 0.0, statistics_obj = 0.0;
     
    23651924    noPrinting = true;
    23661925#endif
    2367 #if NEW_STYLE_SOLVER==0
    23681926    bool noPrinting_ = noPrinting;
    2369 #endif
    23701927    // Say not in integer
    23711928    int integerStatus = -1;
     
    24391996        int * knapsackRow = NULL;
    24401997        int numberKnapsack = 0;
    2441 #if NEW_STYLE_SOLVER
    2442         int numberInputs = 0;
    2443         readMode_ = CbcOrClpRead_mode;
    2444         for (iUser = 0; iUser < numberUserFunctions_; iUser++) {
    2445             int status = userFunction_[iUser]->importData(this, argc, const_cast<char **>(argv));
    2446             if (status >= 0) {
    2447                 if (!status) {
    2448                     numberInputs++;
    2449                     statusUserFunction_[iUser] = 1;
    2450                     goodModel = true;
    2451                     solver = model_.solver();
    2452 #ifndef CBC_OTHER_SOLVER
    2453                     clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver);
    2454                     lpSolver = clpSolver->getModelPtr();
    2455 #endif
    2456                 } else {
    2457                     printf("Bad input from user function %s\n", userFunction_[iUser]->name().c_str());
    2458                     abort();
    2459                 }
    2460             }
    2461         }
    2462         if (numberInputs > 1) {
    2463             printf("Two or more user inputs!\n");
    2464             abort();
    2465         }
    2466         if (originalCoinModel_)
    2467             complicatedInteger = 1;
    2468         testOsiParameters = intValue(CBC_PARAM_INT_TESTOSI);
    2469         if (noPrinting_) {
    2470             model_.messageHandler()->setLogLevel(0);
    2471             setCbcOrClpPrinting(false);
    2472         }
    2473         CbcOrClpRead_mode = readMode_;
    2474 #endif
    24751998#ifdef COIN_HAS_ASL
    24761999        ampl_info info;
     
    38983421                                    babModel_->setSecondaryStatus(iStatus2);
    38993422                                }
    3900 #if NEW_STYLE_SOLVER
    3901                                 int returnCode = callBack_->callBack(&model_, 1);
    3902 #else
    39033423                                int returnCode = callBack(&model, 1);
    3904 #endif
    39053424                                if (returnCode) {
    39063425                                    // exit if user wants
    3907 #if NEW_STYLE_SOLVER
    3908                                     updateModel(model2, returnMode);
    3909 #else
    39103426                                    delete babModel_;
    39113427                                    babModel_ = NULL;
    3912 #endif
    39133428                                    return returnCode;
    39143429                                }
     
    39243439                                model2 = lpSolver;
    39253440                            }
    3926 #if NEW_STYLE_SOLVER
    3927                             updateModel(model2, returnMode);
    3928                             for (iUser = 0; iUser < numberUserFunctions_; iUser++) {
    3929                                 if (statusUserFunction_[iUser])
    3930                                     userFunction_[iUser]->exportSolution(this, 1);
    3931                             }
    3932 #endif
    39333441#ifdef COIN_HAS_ASL
    39343442                            if (statusUserFunction_[0]) {
     
    41503658                            }
    41513659                            // Actually do heuristics
    4152                             doHeuristics(&model_, 2, parameters_, numberParameters_, noPrinting_, initialPumpTune);
     3660                            doHeuristics(&model_,2,parameters_,
     3661                                numberParameters_,noPrinting_,initialPumpTune);
    41533662                            if (model_.bestSolution()) {
    41543663                                model_.setProblemStatus(1);
     
    41953704#endif
    41963705                            }
    4197 #if NEW_STYLE_SOLVER
    4198                             int returnCode = callBack_->callBack(&model_, 6);
    4199 #else
    42003706                            int returnCode = callBack(&model, 6);
    4201 #endif
    42023707                            if (returnCode) {
    42033708                                // exit if user wants
    4204 #if NEW_STYLE_SOLVER
    4205                                 updateModel(NULL, returnMode);
    4206 #else
    42073709                                delete babModel_;
    42083710                                babModel_ = NULL;
    4209 #endif
    42103711                                return returnCode;
    42113712                            }
     
    45084009                                model_.setSecondaryStatus(iStatus2);
    45094010                                si->setWarmStart(NULL);
    4510 #if NEW_STYLE_SOLVER
    4511                                 int returnCode = callBack_->callBack(&model_, 1);
    4512 #else
    45134011                                int returnCode = callBack(&model_, 1);
    4514 #endif
    45154012                                if (returnCode) {
    45164013                                    // exit if user wants
    4517 #if NEW_STYLE_SOLVER
    4518                                     updateModel(NULL, returnMode);
    4519 #else
    45204014                                    delete babModel_;
    45214015                                    babModel_ = NULL;
    4522 #endif
    45234016                                    return returnCode;
    45244017                                }
     
    49504443                                        solver2->setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ;
    49514444                                }
    4952 #if NEW_STYLE_SOLVER
    4953                                 if (!solver2) {
    4954                                     for (iUser = 0; iUser < numberUserFunctions_; iUser++) {
    4955                                         if (statusUserFunction_[iUser])
    4956                                             userFunction_[iUser]->exportSolution(this, 11, "infeasible/unbounded by pre-processing");
    4957                                     }
    4958                                 }
    4959 #endif
    49604445#ifdef COIN_HAS_ASL
    49614446                                if (!solver2 && statusUserFunction_[0]) {
     
    49934478                                    babModel_->setProblemStatus(-1);
    49944479                                }
    4995 #if NEW_STYLE_SOLVER
    4996                                 int returnCode = callBack_->callBack(babModel_, 2);
    4997 #else
    49984480                                int returnCode = callBack(babModel_, 2);
    4999 #endif
    50004481                                if (returnCode) {
    50014482                                    // exit if user wants
    5002 #if NEW_STYLE_SOLVER
    5003                                     updateModel(NULL, returnMode);
    5004 #else
    50054483                                    delete babModel_;
    50064484                                    babModel_ = NULL;
    5007 #endif
    50084485                                    return returnCode;
    50094486                                }
     
    51934670                            }
    51944671                            // Set up heuristics
    5195                             doHeuristics(babModel_, (!miplib) ? 1 : 10, parameters_, numberParameters_, noPrinting_, initialPumpTune);
     4672                            doHeuristics(&model_,((!miplib)?1:10),parameters_,
     4673                                numberParameters_,noPrinting_,initialPumpTune);
    51964674                            if (!miplib) {
    51974675                                if (parameters_[whichParam(CBC_PARAM_STR_LOCALTREE, numberParameters_, parameters_)].currentOptionAsInteger()) {
     
    55975075                            }
    55985076                            if (type == CBC_PARAM_ACTION_BAB) {
    5599 #if NEW_STYLE_SOLVER
    5600                                 {
    5601                                     CbcSolverUsefulData info;
    5602                                     bool useInfo = false;
    5603                                     for (iUser = 0; iUser < numberUserFunctions_; iUser++) {
    5604                                         if (statusUserFunction_[iUser]) {
    5605                                             userFunction_[iUser]->fillInformation(this, info);
    5606                                             useInfo = true;
    5607                                         }
    5608                                     }
    5609                                     if (useInfo) {
    5610                                         priorities = info.priorities_;
    5611                                         branchDirection = info.branchDirection_;
    5612                                         pseudoDown = info.pseudoDown_;
    5613                                         pseudoUp = info.pseudoUp_;
    5614                                         solutionIn = info.primalSolution_;
    5615                                         if (info.priorities_) {
    5616                                             int numberColumns = originalCoinModel_ ? originalCoinModel_->numberColumns() :
    5617                                                                 lpSolver->getNumCols();
    5618                                             prioritiesIn = reinterpret_cast<int *> (malloc(numberColumns * sizeof(int)));
    5619                                             memcpy(prioritiesIn, info.priorities_, numberColumns*sizeof(int));
    5620                                         }
    5621                                         sosPriority = info.sosPriority_;
    5622                                     }
    5623                                 }
    5624 #endif
    56255077#ifdef COIN_HAS_ASL
    56265078                                if (statusUserFunction_[0]) {
     
    65516003                                babModel_->setThreadMode(numberThreads / 100);
    65526004#endif
    6553 #if NEW_STYLE_SOLVER
    6554                                 int returnCode = callBack_->callBack(babModel_, 3);
    6555 #else
    65566005                                int returnCode = callBack(babModel_, 3);
    6557 #endif
    65586006                                if (returnCode) {
    65596007                                    // exit if user wants
    6560 #if NEW_STYLE_SOLVER
    6561                                     updateModel(NULL, returnMode);
    6562 #else
    65636008                                    delete babModel_;
    65646009                                    babModel_ = NULL;
    6565 #endif
    65666010                                    return returnCode;
    65676011                                }
     
    67666210                                printHistory("branch.log");
    67676211#endif
    6768 #if NEW_STYLE_SOLVER
    6769                                 returnCode = callBack_->callBack(babModel_, 4);
    6770 #else
    67716212                                returnCode = callBack(babModel_, 4);
    6772 #endif
    67736213                                if (returnCode) {
    67746214                                    // exit if user wants
    6775 #if NEW_STYLE_SOLVER
    6776                                     updateModel(NULL, returnMode);
    6777 #else
    67786215                                    model_.moveInfo(*babModel_);
    67796216                                    delete babModel_;
    67806217                                    babModel_ = NULL;
    6781 #endif
    67826218                                    return returnCode;
    67836219                                }
     
    71396575                                    }
    71406576                                    assert (saveSolver->isProvenOptimal());
    7141 #if NEW_STYLE_SOLVER==0
    71426577#ifndef CBC_OTHER_SOLVER
    71436578                                    // and original solver
     
    71616596                                    assert (originalSolver->isProvenOptimal());
    71626597#endif
    7163 #endif
    71646598                                    babModel_->assignSolver(saveSolver);
    71656599                                    memcpy(bestSolution, babModel_->solver()->getColSolution(), n*sizeof(double));
     
    71696603                                    memcpy(bestSolution, babModel_->solver()->getColSolution(), n*sizeof(double));
    71706604                                }
    7171 #if NEW_STYLE_SOLVER==0
    71726605                                if (returnMode == 1) {
    71736606                                    model_.deleteSolutions();
    71746607                                    model_.setBestSolution(bestSolution, n, babModel_->getMinimizationObjValue());
    71756608                                }
    7176 #endif
    71776609                                babModel_->deleteSolutions();
    71786610                                babModel_->setBestSolution(bestSolution, n, babModel_->getMinimizationObjValue());
    7179 #if NEW_STYLE_SOLVER==0
    71806611#ifndef CBC_OTHER_SOLVER
    71816612                                // and put back in very original solver
     
    72216652                                }
    72226653#endif
    7223 #endif
    72246654                                checkSOS(babModel_, babModel_->solver());
    72256655                            } else if (model_.bestSolution() && type == CBC_PARAM_ACTION_BAB && model_.getMinimizationObjValue() < 1.0e50 && preProcess) {
     
    72356665                                babModel_->setMinimizationObjValue(model_.getMinimizationObjValue());
    72366666                                memcpy(bestSolution, babModel_->solver()->getColSolution(), n*sizeof(double));
    7237 #if NEW_STYLE_SOLVER==0
    72386667#ifndef CBC_OTHER_SOLVER
    72396668                                // and put back in very original solver
     
    72576686                                    delete basis;
    72586687                                }
    7259 #endif
    72606688#endif
    72616689                            }
     
    73246752                                    << CoinMessageEol;
    73256753                                }
    7326 #if NEW_STYLE_SOLVER
    7327                                 int returnCode = callBack_->callBack(babModel_, 5);
    7328 #else
    73296754                                int returnCode = callBack(babModel_, 5);
    7330 #endif
    73316755                                if (returnCode) {
    73326756                                    // exit if user wants
    7333 #if NEW_STYLE_SOLVER
    7334                                     updateModel(NULL, returnMode);
    7335 #else
    73366757                                    model_.moveInfo(*babModel_);
    73376758                                    delete babModel_;
    73386759                                    babModel_ = NULL;
    7339 #endif
    73406760                                    return returnCode;
    73416761                                }
    7342 #if NEW_STYLE_SOLVER
    7343                                 if (bestSolution && numberKnapsack) {
    7344                                     // expanded knapsack
    7345                                     assert (originalCoinModel_);
    7346                                     // Fills in original solution (coinModel length - rest junk)
    7347                                     clpSolver = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver());
    7348                                     lpSolver = clpSolver->getModelPtr();
    7349                                     int numberColumns2 = lpSolver->numberColumns();
    7350                                     assert (numberColumns2 > originalCoinModel_->numberColumns());
    7351                                     double * primalSolution = new double [numberColumns2];
    7352                                     memset(primalSolution, 0, numberColumns2*sizeof(double));
    7353                                     afterKnapsack(saveTightenedModel,  whichColumn,  knapsackStart,
    7354                                                   knapsackRow,  numberKnapsack,
    7355                                                   lpSolver->primalColumnSolution(), primalSolution, 1);
    7356                                     memcpy(lpSolver->primalColumnSolution(), primalSolution, numberColumns2*sizeof(double));
    7357                                     delete [] primalSolution;
    7358                                 }
    7359                                 updateModel(NULL, returnMode);
    7360                                 for (iUser = 0; iUser < numberUserFunctions_; iUser++) {
    7361                                     if (statusUserFunction_[iUser])
    7362                                         userFunction_[iUser]->exportSolution(this, 2);
    7363                                 }
    7364 #endif
    7365 #ifdef COIN_HAS_ASL
    7366 #if NEW_STYLE_SOLVER
    7367                                 if (statusUserFunction_[0]) {
    7368                                     clpSolver = dynamic_cast< OsiClpSolverInterface*> (babModel_->solver());
    7369                                     lpSolver = clpSolver->getModelPtr();
    7370                                     double value = babModel_->getObjValue() * lpSolver->getObjSense();
    7371                                     char buf[300];
    7372                                     int pos = 0;
    7373                                     if (iStat == 0) {
    7374                                         if (babModel_->getObjValue() < 1.0e40) {
    7375                                             pos += sprintf(buf + pos, "optimal," );
    7376                                         } else {
    7377                                             // infeasible
    7378                                             iStat = 1;
    7379                                             pos += sprintf(buf + pos, "infeasible,");
    7380                                         }
    7381                                     } else if (iStat == 1) {
    7382                                         if (iStat2 != 6)
    7383                                             iStat = 3;
    7384                                         else
    7385                                             iStat = 4;
    7386                                         pos += sprintf(buf + pos, "stopped on %s,", minor[iStat2].c_str());
    7387                                     } else if (iStat == 2) {
    7388                                         iStat = 7;
    7389                                         pos += sprintf(buf + pos, "stopped on difficulties,");
    7390                                     } else if (iStat == 5) {
    7391                                         iStat = 3;
    7392                                         pos += sprintf(buf + pos, "stopped on ctrl-c,");
    7393                                     } else if (iStat == 6) {
    7394                                         // bab infeasible
    7395                                         pos += sprintf(buf + pos, "integer infeasible,");
    7396                                         iStat = 1;
    7397                                     } else {
    7398                                         pos += sprintf(buf + pos, "status unknown,");
    7399                                         iStat = 6;
    7400                                     }
    7401                                     info.problemStatus = iStat;
    7402                                     info.objValue = value;
    7403                                     if (babModel_->getObjValue() < 1.0e40) {
    7404                                         int precision = ampl_obj_prec();
    7405                                         if (precision > 0)
    7406                                             pos += sprintf(buf + pos, " objective %.*g", precision,
    7407                                                            value);
    7408                                         else
    7409                                             pos += sprintf(buf + pos, " objective %g", value);
    7410                                     }
    7411                                     sprintf(buf + pos, "\n%d nodes, %d iterations, %g seconds",
    7412                                             babModel_->getNodeCount(),
    7413                                             babModel_->getIterationCount(),
    7414                                             totalTime);
    7415                                     if (bestSolution) {
    7416                                         free(info.primalSolution);
    7417                                         if (!numberKnapsack) {
    7418                                             info.primalSolution = reinterpret_cast<double *> (malloc(n * sizeof(double)));
    7419                                             CoinCopyN(lpSolver->primalColumnSolution(), n, info.primalSolution);
    7420                                             int numberRows = lpSolver->numberRows();
    7421                                             free(info.dualSolution);
    7422                                             info.dualSolution = reinterpret_cast<double *> (malloc(numberRows * sizeof(double)));
    7423                                             CoinCopyN(lpSolver->dualRowSolution(), numberRows, info.dualSolution);
    7424                                         } else {
    7425                                             // expanded knapsack
    7426                                             info.dualSolution = NULL;
    7427                                             int numberColumns = saveCoinModel.numberColumns();
    7428                                             info.primalSolution = reinterpret_cast<double *> (malloc(numberColumns * sizeof(double)));
    7429                                             // Fills in original solution (coinModel length)
    7430                                             afterKnapsack(saveTightenedModel,  whichColumn,  knapsackStart,
    7431                                                           knapsackRow,  numberKnapsack,
    7432                                                           lpSolver->primalColumnSolution(), info.primalSolution, 1);
    7433                                         }
    7434                                     } else {
    7435                                         info.primalSolution = NULL;
    7436                                         info.dualSolution = NULL;
    7437                                     }
    7438                                     // put buffer into info
    7439                                     strcpy(info.buffer, buf);
    7440                                 }
    7441 #endif
    7442 #endif
    74436762                            } else {
    74446763                                std::cout << "Model strengthened - now has " << clpSolver->getNumRows()
     
    86737992                        }
    86747993#endif
    8675 #if NEW_STYLE_SOLVER
    8676                         if (goodModel) {
    8677                             std::string name = CoinReadGetString(argc, argv);
    8678                             if (name != "EOL") {
    8679                                 int length = name.size();
    8680                                 int percent = name.find('%');
    8681                                 std::string command = name;
    8682                                 std::string options = "";
    8683                                 if (percent<length && percent>0) {
    8684                                     command = name.substr(0, percent);
    8685                                     options = name.substr(percent + 1);
    8686                                 }
    8687                                 CbcUser * userCode = userFunction(command.c_str());
    8688                                 if (userCode)
    8689                                     userCode->solve(this, options.c_str());
    8690                             } else {
    8691                                 parameters_[iParam].printString();
    8692                             }
    8693                         }
    8694 #endif
    86957994                        break;
    86967995                    case CBC_PARAM_ACTION_USERCBC:
     
    92988597    //dmalloc_shutdown();
    92998598#endif
    9300 #if NEW_STYLE_SOLVER
    9301     updateModel(NULL, returnMode);
    9302     for (iUser = 0; iUser < numberUserFunctions_; iUser++) {
    9303         if (statusUserFunction_[iUser])
    9304             userFunction_[iUser]->exportData(this);
    9305     }
    9306     sprintf(generalPrint, "Total time %.2f", CoinCpuTime() - startTime_);
    9307 #else
    93088599    if (babModel_) {
    93098600        model_.moveInfo(*babModel_);
     
    93358626    model_.solver()->setWarmStart(NULL);
    93368627    sprintf(generalPrint, "Total time %.2f", CoinCpuTime() - time0);
    9337 #endif
    93388628    generalMessageHandler->message(CLP_GENERAL, generalMessages)
    93398629    << generalPrint
     
    93418631    return 0;
    93428632}
     8633
     8634
     8635
     8636int CbcMain (int argc, const char *argv[],
     8637             CbcModel  & model)
     8638{
     8639    CbcMain0(model);
     8640    return CbcMain1(argc, argv, model);
     8641}
     8642
     8643
     8644void CbcMain0 (CbcModel  & model)
     8645{
     8646#ifndef CBC_OTHER_SOLVER
     8647    OsiClpSolverInterface * originalSolver = dynamic_cast<OsiClpSolverInterface *> (model.solver());
     8648#elif CBC_OTHER_SOLVER==1
     8649    OsiCpxSolverInterface * originalSolver = dynamic_cast<OsiCpxSolverInterface *> (model.solver());
     8650    // Dummy solvers
     8651    OsiClpSolverInterface dummySolver;
     8652    ClpSimplex * lpSolver = dummySolver.getModelPtr();
     8653    OsiCpxSolverInterface * clpSolver = originalSolver;
     8654#endif
     8655    assert (originalSolver);
     8656    CoinMessageHandler * generalMessageHandler = originalSolver->messageHandler();
     8657    generalMessageHandler->setPrefix(true);
     8658#ifndef CBC_OTHER_SOLVER
     8659    OsiSolverInterface * solver = model.solver();
     8660    OsiClpSolverInterface * clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver);
     8661    ClpSimplex * lpSolver = clpSolver->getModelPtr();
     8662    lpSolver->setPerturbation(50);
     8663    lpSolver->messageHandler()->setPrefix(false);
     8664#endif
     8665    establishParams(numberParameters, parameters) ;
     8666    const char dirsep =  CoinFindDirSeparator();
     8667    std::string directory;
     8668    std::string dirSample;
     8669    std::string dirNetlib;
     8670    std::string dirMiplib;
     8671    if (dirsep == '/') {
     8672        directory = "./";
     8673        dirSample = "../../Data/Sample/";
     8674        dirNetlib = "../../Data/Netlib/";
     8675        dirMiplib = "../../Data/miplib3/";
     8676    } else {
     8677        directory = ".\\";
     8678        dirSample = "..\\..\\..\\..\\Data\\Sample\\";
     8679        dirNetlib = "..\\..\\..\\..\\Data\\Netlib\\";
     8680        dirMiplib = "..\\..\\..\\..\\Data\\miplib3\\";
     8681    }
     8682    std::string defaultDirectory = directory;
     8683    std::string importFile = "";
     8684    std::string exportFile = "default.mps";
     8685    std::string importBasisFile = "";
     8686    std::string importPriorityFile = "";
     8687    std::string debugFile = "";
     8688    std::string printMask = "";
     8689    std::string exportBasisFile = "default.bas";
     8690    std::string saveFile = "default.prob";
     8691    std::string restoreFile = "default.prob";
     8692    std::string solutionFile = "stdout";
     8693    std::string solutionSaveFile = "solution.file";
     8694    int doIdiot = -1;
     8695    int outputFormat = 2;
     8696    int substitution = 3;
     8697    int dualize = 3;
     8698    int preSolve = 5;
     8699    int doSprint = -1;
     8700    int testOsiParameters = -1;
     8701    parameters[whichParam(CLP_PARAM_ACTION_BASISIN, numberParameters, parameters)].setStringValue(importBasisFile);
     8702    parameters[whichParam(CBC_PARAM_ACTION_PRIORITYIN, numberParameters, parameters)].setStringValue(importPriorityFile);
     8703    parameters[whichParam(CLP_PARAM_ACTION_BASISOUT, numberParameters, parameters)].setStringValue(exportBasisFile);
     8704    parameters[whichParam(CLP_PARAM_ACTION_DEBUG, numberParameters, parameters)].setStringValue(debugFile);
     8705    parameters[whichParam(CLP_PARAM_ACTION_PRINTMASK, numberParameters, parameters)].setStringValue(printMask);
     8706    parameters[whichParam(CLP_PARAM_ACTION_DIRECTORY, numberParameters, parameters)].setStringValue(directory);
     8707    parameters[whichParam(CLP_PARAM_ACTION_DIRSAMPLE, numberParameters, parameters)].setStringValue(dirSample);
     8708    parameters[whichParam(CLP_PARAM_ACTION_DIRNETLIB, numberParameters, parameters)].setStringValue(dirNetlib);
     8709    parameters[whichParam(CBC_PARAM_ACTION_DIRMIPLIB, numberParameters, parameters)].setStringValue(dirMiplib);
     8710    parameters[whichParam(CLP_PARAM_DBL_DUALBOUND, numberParameters, parameters)].setDoubleValue(lpSolver->dualBound());
     8711    parameters[whichParam(CLP_PARAM_DBL_DUALTOLERANCE, numberParameters, parameters)].setDoubleValue(lpSolver->dualTolerance());
     8712    parameters[whichParam(CLP_PARAM_ACTION_EXPORT, numberParameters, parameters)].setStringValue(exportFile);
     8713    parameters[whichParam(CLP_PARAM_INT_IDIOT, numberParameters, parameters)].setIntValue(doIdiot);
     8714    parameters[whichParam(CLP_PARAM_ACTION_IMPORT, numberParameters, parameters)].setStringValue(importFile);
     8715    parameters[whichParam(CLP_PARAM_DBL_PRESOLVETOLERANCE, numberParameters, parameters)].setDoubleValue(1.0e-8);
     8716    int slog = whichParam(CLP_PARAM_INT_SOLVERLOGLEVEL, numberParameters, parameters);
     8717    int log = whichParam(CLP_PARAM_INT_LOGLEVEL, numberParameters, parameters);
     8718    parameters[slog].setIntValue(1);
     8719    clpSolver->messageHandler()->setLogLevel(1) ;
     8720    model.messageHandler()->setLogLevel(1);
     8721    lpSolver->setLogLevel(1);
     8722    parameters[log].setIntValue(1);
     8723    parameters[whichParam(CLP_PARAM_INT_MAXFACTOR, numberParameters, parameters)].setIntValue(lpSolver->factorizationFrequency());
     8724    parameters[whichParam(CLP_PARAM_INT_MAXITERATION, numberParameters, parameters)].setIntValue(lpSolver->maximumIterations());
     8725    parameters[whichParam(CLP_PARAM_INT_OUTPUTFORMAT, numberParameters, parameters)].setIntValue(outputFormat);
     8726    parameters[whichParam(CLP_PARAM_INT_PRESOLVEPASS, numberParameters, parameters)].setIntValue(preSolve);
     8727    parameters[whichParam(CLP_PARAM_INT_PERTVALUE, numberParameters, parameters)].setIntValue(lpSolver->perturbation());
     8728    parameters[whichParam(CLP_PARAM_DBL_PRIMALTOLERANCE, numberParameters, parameters)].setDoubleValue(lpSolver->primalTolerance());
     8729    parameters[whichParam(CLP_PARAM_DBL_PRIMALWEIGHT, numberParameters, parameters)].setDoubleValue(lpSolver->infeasibilityCost());
     8730    parameters[whichParam(CLP_PARAM_ACTION_RESTORE, numberParameters, parameters)].setStringValue(restoreFile);
     8731    parameters[whichParam(CLP_PARAM_ACTION_SAVE, numberParameters, parameters)].setStringValue(saveFile);
     8732    //parameters[whichParam(CLP_PARAM_DBL_TIMELIMIT,numberParameters,parameters)].setDoubleValue(1.0e8);
     8733    parameters[whichParam(CBC_PARAM_DBL_TIMELIMIT_BAB, numberParameters, parameters)].setDoubleValue(1.0e8);
     8734    parameters[whichParam(CLP_PARAM_ACTION_SOLUTION, numberParameters, parameters)].setStringValue(solutionFile);
     8735    parameters[whichParam(CLP_PARAM_ACTION_SAVESOL, numberParameters, parameters)].setStringValue(solutionSaveFile);
     8736    parameters[whichParam(CLP_PARAM_INT_SPRINT, numberParameters, parameters)].setIntValue(doSprint);
     8737    parameters[whichParam(CLP_PARAM_INT_SUBSTITUTION, numberParameters, parameters)].setIntValue(substitution);
     8738    parameters[whichParam(CLP_PARAM_INT_DUALIZE, numberParameters, parameters)].setIntValue(dualize);
     8739    model.setNumberBeforeTrust(10);
     8740    parameters[whichParam(CBC_PARAM_INT_NUMBERBEFORE, numberParameters, parameters)].setIntValue(5);
     8741    parameters[whichParam(CBC_PARAM_INT_MAXNODES, numberParameters, parameters)].setIntValue(model.getMaximumNodes());
     8742    model.setNumberStrong(5);
     8743    parameters[whichParam(CBC_PARAM_INT_STRONGBRANCHING, numberParameters, parameters)].setIntValue(model.numberStrong());
     8744    parameters[whichParam(CBC_PARAM_DBL_INFEASIBILITYWEIGHT, numberParameters, parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcInfeasibilityWeight));
     8745    parameters[whichParam(CBC_PARAM_DBL_INTEGERTOLERANCE, numberParameters, parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcIntegerTolerance));
     8746    parameters[whichParam(CBC_PARAM_DBL_INCREMENT, numberParameters, parameters)].setDoubleValue(model.getDblParam(CbcModel::CbcCutoffIncrement));
     8747    parameters[whichParam(CBC_PARAM_INT_TESTOSI, numberParameters, parameters)].setIntValue(testOsiParameters);
     8748    parameters[whichParam(CBC_PARAM_INT_FPUMPTUNE, numberParameters, parameters)].setIntValue(1003);
     8749    initialPumpTune = 1003;
     8750#ifdef CBC_THREAD
     8751    parameters[whichParam(CBC_PARAM_INT_THREADS, numberParameters, parameters)].setIntValue(0);
     8752#endif
     8753    // Set up likely cut generators and defaults
     8754    parameters[whichParam(CBC_PARAM_STR_PREPROCESS, numberParameters, parameters)].setCurrentOption("sos");
     8755    parameters[whichParam(CBC_PARAM_INT_MIPOPTIONS, numberParameters, parameters)].setIntValue(1057);
     8756    parameters[whichParam(CBC_PARAM_INT_CUTPASSINTREE, numberParameters, parameters)].setIntValue(1);
     8757    parameters[whichParam(CBC_PARAM_INT_MOREMIPOPTIONS, numberParameters, parameters)].setIntValue(-1);
     8758    parameters[whichParam(CBC_PARAM_INT_MAXHOTITS, numberParameters, parameters)].setIntValue(100);
     8759    parameters[whichParam(CBC_PARAM_STR_CUTSSTRATEGY, numberParameters, parameters)].setCurrentOption("on");
     8760    parameters[whichParam(CBC_PARAM_STR_HEURISTICSTRATEGY, numberParameters, parameters)].setCurrentOption("on");
     8761    parameters[whichParam(CBC_PARAM_STR_NODESTRATEGY, numberParameters, parameters)].setCurrentOption("fewest");
     8762    parameters[whichParam(CBC_PARAM_STR_GOMORYCUTS, numberParameters, parameters)].setCurrentOption("ifmove");
     8763    parameters[whichParam(CBC_PARAM_STR_PROBINGCUTS, numberParameters, parameters)].setCurrentOption("ifmove");
     8764    parameters[whichParam(CBC_PARAM_STR_KNAPSACKCUTS, numberParameters, parameters)].setCurrentOption("ifmove");
     8765#ifdef ZERO_HALF_CUTS
     8766    parameters[whichParam(CBC_PARAM_STR_ZEROHALFCUTS, numberParameters, parameters)].setCurrentOption("off");
     8767#endif
     8768    parameters[whichParam(CBC_PARAM_STR_REDSPLITCUTS, numberParameters, parameters)].setCurrentOption("off");
     8769    parameters[whichParam(CBC_PARAM_STR_CLIQUECUTS, numberParameters, parameters)].setCurrentOption("ifmove");
     8770    parameters[whichParam(CBC_PARAM_STR_MIXEDCUTS, numberParameters, parameters)].setCurrentOption("ifmove");
     8771    parameters[whichParam(CBC_PARAM_STR_FLOWCUTS, numberParameters, parameters)].setCurrentOption("ifmove");
     8772    parameters[whichParam(CBC_PARAM_STR_TWOMIRCUTS, numberParameters, parameters)].setCurrentOption("root");
     8773    parameters[whichParam(CBC_PARAM_STR_LANDPCUTS, numberParameters, parameters)].setCurrentOption("off");
     8774    parameters[whichParam(CBC_PARAM_STR_RESIDCUTS, numberParameters, parameters)].setCurrentOption("off");
     8775    parameters[whichParam(CBC_PARAM_STR_ROUNDING, numberParameters, parameters)].setCurrentOption("on");
     8776    parameters[whichParam(CBC_PARAM_STR_FPUMP, numberParameters, parameters)].setCurrentOption("on");
     8777    parameters[whichParam(CBC_PARAM_STR_GREEDY, numberParameters, parameters)].setCurrentOption("on");
     8778    parameters[whichParam(CBC_PARAM_STR_COMBINE, numberParameters, parameters)].setCurrentOption("on");
     8779    parameters[whichParam(CBC_PARAM_STR_CROSSOVER2, numberParameters, parameters)].setCurrentOption("off");
     8780    parameters[whichParam(CBC_PARAM_STR_PIVOTANDCOMPLEMENT, numberParameters, parameters)].setCurrentOption("off");
     8781    parameters[whichParam(CBC_PARAM_STR_PIVOTANDFIX, numberParameters, parameters)].setCurrentOption("off");
     8782    parameters[whichParam(CBC_PARAM_STR_RANDROUND, numberParameters, parameters)].setCurrentOption("off");
     8783    parameters[whichParam(CBC_PARAM_STR_NAIVE, numberParameters, parameters)].setCurrentOption("off");
     8784    parameters[whichParam(CBC_PARAM_STR_RINS, numberParameters, parameters)].setCurrentOption("off");
     8785    parameters[whichParam(CBC_PARAM_STR_DINS, numberParameters, parameters)].setCurrentOption("off");
     8786    parameters[whichParam(CBC_PARAM_STR_RENS, numberParameters, parameters)].setCurrentOption("off");
     8787    parameters[whichParam(CBC_PARAM_STR_LOCALTREE, numberParameters, parameters)].setCurrentOption("off");
     8788    parameters[whichParam(CBC_PARAM_STR_COSTSTRATEGY, numberParameters, parameters)].setCurrentOption("off");
     8789}
     8790
     8791/*
     8792  Routines to print statistics.
     8793*/
    93438794static void breakdown(const char * name, int numberLook, const double * region)
    93448795{
     
    96459096    breakdown("Objective", numberColumns, objective);
    96469097}
     9098
     9099
    96479100static bool maskMatches(const int * starts, char ** masks,
    96489101                        std::string & check)
     
    96659118    return false;
    96669119}
     9120
    96679121static void clean(char * temp)
    96689122{
     
    96729126    *put = '\0';
    96739127}
     9128
    96749129static void generateCode(CbcModel * /*model*/, const char * fileName, int type, int preProcess)
    96759130{
Note: See TracChangeset for help on using the changeset viewer.