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,1164 @@
1
+ /* $Id: CoinIndexedVector.hpp 1767 2015-01-05 12:36:13Z forrest $ */
2
+ // Copyright (C) 2000, 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 CoinIndexedVector_H
7
+ #define CoinIndexedVector_H
8
+
9
+ #if defined(_MSC_VER)
10
+ // Turn off compiler warning about long names
11
+ # pragma warning(disable:4786)
12
+ #endif
13
+
14
+ #include <map>
15
+ #include "CoinFinite.hpp"
16
+ #ifndef CLP_NO_VECTOR
17
+ #include "CoinPackedVectorBase.hpp"
18
+ #endif
19
+ #include "CoinSort.hpp"
20
+ #include "CoinHelperFunctions.hpp"
21
+ #include <cassert>
22
+
23
+ #ifndef COIN_FLOAT
24
+ #define COIN_INDEXED_TINY_ELEMENT 1.0e-50
25
+ #define COIN_INDEXED_REALLY_TINY_ELEMENT 1.0e-100
26
+ #else
27
+ #define COIN_INDEXED_TINY_ELEMENT 1.0e-35
28
+ #define COIN_INDEXED_REALLY_TINY_ELEMENT 1.0e-39
29
+ #endif
30
+
31
+ /** Indexed Vector
32
+
33
+ This stores values unpacked but apart from that is a bit like CoinPackedVector.
34
+ It is designed to be lightweight in normal use.
35
+
36
+ It now has a "packed" mode when it is even more like CoinPackedVector
37
+
38
+ Indices array has capacity_ extra chars which are zeroed and can
39
+ be used for any purpose - but must be re-zeroed
40
+
41
+ Stores vector of indices and associated element values.
42
+ Supports sorting of indices.
43
+
44
+ Does not support negative indices.
45
+
46
+ Does NOT support testing for duplicates
47
+
48
+ *** getElements is no longer supported
49
+
50
+ Here is a sample usage:
51
+ @verbatim
52
+ const int ne = 4;
53
+ int inx[ne] = { 1, 4, 0, 2 }
54
+ double el[ne] = { 10., 40., 1., 50. }
55
+
56
+ // Create vector and set its valuex1
57
+ CoinIndexedVector r(ne,inx,el);
58
+
59
+ // access as a full storage vector
60
+ assert( r[ 0]==1. );
61
+ assert( r[ 1]==10.);
62
+ assert( r[ 2]==50.);
63
+ assert( r[ 3]==0. );
64
+ assert( r[ 4]==40.);
65
+
66
+ // sort Elements in increasing order
67
+ r.sortIncrElement();
68
+
69
+ // access each index and element
70
+ assert( r.getIndices ()[0]== 0 );
71
+ assert( r.getIndices ()[1]== 1 );
72
+ assert( r.getIndices ()[2]== 4 );
73
+ assert( r.getIndices ()[3]== 2 );
74
+
75
+ // access as a full storage vector
76
+ assert( r[ 0]==1. );
77
+ assert( r[ 1]==10.);
78
+ assert( r[ 2]==50.);
79
+ assert( r[ 3]==0. );
80
+ assert( r[ 4]==40.);
81
+
82
+ // Tests for equality and equivalence
83
+ CoinIndexedVector r1;
84
+ r1=r;
85
+ assert( r==r1 );
86
+ assert( r.equivalent(r1) );
87
+ r.sortIncrElement();
88
+ assert( r!=r1 );
89
+ assert( r.equivalent(r1) );
90
+
91
+ // Add indexed vectors.
92
+ // Similarly for subtraction, multiplication,
93
+ // and division.
94
+ CoinIndexedVector add = r + r1;
95
+ assert( add[0] == 1.+ 1. );
96
+ assert( add[1] == 10.+10. );
97
+ assert( add[2] == 50.+50. );
98
+ assert( add[3] == 0.+ 0. );
99
+ assert( add[4] == 40.+40. );
100
+
101
+ assert( r.sum() == 10.+40.+1.+50. );
102
+ @endverbatim
103
+ */
104
+ class CoinIndexedVector {
105
+ friend void CoinIndexedVectorUnitTest();
106
+
107
+ public:
108
+ /**@name Get methods. */
109
+ //@{
110
+ /// Get the size
111
+ inline int getNumElements() const { return nElements_; }
112
+ /// Get indices of elements
113
+ inline const int * getIndices() const { return indices_; }
114
+ /// Get element values
115
+ // ** No longer supported virtual const double * getElements() const ;
116
+ /// Get indices of elements
117
+ inline int * getIndices() { return indices_; }
118
+ /** Get the vector as a dense vector. This is normal storage method.
119
+ The user should not not delete [] this.
120
+ */
121
+ inline double * denseVector() const { return elements_; }
122
+ /// For very temporary use when user needs to borrow a dense vector
123
+ inline void setDenseVector(double * array)
124
+ { elements_ = array;}
125
+ /// For very temporary use when user needs to borrow an index vector
126
+ inline void setIndexVector(int * array)
127
+ { indices_ = array;}
128
+ /** Access the i'th element of the full storage vector.
129
+ */
130
+ double & operator[](int i) const;
131
+
132
+ //@}
133
+
134
+ //-------------------------------------------------------------------
135
+ // Set indices and elements
136
+ //-------------------------------------------------------------------
137
+ /**@name Set methods */
138
+ //@{
139
+ /// Set the size
140
+ inline void setNumElements(int value) { nElements_ = value;
141
+ if (!nElements_) packedMode_=false;}
142
+ /// Reset the vector (as if were just created an empty vector). This leaves arrays!
143
+ void clear();
144
+ /// Reset the vector (as if were just created an empty vector)
145
+ void empty();
146
+ /** Assignment operator. */
147
+ CoinIndexedVector & operator=(const CoinIndexedVector &);
148
+ #ifndef CLP_NO_VECTOR
149
+ /** Assignment operator from a CoinPackedVectorBase. <br>
150
+ <strong>NOTE</strong>: This assumes no duplicates */
151
+ CoinIndexedVector & operator=(const CoinPackedVectorBase & rhs);
152
+ #endif
153
+ /** Copy the contents of one vector into another. If multiplier is 1
154
+ It is the equivalent of = but if vectors are same size does
155
+ not re-allocate memory just clears and copies */
156
+ void copy(const CoinIndexedVector & rhs, double multiplier=1.0);
157
+
158
+ /** Borrow ownership of the arguments to this vector.
159
+ Size is the length of the unpacked elements vector. */
160
+ void borrowVector(int size, int numberIndices, int* inds, double* elems);
161
+
162
+ /** Return ownership of the arguments to this vector.
163
+ State after is empty .
164
+ */
165
+ void returnVector();
166
+
167
+ /** Set vector numberIndices, indices, and elements.
168
+ NumberIndices is the length of both the indices and elements vectors.
169
+ The indices and elements vectors are copied into this class instance's
170
+ member data. Assumed to have no duplicates */
171
+ void setVector(int numberIndices, const int * inds, const double * elems);
172
+
173
+ /** Set vector size, indices, and elements.
174
+ Size is the length of the unpacked elements vector.
175
+ The indices and elements vectors are copied into this class instance's
176
+ member data. We do not check for duplicate indices */
177
+ void setVector(int size, int numberIndices, const int * inds, const double * elems);
178
+
179
+ /** Elements set to have the same scalar value */
180
+ void setConstant(int size, const int * inds, double elems);
181
+
182
+ /** Indices are not specified and are taken to be 0,1,...,size-1 */
183
+ void setFull(int size, const double * elems);
184
+
185
+ /** Set an existing element in the indexed vector
186
+ The first argument is the "index" into the elements() array
187
+ */
188
+ void setElement(int index, double element);
189
+
190
+ /// Insert an element into the vector
191
+ void insert(int index, double element);
192
+ /// Insert a nonzero element into the vector
193
+ inline void quickInsert(int index, double element)
194
+ {
195
+ assert (!elements_[index]);
196
+ indices_[nElements_++] = index;
197
+ assert (nElements_<=capacity_);
198
+ elements_[index] = element;
199
+ }
200
+ /** Insert or if exists add an element into the vector
201
+ Any resulting zero elements will be made tiny */
202
+ void add(int index, double element);
203
+ /** Insert or if exists add an element into the vector
204
+ Any resulting zero elements will be made tiny.
205
+ This version does no checking */
206
+ inline void quickAdd(int index, double element)
207
+ {
208
+ if (elements_[index]) {
209
+ element += elements_[index];
210
+ if ((element > 0 ? element : -element) >= COIN_INDEXED_TINY_ELEMENT) {
211
+ elements_[index] = element;
212
+ } else {
213
+ elements_[index] = 1.0e-100;
214
+ }
215
+ } else if ((element > 0 ? element : -element) >= COIN_INDEXED_TINY_ELEMENT) {
216
+ indices_[nElements_++] = index;
217
+ assert (nElements_<=capacity_);
218
+ elements_[index] = element;
219
+ }
220
+ }
221
+ /** Insert or if exists add an element into the vector
222
+ Any resulting zero elements will be made tiny.
223
+ This knows element is nonzero
224
+ This version does no checking */
225
+ inline void quickAddNonZero(int index, double element)
226
+ {
227
+ assert (element);
228
+ if (elements_[index]) {
229
+ element += elements_[index];
230
+ if ((element > 0 ? element : -element) >= COIN_INDEXED_TINY_ELEMENT) {
231
+ elements_[index] = element;
232
+ } else {
233
+ elements_[index] = COIN_DBL_MIN;
234
+ }
235
+ } else {
236
+ indices_[nElements_++] = index;
237
+ assert (nElements_<=capacity_);
238
+ elements_[index] = element;
239
+ }
240
+ }
241
+ /** Makes nonzero tiny.
242
+ This version does no checking */
243
+ inline void zero(int index)
244
+ {
245
+ if (elements_[index])
246
+ elements_[index] = COIN_DBL_MIN;
247
+ }
248
+ /** set all small values to zero and return number remaining
249
+ - < tolerance => 0.0 */
250
+ int clean(double tolerance);
251
+ /// Same but packs down
252
+ int cleanAndPack(double tolerance);
253
+ /// Same but packs down and is safe (i.e. if order is odd)
254
+ int cleanAndPackSafe(double tolerance);
255
+ /// Mark as packed
256
+ inline void setPacked()
257
+ { packedMode_ = true;}
258
+ #ifndef NDEBUG
259
+ /// For debug check vector is clear i.e. no elements
260
+ void checkClear();
261
+ /// For debug check vector is clean i.e. elements match indices
262
+ void checkClean();
263
+ #else
264
+ inline void checkClear() {};
265
+ inline void checkClean() {};
266
+ #endif
267
+ /// Scan dense region and set up indices (returns number found)
268
+ int scan();
269
+ /** Scan dense region from start to < end and set up indices
270
+ returns number found
271
+ */
272
+ int scan(int start, int end);
273
+ /** Scan dense region and set up indices (returns number found).
274
+ Only ones >= tolerance */
275
+ int scan(double tolerance);
276
+ /** Scan dense region from start to < end and set up indices
277
+ returns number found. Only >= tolerance
278
+ */
279
+ int scan(int start, int end, double tolerance);
280
+ /// These are same but pack down
281
+ int scanAndPack();
282
+ int scanAndPack(int start, int end);
283
+ int scanAndPack(double tolerance);
284
+ int scanAndPack(int start, int end, double tolerance);
285
+ /// Create packed array
286
+ void createPacked(int number, const int * indices,
287
+ const double * elements);
288
+ /// Create unpacked array
289
+ void createUnpacked(int number, const int * indices,
290
+ const double * elements);
291
+ /// Create unpacked singleton
292
+ void createOneUnpackedElement(int index, double element);
293
+ /// This is mainly for testing - goes from packed to indexed
294
+ void expand();
295
+ #ifndef CLP_NO_VECTOR
296
+ /// Append a CoinPackedVector to the end
297
+ void append(const CoinPackedVectorBase & caboose);
298
+ #endif
299
+ /// Append a CoinIndexedVector to the end (with extra space)
300
+ void append(const CoinIndexedVector & caboose);
301
+ /// Append a CoinIndexedVector to the end and modify indices
302
+ void append(CoinIndexedVector & other,int adjustIndex,bool zapElements=false);
303
+
304
+ /// Swap values in positions i and j of indices and elements
305
+ void swap(int i, int j);
306
+
307
+ /// Throw away all entries in rows >= newSize
308
+ void truncate(int newSize);
309
+ /// Print out
310
+ void print() const;
311
+ //@}
312
+ /**@name Arithmetic operators. */
313
+ //@{
314
+ /// add <code>value</code> to every entry
315
+ void operator+=(double value);
316
+ /// subtract <code>value</code> from every entry
317
+ void operator-=(double value);
318
+ /// multiply every entry by <code>value</code>
319
+ void operator*=(double value);
320
+ /// divide every entry by <code>value</code> (** 0 vanishes)
321
+ void operator/=(double value);
322
+ //@}
323
+
324
+ /**@name Comparison operators on two indexed vectors */
325
+ //@{
326
+ #ifndef CLP_NO_VECTOR
327
+ /** Equal. Returns true if vectors have same length and corresponding
328
+ element of each vector is equal. */
329
+ bool operator==(const CoinPackedVectorBase & rhs) const;
330
+ /// Not equal
331
+ bool operator!=(const CoinPackedVectorBase & rhs) const;
332
+ #endif
333
+ /** Equal. Returns true if vectors have same length and corresponding
334
+ element of each vector is equal. */
335
+ bool operator==(const CoinIndexedVector & rhs) const;
336
+ /// Not equal
337
+ bool operator!=(const CoinIndexedVector & rhs) const;
338
+ /// Equal with a tolerance (returns -1 or position of inequality).
339
+ int isApproximatelyEqual(const CoinIndexedVector & rhs, double tolerance=1.0e-8) const;
340
+ //@}
341
+
342
+ /**@name Index methods */
343
+ //@{
344
+ /// Get value of maximum index
345
+ int getMaxIndex() const;
346
+ /// Get value of minimum index
347
+ int getMinIndex() const;
348
+ //@}
349
+
350
+
351
+ /**@name Sorting */
352
+ //@{
353
+ /** Sort the indexed storage vector (increasing indices). */
354
+ void sort()
355
+ { std::sort(indices_,indices_+nElements_); }
356
+
357
+ void sortIncrIndex()
358
+ { std::sort(indices_,indices_+nElements_); }
359
+
360
+ void sortDecrIndex();
361
+
362
+ void sortIncrElement();
363
+
364
+ void sortDecrElement();
365
+ void sortPacked();
366
+
367
+ //@}
368
+
369
+ //#############################################################################
370
+
371
+ /**@name Arithmetic operators on packed vectors.
372
+
373
+ <strong>NOTE</strong>: These methods operate on those positions where at
374
+ least one of the arguments has a value listed. At those positions the
375
+ appropriate operation is executed, Otherwise the result of the operation is
376
+ considered 0.<br>
377
+ <strong>NOTE 2</strong>: Because these methods return an object (they can't
378
+ return a reference, though they could return a pointer...) they are
379
+ <em>very</em> inefficient...
380
+ */
381
+ //@{
382
+ /// Return the sum of two indexed vectors
383
+ CoinIndexedVector operator+(
384
+ const CoinIndexedVector& op2);
385
+
386
+ /// Return the difference of two indexed vectors
387
+ CoinIndexedVector operator-(
388
+ const CoinIndexedVector& op2);
389
+
390
+ /// Return the element-wise product of two indexed vectors
391
+ CoinIndexedVector operator*(
392
+ const CoinIndexedVector& op2);
393
+
394
+ /// Return the element-wise ratio of two indexed vectors (0.0/0.0 => 0.0) (0 vanishes)
395
+ CoinIndexedVector operator/(
396
+ const CoinIndexedVector& op2);
397
+ /// The sum of two indexed vectors
398
+ void operator+=(const CoinIndexedVector& op2);
399
+
400
+ /// The difference of two indexed vectors
401
+ void operator-=( const CoinIndexedVector& op2);
402
+
403
+ /// The element-wise product of two indexed vectors
404
+ void operator*=(const CoinIndexedVector& op2);
405
+
406
+ /// The element-wise ratio of two indexed vectors (0.0/0.0 => 0.0) (0 vanishes)
407
+ void operator/=(const CoinIndexedVector& op2);
408
+ //@}
409
+
410
+ /**@name Memory usage */
411
+ //@{
412
+ /** Reserve space.
413
+ If one knows the eventual size of the indexed vector,
414
+ then it may be more efficient to reserve the space.
415
+ */
416
+ void reserve(int n);
417
+ /** capacity returns the size which could be accomodated without
418
+ having to reallocate storage.
419
+ */
420
+ inline int capacity() const { return capacity_; }
421
+ inline void setCapacity(int value)
422
+ { capacity_ = value; }
423
+ /// Sets packed mode
424
+ inline void setPackedMode(bool yesNo)
425
+ { packedMode_=yesNo;}
426
+ /// Gets packed mode
427
+ inline bool packedMode() const
428
+ { return packedMode_;}
429
+ //@}
430
+
431
+ /**@name Constructors and destructors */
432
+ //@{
433
+ /** Default constructor */
434
+ CoinIndexedVector();
435
+ /** Alternate Constructors - set elements to vector of doubles */
436
+ CoinIndexedVector(int size, const int * inds, const double * elems);
437
+ /** Alternate Constructors - set elements to same scalar value */
438
+ CoinIndexedVector(int size, const int * inds, double element);
439
+ /** Alternate Constructors - construct full storage with indices 0 through
440
+ size-1. */
441
+ CoinIndexedVector(int size, const double * elements);
442
+ /** Alternate Constructors - just size */
443
+ CoinIndexedVector(int size);
444
+ /** Copy constructor. */
445
+ CoinIndexedVector(const CoinIndexedVector &);
446
+ /** Copy constructor.2 */
447
+ CoinIndexedVector(const CoinIndexedVector *);
448
+ #ifndef CLP_NO_VECTOR
449
+ /** Copy constructor <em>from a PackedVectorBase</em>. */
450
+ CoinIndexedVector(const CoinPackedVectorBase & rhs);
451
+ #endif
452
+ /** Destructor */
453
+ ~CoinIndexedVector ();
454
+ //@}
455
+
456
+ private:
457
+ /**@name Private methods */
458
+ //@{
459
+ /// Copy internal data
460
+ void gutsOfSetVector(int size,
461
+ const int * inds, const double * elems);
462
+ void gutsOfSetVector(int size, int numberIndices,
463
+ const int * inds, const double * elems);
464
+ void gutsOfSetPackedVector(int size, int numberIndices,
465
+ const int * inds, const double * elems);
466
+ ///
467
+ void gutsOfSetConstant(int size,
468
+ const int * inds, double value);
469
+ //@}
470
+
471
+ protected:
472
+ /**@name Private member data */
473
+ //@{
474
+ /// Vector indices
475
+ int * indices_;
476
+ ///Vector elements
477
+ double * elements_;
478
+ /// Size of indices and packed elements vectors
479
+ int nElements_;
480
+ /// Amount of memory allocated for indices_, and elements_.
481
+ int capacity_;
482
+ /// Offset to get where new allocated array
483
+ int offset_;
484
+ /// If true then is operating in packed mode
485
+ bool packedMode_;
486
+ //@}
487
+ };
488
+
489
+ //#############################################################################
490
+ /** A function that tests the methods in the CoinIndexedVector class. The
491
+ only reason for it not to be a member method is that this way it doesn't
492
+ have to be compiled into the library. And that's a gain, because the
493
+ library should be compiled with optimization on, but this method should be
494
+ compiled with debugging. */
495
+ void
496
+ CoinIndexedVectorUnitTest();
497
+ /** Pointer with length in bytes
498
+
499
+ This has a pointer to an array and the number of bytes in array.
500
+ If number of bytes==-1 then
501
+ CoinConditionalNew deletes existing pointer and returns new pointer
502
+ of correct size (and number bytes still -1).
503
+ CoinConditionalDelete deletes existing pointer and NULLs it.
504
+ So behavior is as normal (apart from New deleting pointer which will have
505
+ no effect with good coding practices.
506
+ If number of bytes >=0 then
507
+ CoinConditionalNew just returns existing pointer if array big enough
508
+ otherwise deletes existing pointer, allocates array with spare 1%+64 bytes
509
+ and updates number of bytes
510
+ CoinConditionalDelete sets number of bytes = -size-2 and then array
511
+ returns NULL
512
+ */
513
+ class CoinArrayWithLength {
514
+
515
+ public:
516
+ /**@name Get methods. */
517
+ //@{
518
+ /// Get the size
519
+ inline int getSize() const
520
+ { return size_; }
521
+ /// Get the size
522
+ inline int rawSize() const
523
+ { return size_; }
524
+ /// See if persistence already on
525
+ inline bool switchedOn() const
526
+ { return size_!=-1; }
527
+ /// Get the capacity (just read it)
528
+ inline int capacity() const
529
+ { return (size_>-2) ? size_ : (-size_)-2; }
530
+ /// Set the capacity to >=0 if <=-2
531
+ inline void setCapacity()
532
+ { if (size_<=-2) size_ = (-size_)-2; }
533
+ /// Get Array
534
+ inline const char * array() const
535
+ { return (size_>-2) ? array_ : NULL; }
536
+ //@}
537
+
538
+ /**@name Set methods */
539
+ //@{
540
+ /// Set the size
541
+ inline void setSize(int value)
542
+ { size_ = value; }
543
+ /// Set the size to -1
544
+ inline void switchOff()
545
+ { size_ = -1; }
546
+ /// Set the size to -2 and alignment
547
+ inline void switchOn(int alignment=3)
548
+ { size_ = -2; alignment_=alignment;}
549
+ /// Does what is needed to set persistence
550
+ void setPersistence(int flag,int currentLength);
551
+ /// Zero out array
552
+ void clear();
553
+ /// Swaps memory between two members
554
+ void swap(CoinArrayWithLength & other);
555
+ /// Extend a persistent array keeping data (size in bytes)
556
+ void extend(int newSize);
557
+ //@}
558
+
559
+ /**@name Condition methods */
560
+ //@{
561
+ /// Conditionally gets new array
562
+ char * conditionalNew(long sizeWanted);
563
+ /// Conditionally deletes
564
+ void conditionalDelete();
565
+ //@}
566
+
567
+ /**@name Constructors and destructors */
568
+ //@{
569
+ /** Default constructor - NULL*/
570
+ inline CoinArrayWithLength()
571
+ : array_(NULL),size_(-1),offset_(0),alignment_(0)
572
+ { }
573
+ /** Alternate Constructor - length in bytes - size_ -1 */
574
+ inline CoinArrayWithLength(int size)
575
+ : size_(-1),offset_(0),alignment_(0)
576
+ { array_=new char [size];}
577
+ /** Alternate Constructor - length in bytes
578
+ mode - 0 size_ set to size
579
+ mode>0 size_ set to size and zeroed
580
+ if size<=0 just does alignment
581
+ If abs(mode) >2 then align on that as power of 2
582
+ */
583
+ CoinArrayWithLength(int size, int mode);
584
+ /** Copy constructor. */
585
+ CoinArrayWithLength(const CoinArrayWithLength & rhs);
586
+ /** Copy constructor.2 */
587
+ CoinArrayWithLength(const CoinArrayWithLength * rhs);
588
+ /** Assignment operator. */
589
+ CoinArrayWithLength& operator=(const CoinArrayWithLength & rhs);
590
+ /** Assignment with length (if -1 use internal length) */
591
+ void copy(const CoinArrayWithLength & rhs, int numberBytes=-1);
592
+ /** Assignment with length - does not copy */
593
+ void allocate(const CoinArrayWithLength & rhs, int numberBytes);
594
+ /** Destructor */
595
+ ~CoinArrayWithLength ();
596
+ /// Get array with alignment
597
+ void getArray(int size);
598
+ /// Really get rid of array with alignment
599
+ void reallyFreeArray();
600
+ /// Get enough space (if more needed then do at least needed)
601
+ void getCapacity(int numberBytes,int numberIfNeeded=-1);
602
+ //@}
603
+
604
+ protected:
605
+ /**@name Private member data */
606
+ //@{
607
+ /// Array
608
+ char * array_;
609
+ /// Size of array in bytes
610
+ CoinBigIndex size_;
611
+ /// Offset of array
612
+ int offset_;
613
+ /// Alignment wanted (power of 2)
614
+ int alignment_;
615
+ //@}
616
+ };
617
+ /// double * version
618
+
619
+ class CoinDoubleArrayWithLength : public CoinArrayWithLength {
620
+
621
+ public:
622
+ /**@name Get methods. */
623
+ //@{
624
+ /// Get the size
625
+ inline int getSize() const
626
+ { return size_/CoinSizeofAsInt(double); }
627
+ /// Get Array
628
+ inline double * array() const
629
+ { return reinterpret_cast<double *> ((size_>-2) ? array_ : NULL); }
630
+ //@}
631
+
632
+ /**@name Set methods */
633
+ //@{
634
+ /// Set the size
635
+ inline void setSize(int value)
636
+ { size_ = value*CoinSizeofAsInt(double); }
637
+ //@}
638
+
639
+ /**@name Condition methods */
640
+ //@{
641
+ /// Conditionally gets new array
642
+ inline double * conditionalNew(int sizeWanted)
643
+ { return reinterpret_cast<double *> ( CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast<long> ((sizeWanted)*CoinSizeofAsInt(double)) : -1)); }
644
+ //@}
645
+
646
+ /**@name Constructors and destructors */
647
+ //@{
648
+ /** Default constructor - NULL*/
649
+ inline CoinDoubleArrayWithLength()
650
+ { array_=NULL; size_=-1;}
651
+ /** Alternate Constructor - length in bytes - size_ -1 */
652
+ inline CoinDoubleArrayWithLength(int size)
653
+ { array_=new char [size*CoinSizeofAsInt(double)]; size_=-1;}
654
+ /** Alternate Constructor - length in bytes
655
+ mode - 0 size_ set to size
656
+ 1 size_ set to size and zeroed
657
+ */
658
+ inline CoinDoubleArrayWithLength(int size, int mode)
659
+ : CoinArrayWithLength(size*CoinSizeofAsInt(double),mode) {}
660
+ /** Copy constructor. */
661
+ inline CoinDoubleArrayWithLength(const CoinDoubleArrayWithLength & rhs)
662
+ : CoinArrayWithLength(rhs) {}
663
+ /** Copy constructor.2 */
664
+ inline CoinDoubleArrayWithLength(const CoinDoubleArrayWithLength * rhs)
665
+ : CoinArrayWithLength(rhs) {}
666
+ /** Assignment operator. */
667
+ inline CoinDoubleArrayWithLength& operator=(const CoinDoubleArrayWithLength & rhs)
668
+ { CoinArrayWithLength::operator=(rhs); return *this;}
669
+ //@}
670
+ };
671
+ /// CoinFactorizationDouble * version
672
+
673
+ class CoinFactorizationDoubleArrayWithLength : public CoinArrayWithLength {
674
+
675
+ public:
676
+ /**@name Get methods. */
677
+ //@{
678
+ /// Get the size
679
+ inline int getSize() const
680
+ { return size_/CoinSizeofAsInt(CoinFactorizationDouble); }
681
+ /// Get Array
682
+ inline CoinFactorizationDouble * array() const
683
+ { return reinterpret_cast<CoinFactorizationDouble *> ((size_>-2) ? array_ : NULL); }
684
+ //@}
685
+
686
+ /**@name Set methods */
687
+ //@{
688
+ /// Set the size
689
+ inline void setSize(int value)
690
+ { size_ = value*CoinSizeofAsInt(CoinFactorizationDouble); }
691
+ //@}
692
+
693
+ /**@name Condition methods */
694
+ //@{
695
+ /// Conditionally gets new array
696
+ inline CoinFactorizationDouble * conditionalNew(int sizeWanted)
697
+ { return reinterpret_cast<CoinFactorizationDouble *> (CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast<long> (( sizeWanted)*CoinSizeofAsInt(CoinFactorizationDouble)) : -1)); }
698
+ //@}
699
+
700
+ /**@name Constructors and destructors */
701
+ //@{
702
+ /** Default constructor - NULL*/
703
+ inline CoinFactorizationDoubleArrayWithLength()
704
+ { array_=NULL; size_=-1;}
705
+ /** Alternate Constructor - length in bytes - size_ -1 */
706
+ inline CoinFactorizationDoubleArrayWithLength(int size)
707
+ { array_=new char [size*CoinSizeofAsInt(CoinFactorizationDouble)]; size_=-1;}
708
+ /** Alternate Constructor - length in bytes
709
+ mode - 0 size_ set to size
710
+ 1 size_ set to size and zeroed
711
+ */
712
+ inline CoinFactorizationDoubleArrayWithLength(int size, int mode)
713
+ : CoinArrayWithLength(size*CoinSizeofAsInt(CoinFactorizationDouble),mode) {}
714
+ /** Copy constructor. */
715
+ inline CoinFactorizationDoubleArrayWithLength(const CoinFactorizationDoubleArrayWithLength & rhs)
716
+ : CoinArrayWithLength(rhs) {}
717
+ /** Copy constructor.2 */
718
+ inline CoinFactorizationDoubleArrayWithLength(const CoinFactorizationDoubleArrayWithLength * rhs)
719
+ : CoinArrayWithLength(rhs) {}
720
+ /** Assignment operator. */
721
+ inline CoinFactorizationDoubleArrayWithLength& operator=(const CoinFactorizationDoubleArrayWithLength & rhs)
722
+ { CoinArrayWithLength::operator=(rhs); return *this;}
723
+ //@}
724
+ };
725
+ /// CoinFactorizationLongDouble * version
726
+
727
+ class CoinFactorizationLongDoubleArrayWithLength : public CoinArrayWithLength {
728
+
729
+ public:
730
+ /**@name Get methods. */
731
+ //@{
732
+ /// Get the size
733
+ inline int getSize() const
734
+ { return size_/CoinSizeofAsInt(long double); }
735
+ /// Get Array
736
+ inline long double * array() const
737
+ { return reinterpret_cast<long double *> ((size_>-2) ? array_ : NULL); }
738
+ //@}
739
+
740
+ /**@name Set methods */
741
+ //@{
742
+ /// Set the size
743
+ inline void setSize(int value)
744
+ { size_ = value*CoinSizeofAsInt(long double); }
745
+ //@}
746
+
747
+ /**@name Condition methods */
748
+ //@{
749
+ /// Conditionally gets new array
750
+ inline long double * conditionalNew(int sizeWanted)
751
+ { return reinterpret_cast<long double *> (CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast<long> (( sizeWanted)*CoinSizeofAsInt(long double)) : -1)); }
752
+ //@}
753
+
754
+ /**@name Constructors and destructors */
755
+ //@{
756
+ /** Default constructor - NULL*/
757
+ inline CoinFactorizationLongDoubleArrayWithLength()
758
+ { array_=NULL; size_=-1;}
759
+ /** Alternate Constructor - length in bytes - size_ -1 */
760
+ inline CoinFactorizationLongDoubleArrayWithLength(int size)
761
+ { array_=new char [size*CoinSizeofAsInt(long double)]; size_=-1;}
762
+ /** Alternate Constructor - length in bytes
763
+ mode - 0 size_ set to size
764
+ 1 size_ set to size and zeroed
765
+ */
766
+ inline CoinFactorizationLongDoubleArrayWithLength(int size, int mode)
767
+ : CoinArrayWithLength(size*CoinSizeofAsInt(long double),mode) {}
768
+ /** Copy constructor. */
769
+ inline CoinFactorizationLongDoubleArrayWithLength(const CoinFactorizationLongDoubleArrayWithLength & rhs)
770
+ : CoinArrayWithLength(rhs) {}
771
+ /** Copy constructor.2 */
772
+ inline CoinFactorizationLongDoubleArrayWithLength(const CoinFactorizationLongDoubleArrayWithLength * rhs)
773
+ : CoinArrayWithLength(rhs) {}
774
+ /** Assignment operator. */
775
+ inline CoinFactorizationLongDoubleArrayWithLength& operator=(const CoinFactorizationLongDoubleArrayWithLength & rhs)
776
+ { CoinArrayWithLength::operator=(rhs); return *this;}
777
+ //@}
778
+ };
779
+ /// int * version
780
+
781
+ class CoinIntArrayWithLength : public CoinArrayWithLength {
782
+
783
+ public:
784
+ /**@name Get methods. */
785
+ //@{
786
+ /// Get the size
787
+ inline int getSize() const
788
+ { return size_/CoinSizeofAsInt(int); }
789
+ /// Get Array
790
+ inline int * array() const
791
+ { return reinterpret_cast<int *> ((size_>-2) ? array_ : NULL); }
792
+ //@}
793
+
794
+ /**@name Set methods */
795
+ //@{
796
+ /// Set the size
797
+ inline void setSize(int value)
798
+ { size_ = value*CoinSizeofAsInt(int); }
799
+ //@}
800
+
801
+ /**@name Condition methods */
802
+ //@{
803
+ /// Conditionally gets new array
804
+ inline int * conditionalNew(int sizeWanted)
805
+ { return reinterpret_cast<int *> (CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast<long> (( sizeWanted)*CoinSizeofAsInt(int)) : -1)); }
806
+ //@}
807
+
808
+ /**@name Constructors and destructors */
809
+ //@{
810
+ /** Default constructor - NULL*/
811
+ inline CoinIntArrayWithLength()
812
+ { array_=NULL; size_=-1;}
813
+ /** Alternate Constructor - length in bytes - size_ -1 */
814
+ inline CoinIntArrayWithLength(int size)
815
+ { array_=new char [size*CoinSizeofAsInt(int)]; size_=-1;}
816
+ /** Alternate Constructor - length in bytes
817
+ mode - 0 size_ set to size
818
+ 1 size_ set to size and zeroed
819
+ */
820
+ inline CoinIntArrayWithLength(int size, int mode)
821
+ : CoinArrayWithLength(size*CoinSizeofAsInt(int),mode) {}
822
+ /** Copy constructor. */
823
+ inline CoinIntArrayWithLength(const CoinIntArrayWithLength & rhs)
824
+ : CoinArrayWithLength(rhs) {}
825
+ /** Copy constructor.2 */
826
+ inline CoinIntArrayWithLength(const CoinIntArrayWithLength * rhs)
827
+ : CoinArrayWithLength(rhs) {}
828
+ /** Assignment operator. */
829
+ inline CoinIntArrayWithLength& operator=(const CoinIntArrayWithLength & rhs)
830
+ { CoinArrayWithLength::operator=(rhs); return *this;}
831
+ //@}
832
+ };
833
+ /// CoinBigIndex * version
834
+
835
+ class CoinBigIndexArrayWithLength : public CoinArrayWithLength {
836
+
837
+ public:
838
+ /**@name Get methods. */
839
+ //@{
840
+ /// Get the size
841
+ inline int getSize() const
842
+ { return size_/CoinSizeofAsInt(CoinBigIndex); }
843
+ /// Get Array
844
+ inline CoinBigIndex * array() const
845
+ { return reinterpret_cast<CoinBigIndex *> ((size_>-2) ? array_ : NULL); }
846
+ //@}
847
+
848
+ /**@name Set methods */
849
+ //@{
850
+ /// Set the size
851
+ inline void setSize(int value)
852
+ { size_ = value*CoinSizeofAsInt(CoinBigIndex); }
853
+ //@}
854
+
855
+ /**@name Condition methods */
856
+ //@{
857
+ /// Conditionally gets new array
858
+ inline CoinBigIndex * conditionalNew(int sizeWanted)
859
+ { return reinterpret_cast<CoinBigIndex *> (CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast<long> (( sizeWanted)*CoinSizeofAsInt(CoinBigIndex)) : -1)); }
860
+ //@}
861
+
862
+ /**@name Constructors and destructors */
863
+ //@{
864
+ /** Default constructor - NULL*/
865
+ inline CoinBigIndexArrayWithLength()
866
+ { array_=NULL; size_=-1;}
867
+ /** Alternate Constructor - length in bytes - size_ -1 */
868
+ inline CoinBigIndexArrayWithLength(int size)
869
+ { array_=new char [size*CoinSizeofAsInt(CoinBigIndex)]; size_=-1;}
870
+ /** Alternate Constructor - length in bytes
871
+ mode - 0 size_ set to size
872
+ 1 size_ set to size and zeroed
873
+ */
874
+ inline CoinBigIndexArrayWithLength(int size, int mode)
875
+ : CoinArrayWithLength(size*CoinSizeofAsInt(CoinBigIndex),mode) {}
876
+ /** Copy constructor. */
877
+ inline CoinBigIndexArrayWithLength(const CoinBigIndexArrayWithLength & rhs)
878
+ : CoinArrayWithLength(rhs) {}
879
+ /** Copy constructor.2 */
880
+ inline CoinBigIndexArrayWithLength(const CoinBigIndexArrayWithLength * rhs)
881
+ : CoinArrayWithLength(rhs) {}
882
+ /** Assignment operator. */
883
+ inline CoinBigIndexArrayWithLength& operator=(const CoinBigIndexArrayWithLength & rhs)
884
+ { CoinArrayWithLength::operator=(rhs); return *this;}
885
+ //@}
886
+ };
887
+ /// unsigned int * version
888
+
889
+ class CoinUnsignedIntArrayWithLength : public CoinArrayWithLength {
890
+
891
+ public:
892
+ /**@name Get methods. */
893
+ //@{
894
+ /// Get the size
895
+ inline int getSize() const
896
+ { return size_/CoinSizeofAsInt(unsigned int); }
897
+ /// Get Array
898
+ inline unsigned int * array() const
899
+ { return reinterpret_cast<unsigned int *> ((size_>-2) ? array_ : NULL); }
900
+ //@}
901
+
902
+ /**@name Set methods */
903
+ //@{
904
+ /// Set the size
905
+ inline void setSize(int value)
906
+ { size_ = value*CoinSizeofAsInt(unsigned int); }
907
+ //@}
908
+
909
+ /**@name Condition methods */
910
+ //@{
911
+ /// Conditionally gets new array
912
+ inline unsigned int * conditionalNew(int sizeWanted)
913
+ { return reinterpret_cast<unsigned int *> (CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast<long> (( sizeWanted)*CoinSizeofAsInt(unsigned int)) : -1)); }
914
+ //@}
915
+
916
+ /**@name Constructors and destructors */
917
+ //@{
918
+ /** Default constructor - NULL*/
919
+ inline CoinUnsignedIntArrayWithLength()
920
+ { array_=NULL; size_=-1;}
921
+ /** Alternate Constructor - length in bytes - size_ -1 */
922
+ inline CoinUnsignedIntArrayWithLength(int size)
923
+ { array_=new char [size*CoinSizeofAsInt(unsigned int)]; size_=-1;}
924
+ /** Alternate Constructor - length in bytes
925
+ mode - 0 size_ set to size
926
+ 1 size_ set to size and zeroed
927
+ */
928
+ inline CoinUnsignedIntArrayWithLength(int size, int mode)
929
+ : CoinArrayWithLength(size*CoinSizeofAsInt(unsigned int),mode) {}
930
+ /** Copy constructor. */
931
+ inline CoinUnsignedIntArrayWithLength(const CoinUnsignedIntArrayWithLength & rhs)
932
+ : CoinArrayWithLength(rhs) {}
933
+ /** Copy constructor.2 */
934
+ inline CoinUnsignedIntArrayWithLength(const CoinUnsignedIntArrayWithLength * rhs)
935
+ : CoinArrayWithLength(rhs) {}
936
+ /** Assignment operator. */
937
+ inline CoinUnsignedIntArrayWithLength& operator=(const CoinUnsignedIntArrayWithLength & rhs)
938
+ { CoinArrayWithLength::operator=(rhs); return *this;}
939
+ //@}
940
+ };
941
+ /// void * version
942
+
943
+ class CoinVoidStarArrayWithLength : public CoinArrayWithLength {
944
+
945
+ public:
946
+ /**@name Get methods. */
947
+ //@{
948
+ /// Get the size
949
+ inline int getSize() const
950
+ { return size_/CoinSizeofAsInt(void *); }
951
+ /// Get Array
952
+ inline void ** array() const
953
+ { return reinterpret_cast<void **> ((size_>-2) ? array_ : NULL); }
954
+ //@}
955
+
956
+ /**@name Set methods */
957
+ //@{
958
+ /// Set the size
959
+ inline void setSize(int value)
960
+ { size_ = value*CoinSizeofAsInt(void *); }
961
+ //@}
962
+
963
+ /**@name Condition methods */
964
+ //@{
965
+ /// Conditionally gets new array
966
+ inline void ** conditionalNew(int sizeWanted)
967
+ { return reinterpret_cast<void **> ( CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast<long> ((sizeWanted)*CoinSizeofAsInt(void *)) : -1)); }
968
+ //@}
969
+
970
+ /**@name Constructors and destructors */
971
+ //@{
972
+ /** Default constructor - NULL*/
973
+ inline CoinVoidStarArrayWithLength()
974
+ { array_=NULL; size_=-1;}
975
+ /** Alternate Constructor - length in bytes - size_ -1 */
976
+ inline CoinVoidStarArrayWithLength(int size)
977
+ { array_=new char [size*CoinSizeofAsInt(void *)]; size_=-1;}
978
+ /** Alternate Constructor - length in bytes
979
+ mode - 0 size_ set to size
980
+ 1 size_ set to size and zeroed
981
+ */
982
+ inline CoinVoidStarArrayWithLength(int size, int mode)
983
+ : CoinArrayWithLength(size*CoinSizeofAsInt(void *),mode) {}
984
+ /** Copy constructor. */
985
+ inline CoinVoidStarArrayWithLength(const CoinVoidStarArrayWithLength & rhs)
986
+ : CoinArrayWithLength(rhs) {}
987
+ /** Copy constructor.2 */
988
+ inline CoinVoidStarArrayWithLength(const CoinVoidStarArrayWithLength * rhs)
989
+ : CoinArrayWithLength(rhs) {}
990
+ /** Assignment operator. */
991
+ inline CoinVoidStarArrayWithLength& operator=(const CoinVoidStarArrayWithLength & rhs)
992
+ { CoinArrayWithLength::operator=(rhs); return *this;}
993
+ //@}
994
+ };
995
+ /// arbitrary version
996
+
997
+ class CoinArbitraryArrayWithLength : public CoinArrayWithLength {
998
+
999
+ public:
1000
+ /**@name Get methods. */
1001
+ //@{
1002
+ /// Get the size
1003
+ inline int getSize() const
1004
+ { return size_/lengthInBytes_; }
1005
+ /// Get Array
1006
+ inline void ** array() const
1007
+ { return reinterpret_cast<void **> ((size_>-2) ? array_ : NULL); }
1008
+ //@}
1009
+
1010
+ /**@name Set methods */
1011
+ //@{
1012
+ /// Set the size
1013
+ inline void setSize(int value)
1014
+ { size_ = value*lengthInBytes_; }
1015
+ //@}
1016
+
1017
+ /**@name Condition methods */
1018
+ //@{
1019
+ /// Conditionally gets new array
1020
+ inline char * conditionalNew(int length, int sizeWanted)
1021
+ { lengthInBytes_=length;return reinterpret_cast<char *> ( CoinArrayWithLength::conditionalNew(sizeWanted>=0 ? static_cast<long>
1022
+ ((sizeWanted)*lengthInBytes_) : -1)); }
1023
+ //@}
1024
+
1025
+ /**@name Constructors and destructors */
1026
+ //@{
1027
+ /** Default constructor - NULL*/
1028
+ inline CoinArbitraryArrayWithLength(int length=1)
1029
+ { array_=NULL; size_=-1;lengthInBytes_=length;}
1030
+ /** Alternate Constructor - length in bytes - size_ -1 */
1031
+ inline CoinArbitraryArrayWithLength(int length, int size)
1032
+ { array_=new char [size*length]; size_=-1; lengthInBytes_=length;}
1033
+ /** Alternate Constructor - length in bytes
1034
+ mode - 0 size_ set to size
1035
+ 1 size_ set to size and zeroed
1036
+ */
1037
+ inline CoinArbitraryArrayWithLength(int length, int size, int mode)
1038
+ : CoinArrayWithLength(size*length,mode) {lengthInBytes_=length;}
1039
+ /** Copy constructor. */
1040
+ inline CoinArbitraryArrayWithLength(const CoinArbitraryArrayWithLength & rhs)
1041
+ : CoinArrayWithLength(rhs) {}
1042
+ /** Copy constructor.2 */
1043
+ inline CoinArbitraryArrayWithLength(const CoinArbitraryArrayWithLength * rhs)
1044
+ : CoinArrayWithLength(rhs) {}
1045
+ /** Assignment operator. */
1046
+ inline CoinArbitraryArrayWithLength& operator=(const CoinArbitraryArrayWithLength & rhs)
1047
+ { CoinArrayWithLength::operator=(rhs); return *this;}
1048
+ //@}
1049
+
1050
+ protected:
1051
+ /**@name Private member data */
1052
+ //@{
1053
+ /// Length in bytes
1054
+ int lengthInBytes_;
1055
+ //@}
1056
+ };
1057
+ class CoinPartitionedVector : public CoinIndexedVector {
1058
+
1059
+ public:
1060
+ #ifndef COIN_PARTITIONS
1061
+ #define COIN_PARTITIONS 8
1062
+ #endif
1063
+ /**@name Get methods. */
1064
+ //@{
1065
+ /// Get the size of a partition
1066
+ inline int getNumElements(int partition) const { assert (partition<COIN_PARTITIONS);
1067
+ return numberElementsPartition_[partition]; }
1068
+ /// Get number of partitions
1069
+ inline int getNumPartitions() const
1070
+ { return numberPartitions_; }
1071
+ /// Get the size
1072
+ inline int getNumElements() const { return nElements_; }
1073
+ /// Get starts
1074
+ inline int startPartition(int partition) const { assert (partition<=COIN_PARTITIONS);
1075
+ return startPartition_[partition]; }
1076
+ /// Get starts
1077
+ inline const int * startPartitions() const
1078
+ { return startPartition_; }
1079
+ //@}
1080
+
1081
+ //-------------------------------------------------------------------
1082
+ // Set indices and elements
1083
+ //-------------------------------------------------------------------
1084
+ /**@name Set methods */
1085
+ //@{
1086
+ /// Set the size of a partition
1087
+ inline void setNumElementsPartition(int partition, int value) { assert (partition<COIN_PARTITIONS);
1088
+ if (numberPartitions_) numberElementsPartition_[partition]=value; }
1089
+ /// Set the size of a partition (just for a tiny while)
1090
+ inline void setTempNumElementsPartition(int partition, int value) { assert (partition<COIN_PARTITIONS);
1091
+ numberElementsPartition_[partition]=value; }
1092
+ /// Add up number of elements in partitions
1093
+ void computeNumberElements();
1094
+ /// Add up number of elements in partitions and pack and get rid of partitions
1095
+ void compact();
1096
+ /** Reserve space.
1097
+ */
1098
+ void reserve(int n);
1099
+ /// Setup partitions (needs end as well)
1100
+ void setPartitions(int number,const int * starts);
1101
+ /// Reset the vector (as if were just created an empty vector). Gets rid of partitions
1102
+ void clearAndReset();
1103
+ /// Reset the vector (as if were just created an empty vector). Keeps partitions
1104
+ void clearAndKeep();
1105
+ /// Clear a partition.
1106
+ void clearPartition(int partition);
1107
+ #ifndef NDEBUG
1108
+ /// For debug check vector is clear i.e. no elements
1109
+ void checkClear();
1110
+ /// For debug check vector is clean i.e. elements match indices
1111
+ void checkClean();
1112
+ #else
1113
+ inline void checkClear() {};
1114
+ inline void checkClean() {};
1115
+ #endif
1116
+ /// Scan dense region and set up indices (returns number found)
1117
+ int scan(int partition, double tolerance=0.0);
1118
+ /** Scan dense region from start to < end and set up indices
1119
+ returns number found
1120
+ */
1121
+ /// Print out
1122
+ void print() const;
1123
+ //@}
1124
+
1125
+ /**@name Sorting */
1126
+ //@{
1127
+ /** Sort the indexed storage vector (increasing indices). */
1128
+ void sort();
1129
+ //@}
1130
+
1131
+ /**@name Constructors and destructors (not all wriiten) */
1132
+ //@{
1133
+ /** Default constructor */
1134
+ CoinPartitionedVector();
1135
+ /** Alternate Constructors - set elements to vector of doubles */
1136
+ CoinPartitionedVector(int size, const int * inds, const double * elems);
1137
+ /** Alternate Constructors - set elements to same scalar value */
1138
+ CoinPartitionedVector(int size, const int * inds, double element);
1139
+ /** Alternate Constructors - construct full storage with indices 0 through
1140
+ size-1. */
1141
+ CoinPartitionedVector(int size, const double * elements);
1142
+ /** Alternate Constructors - just size */
1143
+ CoinPartitionedVector(int size);
1144
+ /** Copy constructor. */
1145
+ CoinPartitionedVector(const CoinPartitionedVector &);
1146
+ /** Copy constructor.2 */
1147
+ CoinPartitionedVector(const CoinPartitionedVector *);
1148
+ /** Assignment operator. */
1149
+ CoinPartitionedVector & operator=(const CoinPartitionedVector &);
1150
+ /** Destructor */
1151
+ ~CoinPartitionedVector ();
1152
+ //@}
1153
+ protected:
1154
+ /**@name Private member data */
1155
+ //@{
1156
+ /// Starts
1157
+ int startPartition_[COIN_PARTITIONS+1];
1158
+ /// Size of indices in a partition
1159
+ int numberElementsPartition_[COIN_PARTITIONS];
1160
+ /// Number of partitions (0 means off)
1161
+ int numberPartitions_;
1162
+ //@}
1163
+ };
1164
+ #endif