Changeset 1386
 Timestamp:
 Dec 9, 2009 2:59:30 PM (11 years ago)
 Location:
 branches/sandbox/Cbc/src
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

branches/sandbox/Cbc/src/CbcSolver.cpp
r1383 r1386 52 52 #define CBCVERSION "2.4.01" 53 53 #endif 54 //#define ORBITAL55 #ifdef ORBITAL56 #include "CbcOrbital.hpp"57 #endif58 54 //#define USER_HAS_FAKE_CLP 59 55 //#define USER_HAS_FAKE_CBC 56 60 57 //#define CLP_MALLOC_STATISTICS 58 61 59 #ifdef CLP_MALLOC_STATISTICS 62 60 #include <malloc.h> … … 81 79 } 82 80 } 83 # ifdef DEBUG_MALLOC81 # ifdef DEBUG_MALLOC 84 82 void *p; 85 83 if (malloc_counts_on) … … 87 85 else 88 86 p = malloc(size); 89 # else87 # else 90 88 void * p = malloc(size); 91 # endif89 # endif 92 90 //char * xx = (char *) p; 93 91 //memset(xx,0,size); … … 98 96 void operator delete (void *p) throw() 99 97 { 100 # ifdef DEBUG_MALLOC98 # ifdef DEBUG_MALLOC 101 99 if (malloc_counts_on) 102 100 stolen_from_ekk_freeBase(p); 103 101 else 104 102 free(p); 105 # else103 # else 106 104 free(p); 107 # endif105 # endif 108 106 } 109 107 static void malloc_stats2() … … 119 117 // print results 120 118 } 121 #else 119 #else //CLP_MALLOC_STATISTICS 122 120 //void stolen_from_ekk_memory(void * dummy,int type) 123 121 //{ 124 122 //} 125 123 //bool malloc_counts_on=false; 126 #endif 124 #endif //CLP_MALLOC_STATISTICS 125 127 126 //#define DMALLOC 128 127 #ifdef DMALLOC 129 128 #include "dmalloc.h" 130 129 #endif 130 131 131 #ifdef WSSMP_BARRIER 132 132 #define FOREIGN_BARRIER 133 133 #endif 134 134 135 #ifdef UFL_BARRIER 135 136 #define FOREIGN_BARRIER 136 137 #endif 138 137 139 #ifdef TAUCS_BARRIER 138 140 #define FOREIGN_BARRIER 139 141 #endif 142 140 143 static int initialPumpTune = 1; 141 144 #include "CoinWarmStartBasis.hpp" … … 145 148 #include "OsiRowCut.hpp" 146 149 #include "OsiColCut.hpp" 150 147 151 #ifndef COIN_HAS_LINK 148 152 #define COIN_HAS_LINK … … 151 155 #include "CbcLinked.hpp" 152 156 #endif 157 153 158 #include "CglPreProcess.hpp" 154 159 #include "CglCutGenerator.hpp" … … 165 170 #include "CglLandP.hpp" 166 171 #include "CglResidualCapacity.hpp" 172 167 173 #ifdef ZERO_HALF_CUTS 168 174 #include "CglZeroHalf.hpp" … … 194 200 195 201 #include "OsiClpSolverInterface.hpp" 202 196 203 #include "CbcSolver.hpp" 204 197 205 //#define IN_BRANCH_AND_BOUND (0x01000000262144) 198 206 #define IN_BRANCH_AND_BOUND (0x0100000026214412810242048) 199 207 //#define IN_BRANCH_AND_BOUND (0x01000000262144128) 208 209 /* 210 CbcStopNow class definitions. 211 */ 212 213 CbcStopNow::CbcStopNow() 214 { 215 } 216 CbcStopNow::~CbcStopNow() 217 { 218 } 219 // Copy constructor 220 CbcStopNow::CbcStopNow ( const CbcStopNow & ) 221 { 222 } 223 // Assignment operator 224 CbcStopNow & 225 CbcStopNow::operator=(const CbcStopNow & rhs) 226 { 227 if (this != &rhs) { 228 } 229 return *this; 230 } 231 // Clone 232 CbcStopNow * 233 CbcStopNow::clone() const 234 { 235 return new CbcStopNow(*this); 236 } 237 238 /* 239 CbcUser class definitions. 240 */ 241 242 // User stuff (base class) 243 CbcUser::CbcUser() 244 : coinModel_(NULL), 245 userName_("null") 246 { 247 } 248 CbcUser::~CbcUser() 249 { 250 delete coinModel_; 251 } 252 // Copy constructor 253 CbcUser::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 262 CbcUser & 263 CbcUser::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 200 279 CbcSolver::CbcSolver() 201 280 : babModel_(NULL), … … 657 736 cutGenerator_[numberCutGenerators_++] = generator>clone(); 658 737 } 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. 696 747 */ 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 831 749 #ifdef CPX_KEEP_RESULTS 832 750 #define CBC_OTHER_SOLVER 1 833 751 #endif 752 834 753 #ifdef COIN_HAS_CPX 835 754 #include "OsiCpxSolverInterface.hpp" 836 755 #endif 756 837 757 #ifdef CBC_OTHER_SOLVER 838 758 #if CBC_OTHER_SOLVER==1 839 759 #include "OsiCpxSolverInterface.hpp" 840 760 #endif 841 #undef NEW_STYLE_SOLVER 842 #define NEW_STYLE_SOLVER 0 843 #endif 761 #endif 762 844 763 #ifdef COIN_HAS_ASL 845 764 #include "Cbc_ampl.h" 846 765 #endif 766 847 767 static double totalTime = 0.0; 848 768 static void statistics(ClpSimplex * originalModel, ClpSimplex * model); … … 850 770 std::string & check); 851 771 static 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 856 774 void fakeMain (ClpSimplex & model, OsiSolverInterface & osiSolver, CbcModel & babSolver); 857 775 void fakeMain2 (ClpSimplex & model, OsiClpSolverInterface & osiSolver, int options); 858 776 859 777 // Allow for interrupts 860 // But is this threadsafe 778 // But is this threadsafe? (so switched off by option) 861 779 862 780 #include "CoinSignal.hpp" … … 872 790 } 873 791 } 792 874 793 //#define CBC_SIG_TRAP 875 794 #ifdef CBC_SIG_TRAP … … 882 801 } 883 802 #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 897 804 int CbcOrClpRead_mode = 1; 898 805 FILE * CbcOrClpReadCommand = stdin; 899 806 extern int CbcOrClpEnvironmentIndex; 900 807 static bool noPrinting = false; 808 901 809 #ifndef CBC_OTHER_SOLVER 902 #if NEW_STYLE_SOLVER903 int * CbcSolver::analyze(OsiClpSolverInterface * solverMod, int & numberChanged, double & increment,904 bool changeInt, CoinMessageHandler * generalMessageHandler)905 #else906 810 static int * analyze(OsiClpSolverInterface * solverMod, int & numberChanged, double & increment, 907 811 bool changeInt, CoinMessageHandler * generalMessageHandler) 908 #endif909 812 { 910 #if NEW_STYLE_SOLVER==0911 813 bool noPrinting_ = noPrinting; 912 #endif913 814 OsiSolverInterface * solver = solverMod>clone(); 914 815 char generalPrint[200]; … … 1208 1109 } 1209 1110 } 1210 #endif 1211 1111 #endif // ifndef CBC_OTHER_SOLVER 1212 1112 1213 1113 #ifdef COIN_HAS_LINK … … 1710 1610 } 1711 1611 } 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.0e5) { 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.0e5); 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.0e5 && 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 */ 1836 1617 #ifdef COIN_DEVELOP 1837 1618 void checkSOS(CbcModel * babModel, const OsiSolverInterface * solver) … … 1930 1711 } 1931 1712 } 1932 #endif 1713 #endif // COIN_DEVELOP 1933 1714 } 1934 #if NEW_STYLE_SOLVER==0 1715 1716 static 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 1725 int 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 1733 int callCbc1(const char * input2, CbcModel & model) 1734 { 1735 return callCbc1(input2, model, dummyCallBack); 1736 } 1737 1738 int 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 1935 1746 int callCbc1(const char * input2, CbcModel & model, int callBack(CbcModel * currentSolver, int whereFrom)) 1936 1747 { … … 1990 1801 return returnCode; 1991 1802 } 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 1999 1805 int callCbc(const char * input2, CbcModel & babSolver) 2000 1806 { … … 2002 1808 return callCbc1(input2, babSolver); 2003 1809 } 1810 2004 1811 int callCbc(const std::string input2, CbcModel & babSolver) 2005 1812 { … … 2010 1817 return returnCode; 2011 1818 } 1819 2012 1820 int callCbc(const char * input2, OsiClpSolverInterface& solver1) 2013 1821 { … … 2015 1823 return callCbc(input2, model); 2016 1824 } 1825 2017 1826 int callCbc(const char * input2) 2018 1827 { … … 2022 1831 } 2023 1832 } 1833 2024 1834 int callCbc(const std::string input2, OsiClpSolverInterface& solver1) 2025 1835 { … … 2029 1839 return returnCode; 2030 1840 } 1841 2031 1842 int callCbc(const std::string input2) 2032 1843 { … … 2037 1848 return returnCode; 2038 1849 } 2039 static int dummyCallBack(CbcModel * /*model*/, int /*whereFrom*/) 2040 { 2041 return 0; 2042 } 1850 1851 #define CBCMAXPARAMETERS 200 1852 static CbcOrClpParam parameters[CBCMAXPARAMETERS]; 1853 static int numberParameters = 0 ; 1854 1855 int CbcClpUnitTest (const CbcModel & saveModel, 1856 std::string& dirMiplib, int testSwitch, 1857 double * stuff); 1858 2043 1859 int CbcMain1 (int argc, const char *argv[], 2044 1860 CbcModel & model) … … 2046 1862 return CbcMain1(argc, argv, model, dummyCallBack); 2047 1863 } 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.0e8); 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 2287 1866 /* Meaning of whereFrom: 2288 1867 1 after initial solve by dualsimplex etc … … 2294 1873 */ 2295 1874 2296 #if NEW_STYLE_SOLVER==02297 1875 int CbcMain1 (int argc, const char *argv[], 2298 1876 CbcModel & model, 2299 1877 int callBack(CbcModel * currentSolver, int whereFrom)) 2300 #else2301 /* This takes a list of commands, does "stuff" and returns2302 returnMode 2303 0 model and solver untouched  babModel updated2304 1 model updated  just with solution basis etc2305 2 model updated i.e. as babModel (babModel NULL)2306 */2307 int2308 CbcSolver::solve (int argc, const char *argv[], int returnMode)2309 #endif2310 1878 { 2311 #if NEW_STYLE_SOLVER==02312 1879 CbcOrClpParam * parameters_ = parameters; 2313 1880 int numberParameters_ = numberParameters; … … 2318 1885 int statusUserFunction_[1]; 2319 1886 int numberUserFunctions_ = 1; // to allow for ampl 2320 #else2321 delete babModel_;2322 babModel_ = NULL;2323 CbcOrClpRead_mode = 1;2324 delete [] statusUserFunction_;2325 statusUserFunction_ = new int [numberUserFunctions_];2326 int iUser;2327 #endif2328 1887 // Statistics 2329 1888 double statistics_seconds = 0.0, statistics_obj = 0.0; … … 2365 1924 noPrinting = true; 2366 1925 #endif 2367 #if NEW_STYLE_SOLVER==02368 1926 bool noPrinting_ = noPrinting; 2369 #endif2370 1927 // Say not in integer 2371 1928 int integerStatus = 1; … … 2439 1996 int * knapsackRow = NULL; 2440 1997 int numberKnapsack = 0; 2441 #if NEW_STYLE_SOLVER2442 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_SOLVER2453 clpSolver = dynamic_cast< OsiClpSolverInterface*> (solver);2454 lpSolver = clpSolver>getModelPtr();2455 #endif2456 } 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 #endif2475 1998 #ifdef COIN_HAS_ASL 2476 1999 ampl_info info; … … 3898 3421 babModel_>setSecondaryStatus(iStatus2); 3899 3422 } 3900 #if NEW_STYLE_SOLVER3901 int returnCode = callBack_>callBack(&model_, 1);3902 #else3903 3423 int returnCode = callBack(&model, 1); 3904 #endif3905 3424 if (returnCode) { 3906 3425 // exit if user wants 3907 #if NEW_STYLE_SOLVER3908 updateModel(model2, returnMode);3909 #else3910 3426 delete babModel_; 3911 3427 babModel_ = NULL; 3912 #endif3913 3428 return returnCode; 3914 3429 } … … 3924 3439 model2 = lpSolver; 3925 3440 } 3926 #if NEW_STYLE_SOLVER3927 updateModel(model2, returnMode);3928 for (iUser = 0; iUser < numberUserFunctions_; iUser++) {3929 if (statusUserFunction_[iUser])3930 userFunction_[iUser]>exportSolution(this, 1);3931 }3932 #endif3933 3441 #ifdef COIN_HAS_ASL 3934 3442 if (statusUserFunction_[0]) { … … 4150 3658 } 4151 3659 // Actually do heuristics 4152 doHeuristics(&model_, 2, parameters_, numberParameters_, noPrinting_, initialPumpTune); 3660 doHeuristics(&model_,2,parameters_, 3661 numberParameters_,noPrinting_,initialPumpTune); 4153 3662 if (model_.bestSolution()) { 4154 3663 model_.setProblemStatus(1); … … 4195 3704 #endif 4196 3705 } 4197 #if NEW_STYLE_SOLVER4198 int returnCode = callBack_>callBack(&model_, 6);4199 #else4200 3706 int returnCode = callBack(&model, 6); 4201 #endif4202 3707 if (returnCode) { 4203 3708 // exit if user wants 4204 #if NEW_STYLE_SOLVER4205 updateModel(NULL, returnMode);4206 #else4207 3709 delete babModel_; 4208 3710 babModel_ = NULL; 4209 #endif4210 3711 return returnCode; 4211 3712 } … … 4508 4009 model_.setSecondaryStatus(iStatus2); 4509 4010 si>setWarmStart(NULL); 4510 #if NEW_STYLE_SOLVER4511 int returnCode = callBack_>callBack(&model_, 1);4512 #else4513 4011 int returnCode = callBack(&model_, 1); 4514 #endif4515 4012 if (returnCode) { 4516 4013 // exit if user wants 4517 #if NEW_STYLE_SOLVER4518 updateModel(NULL, returnMode);4519 #else4520 4014 delete babModel_; 4521 4015 babModel_ = NULL; 4522 #endif4523 4016 return returnCode; 4524 4017 } … … 4950 4443 solver2>setHintParam(OsiDoInBranchAndCut, false, OsiHintDo) ; 4951 4444 } 4952 #if NEW_STYLE_SOLVER4953 if (!solver2) {4954 for (iUser = 0; iUser < numberUserFunctions_; iUser++) {4955 if (statusUserFunction_[iUser])4956 userFunction_[iUser]>exportSolution(this, 11, "infeasible/unbounded by preprocessing");4957 }4958 }4959 #endif4960 4445 #ifdef COIN_HAS_ASL 4961 4446 if (!solver2 && statusUserFunction_[0]) { … … 4993 4478 babModel_>setProblemStatus(1); 4994 4479 } 4995 #if NEW_STYLE_SOLVER4996 int returnCode = callBack_>callBack(babModel_, 2);4997 #else4998 4480 int returnCode = callBack(babModel_, 2); 4999 #endif5000 4481 if (returnCode) { 5001 4482 // exit if user wants 5002 #if NEW_STYLE_SOLVER5003 updateModel(NULL, returnMode);5004 #else5005 4483 delete babModel_; 5006 4484 babModel_ = NULL; 5007 #endif5008 4485 return returnCode; 5009 4486 } … … 5193 4670 } 5194 4671 // Set up heuristics 5195 doHeuristics(babModel_, (!miplib) ? 1 : 10, parameters_, numberParameters_, noPrinting_, initialPumpTune); 4672 doHeuristics(&model_,((!miplib)?1:10),parameters_, 4673 numberParameters_,noPrinting_,initialPumpTune); 5196 4674 if (!miplib) { 5197 4675 if (parameters_[whichParam(CBC_PARAM_STR_LOCALTREE, numberParameters_, parameters_)].currentOptionAsInteger()) { … … 5597 5075 } 5598 5076 if (type == CBC_PARAM_ACTION_BAB) { 5599 #if NEW_STYLE_SOLVER5600 {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 #endif5625 5077 #ifdef COIN_HAS_ASL 5626 5078 if (statusUserFunction_[0]) { … … 6551 6003 babModel_>setThreadMode(numberThreads / 100); 6552 6004 #endif 6553 #if NEW_STYLE_SOLVER6554 int returnCode = callBack_>callBack(babModel_, 3);6555 #else6556 6005 int returnCode = callBack(babModel_, 3); 6557 #endif6558 6006 if (returnCode) { 6559 6007 // exit if user wants 6560 #if NEW_STYLE_SOLVER6561 updateModel(NULL, returnMode);6562 #else6563 6008 delete babModel_; 6564 6009 babModel_ = NULL; 6565 #endif6566 6010 return returnCode; 6567 6011 } … … 6766 6210 printHistory("branch.log"); 6767 6211 #endif 6768 #if NEW_STYLE_SOLVER6769 returnCode = callBack_>callBack(babModel_, 4);6770 #else6771 6212 returnCode = callBack(babModel_, 4); 6772 #endif6773 6213 if (returnCode) { 6774 6214 // exit if user wants 6775 #if NEW_STYLE_SOLVER6776 updateModel(NULL, returnMode);6777 #else6778 6215 model_.moveInfo(*babModel_); 6779 6216 delete babModel_; 6780 6217 babModel_ = NULL; 6781 #endif6782 6218 return returnCode; 6783 6219 } … … 7139 6575 } 7140 6576 assert (saveSolver>isProvenOptimal()); 7141 #if NEW_STYLE_SOLVER==07142 6577 #ifndef CBC_OTHER_SOLVER 7143 6578 // and original solver … … 7161 6596 assert (originalSolver>isProvenOptimal()); 7162 6597 #endif 7163 #endif7164 6598 babModel_>assignSolver(saveSolver); 7165 6599 memcpy(bestSolution, babModel_>solver()>getColSolution(), n*sizeof(double)); … … 7169 6603 memcpy(bestSolution, babModel_>solver()>getColSolution(), n*sizeof(double)); 7170 6604 } 7171 #if NEW_STYLE_SOLVER==07172 6605 if (returnMode == 1) { 7173 6606 model_.deleteSolutions(); 7174 6607 model_.setBestSolution(bestSolution, n, babModel_>getMinimizationObjValue()); 7175 6608 } 7176 #endif7177 6609 babModel_>deleteSolutions(); 7178 6610 babModel_>setBestSolution(bestSolution, n, babModel_>getMinimizationObjValue()); 7179 #if NEW_STYLE_SOLVER==07180 6611 #ifndef CBC_OTHER_SOLVER 7181 6612 // and put back in very original solver … … 7221 6652 } 7222 6653 #endif 7223 #endif7224 6654 checkSOS(babModel_, babModel_>solver()); 7225 6655 } else if (model_.bestSolution() && type == CBC_PARAM_ACTION_BAB && model_.getMinimizationObjValue() < 1.0e50 && preProcess) { … … 7235 6665 babModel_>setMinimizationObjValue(model_.getMinimizationObjValue()); 7236 6666 memcpy(bestSolution, babModel_>solver()>getColSolution(), n*sizeof(double)); 7237 #if NEW_STYLE_SOLVER==07238 6667 #ifndef CBC_OTHER_SOLVER 7239 6668 // and put back in very original solver … … 7257 6686 delete basis; 7258 6687 } 7259 #endif7260 6688 #endif 7261 6689 } … … 7324 6752 << CoinMessageEol; 7325 6753 } 7326 #if NEW_STYLE_SOLVER7327 int returnCode = callBack_>callBack(babModel_, 5);7328 #else7329 6754 int returnCode = callBack(babModel_, 5); 7330 #endif7331 6755 if (returnCode) { 7332 6756 // exit if user wants 7333 #if NEW_STYLE_SOLVER7334 updateModel(NULL, returnMode);7335 #else7336 6757 model_.moveInfo(*babModel_); 7337 6758 delete babModel_; 7338 6759 babModel_ = NULL; 7339 #endif7340 6760 return returnCode; 7341 6761 } 7342 #if NEW_STYLE_SOLVER7343 if (bestSolution && numberKnapsack) {7344 // expanded knapsack7345 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 #endif7365 #ifdef COIN_HAS_ASL7366 #if NEW_STYLE_SOLVER7367 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 // infeasible7378 iStat = 1;7379 pos += sprintf(buf + pos, "infeasible,");7380 }7381 } else if (iStat == 1) {7382 if (iStat2 != 6)7383 iStat = 3;7384 else7385 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 ctrlc,");7393 } else if (iStat == 6) {7394 // bab infeasible7395 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 else7409 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 knapsack7426 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 info7439 strcpy(info.buffer, buf);7440 }7441 #endif7442 #endif7443 6762 } else { 7444 6763 std::cout << "Model strengthened  now has " << clpSolver>getNumRows() … … 8673 7992 } 8674 7993 #endif 8675 #if NEW_STYLE_SOLVER8676 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 #endif8695 7994 break; 8696 7995 case CBC_PARAM_ACTION_USERCBC: … … 9298 8597 //dmalloc_shutdown(); 9299 8598 #endif 9300 #if NEW_STYLE_SOLVER9301 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 #else9308 8599 if (babModel_) { 9309 8600 model_.moveInfo(*babModel_); … … 9335 8626 model_.solver()>setWarmStart(NULL); 9336 8627 sprintf(generalPrint, "Total time %.2f", CoinCpuTime()  time0); 9337 #endif9338 8628 generalMessageHandler>message(CLP_GENERAL, generalMessages) 9339 8629 << generalPrint … … 9341 8631 return 0; 9342 8632 } 8633 8634 8635 8636 int CbcMain (int argc, const char *argv[], 8637 CbcModel & model) 8638 { 8639 CbcMain0(model); 8640 return CbcMain1(argc, argv, model); 8641 } 8642 8643 8644 void 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.0e8); 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 */ 9343 8794 static void breakdown(const char * name, int numberLook, const double * region) 9344 8795 { … … 9645 9096 breakdown("Objective", numberColumns, objective); 9646 9097 } 9098 9099 9647 9100 static bool maskMatches(const int * starts, char ** masks, 9648 9101 std::string & check) … … 9665 9118 return false; 9666 9119 } 9120 9667 9121 static void clean(char * temp) 9668 9122 { … … 9672 9126 *put = '\0'; 9673 9127 } 9128 9674 9129 static void generateCode(CbcModel * /*model*/, const char * fileName, int type, int preProcess) 9675 9130 { 
branches/sandbox/Cbc/src/CbcSolverHeuristics.cpp
r1383 r1386 1 /* $Id : CbcSolverHeuristics.cpp 1240 20091002 18:41:44Z forrest$ */1 /* $Id$ */ 2 2 // Copyright (C) 2007, International Business Machines 3 3 // Corporation and others. All Rights Reserved. … … 1134 1134 } 1135 1135 1136 1137 int doHeuristics(CbcModel * model, int type, 1138 CbcOrClpParam * parameters_, int numberParameters_, 1139 bool noPrinting_, int initialPumpTune) 1136 int doHeuristics(CbcModel * model, int type, CbcOrClpParam* parameters_, 1137 int numberParameters_,int noPrinting_,int initialPumpTune) 1140 1138 { 1141 1139 #if 0 //NEW_STYLE_SOLVER==0 
branches/sandbox/Cbc/src/CbcSolverHeuristics.hpp
r1383 r1386 1 /* $Id : CbcSolver.hpp 1212 20090821 16:19:13Z forrest$ */1 /* $Id$ */ 2 2 // Copyright (C) 2007, International Business Machines 3 3 // Corporation and others. All Rights Reserved. … … 38 38 (out model later) 39 39 */ 40 int doHeuristics(CbcModel * model, int type, 41 CbcOrClpParam * parameters_, int numberParameters_, 42 bool noPrinting_, int initialPumpTune); 40 int doHeuristics(CbcModel * model, int type, CbcOrClpParam *parameters_, 41 int numberParameters_,int noPrinting_,int initialPumpTune) ; 43 42 44 45 43 46 44 #endif //CbcSolverHeuristics_H 45
Note: See TracChangeset
for help on using the changeset viewer.