ruby-cbc 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
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,62 @@
1
+ module Ilp
2
+ class Var
3
+ attr_accessor :kind, :name, :lower_bound, :upper_bound
4
+
5
+ BINARY_KIND = :binary
6
+ INTEGER_KIND = :integer
7
+ CONTINUOUS_KIND = :continuous
8
+
9
+ def initialize(name: nil, kind: INTEGER_KIND, lower_bound: nil, upper_bound: nil)
10
+ @kind = kind
11
+ @name = name
12
+ @name = ('a'..'z').to_a.shuffle[0,8].join if name.nil?
13
+ @lower_bound = lower_bound
14
+ @upper_bound = upper_bound
15
+ end
16
+
17
+ def bounds=(range)
18
+ @lower_bound = range.min
19
+ @upper_bound = range.max
20
+ end
21
+
22
+ def bounds
23
+ @lower_bound..@upper_bound
24
+ end
25
+
26
+ def +(vars)
27
+ Ilp::Term.new(self) + vars
28
+ end
29
+
30
+ def -(vars)
31
+ Ilp::Term.new(self) - vars
32
+ end
33
+
34
+ def -@
35
+ Ilp::Term.new(self, -1)
36
+ end
37
+
38
+ def *(mult)
39
+ Ilp::Term.new(self) * mult
40
+ end
41
+
42
+ def ==(vars)
43
+ Ilp::Term.new(self) == vars
44
+ end
45
+
46
+ def <=(vars)
47
+ Ilp::Term.new(self) <= vars
48
+ end
49
+
50
+ def >=(vars)
51
+ Ilp::Term.new(self) >= vars
52
+ end
53
+
54
+ def coerce(num)
55
+ [Ilp::Term.new(self), num]
56
+ end
57
+
58
+ def to_s
59
+ name
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,125 @@
1
+ require "set"
2
+
3
+ module Cbc
4
+
5
+ INF = 1.0 / 0.0 # Useful for ranges
6
+
7
+ class Model
8
+
9
+
10
+ attr_accessor :vars, :constraints, :objective, :name
11
+
12
+ def initialize(name: "ILP Problem")
13
+ @vars = Set.new
14
+ @constraints = Set.new
15
+ @objective = nil
16
+ @name = name
17
+ end
18
+
19
+ def int_var(range = nil, name: nil)
20
+ var(Ilp::Var::INTEGER_KIND, range, name)
21
+ end
22
+
23
+ def int_var_array(length, range = nil, names: nil)
24
+ array_var(length, Ilp::Var::INTEGER_KIND, range, names)
25
+ end
26
+
27
+ def bin_var(name: nil)
28
+ var(Ilp::Var::BINARY_KIND, nil, name)
29
+ end
30
+
31
+ def bin_var_array(length, names: nil)
32
+ array_var(length, Ilp::Var::BINARY_KIND, range, names)
33
+ end
34
+
35
+ def cont_var(range = nil, name: nil)
36
+ var(Ilp::Var::CONTINUOUS_KIND, range, name)
37
+ end
38
+
39
+ def cont_var_array(length, range = nil, name: nil)
40
+ array_var(length, Ilp::Var::CONTINUOUS_KIND, range, names)
41
+ end
42
+
43
+ def enforce(constraint)
44
+ constraints << constraint
45
+ end
46
+
47
+ def minimize(expression)
48
+ @objective = Ilp::Objective.new(expression, Ilp::Objective::MINIMIZE) if expression
49
+ self
50
+ end
51
+
52
+ def maximize(expression)
53
+ @objective = Ilp::Objective.new(expression, Ilp::Objective::MAXIMIZE) if expression
54
+ self
55
+ end
56
+
57
+ def to_problem
58
+ Cbc::Problem.new(self)
59
+ end
60
+
61
+ def to_s
62
+ str = ""
63
+ if objective
64
+ str << objective.to_s << "\n"
65
+ else
66
+ str << "Maximize\n 0 #{vars.first.to_s}\n"
67
+ end
68
+ str << "\nSubject To\n"
69
+ constraints.each do |cons|
70
+ str << " " << cons.to_s << "\n"
71
+ end
72
+ bounded_vars = vars.select{ |v| v.kind != Ilp::Var::BINARY_KIND }
73
+ if bounded_vars.any?
74
+ str << "\nBounds\n"
75
+ bounded_vars.each { |v| str << " #{lb_to_s(v.lower_bound)} <= #{v} <= #{ub_to_s(v.upper_bound)}\n" }
76
+ end
77
+
78
+ int_vars = vars.select{ |v| v.kind == Ilp::Var::INTEGER_KIND }
79
+ if int_vars.any?
80
+ str << "\nGenerals\n"
81
+ int_vars.each { |v| str << " #{v}\n" }
82
+ end
83
+
84
+ bin_vars = vars.select{ |v| v.kind == Ilp::Var::BINARY_KIND }
85
+ if bin_vars.any?
86
+ str << "\nBinaries\n"
87
+ bin_vars.each { |v| str << " #{v}\n" }
88
+ end
89
+ str << "\nEnd\n"
90
+
91
+ str
92
+ end
93
+
94
+ private
95
+ def array_var(length, kind, range, names)
96
+ ar = Array.new(length) { var(kind, range, nil) }
97
+ ar.zip(names).map{ |var, name| var.name = name } unless names.nil?
98
+ ar
99
+ end
100
+
101
+ def var(kind, range, name)
102
+ if range.nil?
103
+ v = Ilp::Var.new(kind: kind, name: name)
104
+ @vars << v
105
+ return v
106
+ end
107
+ v = Ilp::Var.new(kind: kind, name: name, lower_bound: range.min, upper_bound: range.max)
108
+ @vars << v
109
+ v
110
+ end
111
+
112
+ def lb_to_s(lb)
113
+ return "-inf" if ! lb || lb == -Cbc::INF
114
+ return "+inf" if lb == Cbc::INF
115
+ return "#{lb}"
116
+ end
117
+
118
+ def ub_to_s(ub)
119
+ return "+inf" if ! ub || ub == Cbc::INF
120
+ return "-inf" if ub == -Cbc::INF
121
+ return "#{ub}"
122
+ end
123
+
124
+ end
125
+ end
@@ -0,0 +1,170 @@
1
+ # require "../../ext/ruby-cbc/install/lib/cbc_wrapper"
2
+
3
+ module Cbc
4
+ class Problem
5
+
6
+
7
+ def initialize(model)
8
+
9
+ @int_arrays = []
10
+ @double_arrays = []
11
+
12
+ @variables = {}
13
+ vars = model.vars
14
+ vars_data = {}
15
+ vars.each_with_index do |v, idx|
16
+ @variables[v] = idx
17
+ vars_data[v] = VarData.new(v, idx, [], [])
18
+ end
19
+
20
+ model.constraints.each_with_index do |c, idx|
21
+ c.terms.each do |term|
22
+ v_data = vars_data[term.var]
23
+ v_data.constraints << idx
24
+ v_data.coefs << term.mult
25
+ end
26
+ end
27
+
28
+ indexes = []
29
+ rows = []
30
+ coefs = []
31
+
32
+ vars.each_with_index do |v, idx|
33
+ v_data = vars_data[v]
34
+ indexes[idx] = rows.count
35
+ rows += v_data.constraints
36
+ coefs += v_data.coefs
37
+ end
38
+
39
+ indexes << rows.count
40
+
41
+ objective = Array.new(vars.count, 0)
42
+ if model.objective
43
+ model.objective.terms.each do |term|
44
+ objective[vars_data[term.var].col_idx] = term.mult
45
+ end
46
+ end
47
+
48
+ @cbc_model = Cbc_wrapper.Cbc_newModel
49
+ Cbc_wrapper.Cbc_loadProblem(@cbc_model, model.vars.count, model.constraints.count,
50
+ to_int_array(indexes), to_int_array(rows),
51
+ to_double_array(coefs), nil, nil, to_double_array(objective),
52
+ nil, nil)
53
+
54
+ # Segmentation errors when setting name
55
+ # Cbc_wrapper.Cbc_setProblemName(@cbc_model, model.name) if model.name
56
+
57
+ if model.objective
58
+ obj_sense = model.objective.objective_function == Ilp::Objective::MINIMIZE ? 1 : -1
59
+ Cbc_wrapper.Cbc_setObjSense(@cbc_model, obj_sense)
60
+ end
61
+
62
+ model.constraints.each_with_index do |c, idx|
63
+ case c.type
64
+ when Ilp::Constraint::LESS_OR_EQ
65
+ Cbc_wrapper.Cbc_setRowUpper(@cbc_model, idx, c.bound)
66
+ when Ilp::Constraint::GREATER_OR_EQ
67
+ Cbc_wrapper.Cbc_setRowLower(@cbc_model, idx, c.bound)
68
+ when Ilp::Constraint::EQUALS
69
+ Cbc_wrapper.Cbc_setRowUpper(@cbc_model, idx, c.bound)
70
+ Cbc_wrapper.Cbc_setRowLower(@cbc_model, idx, c.bound)
71
+ end
72
+ end
73
+ model.vars.each_with_index do |v, idx|
74
+ case v.kind
75
+ when Ilp::Var::INTEGER_KIND
76
+ Cbc_wrapper.Cbc_setInteger(@cbc_model, idx)
77
+ when Ilp::Var::BINARY_KIND
78
+ Cbc_wrapper.Cbc_setInteger(@cbc_model, idx)
79
+ v.bounds = 0..1
80
+ when Ilp::Var::CONTINUOUS_KIND
81
+ Cbc_wrapper.Cbc_setContinuous(@cbc_model, idx)
82
+ end
83
+ Cbc_wrapper.Cbc_setColLower(@cbc_model, idx, v.lower_bound) unless v.lower_bound.nil?
84
+ Cbc_wrapper.Cbc_setColUpper(@cbc_model, idx, v.upper_bound) unless v.upper_bound.nil?
85
+ end
86
+
87
+ ObjectSpace.define_finalizer(self, self.class.finalizer(@cbc_model, @int_arrays, @double_arrays))
88
+
89
+ @default_solve_params = {
90
+ log: 0,
91
+ }
92
+
93
+ end
94
+
95
+ def solve(params = {})
96
+ @default_solve_params.merge(params).each do |name, value|
97
+ Cbc_wrapper.Cbc_setParameter(@cbc_model, name.to_s, value.to_s)
98
+ end
99
+ Cbc_wrapper.Cbc_solve(@cbc_model)
100
+ @solution = Cbc_wrapper::DoubleArray.frompointer(Cbc_wrapper.Cbc_getColSolution(@cbc_model))
101
+ end
102
+
103
+ def value_of(var)
104
+ idx = @variables[var]
105
+ return nil if idx.nil?
106
+ @solution[idx]
107
+ end
108
+
109
+ def set_time_limit(seconds)
110
+ @default_solve_params[:sec] = seconds
111
+ end
112
+
113
+ def proven_optimal?
114
+ Cbc_wrapper.Cbc_isProvenOptimal(@cbc_model) == 1
115
+ end
116
+
117
+ def proven_infeasible?
118
+ Cbc_wrapper.Cbc_isProvenInfeasible(@cbc_model) == 1
119
+ end
120
+
121
+ def time_limit_reached?
122
+ Cbc_wrapper.Cbc_isSecondsLimitReached(@cbc_model)
123
+ end
124
+
125
+ def solution_limit_reached?
126
+ Cbc_wrapper.Cbc_isSolutionLimitReached(@cbc_model)
127
+ end
128
+
129
+ def objective_value
130
+ Cbc_wrapper.Cbc_getObjValue(@cbc_model)
131
+ end
132
+
133
+ # Returns the best know bound so far
134
+ def best_bound
135
+ Cbc_wrapper.Cbc_getBestPossibleObjValue(@cbc_model)
136
+ end
137
+
138
+ def self.finalizer(cbc_model, int_arrays, double_arrays)
139
+ proc do
140
+ Cbc_wrapper.Cbc_deleteModel(cbc_model)
141
+ int_arrays.each { |ar| Cbc_wrapper.delete_intArray(ar) }
142
+ double_arrays.each { |ar| Cbc_wrapper.delete_doubleArray(ar) }
143
+ end
144
+ end
145
+
146
+ def write
147
+ Cbc_wrapper.Cbc_writeMps(@cbc_model, "test")
148
+ end
149
+
150
+ private
151
+
152
+ def to_int_array(array)
153
+ c_array = Cbc_wrapper::IntArray.new(array.count)
154
+ array.each_with_index { |value, idx| c_array[idx] = value }
155
+ @int_arrays << c_array
156
+ c_array
157
+ end
158
+
159
+ def to_double_array(array)
160
+ c_array = Cbc_wrapper::DoubleArray.new(array.count)
161
+ array.each_with_index { |value, idx| c_array[idx] = value }
162
+ @double_arrays << c_array
163
+ c_array
164
+ end
165
+
166
+ VarData = Struct.new(:variable, :col_idx, :constraints, :coefs)
167
+ end
168
+
169
+
170
+ end
@@ -0,0 +1,3 @@
1
+ module Cbc
2
+ VERSION = "0.1.9"
3
+ end
data/lib/ruby-cbc.rb ADDED
@@ -0,0 +1,21 @@
1
+ require "ruby-cbc/version"
2
+
3
+ module Cbc
4
+ end
5
+
6
+ files = %w(
7
+ model
8
+ problem
9
+ version
10
+ ilp/constant
11
+ ilp/constraint
12
+ ilp/objective
13
+ ilp/term
14
+ ilp/term_array
15
+ ilp/var
16
+ )
17
+
18
+ require File.expand_path("../../ext/ruby-cbc/cbc_wrapper", __FILE__)
19
+ files.each do |file|
20
+ require File.expand_path("../ruby-cbc/#{file}", __FILE__)
21
+ end
data/ruby-cbc.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ruby-cbc/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ruby-cbc"
8
+ spec.version = Cbc::VERSION
9
+ spec.authors = ["Guillaume Verger"]
10
+ spec.email = ["verger.guillaume@gmail.com"]
11
+
12
+ spec.summary = "Wrapper around Cbc Linear Programming Solver"
13
+ spec.description = "Wrapper around Cbc Linear Programming Solver"
14
+ spec.homepage = "https://github.com/gverger/ruby-cbc"
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ if spec.respond_to?(:metadata)
19
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib", "ext"]
28
+ spec.extensions << "ext/ruby-cbc/extconf.rb"
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.10"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rspec"
33
+ spec.add_development_dependency "rake-compiler"
34
+ spec.add_development_dependency "pry"
35
+ spec.add_development_dependency "pry-byebug"
36
+ end