ruby-cbc 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +4 -0
  6. data/README.md +203 -0
  7. data/Rakefile +40 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +7 -0
  10. data/ext/ruby-cbc/cbc.i +15 -0
  11. data/ext/ruby-cbc/cbc_wrap.c +4618 -0
  12. data/ext/ruby-cbc/extconf.rb +60 -0
  13. data/ext/ruby-cbc/install/bin/cbc +0 -0
  14. data/ext/ruby-cbc/install/bin/clp +0 -0
  15. data/ext/ruby-cbc/install/include/coin/CbcBranchActual.hpp +24 -0
  16. data/ext/ruby-cbc/install/include/coin/CbcBranchAllDifferent.hpp +62 -0
  17. data/ext/ruby-cbc/install/include/coin/CbcBranchBase.hpp +78 -0
  18. data/ext/ruby-cbc/install/include/coin/CbcBranchCut.hpp +183 -0
  19. data/ext/ruby-cbc/install/include/coin/CbcBranchDecision.hpp +129 -0
  20. data/ext/ruby-cbc/install/include/coin/CbcBranchDefaultDecision.hpp +100 -0
  21. data/ext/ruby-cbc/install/include/coin/CbcBranchDynamic.hpp +206 -0
  22. data/ext/ruby-cbc/install/include/coin/CbcBranchLotsize.hpp +242 -0
  23. data/ext/ruby-cbc/install/include/coin/CbcBranchToFixLots.hpp +94 -0
  24. data/ext/ruby-cbc/install/include/coin/CbcBranchingObject.hpp +236 -0
  25. data/ext/ruby-cbc/install/include/coin/CbcClique.hpp +303 -0
  26. data/ext/ruby-cbc/install/include/coin/CbcCompare.hpp +39 -0
  27. data/ext/ruby-cbc/install/include/coin/CbcCompareActual.hpp +14 -0
  28. data/ext/ruby-cbc/install/include/coin/CbcCompareBase.hpp +142 -0
  29. data/ext/ruby-cbc/install/include/coin/CbcCompareDefault.hpp +120 -0
  30. data/ext/ruby-cbc/install/include/coin/CbcCompareDepth.hpp +47 -0
  31. data/ext/ruby-cbc/install/include/coin/CbcCompareEstimate.hpp +48 -0
  32. data/ext/ruby-cbc/install/include/coin/CbcCompareObjective.hpp +49 -0
  33. data/ext/ruby-cbc/install/include/coin/CbcConfig.h +14 -0
  34. data/ext/ruby-cbc/install/include/coin/CbcConsequence.hpp +49 -0
  35. data/ext/ruby-cbc/install/include/coin/CbcCountRowCut.hpp +168 -0
  36. data/ext/ruby-cbc/install/include/coin/CbcCutGenerator.hpp +482 -0
  37. data/ext/ruby-cbc/install/include/coin/CbcCutModifier.hpp +57 -0
  38. data/ext/ruby-cbc/install/include/coin/CbcCutSubsetModifier.hpp +66 -0
  39. data/ext/ruby-cbc/install/include/coin/CbcDummyBranchingObject.hpp +83 -0
  40. data/ext/ruby-cbc/install/include/coin/CbcEventHandler.hpp +245 -0
  41. data/ext/ruby-cbc/install/include/coin/CbcFathom.hpp +137 -0
  42. data/ext/ruby-cbc/install/include/coin/CbcFathomDynamicProgramming.hpp +169 -0
  43. data/ext/ruby-cbc/install/include/coin/CbcFeasibilityBase.hpp +56 -0
  44. data/ext/ruby-cbc/install/include/coin/CbcFixVariable.hpp +67 -0
  45. data/ext/ruby-cbc/install/include/coin/CbcFollowOn.hpp +207 -0
  46. data/ext/ruby-cbc/install/include/coin/CbcFullNodeInfo.hpp +161 -0
  47. data/ext/ruby-cbc/install/include/coin/CbcGeneral.hpp +60 -0
  48. data/ext/ruby-cbc/install/include/coin/CbcGeneralDepth.hpp +279 -0
  49. data/ext/ruby-cbc/install/include/coin/CbcHeuristic.hpp +682 -0
  50. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDINS.hpp +96 -0
  51. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDW.hpp +309 -0
  52. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDive.hpp +192 -0
  53. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveCoefficient.hpp +52 -0
  54. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveFractional.hpp +52 -0
  55. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveGuided.hpp +55 -0
  56. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveLineSearch.hpp +52 -0
  57. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDivePseudoCost.hpp +60 -0
  58. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveVectorLength.hpp +52 -0
  59. data/ext/ruby-cbc/install/include/coin/CbcHeuristicFPump.hpp +340 -0
  60. data/ext/ruby-cbc/install/include/coin/CbcHeuristicGreedy.hpp +280 -0
  61. data/ext/ruby-cbc/install/include/coin/CbcHeuristicLocal.hpp +271 -0
  62. data/ext/ruby-cbc/install/include/coin/CbcHeuristicPivotAndFix.hpp +58 -0
  63. data/ext/ruby-cbc/install/include/coin/CbcHeuristicRENS.hpp +77 -0
  64. data/ext/ruby-cbc/install/include/coin/CbcHeuristicRINS.hpp +102 -0
  65. data/ext/ruby-cbc/install/include/coin/CbcHeuristicRandRound.hpp +58 -0
  66. data/ext/ruby-cbc/install/include/coin/CbcHeuristicVND.hpp +94 -0
  67. data/ext/ruby-cbc/install/include/coin/CbcLinked.hpp +1406 -0
  68. data/ext/ruby-cbc/install/include/coin/CbcMessage.hpp +94 -0
  69. data/ext/ruby-cbc/install/include/coin/CbcMipStartIO.hpp +26 -0
  70. data/ext/ruby-cbc/install/include/coin/CbcModel.hpp +2952 -0
  71. data/ext/ruby-cbc/install/include/coin/CbcNWay.hpp +166 -0
  72. data/ext/ruby-cbc/install/include/coin/CbcNode.hpp +351 -0
  73. data/ext/ruby-cbc/install/include/coin/CbcNodeInfo.hpp +349 -0
  74. data/ext/ruby-cbc/install/include/coin/CbcObject.hpp +272 -0
  75. data/ext/ruby-cbc/install/include/coin/CbcObjectUpdateData.hpp +64 -0
  76. data/ext/ruby-cbc/install/include/coin/CbcOrClpParam.cpp +4134 -0
  77. data/ext/ruby-cbc/install/include/coin/CbcOrClpParam.hpp +532 -0
  78. data/ext/ruby-cbc/install/include/coin/CbcParam.hpp +324 -0
  79. data/ext/ruby-cbc/install/include/coin/CbcPartialNodeInfo.hpp +110 -0
  80. data/ext/ruby-cbc/install/include/coin/CbcSOS.hpp +279 -0
  81. data/ext/ruby-cbc/install/include/coin/CbcSimpleInteger.hpp +286 -0
  82. data/ext/ruby-cbc/install/include/coin/CbcSimpleIntegerDynamicPseudoCost.hpp +564 -0
  83. data/ext/ruby-cbc/install/include/coin/CbcSimpleIntegerPseudoCost.hpp +114 -0
  84. data/ext/ruby-cbc/install/include/coin/CbcSolver.hpp +447 -0
  85. data/ext/ruby-cbc/install/include/coin/CbcStrategy.hpp +258 -0
  86. data/ext/ruby-cbc/install/include/coin/CbcSubProblem.hpp +83 -0
  87. data/ext/ruby-cbc/install/include/coin/CbcTree.hpp +490 -0
  88. data/ext/ruby-cbc/install/include/coin/CbcTreeLocal.hpp +372 -0
  89. data/ext/ruby-cbc/install/include/coin/Cbc_C_Interface.h +381 -0
  90. data/ext/ruby-cbc/install/include/coin/Cgl012cut.hpp +464 -0
  91. data/ext/ruby-cbc/install/include/coin/CglAllDifferent.hpp +115 -0
  92. data/ext/ruby-cbc/install/include/coin/CglClique.hpp +308 -0
  93. data/ext/ruby-cbc/install/include/coin/CglConfig.h +19 -0
  94. data/ext/ruby-cbc/install/include/coin/CglCutGenerator.hpp +121 -0
  95. data/ext/ruby-cbc/install/include/coin/CglDuplicateRow.hpp +189 -0
  96. data/ext/ruby-cbc/install/include/coin/CglFlowCover.hpp +371 -0
  97. data/ext/ruby-cbc/install/include/coin/CglGMI.hpp +364 -0
  98. data/ext/ruby-cbc/install/include/coin/CglGMIParam.hpp +313 -0
  99. data/ext/ruby-cbc/install/include/coin/CglGomory.hpp +204 -0
  100. data/ext/ruby-cbc/install/include/coin/CglKnapsackCover.hpp +310 -0
  101. data/ext/ruby-cbc/install/include/coin/CglLandP.hpp +306 -0
  102. data/ext/ruby-cbc/install/include/coin/CglLandPValidator.hpp +130 -0
  103. data/ext/ruby-cbc/install/include/coin/CglLiftAndProject.hpp +104 -0
  104. data/ext/ruby-cbc/install/include/coin/CglMessage.hpp +50 -0
  105. data/ext/ruby-cbc/install/include/coin/CglMixedIntegerRounding.hpp +429 -0
  106. data/ext/ruby-cbc/install/include/coin/CglMixedIntegerRounding2.hpp +427 -0
  107. data/ext/ruby-cbc/install/include/coin/CglOddHole.hpp +160 -0
  108. data/ext/ruby-cbc/install/include/coin/CglParam.hpp +93 -0
  109. data/ext/ruby-cbc/install/include/coin/CglPreProcess.hpp +492 -0
  110. data/ext/ruby-cbc/install/include/coin/CglProbing.hpp +543 -0
  111. data/ext/ruby-cbc/install/include/coin/CglRedSplit.hpp +448 -0
  112. data/ext/ruby-cbc/install/include/coin/CglRedSplit2.hpp +494 -0
  113. data/ext/ruby-cbc/install/include/coin/CglRedSplit2Param.hpp +495 -0
  114. data/ext/ruby-cbc/install/include/coin/CglRedSplitParam.hpp +272 -0
  115. data/ext/ruby-cbc/install/include/coin/CglResidualCapacity.hpp +240 -0
  116. data/ext/ruby-cbc/install/include/coin/CglSimpleRounding.hpp +174 -0
  117. data/ext/ruby-cbc/install/include/coin/CglStored.hpp +125 -0
  118. data/ext/ruby-cbc/install/include/coin/CglTreeInfo.hpp +180 -0
  119. data/ext/ruby-cbc/install/include/coin/CglTwomir.hpp +565 -0
  120. data/ext/ruby-cbc/install/include/coin/CglZeroHalf.hpp +133 -0
  121. data/ext/ruby-cbc/install/include/coin/ClpAmplObjective.hpp +113 -0
  122. data/ext/ruby-cbc/install/include/coin/ClpCholeskyBase.hpp +294 -0
  123. data/ext/ruby-cbc/install/include/coin/ClpCholeskyDense.hpp +162 -0
  124. data/ext/ruby-cbc/install/include/coin/ClpConfig.h +17 -0
  125. data/ext/ruby-cbc/install/include/coin/ClpConstraint.hpp +125 -0
  126. data/ext/ruby-cbc/install/include/coin/ClpConstraintAmpl.hpp +108 -0
  127. data/ext/ruby-cbc/install/include/coin/ClpConstraintLinear.hpp +110 -0
  128. data/ext/ruby-cbc/install/include/coin/ClpConstraintQuadratic.hpp +119 -0
  129. data/ext/ruby-cbc/install/include/coin/ClpDualRowDantzig.hpp +71 -0
  130. data/ext/ruby-cbc/install/include/coin/ClpDualRowPivot.hpp +129 -0
  131. data/ext/ruby-cbc/install/include/coin/ClpDualRowSteepest.hpp +153 -0
  132. data/ext/ruby-cbc/install/include/coin/ClpDummyMatrix.hpp +183 -0
  133. data/ext/ruby-cbc/install/include/coin/ClpDynamicExampleMatrix.hpp +186 -0
  134. data/ext/ruby-cbc/install/include/coin/ClpDynamicMatrix.hpp +381 -0
  135. data/ext/ruby-cbc/install/include/coin/ClpEventHandler.hpp +187 -0
  136. data/ext/ruby-cbc/install/include/coin/ClpFactorization.hpp +432 -0
  137. data/ext/ruby-cbc/install/include/coin/ClpGubDynamicMatrix.hpp +247 -0
  138. data/ext/ruby-cbc/install/include/coin/ClpGubMatrix.hpp +358 -0
  139. data/ext/ruby-cbc/install/include/coin/ClpInterior.hpp +570 -0
  140. data/ext/ruby-cbc/install/include/coin/ClpLinearObjective.hpp +103 -0
  141. data/ext/ruby-cbc/install/include/coin/ClpMatrixBase.hpp +524 -0
  142. data/ext/ruby-cbc/install/include/coin/ClpMessage.hpp +131 -0
  143. data/ext/ruby-cbc/install/include/coin/ClpModel.hpp +1307 -0
  144. data/ext/ruby-cbc/install/include/coin/ClpNetworkMatrix.hpp +229 -0
  145. data/ext/ruby-cbc/install/include/coin/ClpNode.hpp +349 -0
  146. data/ext/ruby-cbc/install/include/coin/ClpNonLinearCost.hpp +401 -0
  147. data/ext/ruby-cbc/install/include/coin/ClpObjective.hpp +134 -0
  148. data/ext/ruby-cbc/install/include/coin/ClpPackedMatrix.hpp +638 -0
  149. data/ext/ruby-cbc/install/include/coin/ClpParameters.hpp +126 -0
  150. data/ext/ruby-cbc/install/include/coin/ClpPdcoBase.hpp +103 -0
  151. data/ext/ruby-cbc/install/include/coin/ClpPlusMinusOneMatrix.hpp +290 -0
  152. data/ext/ruby-cbc/install/include/coin/ClpPresolve.hpp +299 -0
  153. data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnDantzig.hpp +72 -0
  154. data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnPivot.hpp +155 -0
  155. data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnSteepest.hpp +247 -0
  156. data/ext/ruby-cbc/install/include/coin/ClpQuadraticObjective.hpp +155 -0
  157. data/ext/ruby-cbc/install/include/coin/ClpSimplex.hpp +1797 -0
  158. data/ext/ruby-cbc/install/include/coin/ClpSimplexDual.hpp +300 -0
  159. data/ext/ruby-cbc/install/include/coin/ClpSimplexNonlinear.hpp +117 -0
  160. data/ext/ruby-cbc/install/include/coin/ClpSimplexOther.hpp +277 -0
  161. data/ext/ruby-cbc/install/include/coin/ClpSimplexPrimal.hpp +244 -0
  162. data/ext/ruby-cbc/install/include/coin/ClpSolve.hpp +446 -0
  163. data/ext/ruby-cbc/install/include/coin/Clp_C_Interface.h +525 -0
  164. data/ext/ruby-cbc/install/include/coin/CoinAlloc.hpp +176 -0
  165. data/ext/ruby-cbc/install/include/coin/CoinBuild.hpp +149 -0
  166. data/ext/ruby-cbc/install/include/coin/CoinDenseFactorization.hpp +419 -0
  167. data/ext/ruby-cbc/install/include/coin/CoinDenseVector.hpp +383 -0
  168. data/ext/ruby-cbc/install/include/coin/CoinDistance.hpp +48 -0
  169. data/ext/ruby-cbc/install/include/coin/CoinError.hpp +257 -0
  170. data/ext/ruby-cbc/install/include/coin/CoinFactorization.hpp +2044 -0
  171. data/ext/ruby-cbc/install/include/coin/CoinFileIO.hpp +166 -0
  172. data/ext/ruby-cbc/install/include/coin/CoinFinite.hpp +34 -0
  173. data/ext/ruby-cbc/install/include/coin/CoinFloatEqual.hpp +177 -0
  174. data/ext/ruby-cbc/install/include/coin/CoinHelperFunctions.hpp +1111 -0
  175. data/ext/ruby-cbc/install/include/coin/CoinIndexedVector.hpp +1164 -0
  176. data/ext/ruby-cbc/install/include/coin/CoinLpIO.hpp +805 -0
  177. data/ext/ruby-cbc/install/include/coin/CoinMessage.hpp +96 -0
  178. data/ext/ruby-cbc/install/include/coin/CoinMessageHandler.hpp +666 -0
  179. data/ext/ruby-cbc/install/include/coin/CoinModel.hpp +1054 -0
  180. data/ext/ruby-cbc/install/include/coin/CoinModelUseful.hpp +441 -0
  181. data/ext/ruby-cbc/install/include/coin/CoinMpsIO.hpp +1056 -0
  182. data/ext/ruby-cbc/install/include/coin/CoinOslFactorization.hpp +280 -0
  183. data/ext/ruby-cbc/install/include/coin/CoinPackedMatrix.hpp +947 -0
  184. data/ext/ruby-cbc/install/include/coin/CoinPackedVector.hpp +657 -0
  185. data/ext/ruby-cbc/install/include/coin/CoinPackedVectorBase.hpp +269 -0
  186. data/ext/ruby-cbc/install/include/coin/CoinParam.hpp +644 -0
  187. data/ext/ruby-cbc/install/include/coin/CoinPragma.hpp +26 -0
  188. data/ext/ruby-cbc/install/include/coin/CoinPresolveDoubleton.hpp +73 -0
  189. data/ext/ruby-cbc/install/include/coin/CoinPresolveDual.hpp +85 -0
  190. data/ext/ruby-cbc/install/include/coin/CoinPresolveDupcol.hpp +226 -0
  191. data/ext/ruby-cbc/install/include/coin/CoinPresolveEmpty.hpp +116 -0
  192. data/ext/ruby-cbc/install/include/coin/CoinPresolveFixed.hpp +181 -0
  193. data/ext/ruby-cbc/install/include/coin/CoinPresolveForcing.hpp +61 -0
  194. data/ext/ruby-cbc/install/include/coin/CoinPresolveImpliedFree.hpp +60 -0
  195. data/ext/ruby-cbc/install/include/coin/CoinPresolveIsolated.hpp +51 -0
  196. data/ext/ruby-cbc/install/include/coin/CoinPresolveMatrix.hpp +1842 -0
  197. data/ext/ruby-cbc/install/include/coin/CoinPresolveMonitor.hpp +105 -0
  198. data/ext/ruby-cbc/install/include/coin/CoinPresolvePsdebug.hpp +166 -0
  199. data/ext/ruby-cbc/install/include/coin/CoinPresolveSingleton.hpp +112 -0
  200. data/ext/ruby-cbc/install/include/coin/CoinPresolveSubst.hpp +101 -0
  201. data/ext/ruby-cbc/install/include/coin/CoinPresolveTighten.hpp +55 -0
  202. data/ext/ruby-cbc/install/include/coin/CoinPresolveTripleton.hpp +66 -0
  203. data/ext/ruby-cbc/install/include/coin/CoinPresolveUseless.hpp +63 -0
  204. data/ext/ruby-cbc/install/include/coin/CoinPresolveZeros.hpp +60 -0
  205. data/ext/ruby-cbc/install/include/coin/CoinRational.hpp +44 -0
  206. data/ext/ruby-cbc/install/include/coin/CoinSearchTree.hpp +465 -0
  207. data/ext/ruby-cbc/install/include/coin/CoinShallowPackedVector.hpp +148 -0
  208. data/ext/ruby-cbc/install/include/coin/CoinSignal.hpp +117 -0
  209. data/ext/ruby-cbc/install/include/coin/CoinSimpFactorization.hpp +431 -0
  210. data/ext/ruby-cbc/install/include/coin/CoinSmartPtr.hpp +528 -0
  211. data/ext/ruby-cbc/install/include/coin/CoinSnapshot.hpp +476 -0
  212. data/ext/ruby-cbc/install/include/coin/CoinSort.hpp +678 -0
  213. data/ext/ruby-cbc/install/include/coin/CoinStructuredModel.hpp +247 -0
  214. data/ext/ruby-cbc/install/include/coin/CoinTime.hpp +310 -0
  215. data/ext/ruby-cbc/install/include/coin/CoinTypes.hpp +64 -0
  216. data/ext/ruby-cbc/install/include/coin/CoinUtility.hpp +19 -0
  217. data/ext/ruby-cbc/install/include/coin/CoinUtilsConfig.h +34 -0
  218. data/ext/ruby-cbc/install/include/coin/CoinWarmStart.hpp +58 -0
  219. data/ext/ruby-cbc/install/include/coin/CoinWarmStartBasis.hpp +456 -0
  220. data/ext/ruby-cbc/install/include/coin/CoinWarmStartDual.hpp +166 -0
  221. data/ext/ruby-cbc/install/include/coin/CoinWarmStartPrimalDual.hpp +211 -0
  222. data/ext/ruby-cbc/install/include/coin/CoinWarmStartVector.hpp +488 -0
  223. data/ext/ruby-cbc/install/include/coin/Coin_C_defines.h +115 -0
  224. data/ext/ruby-cbc/install/include/coin/Idiot.hpp +298 -0
  225. data/ext/ruby-cbc/install/include/coin/OsiAuxInfo.hpp +206 -0
  226. data/ext/ruby-cbc/install/include/coin/OsiBranchingObject.hpp +1005 -0
  227. data/ext/ruby-cbc/install/include/coin/OsiCbcSolverInterface.hpp +764 -0
  228. data/ext/ruby-cbc/install/include/coin/OsiChooseVariable.hpp +534 -0
  229. data/ext/ruby-cbc/install/include/coin/OsiClpSolverInterface.hpp +1509 -0
  230. data/ext/ruby-cbc/install/include/coin/OsiColCut.hpp +324 -0
  231. data/ext/ruby-cbc/install/include/coin/OsiCollections.hpp +35 -0
  232. data/ext/ruby-cbc/install/include/coin/OsiConfig.h +19 -0
  233. data/ext/ruby-cbc/install/include/coin/OsiCut.hpp +245 -0
  234. data/ext/ruby-cbc/install/include/coin/OsiCuts.hpp +474 -0
  235. data/ext/ruby-cbc/install/include/coin/OsiPresolve.hpp +252 -0
  236. data/ext/ruby-cbc/install/include/coin/OsiRowCut.hpp +331 -0
  237. data/ext/ruby-cbc/install/include/coin/OsiRowCutDebugger.hpp +187 -0
  238. data/ext/ruby-cbc/install/include/coin/OsiSolverBranch.hpp +152 -0
  239. data/ext/ruby-cbc/install/include/coin/OsiSolverInterface.hpp +2143 -0
  240. data/ext/ruby-cbc/install/include/coin/OsiSolverParameters.hpp +142 -0
  241. data/ext/ruby-cbc/install/include/coin/OsiUnitTests.hpp +374 -0
  242. data/ext/ruby-cbc/install/lib/libCbc.la +35 -0
  243. data/ext/ruby-cbc/install/lib/libCbc.so +0 -0
  244. data/ext/ruby-cbc/install/lib/libCbc.so.3 +0 -0
  245. data/ext/ruby-cbc/install/lib/libCbc.so.3.9.7 +0 -0
  246. data/ext/ruby-cbc/install/lib/libCbcSolver.la +35 -0
  247. data/ext/ruby-cbc/install/lib/libCbcSolver.so +0 -0
  248. data/ext/ruby-cbc/install/lib/libCbcSolver.so.3 +0 -0
  249. data/ext/ruby-cbc/install/lib/libCbcSolver.so.3.9.7 +0 -0
  250. data/ext/ruby-cbc/install/lib/libCgl.la +35 -0
  251. data/ext/ruby-cbc/install/lib/libCgl.so +0 -0
  252. data/ext/ruby-cbc/install/lib/libCgl.so.1 +0 -0
  253. data/ext/ruby-cbc/install/lib/libCgl.so.1.9.7 +0 -0
  254. data/ext/ruby-cbc/install/lib/libClp.la +35 -0
  255. data/ext/ruby-cbc/install/lib/libClp.so +0 -0
  256. data/ext/ruby-cbc/install/lib/libClp.so.1 +0 -0
  257. data/ext/ruby-cbc/install/lib/libClp.so.1.13.9 +0 -0
  258. data/ext/ruby-cbc/install/lib/libClpSolver.la +35 -0
  259. data/ext/ruby-cbc/install/lib/libClpSolver.so +0 -0
  260. data/ext/ruby-cbc/install/lib/libClpSolver.so.1 +0 -0
  261. data/ext/ruby-cbc/install/lib/libClpSolver.so.1.13.9 +0 -0
  262. data/ext/ruby-cbc/install/lib/libCoinUtils.la +35 -0
  263. data/ext/ruby-cbc/install/lib/libCoinUtils.so +0 -0
  264. data/ext/ruby-cbc/install/lib/libCoinUtils.so.3 +0 -0
  265. data/ext/ruby-cbc/install/lib/libCoinUtils.so.3.10.11 +0 -0
  266. data/ext/ruby-cbc/install/lib/libOsi.la +35 -0
  267. data/ext/ruby-cbc/install/lib/libOsi.so +0 -0
  268. data/ext/ruby-cbc/install/lib/libOsi.so.1 +0 -0
  269. data/ext/ruby-cbc/install/lib/libOsi.so.1.12.6 +0 -0
  270. data/ext/ruby-cbc/install/lib/libOsiCbc.la +35 -0
  271. data/ext/ruby-cbc/install/lib/libOsiCbc.so +0 -0
  272. data/ext/ruby-cbc/install/lib/libOsiCbc.so.3 +0 -0
  273. data/ext/ruby-cbc/install/lib/libOsiCbc.so.3.9.7 +0 -0
  274. data/ext/ruby-cbc/install/lib/libOsiClp.la +35 -0
  275. data/ext/ruby-cbc/install/lib/libOsiClp.so +0 -0
  276. data/ext/ruby-cbc/install/lib/libOsiClp.so.1 +0 -0
  277. data/ext/ruby-cbc/install/lib/libOsiClp.so.1.13.9 +0 -0
  278. data/ext/ruby-cbc/install/lib/libOsiCommonTests.la +35 -0
  279. data/ext/ruby-cbc/install/lib/libOsiCommonTests.so +0 -0
  280. data/ext/ruby-cbc/install/lib/libOsiCommonTests.so.1 +0 -0
  281. data/ext/ruby-cbc/install/lib/libOsiCommonTests.so.1.12.6 +0 -0
  282. data/ext/ruby-cbc/install/lib/pkgconfig/cbc.pc +12 -0
  283. data/ext/ruby-cbc/install/lib/pkgconfig/cgl.pc +12 -0
  284. data/ext/ruby-cbc/install/lib/pkgconfig/clp.pc +12 -0
  285. data/ext/ruby-cbc/install/lib/pkgconfig/coindatamiplib3.pc +9 -0
  286. data/ext/ruby-cbc/install/lib/pkgconfig/coindatasample.pc +9 -0
  287. data/ext/ruby-cbc/install/lib/pkgconfig/coinutils.pc +12 -0
  288. data/ext/ruby-cbc/install/lib/pkgconfig/osi-cbc.pc +12 -0
  289. data/ext/ruby-cbc/install/lib/pkgconfig/osi-clp.pc +12 -0
  290. data/ext/ruby-cbc/install/lib/pkgconfig/osi-unittests.pc +12 -0
  291. data/ext/ruby-cbc/install/lib/pkgconfig/osi.pc +12 -0
  292. data/lib/ruby-cbc/ilp/constant.rb +44 -0
  293. data/lib/ruby-cbc/ilp/constraint.rb +32 -0
  294. data/lib/ruby-cbc/ilp/objective.rb +26 -0
  295. data/lib/ruby-cbc/ilp/term.rb +47 -0
  296. data/lib/ruby-cbc/ilp/term_array.rb +80 -0
  297. data/lib/ruby-cbc/ilp/var.rb +62 -0
  298. data/lib/ruby-cbc/model.rb +125 -0
  299. data/lib/ruby-cbc/problem.rb +170 -0
  300. data/lib/ruby-cbc/version.rb +3 -0
  301. data/lib/ruby-cbc.rb +21 -0
  302. data/ruby-cbc.gemspec +36 -0
  303. metadata +431 -0
