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,805 @@
1
+ /* $Id: CoinLpIO.hpp 1749 2014-10-24 20:00:14Z tkr $ */
2
+ // Last edit: 11/5/08
3
+ //
4
+ // Name: CoinLpIO.hpp; Support for Lp files
5
+ // Author: Francois Margot
6
+ // Tepper School of Business
7
+ // Carnegie Mellon University, Pittsburgh, PA 15213
8
+ // email: fmargot@andrew.cmu.edu
9
+ // Date: 12/28/03
10
+ //-----------------------------------------------------------------------------
11
+ // Copyright (C) 2003, Francois Margot, International Business Machines
12
+ // Corporation and others. All Rights Reserved.
13
+ // This code is licensed under the terms of the Eclipse Public License (EPL).
14
+
15
+ #ifndef CoinLpIO_H
16
+ #define CoinLpIO_H
17
+
18
+ #include <cstdio>
19
+
20
+ #include "CoinPackedMatrix.hpp"
21
+ #include "CoinMessage.hpp"
22
+ class CoinSet;
23
+
24
+ const int MAX_OBJECTIVES = 2;
25
+
26
+ typedef int COINColumnIndex;
27
+
28
+ /** Class to read and write Lp files
29
+
30
+ Lp file format:
31
+
32
+ / this is a comment <BR>
33
+ \ this too <BR>
34
+ Min<BR>
35
+ obj: x0 + x1 + 3 x2 - 4.5 xyr + 1 <BR>
36
+ s.t. <BR>
37
+ cons1: x0 - x2 - 2.3 x4 <= 4.2 / this is another comment <BR>
38
+ c2: x1 + x2 >= 1 <BR>
39
+ cc: x1 + x2 + xyr = 2 <BR>
40
+ Bounds <BR>
41
+ 0 <= x1 <= 3 <BR>
42
+ 1 >= x2 <BR>
43
+ x3 = 1 <BR>
44
+ -2 <= x4 <= Inf <BR>
45
+ xyr free <BR>
46
+ Integers <BR>
47
+ x0 <BR>
48
+ Generals <BR>
49
+ x1 xyr <BR>
50
+ Binaries <BR>
51
+ x2 <BR>
52
+ End
53
+
54
+ Notes: <UL>
55
+ <LI> Keywords are: Min, Max, Minimize, Maximize, s.t., Subject To,
56
+ Bounds, Integers, Generals, Binaries, End, Free, Inf.
57
+ <LI> Keywords are not case sensitive and may be in plural or singular form.
58
+ They should not be used as objective, row or column names.
59
+ <LI> Bounds, Integers, Generals, Binaries sections are optional.
60
+ <LI> Generals and Integers are synonymous.
61
+ <LI> Bounds section (if any) must come before Integers, Generals, and
62
+ Binaries sections.
63
+ <LI> Row names must be followed by ':' without blank space.
64
+ Row names are optional. If row names are present,
65
+ they must be distinct (if the k-th constraint has no given name, its name
66
+ is set automatically to "consk" for k=0,...,).
67
+ For valid row names, see the method is_invalid_name().
68
+ <LI> Column names must be followed by a blank space. They must be distinct.
69
+ For valid column names, see the method is_invalid_name().
70
+ <LI> Multiple objectives may be specified, but when there are multiple
71
+ objectives, they must have names (to indicate where each one starts).
72
+ <LI> The objective function names must be followed by ':' without blank space.
73
+ If there is a single objective, the objective function name is optional.
74
+ If no name is given, the name is set to "obj" by default.
75
+ For valid objective function names, see the method is_invalid_name().
76
+ <LI> Ranged constraints are written as two constraints.
77
+ If a name is given for a ranged constraint, the upper bound constraint
78
+ has that name and the lower bound constraint has that name with "_low"
79
+ as suffix. This should be kept in mind when assigning names to ranged
80
+ constraint, as the resulting name must be distinct from all the other
81
+ names and be considered valid by the method is_invalid_name().
82
+ <LI> At most one term related to any single variable may appear in the
83
+ objective function; if more than one term are present, only the last
84
+ one is taken into account.
85
+ At most one constant term may appear in the objective function;
86
+ if present, it must appear last.
87
+ <LI> Default bounds are 0 for lower bound and +infinity for upper bound.
88
+ <LI> Free variables get default lower bound -infinity and
89
+ default upper bound +infinity. Writing "x0 Free" in an
90
+ LP file means "set lower bound on x0 to -infinity".
91
+ <LI> If more than one upper (resp. lower) bound on a variable appears in
92
+ the Bounds section, the last one is the one taken into
93
+ account. The bounds for a binary variable are set to 0/1 only if this
94
+ bound is stronger than the bound obtained from the Bounds section.
95
+ <LI> Numbers larger than DBL_MAX (or larger than 1e+400) in the input file
96
+ might crash the code.
97
+ <LI> A comment must start with '\' or '/'. That symbol must either be
98
+ the first character of a line or be preceded by a blank space. The
99
+ comment ends at the end of the
100
+ line. Comments are skipped while reading an Lp file and they may be
101
+ inserted anywhere.
102
+ </UL>
103
+ */
104
+ class CoinLpIO {
105
+ friend void CoinLpIOUnitTest(const std::string & lpDir);
106
+ public:
107
+
108
+ /**@name Constructor and Destructor */
109
+ //@{
110
+ /// Default Constructor
111
+ CoinLpIO();
112
+
113
+ /// Does the heavy lifting for destruct and assignment.
114
+ void gutsOfDestructor();
115
+
116
+ /// Does the heavy lifting for copy and assignment
117
+ void gutsOfCopy(const CoinLpIO &);
118
+
119
+ /// assignment operator
120
+ CoinLpIO & operator = (const CoinLpIO& rhs) ;
121
+
122
+ /// Copy constructor
123
+ CoinLpIO (const CoinLpIO &);
124
+
125
+ /// Destructor
126
+ ~CoinLpIO();
127
+
128
+ /** Free the vector previous_names_[section] and set
129
+ card_previous_names_[section] to 0.
130
+ section = 0 for row names,
131
+ section = 1 for column names.
132
+ */
133
+ void freePreviousNames(const int section);
134
+
135
+ /// Free all memory (except memory related to hash tables and objName_).
136
+ void freeAll();
137
+ //@}
138
+
139
+ /** A quick inlined function to convert from lb/ub style constraint
140
+ definition to sense/rhs/range style */
141
+ inline void
142
+ convertBoundToSense(const double lower, const double upper,
143
+ char& sense, double& right, double& range) const;
144
+
145
+ /**@name Queries */
146
+ //@{
147
+
148
+ /// Get the problem name
149
+ const char * getProblemName() const;
150
+
151
+ /// Set problem name
152
+ void setProblemName(const char *name);
153
+
154
+ /// Get number of columns
155
+ int getNumCols() const;
156
+
157
+ /// Get number of rows
158
+ int getNumRows() const;
159
+
160
+ /// Get number of nonzero elements
161
+ int getNumElements() const;
162
+
163
+ /// Get pointer to array[getNumCols()] of column lower bounds
164
+ const double * getColLower() const;
165
+
166
+ /// Get pointer to array[getNumCols()] of column upper bounds
167
+ const double * getColUpper() const;
168
+
169
+ /// Get pointer to array[getNumRows()] of row lower bounds
170
+ const double * getRowLower() const;
171
+
172
+ /// Get pointer to array[getNumRows()] of row upper bounds
173
+ const double * getRowUpper() const;
174
+ /** Get pointer to array[getNumRows()] of constraint senses.
175
+ <ul>
176
+ <li>'L': <= constraint
177
+ <li>'E': = constraint
178
+ <li>'G': >= constraint
179
+ <li>'R': ranged constraint
180
+ <li>'N': free constraint
181
+ </ul>
182
+ */
183
+ const char * getRowSense() const;
184
+
185
+ /** Get pointer to array[getNumRows()] of constraint right-hand sides.
186
+
187
+ Given constraints with upper (rowupper) and/or lower (rowlower) bounds,
188
+ the constraint right-hand side (rhs) is set as
189
+ <ul>
190
+ <li> if rowsense()[i] == 'L' then rhs()[i] == rowupper()[i]
191
+ <li> if rowsense()[i] == 'G' then rhs()[i] == rowlower()[i]
192
+ <li> if rowsense()[i] == 'R' then rhs()[i] == rowupper()[i]
193
+ <li> if rowsense()[i] == 'N' then rhs()[i] == 0.0
194
+ </ul>
195
+ */
196
+ const double * getRightHandSide() const;
197
+
198
+ /** Get pointer to array[getNumRows()] of row ranges.
199
+
200
+ Given constraints with upper (rowupper) and/or lower (rowlower) bounds,
201
+ the constraint range (rowrange) is set as
202
+ <ul>
203
+ <li> if rowsense()[i] == 'R' then
204
+ rowrange()[i] == rowupper()[i] - rowlower()[i]
205
+ <li> if rowsense()[i] != 'R' then
206
+ rowrange()[i] is 0.0
207
+ </ul>
208
+ Put another way, only ranged constraints have a nontrivial value for
209
+ rowrange.
210
+ */
211
+ const double * getRowRange() const;
212
+
213
+ /// Get pointer to array[getNumCols()] of objective function coefficients
214
+ const int getNumObjectives() const;
215
+
216
+ /// Get pointer to array[getNumCols()] of objective function coefficients
217
+ const double * getObjCoefficients() const;
218
+
219
+ /// Get pointer to array[getNumCols()] of objective function coefficients for objective j
220
+ const double * getObjCoefficients(int j) const;
221
+
222
+ /// Get pointer to row-wise copy of the coefficient matrix
223
+ const CoinPackedMatrix * getMatrixByRow() const;
224
+
225
+ /// Get pointer to column-wise copy of the coefficient matrix
226
+ const CoinPackedMatrix * getMatrixByCol() const;
227
+
228
+ /// Get objective function name
229
+ const char * getObjName() const;
230
+
231
+ /// Get objective function name for objective j
232
+ const char * getObjName(int j) const;
233
+
234
+ /// Get pointer to array[*card_prev] of previous row names.
235
+ /// The value of *card_prev might be different than getNumRows()+1 if
236
+ /// non distinct
237
+ /// row names were present or if no previous names were saved or if
238
+ /// the object was holding a different problem before.
239
+ void getPreviousRowNames(char const * const * prev,
240
+ int *card_prev) const;
241
+
242
+ /// Get pointer to array[*card_prev] of previous column names.
243
+ /// The value of *card_prev might be different than getNumCols() if non
244
+ /// distinct column names were present of if no previous names were saved,
245
+ /// or if the object was holding a different problem before.
246
+ void getPreviousColNames(char const * const * prev,
247
+ int *card_prev) const;
248
+
249
+ /// Get pointer to array[getNumRows()+1] of row names, including
250
+ /// objective function name as last entry.
251
+ char const * const * getRowNames() const;
252
+
253
+ /// Get pointer to array[getNumCols()] of column names
254
+ char const * const *getColNames() const;
255
+
256
+ /// Return the row name for the specified index.
257
+ /// Return the objective function name if index = getNumRows().
258
+ /// Return 0 if the index is out of range or if row names are not defined.
259
+ const char * rowName(int index) const;
260
+
261
+ /// Return the column name for the specified index.
262
+ /// Return 0 if the index is out of range or if column names are not
263
+ /// defined.
264
+ const char * columnName(int index) const;
265
+
266
+ /// Return the index for the specified row name.
267
+ /// Return getNumRows() for the objective function name.
268
+ /// Return -1 if the name is not found.
269
+ int rowIndex(const char * name) const;
270
+
271
+ /// Return the index for the specified column name.
272
+ /// Return -1 if the name is not found.
273
+ int columnIndex(const char * name) const;
274
+
275
+ ///Returns the (constant) objective offset
276
+ double objectiveOffset() const;
277
+
278
+ ///Returns the (constant) objective offset for objective j
279
+ double objectiveOffset(int j) const;
280
+
281
+ /// Set objective offset
282
+ inline void setObjectiveOffset(double value)
283
+ { objectiveOffset_[0] = value;}
284
+
285
+ /// Set objective offset
286
+ inline void setObjectiveOffset(double value, int j)
287
+ { objectiveOffset_[j] = value;}
288
+
289
+ /// Return true if a column is an integer (binary or general
290
+ /// integer) variable
291
+ bool isInteger(int columnNumber) const;
292
+
293
+ /// Get characteristic vector of integer variables
294
+ const char * integerColumns() const;
295
+ //@}
296
+
297
+ /**@name Parameters */
298
+ //@{
299
+ /// Get infinity
300
+ double getInfinity() const;
301
+
302
+ /// Set infinity. Any number larger is considered infinity.
303
+ /// Default: DBL_MAX
304
+ void setInfinity(const double);
305
+
306
+ /// Get epsilon
307
+ double getEpsilon() const;
308
+
309
+ /// Set epsilon.
310
+ /// Default: 1e-5.
311
+ void setEpsilon(const double);
312
+
313
+ /// Get numberAcross, the number of monomials to be printed per line
314
+ int getNumberAcross() const;
315
+
316
+ /// Set numberAcross.
317
+ /// Default: 10.
318
+ void setNumberAcross(const int);
319
+
320
+ /// Get decimals, the number of digits to write after the decimal point
321
+ int getDecimals() const;
322
+
323
+ /// Set decimals.
324
+ /// Default: 5
325
+ void setDecimals(const int);
326
+ //@}
327
+
328
+ /**@name Public methods */
329
+ //@{
330
+ /** Set the data of the object.
331
+ Set it from the coefficient matrix m, the lower bounds
332
+ collb, the upper bounds colub, objective function obj_coeff,
333
+ integrality vector integrality, lower/upper bounds on the constraints.
334
+ The sense of optimization of the objective function is assumed to be
335
+ a minimization.
336
+ Numbers larger than DBL_MAX (or larger than 1e+400)
337
+ might crash the code. There are two version. The second one is for
338
+ setting multiple objectives.
339
+ */
340
+ void setLpDataWithoutRowAndColNames(
341
+ const CoinPackedMatrix& m,
342
+ const double* collb, const double* colub,
343
+ const double* obj_coeff,
344
+ const char* integrality,
345
+ const double* rowlb, const double* rowub);
346
+
347
+ void setLpDataWithoutRowAndColNames(
348
+ const CoinPackedMatrix& m,
349
+ const double* collb, const double* colub,
350
+ const double* obj_coeff[MAX_OBJECTIVES],
351
+ int num_objectives,
352
+ const char* integrality,
353
+ const double* rowlb, const double* rowub);
354
+
355
+ /** Return 0 if buff is a valid name for a row, a column or objective
356
+ function, return a positive number otherwise.
357
+ If parameter ranged = true, the name is intended for a ranged
358
+ constraint. <BR>
359
+ Return 1 if the name has more than 100 characters (96 characters
360
+ for a ranged constraint name, as "_low" will be added to the name).<BR>
361
+ Return 2 if the name starts with a number.<BR>
362
+ Return 3 if the name is not built with
363
+ the letters a to z, A to Z, the numbers 0 to 9 or the characters
364
+ " ! # $ % & ( ) . ; ? @ _ ' ` { } ~ <BR>
365
+ Return 4 if the name is a keyword.<BR>
366
+ Return 5 if the name is empty or NULL. */
367
+ int is_invalid_name(const char *buff, const bool ranged) const;
368
+
369
+ /** Return 0 if each of the card_vnames entries of vnames is a valid name,
370
+ return a positive number otherwise. The return value, if not 0, is the
371
+ return value of is_invalid_name() for the last invalid name
372
+ in vnames. If check_ranged = true, the names are row names and
373
+ names for ranged constaints must be checked for additional restrictions
374
+ since "_low" will be added to the name if an Lp file is written.
375
+ When check_ranged = true, card_vnames must have getNumRows()+1 entries,
376
+ with entry vnames[getNumRows()] being the
377
+ name of the objective function.
378
+ For a description of valid names and return values, see the method
379
+ is_invalid_name().
380
+
381
+ This method must not be called with check_ranged = true before
382
+ setLpDataWithoutRowAndColNames() has been called, since access
383
+ to the indices of all the ranged constraints is required.
384
+ */
385
+ int are_invalid_names(char const * const *vnames,
386
+ const int card_vnames,
387
+ const bool check_ranged) const;
388
+
389
+ /// Set objective function name to the default "obj" and row
390
+ /// names to the default "cons0", "cons1", ...
391
+ void setDefaultRowNames();
392
+
393
+ /// Set column names to the default "x0", "x1", ...
394
+ void setDefaultColNames();
395
+
396
+ /** Set the row and column names.
397
+ The array rownames must either be NULL or have exactly getNumRows()+1
398
+ distinct entries,
399
+ each of them being a valid name (see is_invalid_name()) and the
400
+ last entry being the intended name for the objective function.
401
+ If rownames is NULL, existing row names and objective function
402
+ name are not changed.
403
+ If rownames is deemed invalid, default row names and objective function
404
+ name are used (see setDefaultRowNames()). The memory location of
405
+ array rownames (or its entries) should not be related
406
+ to the memory location of the array (or entries) obtained from
407
+ getRowNames() or getPreviousRowNames(), as the call to
408
+ setLpDataRowAndColNames() modifies the corresponding arrays.
409
+ Unpredictable results
410
+ are obtained if this requirement is ignored.
411
+
412
+ Similar remarks apply to the array colnames, which must either be
413
+ NULL or have exactly getNumCols() entries.
414
+ */
415
+ void setLpDataRowAndColNames(char const * const * const rownames,
416
+ char const * const * const colnames);
417
+
418
+ /** Write the data in Lp format in the file with name filename.
419
+ Coefficients with value less than epsilon away from an integer value
420
+ are written as integers.
421
+ Write at most numberAcross monomials on a line.
422
+ Write non integer numbers with decimals digits after the decimal point.
423
+ Write objective function name and row names if useRowNames = true.
424
+
425
+ Ranged constraints are written as two constraints.
426
+ If row names are used, the upper bound constraint has the
427
+ name of the original ranged constraint and the
428
+ lower bound constraint has for name the original name with
429
+ "_low" as suffix. If doing so creates two identical row names,
430
+ default row names are used (see setDefaultRowNames()).
431
+ */
432
+ int writeLp(const char *filename,
433
+ const double epsilon,
434
+ const int numberAcross,
435
+ const int decimals,
436
+ const bool useRowNames = true);
437
+
438
+ /** Write the data in Lp format in the file pointed to by the paramater fp.
439
+ Coefficients with value less than epsilon away from an integer value
440
+ are written as integers.
441
+ Write at most numberAcross monomials on a line.
442
+ Write non integer numbers with decimals digits after the decimal point.
443
+ Write objective function name and row names if useRowNames = true.
444
+
445
+ Ranged constraints are written as two constraints.
446
+ If row names are used, the upper bound constraint has the
447
+ name of the original ranged constraint and the
448
+ lower bound constraint has for name the original name with
449
+ "_low" as suffix. If doing so creates two identical row names,
450
+ default row names are used (see setDefaultRowNames()).
451
+ */
452
+ int writeLp(FILE *fp,
453
+ const double epsilon,
454
+ const int numberAcross,
455
+ const int decimals,
456
+ const bool useRowNames = true);
457
+
458
+ /// Write the data in Lp format in the file with name filename.
459
+ /// Write objective function name and row names if useRowNames = true.
460
+ int writeLp(const char *filename, const bool useRowNames = true);
461
+
462
+ /// Write the data in Lp format in the file pointed to by the parameter fp.
463
+ /// Write objective function name and row names if useRowNames = true.
464
+ int writeLp(FILE *fp, const bool useRowNames = true);
465
+
466
+ /// Read the data in Lp format from the file with name filename, using
467
+ /// the given value for epsilon. If the original problem is
468
+ /// a maximization problem, the objective function is immediadtly
469
+ /// flipped to get a minimization problem.
470
+ void readLp(const char *filename, const double epsilon);
471
+
472
+ /// Read the data in Lp format from the file with name filename.
473
+ /// If the original problem is
474
+ /// a maximization problem, the objective function is immediadtly
475
+ /// flipped to get a minimization problem.
476
+ void readLp(const char *filename);
477
+
478
+ /// Read the data in Lp format from the file stream, using
479
+ /// the given value for epsilon.
480
+ /// If the original problem is
481
+ /// a maximization problem, the objective function is immediadtly
482
+ /// flipped to get a minimization problem.
483
+ void readLp(FILE *fp, const double epsilon);
484
+
485
+ /// Read the data in Lp format from the file stream.
486
+ /// If the original problem is
487
+ /// a maximization problem, the objective function is immediadtly
488
+ /// flipped to get a minimization problem.
489
+ void readLp(FILE *fp);
490
+
491
+ /// Dump the data. Low level method for debugging.
492
+ void print() const;
493
+
494
+ /// Load in SOS stuff
495
+ void loadSOS(int numberSets,const CoinSet * sets);
496
+
497
+ /// Load in SOS stuff
498
+ void loadSOS(int numberSets,const CoinSet ** sets);
499
+
500
+ /// Number of SOS sets
501
+ inline int numberSets() const
502
+ { return numberSets_;}
503
+
504
+ /// Set information
505
+ inline CoinSet ** setInformation() const
506
+ { return set_;}
507
+ //@}
508
+ /**@name Message handling */
509
+ //@{
510
+ /** Pass in Message handler
511
+
512
+ Supply a custom message handler. It will not be destroyed when the
513
+ CoinMpsIO object is destroyed.
514
+ */
515
+ void passInMessageHandler(CoinMessageHandler * handler);
516
+
517
+ /// Set the language for messages.
518
+ void newLanguage(CoinMessages::Language language);
519
+
520
+ /// Set the language for messages.
521
+ inline void setLanguage(CoinMessages::Language language) {newLanguage(language);}
522
+
523
+ /// Return the message handler
524
+ inline CoinMessageHandler * messageHandler() const {return handler_;}
525
+
526
+ /// Return the messages
527
+ inline CoinMessages messages() {return messages_;}
528
+ /// Return the messages pointer
529
+ inline CoinMessages * messagesPointer() {return & messages_;}
530
+ //@}
531
+
532
+ protected:
533
+ /// Problem name
534
+ char * problemName_;
535
+
536
+ /// Message handler
537
+ CoinMessageHandler * handler_;
538
+ /** Flag to say if the message handler is the default handler.
539
+
540
+ If true, the handler will be destroyed when the CoinMpsIO
541
+ object is destroyed; if false, it will not be destroyed.
542
+ */
543
+ bool defaultHandler_;
544
+ /// Messages
545
+ CoinMessages messages_;
546
+
547
+ /// Number of rows
548
+ int numberRows_;
549
+
550
+ /// Number of columns
551
+ int numberColumns_;
552
+
553
+ /// Number of elements
554
+ int numberElements_;
555
+
556
+ /// Pointer to column-wise copy of problem matrix coefficients.
557
+ mutable CoinPackedMatrix *matrixByColumn_;
558
+
559
+ /// Pointer to row-wise copy of problem matrix coefficients.
560
+ CoinPackedMatrix *matrixByRow_;
561
+
562
+ /// Pointer to dense vector of row lower bounds
563
+ double * rowlower_;
564
+
565
+ /// Pointer to dense vector of row upper bounds
566
+ double * rowupper_;
567
+
568
+ /// Pointer to dense vector of column lower bounds
569
+ double * collower_;
570
+
571
+ /// Pointer to dense vector of column upper bounds
572
+ double * colupper_;
573
+
574
+ /// Pointer to dense vector of row rhs
575
+ mutable double * rhs_;
576
+
577
+ /** Pointer to dense vector of slack variable upper bounds for ranged
578
+ constraints (undefined for non-ranged constraints)
579
+ */
580
+ mutable double *rowrange_;
581
+
582
+ /// Pointer to dense vector of row senses
583
+ mutable char * rowsense_;
584
+
585
+ /// Pointer to dense vector of objective coefficients
586
+ double * objective_[MAX_OBJECTIVES];
587
+
588
+ /// Number of objectives
589
+ int num_objectives_;
590
+
591
+ /// Constant offset for objective value
592
+ double objectiveOffset_[MAX_OBJECTIVES];
593
+
594
+ /// Pointer to dense vector specifying if a variable is continuous
595
+ /// (0) or integer (1).
596
+ char * integerType_;
597
+
598
+ /// Pointer to sets
599
+ CoinSet ** set_;
600
+
601
+ /// Number of sets
602
+ int numberSets_;
603
+
604
+ /// Current file name
605
+ char * fileName_;
606
+
607
+ /// Value to use for infinity
608
+ double infinity_;
609
+
610
+ /// Value to use for epsilon
611
+ double epsilon_;
612
+
613
+ /// Number of monomials printed in a row
614
+ int numberAcross_;
615
+
616
+ /// Number of decimals printed for coefficients
617
+ int decimals_;
618
+
619
+ /// Objective function name
620
+ char *objName_[MAX_OBJECTIVES];
621
+
622
+ /** Row names (including objective function name)
623
+ and column names when stopHash() for the corresponding
624
+ section was last called or for initial names (deemed invalid)
625
+ read from a file.<BR>
626
+ section = 0 for row names,
627
+ section = 1 for column names. */
628
+ char **previous_names_[2];
629
+
630
+ /// card_previous_names_[section] holds the number of entries in the vector
631
+ /// previous_names_[section].
632
+ /// section = 0 for row names,
633
+ /// section = 1 for column names.
634
+ int card_previous_names_[2];
635
+
636
+ /// Row names (including objective function name)
637
+ /// and column names (linked to Hash tables).
638
+ /// section = 0 for row names,
639
+ /// section = 1 for column names.
640
+ char **names_[2];
641
+
642
+ typedef struct {
643
+ int index, next;
644
+ } CoinHashLink;
645
+
646
+ /// Maximum number of entries in a hash table section.
647
+ /// section = 0 for row names,
648
+ /// section = 1 for column names.
649
+ int maxHash_[2];
650
+
651
+ /// Number of entries in a hash table section.
652
+ /// section = 0 for row names,
653
+ /// section = 1 for column names.
654
+ int numberHash_[2];
655
+
656
+ /// Hash tables with two sections.
657
+ /// section = 0 for row names (including objective function name),
658
+ /// section = 1 for column names.
659
+ mutable CoinHashLink *hash_[2];
660
+
661
+ /// Build the hash table for the given names. The parameter number is
662
+ /// the cardinality of parameter names. Remove duplicate names.
663
+ ///
664
+ /// section = 0 for row names,
665
+ /// section = 1 for column names.
666
+ void startHash(char const * const * const names,
667
+ const COINColumnIndex number,
668
+ int section);
669
+
670
+ /// Delete hash storage. If section = 0, it also frees objName_.
671
+ /// section = 0 for row names,
672
+ /// section = 1 for column names.
673
+ void stopHash(int section);
674
+
675
+ /// Return the index of the given name, return -1 if the name is not found.
676
+ /// Return getNumRows() for the objective function name.
677
+ /// section = 0 for row names (including objective function name),
678
+ /// section = 1 for column names.
679
+ COINColumnIndex findHash(const char *name, int section) const;
680
+
681
+ /// Insert thisName in the hash table if not present yet; does nothing
682
+ /// if the name is already in.
683
+ /// section = 0 for row names,
684
+ /// section = 1 for column names.
685
+ void insertHash(const char *thisName, int section);
686
+
687
+ /// Write a coefficient.
688
+ /// print_1 = 0 : do not print the value 1.
689
+ void out_coeff(FILE *fp, double v, int print_1) const;
690
+
691
+ /// Locate the objective function.
692
+ /// Return 1 if found the keyword "Minimize" or one of its variants,
693
+ /// -1 if found keyword "Maximize" or one of its variants.
694
+ int find_obj(FILE *fp) const;
695
+
696
+ /// Return an integer indicating if the keyword "subject to" or one
697
+ /// of its variants has been read.
698
+ /// Return 1 if buff is the keyword "s.t" or one of its variants.
699
+ /// Return 2 if buff is the keyword "subject" or one of its variants.
700
+ /// Return 0 otherwise.
701
+ int is_subject_to(const char *buff) const;
702
+
703
+ /// Return 1 if the first character of buff is a number.
704
+ /// Return 0 otherwise.
705
+ int first_is_number(const char *buff) const;
706
+
707
+ /// Return 1 if the first character of buff is '/' or '\'.
708
+ /// Return 0 otherwise.
709
+ int is_comment(const char *buff) const;
710
+
711
+ /// Read the file fp until buff contains an end of line
712
+ void skip_comment(char *buff, FILE *fp) const;
713
+
714
+ /// Put in buff the next string that is not part of a comment
715
+ void scan_next(char *buff, FILE *fp) const;
716
+
717
+ /// Return 1 if buff is the keyword "free" or one of its variants.
718
+ /// Return 0 otherwise.
719
+ int is_free(const char *buff) const;
720
+
721
+ /// Return 1 if buff is the keyword "inf" or one of its variants.
722
+ /// Return 0 otherwise.
723
+ int is_inf(const char *buff) const;
724
+
725
+ /// Return an integer indicating the inequality sense read.
726
+ /// Return 0 if buff is '<='.
727
+ /// Return 1 if buff is '='.
728
+ /// Return 2 if buff is '>='.
729
+ /// Return -1 otherwise.
730
+ int is_sense(const char *buff) const;
731
+
732
+ /// Return an integer indicating if one of the keywords "Bounds", "Integers",
733
+ /// "Generals", "Binaries", "Semi-continuous", "Sos", "End", or one
734
+ /// of their variants has been read. (note Semi-continuous not coded)
735
+ /// Return 1 if buff is the keyword "Bounds" or one of its variants.
736
+ /// Return 2 if buff is the keyword "Integers" or "Generals" or one of their
737
+ /// variants.
738
+ /// Return 3 if buff is the keyword "Binaries" or one of its variants.
739
+ /// Return 4 if buff is the keyword "Semi-continuous" or one of its variants.
740
+ /// Return 5 if buff is the keyword "Sos" or one of its variants.
741
+ /// Return 6 if buff is the keyword "End" or one of its variants.
742
+ /// Return 0 otherwise.
743
+ int is_keyword(const char *buff) const;
744
+
745
+ /// Read a monomial of the objective function.
746
+ /// Return 1 if "subject to" or one of its variants has been read.
747
+ int read_monom_obj(FILE *fp, double *coeff, char **name, int *cnt,
748
+ char **obj_name, int *num_objectives, int *obj_starts);
749
+
750
+ /// Read a monomial of a constraint.
751
+ /// Return a positive number if the sense of the inequality has been
752
+ /// read (see method is_sense() for the return code).
753
+ /// Return -1 otherwise.
754
+ int read_monom_row(FILE *fp, char *start_str, double *coeff, char **name,
755
+ int cnt_coeff) const;
756
+
757
+ /// Reallocate vectors related to number of coefficients.
758
+ void realloc_coeff(double **coeff, char ***colNames, int *maxcoeff) const;
759
+
760
+ /// Reallocate vectors related to rows.
761
+ void realloc_row(char ***rowNames, int **start, double **rhs,
762
+ double **rowlow, double **rowup, int *maxrow) const;
763
+
764
+ /// Reallocate vectors related to columns.
765
+ void realloc_col(double **collow, double **colup, char **is_int,
766
+ int *maxcol) const;
767
+
768
+ /// Read a constraint.
769
+ void read_row(FILE *fp, char *buff, double **pcoeff, char ***pcolNames,
770
+ int *cnt_coeff, int *maxcoeff,
771
+ double *rhs, double *rowlow, double *rowup,
772
+ int *cnt_row, double inf) const;
773
+
774
+ /** Check that current objective name and all row names are distinct
775
+ including row names obtained by adding "_low" for ranged constraints.
776
+ If there is a conflict in the names, they are replaced by default
777
+ row names (see setDefaultRowNames()).
778
+
779
+ This method must not be called before
780
+ setLpDataWithoutRowAndColNames() has been called, since access
781
+ to the indices of all the ranged constraints is required.
782
+
783
+ This method must not be called before
784
+ setLpDataRowAndColNames() has been called, since access
785
+ to all the row names is required.
786
+ */
787
+ void checkRowNames();
788
+
789
+ /** Check that current column names are distinct.
790
+ If not, they are replaced by default
791
+ column names (see setDefaultColNames()).
792
+
793
+ This method must not be called before
794
+ setLpDataRowAndColNames() has been called, since access
795
+ to all the column names is required.
796
+ */
797
+ void checkColNames();
798
+
799
+ };
800
+
801
+ void
802
+ CoinLpIOUnitTest(const std::string& lpDir);
803
+
804
+
805
+ #endif