@@ -0,0 +1,682 @@
1
+ /* $Id: CbcHeuristic.hpp 2094 2014-11-18 11:15:36Z forrest $ */
2
+ // Copyright (C) 2002, International Business Machines
3
+ // Corporation and others. All Rights Reserved.
4
+ // This code is licensed under the terms of the Eclipse Public License (EPL).
5
+
6
+ #ifndef CbcHeuristic_H
7
+ #define CbcHeuristic_H
8
+
9
+ #include <string>
10
+ #include <vector>
11
+ #include "CoinPackedMatrix.hpp"
12
+ #include "OsiCuts.hpp"
13
+ #include "CoinHelperFunctions.hpp"
14
+ #include "OsiBranchingObject.hpp"
15
+
16
+ class OsiSolverInterface;
17
+
18
+ class CbcModel;
19
+
20
+ //#############################################################################
21
+
22
+ class CbcHeuristicNodeList;
23
+ class CbcBranchingObject;
24
+
25
+ /** A class describing the branching decisions that were made to get
26
+ to the node where a heuristic was invoked from */
27
+
28
+ class CbcHeuristicNode {
29
+ private:
30
+ void gutsOfConstructor(CbcModel& model);
31
+ CbcHeuristicNode();
32
+ CbcHeuristicNode& operator=(const CbcHeuristicNode&);
33
+ private:
34
+ /// The number of branching decisions made
35
+ int numObjects_;
36
+ /** The indices of the branching objects. Note: an index may be
37
+ listed multiple times. E.g., a general integer variable that has
38
+ been branched on multiple times. */
39
+ CbcBranchingObject** brObj_;
40
+ public:
41
+ CbcHeuristicNode(CbcModel& model);
42
+
43
+ CbcHeuristicNode(const CbcHeuristicNode& rhs);
44
+ ~CbcHeuristicNode();
45
+ double distance(const CbcHeuristicNode* node) const;
46
+ double minDistance(const CbcHeuristicNodeList& nodeList) const;
47
+ bool minDistanceIsSmall(const CbcHeuristicNodeList& nodeList,
48
+ const double threshold) const;
49
+ double avgDistance(const CbcHeuristicNodeList& nodeList) const;
50
+ };
51
+
52
+ class CbcHeuristicNodeList {
53
+ private:
54
+ void gutsOfDelete();
55
+ void gutsOfCopy(const CbcHeuristicNodeList& rhs);
56
+ private:
57
+ std::vector<CbcHeuristicNode*> nodes_;
58
+ public:
59
+ CbcHeuristicNodeList() {}
60
+ CbcHeuristicNodeList(const CbcHeuristicNodeList& rhs);
61
+ CbcHeuristicNodeList& operator=(const CbcHeuristicNodeList& rhs);
62
+ ~CbcHeuristicNodeList();
63
+
64
+ void append(CbcHeuristicNode*& node);
65
+ void append(const CbcHeuristicNodeList& nodes);
66
+ inline const CbcHeuristicNode* node(int i) const {
67
+ return nodes_[i];
68
+ }
69
+ inline int size() const {
70
+ return static_cast<int>(nodes_.size());
71
+ }
72
+ };
73
+
74
+ //#############################################################################
75
+ /** Heuristic base class */
76
+
77
+ class CbcHeuristic {
78
+ private:
79
+ void gutsOfDelete() {}
80
+ void gutsOfCopy(const CbcHeuristic & rhs);
81
+
82
+ public:
83
+ // Default Constructor
84
+ CbcHeuristic ();
85
+
86
+ // Constructor with model - assumed before cuts
87
+ CbcHeuristic (CbcModel & model);
88
+
89
+ // Copy constructor
90
+ CbcHeuristic ( const CbcHeuristic &);
91
+
92
+ virtual ~CbcHeuristic();
93
+
94
+ /// Clone
95
+ virtual CbcHeuristic * clone() const = 0;
96
+
97
+ /// Assignment operator
98
+ CbcHeuristic & operator=(const CbcHeuristic& rhs);
99
+
100
+ /// update model (This is needed if cliques update matrix etc)
101
+ virtual void setModel(CbcModel * model);
102
+
103
+ /// Resets stuff if model changes
104
+ virtual void resetModel(CbcModel * model) = 0;
105
+
106
+ /** returns 0 if no solution, 1 if valid solution
107
+ with better objective value than one passed in
108
+ Sets solution values if good, sets objective value
109
+ This is called after cuts have been added - so can not add cuts
110
+ */
111
+ virtual int solution(double & objectiveValue,
112
+ double * newSolution) = 0;
113
+
114
+ /** returns 0 if no solution, 1 if valid solution, -1 if just
115
+ returning an estimate of best possible solution
116
+ with better objective value than one passed in
117
+ Sets solution values if good, sets objective value (only if nonzero code)
118
+ This is called at same time as cut generators - so can add cuts
119
+ Default is do nothing
120
+ */
121
+ virtual int solution2(double & /*objectiveValue*/,
122
+ double * /*newSolution*/,
123
+ OsiCuts & /*cs*/) {
124
+ return 0;
125
+ }
126
+
127
+ /// Validate model i.e. sets when_ to 0 if necessary (may be NULL)
128
+ virtual void validate() {}
129
+
130
+ /** Sets "when" flag - 0 off, 1 at root, 2 other than root, 3 always.
131
+ If 10 added then don't worry if validate says there are funny objects
132
+ as user knows it will be fine
133
+ */
134
+ inline void setWhen(int value) {
135
+ when_ = value;
136
+ }
137
+ /// Gets "when" flag - 0 off, 1 at root, 2 other than root, 3 always
138
+ inline int when() const {
139
+ return when_;
140
+ }
141
+
142
+ /// Sets number of nodes in subtree (default 200)
143
+ inline void setNumberNodes(int value) {
144
+ numberNodes_ = value;
145
+ }
146
+ /// Gets number of nodes in a subtree (default 200)
147
+ inline int numberNodes() const {
148
+ return numberNodes_;
149
+ }
150
+ /** Switches (does not apply equally to all heuristics)
151
+ 1 bit - stop once allowable gap on objective reached
152
+ 2 bit - always do given number of passes
153
+ 4 bit - weaken cutoff by 5% every 50 passes?
154
+ 8 bit - if has cutoff and suminf bobbling for 20 passes then
155
+ first try halving distance to best possible then
156
+ try keep halving distance to known cutoff
157
+ 16 bit - needs new solution to run
158
+ 1024 bit - stop all heuristics on max time
159
+ */
160
+ inline void setSwitches(int value) {
161
+ switches_ = value;
162
+ }
163
+ /** Switches (does not apply equally to all heuristics)
164
+ 1 bit - stop once allowable gap on objective reached
165
+ 2 bit - always do given number of passes
166
+ 4 bit - weaken cutoff by 5% every 50 passes?
167
+ 8 bit - if has cutoff and suminf bobbling for 20 passes then
168
+ first try halving distance to best possible then
169
+ try keep halving distance to known cutoff
170
+ 16 bit - needs new solution to run
171
+ 1024 bit - stop all heuristics on max time
172
+ 65536 bit and above used for temporary communication
173
+ */
174
+ inline int switches() const {
175
+ return switches_;
176
+ }
177
+ /// Whether to exit at once on gap
178
+ bool exitNow(double bestObjective) const;
179
+ /// Sets feasibility pump options (-1 is off)
180
+ inline void setFeasibilityPumpOptions(int value) {
181
+ feasibilityPumpOptions_ = value;
182
+ }
183
+ /// Gets feasibility pump options (-1 is off)
184
+ inline int feasibilityPumpOptions() const {
185
+ return feasibilityPumpOptions_;
186
+ }
187
+ /// Just set model - do not do anything else
188
+ inline void setModelOnly(CbcModel * model) {
189
+ model_ = model;
190
+ }
191
+
192
+
193
+ /// Sets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0)
194
+ inline void setFractionSmall(double value) {
195
+ fractionSmall_ = value;
196
+ }
197
+ /// Gets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0)
198
+ inline double fractionSmall() const {
199
+ return fractionSmall_;
200
+ }
201
+ /// Get how many solutions the heuristic thought it got
202
+ inline int numberSolutionsFound() const {
203
+ return numberSolutionsFound_;
204
+ }
205
+ /// Increment how many solutions the heuristic thought it got
206
+ inline void incrementNumberSolutionsFound() {
207
+ numberSolutionsFound_++;
208
+ }
209
+
210
+ /** Do mini branch and bound - return
211
+ 0 not finished - no solution
212
+ 1 not finished - solution
213
+ 2 finished - no solution
214
+ 3 finished - solution
215
+ (could add global cut if finished)
216
+ -1 returned on size
217
+ -2 time or user event
218
+ */
219
+ int smallBranchAndBound(OsiSolverInterface * solver, int numberNodes,
220
+ double * newSolution, double & newSolutionValue,
221
+ double cutoff , std::string name) const;
222
+ /// Create C++ lines to get to current state
223
+ virtual void generateCpp( FILE * ) {}
224
+ /// Create C++ lines to get to current state - does work for base class
225
+ void generateCpp( FILE * fp, const char * heuristic) ;
226
+ /// Returns true if can deal with "odd" problems e.g. sos type 2
227
+ virtual bool canDealWithOdd() const {
228
+ return false;
229
+ }
230
+ /// return name of heuristic
231
+ inline const char *heuristicName() const {
232
+ return heuristicName_.c_str();
233
+ }
234
+ /// set name of heuristic
235
+ inline void setHeuristicName(const char *name) {
236
+ heuristicName_ = name;
237
+ }
238
+ /// Set random number generator seed
239
+ void setSeed(int value);
240
+ /// Get random number generator seed
241
+ int getSeed() const;
242
+ /// Sets decay factor (for howOften) on failure
243
+ inline void setDecayFactor(double value) {
244
+ decayFactor_ = value;
245
+ }
246
+ /// Set input solution
247
+ void setInputSolution(const double * solution, double objValue);
248
+ /* Runs if bit set
249
+ 0 - before cuts at root node (or from doHeuristics)
250
+ 1 - during cuts at root
251
+ 2 - after root node cuts
252
+ 3 - after cuts at other nodes
253
+ 4 - during cuts at other nodes
254
+ 8 added if previous heuristic in loop found solution
255
+ */
256
+ inline void setWhereFrom(int value) {
257
+ whereFrom_ = value;
258
+ }
259
+ inline int whereFrom() const {
260
+ return whereFrom_;
261
+ }
262
+ /** Upto this depth we call the tree shallow and the heuristic can be called
263
+ multiple times. That is, the test whether the current node is far from
264
+ the others where the jeuristic was invoked will not be done, only the
265
+ frequency will be tested. After that depth the heuristic will can be
266
+ invoked only once per node, right before branching. That's when it'll be
267
+ tested whether the heur should run at all. */
268
+ inline void setShallowDepth(int value) {
269
+ shallowDepth_ = value;
270
+ }
271
+ /** How often to invoke the heuristics in the shallow part of the tree */
272
+ inline void setHowOftenShallow(int value) {
273
+ howOftenShallow_ = value;
274
+ }
275
+ /** How "far" should this node be from every other where the heuristic was
276
+ run in order to allow the heuristic to run in this node, too. Currently
277
+ this is tested, but we may switch to avgDistanceToRun_ in the future. */
278
+ inline void setMinDistanceToRun(int value) {
279
+ minDistanceToRun_ = value;
280
+ }
281
+
282
+ /** Check whether the heuristic should run at all
283
+ 0 - before cuts at root node (or from doHeuristics)
284
+ 1 - during cuts at root
285
+ 2 - after root node cuts
286
+ 3 - after cuts at other nodes
287
+ 4 - during cuts at other nodes
288
+ 8 added if previous heuristic in loop found solution
289
+ */
290
+ virtual bool shouldHeurRun(int whereFrom);
291
+ /** Check whether the heuristic should run this time */
292
+ bool shouldHeurRun_randomChoice();
293
+ void debugNodes();
294
+ void printDistanceToNodes();
295
+ /// how many times the heuristic has actually run
296
+ inline int numRuns() const {
297
+ return numRuns_;
298
+ }
299
+
300
+ /// How many times the heuristic could run
301
+ inline int numCouldRun() const {
302
+ return numCouldRun_;
303
+ }
304
+ /*! \brief Clone, but ...
305
+
306
+ If type is
307
+ - 0 clone the solver for the model,
308
+ - 1 clone the continuous solver for the model
309
+ - Add 2 to say without integer variables which are at low priority
310
+ - Add 4 to say quite likely infeasible so give up easily (clp only).
311
+ */
312
+ OsiSolverInterface * cloneBut(int type);
313
+ protected:
314
+
315
+ /// Model
316
+ CbcModel * model_;
317
+ /// When flag - 0 off, 1 at root, 2 other than root, 3 always
318
+ int when_;
319
+ /// Number of nodes in any sub tree
320
+ int numberNodes_;
321
+ /** Feasibility pump options , -1 is off
322
+ >=0 for feasibility pump itself
323
+ -2 quick proximity search
324
+ -3 longer proximity search
325
+ */
326
+ int feasibilityPumpOptions_;
327
+ /// Fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound
328
+ mutable double fractionSmall_;
329
+ /// Thread specific random number generator
330
+ CoinThreadRandom randomNumberGenerator_;
331
+ /// Name for printing
332
+ std::string heuristicName_;
333
+
334
+ /// How often to do (code can change)
335
+ mutable int howOften_;
336
+ /// How much to increase how often
337
+ double decayFactor_;
338
+ /** Switches (does not apply equally to all heuristics)
339
+ 1 bit - stop once allowable gap on objective reached
340
+ 2 bit - always do given number of passes
341
+ 4 bit - weaken cutoff by 5% every 50 passes?
342
+ 8 bit - if has cutoff and suminf bobbling for 20 passes then
343
+ first try halving distance to best possible then
344
+ try keep halving distance to known cutoff
345
+ 16 bit - needs new solution to run
346
+ 1024 bit - stop all heuristics on max time
347
+ */
348
+ mutable int switches_;
349
+ /* Runs if bit set
350
+ 0 - before cuts at root node (or from doHeuristics)
351
+ 1 - during cuts at root
352
+ 2 - after root node cuts
353
+ 3 - after cuts at other nodes
354
+ 4 - during cuts at other nodes
355
+ 8 added if previous heuristic in loop found solution
356
+ */
357
+ int whereFrom_;
358
+ /** Upto this depth we call the tree shallow and the heuristic can be called
359
+ multiple times. That is, the test whether the current node is far from
360
+ the others where the jeuristic was invoked will not be done, only the
361
+ frequency will be tested. After that depth the heuristic will can be
362
+ invoked only once per node, right before branching. That's when it'll be
363
+ tested whether the heur should run at all. */
364
+ int shallowDepth_;
365
+ /** How often to invoke the heuristics in the shallow part of the tree */
366
+ int howOftenShallow_;
367
+ /** How many invocations happened within the same node when in a shallow
368
+ part of the tree. */
369
+ int numInvocationsInShallow_;
370
+ /** How many invocations happened when in the deep part of the tree. For
371
+ every node we count only one invocation. */
372
+ int numInvocationsInDeep_;
373
+ /** After how many deep invocations was the heuristic run last time */
374
+ int lastRunDeep_;
375
+ /// how many times the heuristic has actually run
376
+ int numRuns_;
377
+ /** How "far" should this node be from every other where the heuristic was
378
+ run in order to allow the heuristic to run in this node, too. Currently
379
+ this is tested, but we may switch to avgDistanceToRun_ in the future. */
380
+ int minDistanceToRun_;
381
+
382
+ /// The description of the nodes where this heuristic has been applied
383
+ CbcHeuristicNodeList runNodes_;
384
+
385
+ /// How many times the heuristic could run
386
+ int numCouldRun_;
387
+
388
+ /// How many solutions the heuristic thought it got
389
+ int numberSolutionsFound_;
390
+
391
+ /// How many nodes the heuristic did this go
392
+ mutable int numberNodesDone_;
393
+
394
+ // Input solution - so can be used as seed
395
+ double * inputSolution_;
396
+
397
+
398
+ #ifdef JJF_ZERO
399
+ /// Lower bounds of last node where the heuristic found a solution
400
+ double * lowerBoundLastNode_;
401
+ /// Upper bounds of last node where the heuristic found a solution
402
+ double * upperBoundLastNode_;
403
+ #endif
404
+ };
405
+ /** Rounding class
406
+ */
407
+
408
+ class CbcRounding : public CbcHeuristic {
409
+ public:
410
+
411
+ // Default Constructor
412
+ CbcRounding ();
413
+
414
+ // Constructor with model - assumed before cuts
415
+ CbcRounding (CbcModel & model);
416
+
417
+ // Copy constructor
418
+ CbcRounding ( const CbcRounding &);
419
+
420
+ // Destructor
421
+ ~CbcRounding ();
422
+
423
+ /// Assignment operator
424
+ CbcRounding & operator=(const CbcRounding& rhs);
425
+
426
+ /// Clone
427
+ virtual CbcHeuristic * clone() const;
428
+ /// Create C++ lines to get to current state
429
+ virtual void generateCpp( FILE * fp) ;
430
+
431
+ /// Resets stuff if model changes
432
+ virtual void resetModel(CbcModel * model);
433
+
434
+ /// update model (This is needed if cliques update matrix etc)
435
+ virtual void setModel(CbcModel * model);
436
+
437
+ using CbcHeuristic::solution ;
438
+ /** returns 0 if no solution, 1 if valid solution
439
+ with better objective value than one passed in
440
+ Sets solution values if good, sets objective value (only if good)
441
+ This is called after cuts have been added - so can not add cuts
442
+ */
443
+ virtual int solution(double & objectiveValue,
444
+ double * newSolution);
445
+ /** returns 0 if no solution, 1 if valid solution
446
+ with better objective value than one passed in
447
+ Sets solution values if good, sets objective value (only if good)
448
+ This is called after cuts have been added - so can not add cuts
449
+ Use solutionValue rather than solvers one
450
+ */
451
+ virtual int solution(double & objectiveValue,
452
+ double * newSolution,
453
+ double solutionValue);
454
+ /// Validate model i.e. sets when_ to 0 if necessary (may be NULL)
455
+ virtual void validate();
456
+
457
+
458
+ /// Set seed
459
+ void setSeed(int value) {
460
+ seed_ = value;
461
+ }
462
+ /** Check whether the heuristic should run at all
463
+ 0 - before cuts at root node (or from doHeuristics)
464
+ 1 - during cuts at root
465
+ 2 - after root node cuts
466
+ 3 - after cuts at other nodes
467
+ 4 - during cuts at other nodes
468
+ 8 added if previous heuristic in loop found solution
469
+ */
470
+ virtual bool shouldHeurRun(int whereFrom);
471
+
472
+ protected:
473
+ // Data
474
+
475
+ // Original matrix by column
476
+ CoinPackedMatrix matrix_;
477
+
478
+ // Original matrix by
479
+ CoinPackedMatrix matrixByRow_;
480
+
481
+ // Down locks
482
+ unsigned short * down_;
483
+
484
+ // Up locks
485
+ unsigned short * up_;
486
+
487
+ // Equality locks
488
+ unsigned short * equal_;
489
+
490
+ // Seed for random stuff
491
+ int seed_;
492
+ };
493
+
494
+ /** Partial solution class
495
+ If user knows a partial solution this tries to get an integer solution
496
+ it uses hotstart information
497
+ */
498
+
499
+ class CbcHeuristicPartial : public CbcHeuristic {
500
+ public:
501
+
502
+ // Default Constructor
503
+ CbcHeuristicPartial ();
504
+
505
+ /** Constructor with model - assumed before cuts
506
+ Fixes all variables with priority <= given
507
+ and does given number of nodes
508
+ */
509
+ CbcHeuristicPartial (CbcModel & model, int fixPriority = 10000, int numberNodes = 200);
510
+
511
+ // Copy constructor
512
+ CbcHeuristicPartial ( const CbcHeuristicPartial &);
513
+
514
+ // Destructor
515
+ ~CbcHeuristicPartial ();
516
+
517
+ /// Assignment operator
518
+ CbcHeuristicPartial & operator=(const CbcHeuristicPartial& rhs);
519
+
520
+ /// Clone
521
+ virtual CbcHeuristic * clone() const;
522
+ /// Create C++ lines to get to current state
523
+ virtual void generateCpp( FILE * fp) ;
524
+
525
+ /// Resets stuff if model changes
526
+ virtual void resetModel(CbcModel * model);
527
+
528
+ /// update model (This is needed if cliques update matrix etc)
529
+ virtual void setModel(CbcModel * model);
530
+
531
+ using CbcHeuristic::solution ;
532
+ /** returns 0 if no solution, 1 if valid solution
533
+ with better objective value than one passed in
534
+ Sets solution values if good, sets objective value (only if good)
535
+ This is called after cuts have been added - so can not add cuts
536
+ */
537
+ virtual int solution(double & objectiveValue,
538
+ double * newSolution);
539
+ /// Validate model i.e. sets when_ to 0 if necessary (may be NULL)
540
+ virtual void validate();
541
+
542
+
543
+ /// Set priority level
544
+ void setFixPriority(int value) {
545
+ fixPriority_ = value;
546
+ }
547
+
548
+ /** Check whether the heuristic should run at all */
549
+ virtual bool shouldHeurRun(int whereFrom);
550
+
551
+ protected:
552
+ // Data
553
+
554
+ // All variables with abs priority <= this will be fixed
555
+ int fixPriority_;
556
+ };
557
+
558
+ /** heuristic - just picks up any good solution
559
+ found by solver - see OsiBabSolver
560
+ */
561
+
562
+ class CbcSerendipity : public CbcHeuristic {
563
+ public:
564
+
565
+ // Default Constructor
566
+ CbcSerendipity ();
567
+
568
+ /* Constructor with model
569
+ */
570
+ CbcSerendipity (CbcModel & model);
571
+
572
+ // Copy constructor
573
+ CbcSerendipity ( const CbcSerendipity &);
574
+
575
+ // Destructor
576
+ ~CbcSerendipity ();
577
+
578
+ /// Assignment operator
579
+ CbcSerendipity & operator=(const CbcSerendipity& rhs);
580
+
581
+ /// Clone
582
+ virtual CbcHeuristic * clone() const;
583
+ /// Create C++ lines to get to current state
584
+ virtual void generateCpp( FILE * fp) ;
585
+
586
+ /// update model
587
+ virtual void setModel(CbcModel * model);
588
+
589
+ using CbcHeuristic::solution ;
590
+ /** returns 0 if no solution, 1 if valid solution.
591
+ Sets solution values if good, sets objective value (only if good)
592
+ We leave all variables which are at one at this node of the
593
+ tree to that value and will
594
+ initially set all others to zero. We then sort all variables in order of their cost
595
+ divided by the number of entries in rows which are not yet covered. We randomize that
596
+ value a bit so that ties will be broken in different ways on different runs of the heuristic.
597
+ We then choose the best one and set it to one and repeat the exercise.
598
+
599
+ */
600
+ virtual int solution(double & objectiveValue,
601
+ double * newSolution);
602
+ /// Resets stuff if model changes
603
+ virtual void resetModel(CbcModel * model);
604
+
605
+ protected:
606
+ };
607
+
608
+ /** Just One class - this chooses one at random
609
+ */
610
+
611
+ class CbcHeuristicJustOne : public CbcHeuristic {
612
+ public:
613
+
614
+ // Default Constructor
615
+ CbcHeuristicJustOne ();
616
+
617
+ // Constructor with model - assumed before cuts
618
+ CbcHeuristicJustOne (CbcModel & model);
619
+
620
+ // Copy constructor
621
+ CbcHeuristicJustOne ( const CbcHeuristicJustOne &);
622
+
623
+ // Destructor
624
+ ~CbcHeuristicJustOne ();
625
+
626
+ /// Clone
627
+ virtual CbcHeuristicJustOne * clone() const;
628
+
629
+ /// Assignment operator
630
+ CbcHeuristicJustOne & operator=(const CbcHeuristicJustOne& rhs);
631
+
632
+ /// Create C++ lines to get to current state
633
+ virtual void generateCpp( FILE * fp) ;
634
+
635
+ /** returns 0 if no solution, 1 if valid solution
636
+ with better objective value than one passed in
637
+ Sets solution values if good, sets objective value (only if good)
638
+ This is called after cuts have been added - so can not add cuts
639
+ This does Fractional Diving
640
+ */
641
+ virtual int solution(double & objectiveValue,
642
+ double * newSolution);
643
+ /// Resets stuff if model changes
644
+ virtual void resetModel(CbcModel * model);
645
+
646
+ /// update model (This is needed if cliques update matrix etc)
647
+ virtual void setModel(CbcModel * model);
648
+ /// Selects the next variable to branch on
649
+ /** Returns true if all the fractional variables can be trivially
650
+ rounded. Returns false, if there is at least one fractional variable
651
+ that is not trivially roundable. In this case, the bestColumn
652
+ returned will not be trivially roundable.
653
+ This is dummy as never called
654
+ */
655
+ virtual bool selectVariableToBranch(OsiSolverInterface* /*solver*/,
656
+ const double* /*newSolution*/,
657
+ int& /*bestColumn*/,
658
+ int& /*bestRound*/) {
659
+ return true;
660
+ }
661
+ /// Validate model i.e. sets when_ to 0 if necessary (may be NULL)
662
+ virtual void validate();
663
+ /// Adds an heuristic with probability
664
+ void addHeuristic(const CbcHeuristic * heuristic, double probability);
665
+ /// Normalize probabilities
666
+ void normalizeProbabilities();
667
+ protected:
668
+ // Data
669
+
670
+ // Probability of running a heuristic
671
+ double * probabilities_;
672
+
673
+ // Heuristics
674
+ CbcHeuristic ** heuristic_;
675
+
676
+ // Number of heuristics
677
+ int numberHeuristics_;
678
+
679
+ };
680
+
681
+ #endif
682
+