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,1842 @@
1
+ /* $Id: CoinPresolveMatrix.hpp 1761 2014-12-10 09:43:07Z forrest $ */
2
+ // Copyright (C) 2002, International Business Machines
3
+ // Corporation and others. All Rights Reserved.
4
+ // This code is licensed under the terms of the Eclipse Public License (EPL).
5
+
6
+ #ifndef CoinPresolveMatrix_H
7
+ #define CoinPresolveMatrix_H
8
+
9
+ #include "CoinPragma.hpp"
10
+ #include "CoinPackedMatrix.hpp"
11
+ #include "CoinMessage.hpp"
12
+ #include "CoinTime.hpp"
13
+
14
+ #include <cmath>
15
+ #include <cassert>
16
+ #include <cfloat>
17
+ #include <cassert>
18
+ #include <cstdlib>
19
+
20
+ #if PRESOLVE_DEBUG > 0
21
+ #include "CoinFinite.hpp"
22
+ #endif
23
+
24
+ /*! \file
25
+
26
+ Declarations for CoinPresolveMatrix and CoinPostsolveMatrix and their
27
+ common base class CoinPrePostsolveMatrix. Also declarations for
28
+ CoinPresolveAction and a number of non-member utility functions.
29
+ */
30
+
31
+
32
+ #if defined(_MSC_VER)
33
+ // Avoid MS Compiler problem in recognizing type to delete
34
+ // by casting to type.
35
+ // Is this still necessary? -- lh, 111202 --
36
+ #define deleteAction(array,type) delete [] ((type) array)
37
+ #else
38
+ #define deleteAction(array,type) delete [] array
39
+ #endif
40
+
41
+ /*
42
+ Define PRESOLVE_DEBUG and PRESOLVE_CONSISTENCY on the configure command
43
+ line or in a Makefile! See comments in CoinPresolvePsdebug.hpp.
44
+ */
45
+ #if PRESOLVE_DEBUG > 0 || PRESOLVE_CONSISTENCY > 0
46
+
47
+ #define PRESOLVE_STMT(s) s
48
+
49
+ #define PRESOLVEASSERT(x) \
50
+ ((x) ? 1 : ((std::cerr << "FAILED ASSERTION at line " \
51
+ << __LINE__ << ": " #x "\n"), abort(), 0))
52
+
53
+ inline void DIE(const char *s) { std::cout << s ; abort() ; }
54
+
55
+ /*! \brief Indicate column or row present at start of postsolve
56
+
57
+ This code is used during postsolve in [cr]done to indicate columns and rows
58
+ that are present in the presolved system (i.e., present at the start of
59
+ postsolve processing).
60
+
61
+ \todo
62
+ There are a bunch of these code definitions, scattered through presolve
63
+ files. They should be collected in one place.
64
+ */
65
+ #define PRESENT_IN_REDUCED '\377'
66
+
67
+ #else
68
+
69
+ #define PRESOLVEASSERT(x) {}
70
+ #define PRESOLVE_STMT(s) {}
71
+
72
+ inline void DIE(const char *) {}
73
+
74
+ #endif
75
+
76
+ /*
77
+ Unclear why these are separate from standard debug.
78
+ */
79
+ #ifndef PRESOLVE_DETAIL
80
+ #define PRESOLVE_DETAIL_PRINT(s) {}
81
+ #else
82
+ #define PRESOLVE_DETAIL_PRINT(s) s
83
+ #endif
84
+
85
+ /*! \brief Zero tolerance
86
+
87
+ OSL had a fixed zero tolerance; we still use that here.
88
+ */
89
+ const double ZTOLDP = 1e-12 ;
90
+ /*! \brief Alternate zero tolerance
91
+
92
+ Use a different one if we are doing doubletons, etc.
93
+ */
94
+ const double ZTOLDP2 = 1e-10 ;
95
+
96
+ /// The usual finite infinity
97
+ #define PRESOLVE_INF COIN_DBL_MAX
98
+ /// And a small infinity
99
+ #define PRESOLVE_SMALL_INF 1.0e20
100
+ /// Check for infinity using finite infinity
101
+ #define PRESOLVEFINITE(n) (-PRESOLVE_INF < (n) && (n) < PRESOLVE_INF)
102
+
103
+
104
+ class CoinPostsolveMatrix ;
105
+
106
+ /*! \class CoinPresolveAction
107
+ \brief Abstract base class of all presolve routines.
108
+
109
+ The details will make more sense after a quick overview of the grand plan:
110
+ A presolve object is handed a problem object, which it is expected to
111
+ modify in some useful way. Assuming that it succeeds, the presolve object
112
+ should create a postsolve object, <i>i.e.</i>, an object that contains
113
+ instructions for backing out the presolve transform to recover the original
114
+ problem. These postsolve objects are accumulated in a linked list, with each
115
+ successive presolve action adding its postsolve action to the head of the
116
+ list. The end result of all this is a presolved problem object, and a list
117
+ of postsolve objects. The presolved problem object is then handed to a
118
+ solver for optimization, and the problem object augmented with the
119
+ results. The list of postsolve objects is then traversed. Each of them
120
+ (un)modifies the problem object, with the end result being the original
121
+ problem, augmented with solution information.
122
+
123
+ The problem object representation is CoinPrePostsolveMatrix and subclasses.
124
+ Check there for details. The \c CoinPresolveAction class and subclasses
125
+ represent the presolve and postsolve objects.
126
+
127
+ In spite of the name, the only information held in a \c CoinPresolveAction
128
+ object is the information needed to postsolve (<i>i.e.</i>, the information
129
+ needed to back out the presolve transformation). This information is not
130
+ expected to change, so the fields are all \c const.
131
+
132
+ A subclass of \c CoinPresolveAction, implementing a specific pre/postsolve
133
+ action, is expected to declare a static function that attempts to perform a
134
+ presolve transformation. This function will be handed a CoinPresolveMatrix
135
+ to transform, and a pointer to the head of the list of postsolve objects.
136
+ If the transform is successful, the function will create a new
137
+ \c CoinPresolveAction object, link it at the head of the list of postsolve
138
+ objects, and return a pointer to the postsolve object it has just created.
139
+ Otherwise, it should return 0. It is expected that these static functions
140
+ will be the only things that can create new \c CoinPresolveAction objects;
141
+ this is expressed by making each subclass' constructor(s) private.
142
+
143
+ Every subclass must also define a \c postsolve method.
144
+ This function will be handed a CoinPostsolveMatrix to transform.
145
+
146
+ It is the client's responsibility to implement presolve and postsolve driver
147
+ routines. See OsiPresolve for examples.
148
+
149
+ \note Since the only fields in a \c CoinPresolveAction are \c const, anything
150
+ one can do with a variable declared \c CoinPresolveAction* can also be
151
+ done with a variable declared \c const \c CoinPresolveAction* It is
152
+ expected that all derived subclasses of \c CoinPresolveAction also have
153
+ this property.
154
+ */
155
+ class CoinPresolveAction
156
+ {
157
+ public:
158
+ /*! \brief Stub routine to throw exceptions.
159
+
160
+ Exceptions are inefficient, particularly with g++. Even with xlC, the
161
+ use of exceptions adds a long prologue to a routine. Therefore, rather
162
+ than use throw directly in the routine, I use it in a stub routine.
163
+ */
164
+ static void throwCoinError(const char *error, const char *ps_routine)
165
+ { throw CoinError(error, ps_routine, "CoinPresolve"); }
166
+
167
+ /*! \brief The next presolve transformation
168
+
169
+ Set at object construction.
170
+ */
171
+ const CoinPresolveAction *next;
172
+
173
+ /*! \brief Construct a postsolve object and add it to the transformation list.
174
+
175
+ This is an `add to head' operation. This object will point to the
176
+ one passed as the parameter.
177
+ */
178
+ CoinPresolveAction(const CoinPresolveAction *next) : next(next) {}
179
+ /// modify next (when building rather than passing)
180
+ inline void setNext(const CoinPresolveAction *nextAction)
181
+ { next = nextAction;}
182
+
183
+ /*! \brief A name for debug printing.
184
+
185
+ It is expected that the name is not stored in the transform itself.
186
+ */
187
+ virtual const char *name() const = 0;
188
+
189
+ /*! \brief Apply the postsolve transformation for this particular
190
+ presolve action.
191
+ */
192
+ virtual void postsolve(CoinPostsolveMatrix *prob) const = 0;
193
+
194
+ /*! \brief Virtual destructor. */
195
+ virtual ~CoinPresolveAction() {}
196
+ };
197
+
198
+ /*
199
+ These are needed for OSI-aware constructors associated with
200
+ CoinPrePostsolveMatrix, CoinPresolveMatrix, and CoinPostsolveMatrix.
201
+ */
202
+ class ClpSimplex;
203
+ class OsiSolverInterface;
204
+
205
+ /*
206
+ CoinWarmStartBasis is required for methods in CoinPrePostsolveMatrix
207
+ that accept/return a CoinWarmStartBasis object.
208
+ */
209
+ class CoinWarmStartBasis ;
210
+
211
+ /*! \class CoinPrePostsolveMatrix
212
+ \brief Collects all the information about the problem that is needed
213
+ in both presolve and postsolve.
214
+
215
+ In a bit more detail, a column-major representation of the constraint
216
+ matrix and upper and lower bounds on variables and constraints, plus row
217
+ and column solutions, reduced costs, and status. There's also a set of
218
+ arrays holding the original row and column numbers.
219
+
220
+ As presolve and postsolve transform the matrix, it will occasionally be
221
+ necessary to expand the number of entries in a column. There are two
222
+ aspects:
223
+ <ul>
224
+ <li> During postsolve, the constraint system is expected to grow as
225
+ the smaller presolved system is transformed back to the original
226
+ system.
227
+ <li> During both pre- and postsolve, transforms can increase the number
228
+ of coefficients in a row or column. (See the
229
+ variable substitution, doubleton, and tripleton transforms.)
230
+ </ul>
231
+
232
+ The first is addressed by the members #ncols0_, #nrows0_, and #nelems0_.
233
+ These should be set (via constructor parameters) to values large enough
234
+ for the largest size taken on by the constraint system. Typically, this
235
+ will be the size of the original constraint system.
236
+
237
+ The second is addressed by a generous allocation of extra (empty) space
238
+ for the arrays used to hold coefficients and row indices. When columns
239
+ must be expanded, they are moved into the empty space. When it is used up,
240
+ the arrays are compacted. When compaction fails to produce sufficient
241
+ space, presolve/postsolve will fail.
242
+
243
+ CoinPrePostsolveMatrix isn't really intended to be used `bare' --- the
244
+ expectation is that it'll be used through CoinPresolveMatrix or
245
+ CoinPostsolveMatrix. Some of the functions needed to load a problem are
246
+ defined in the derived classes.
247
+
248
+ When CoinPresolve is applied when reoptimising, we need to be prepared to
249
+ accept a basis and modify it in step with the presolve actions (otherwise
250
+ we throw away all the advantages of warm start for reoptimization). But
251
+ other solution components (#acts_, #rowduals_, #sol_, and #rcosts_) are
252
+ needed only for postsolve, where they're used in places to determine the
253
+ proper action(s) when restoring rows or columns. If presolve is provided
254
+ with a solution, it will modify it in step with the presolve actions.
255
+ Moving the solution components from CoinPrePostsolveMatrix to
256
+ CoinPostsolveMatrix would break a lot of code. It's not clear that it's
257
+ worth it, and it would preclude upgrades to the presolve side that might
258
+ make use of any of these. -- lh, 080501 --
259
+
260
+ The constructors that take an OSI or ClpSimplex as a parameter really should
261
+ not be here, but for historical reasons they will likely remain for the
262
+ forseeable future. -- lh, 111202 --
263
+ */
264
+
265
+ class CoinPrePostsolveMatrix
266
+ {
267
+ public:
268
+
269
+ /*! \name Constructors & Destructors */
270
+
271
+ //@{
272
+ /*! \brief `Native' constructor
273
+
274
+ This constructor creates an empty object which must then be loaded. On
275
+ the other hand, it doesn't assume that the client is an
276
+ OsiSolverInterface.
277
+ */
278
+ CoinPrePostsolveMatrix(int ncols_alloc, int nrows_alloc,
279
+ CoinBigIndex nelems_alloc) ;
280
+
281
+ /*! \brief Generic OSI constructor
282
+
283
+ See OSI code for the definition.
284
+ */
285
+ CoinPrePostsolveMatrix(const OsiSolverInterface * si,
286
+ int ncols_,
287
+ int nrows_,
288
+ CoinBigIndex nelems_);
289
+
290
+ /*! ClpOsi constructor
291
+
292
+ See Clp code for the definition.
293
+ */
294
+ CoinPrePostsolveMatrix(const ClpSimplex * si,
295
+ int ncols_,
296
+ int nrows_,
297
+ CoinBigIndex nelems_,
298
+ double bulkRatio);
299
+
300
+ /// Destructor
301
+ ~CoinPrePostsolveMatrix();
302
+ //@}
303
+
304
+ /*! \brief Enum for status of various sorts
305
+
306
+ Matches CoinWarmStartBasis::Status and adds superBasic. Most code that
307
+ converts between CoinPrePostsolveMatrix::Status and
308
+ CoinWarmStartBasis::Status will break if this correspondence is broken.
309
+
310
+ superBasic is an unresolved problem: there's no analogue in
311
+ CoinWarmStartBasis::Status.
312
+ */
313
+ enum Status {
314
+ isFree = 0x00,
315
+ basic = 0x01,
316
+ atUpperBound = 0x02,
317
+ atLowerBound = 0x03,
318
+ superBasic = 0x04
319
+ };
320
+
321
+ /*! \name Functions to work with variable status
322
+
323
+ Functions to work with the CoinPrePostsolveMatrix::Status enum and
324
+ related vectors.
325
+
326
+ \todo
327
+ Why are we futzing around with three bit status? A holdover from the
328
+ packed arrays of CoinWarmStartBasis? Big swaths of the presolve code
329
+ manipulates colstat_ and rowstat_ as unsigned char arrays using simple
330
+ assignment to set values.
331
+ */
332
+ //@{
333
+
334
+ /// Set row status (<i>i.e.</i>, status of artificial for this row)
335
+ inline void setRowStatus(int sequence, Status status)
336
+ {
337
+ unsigned char & st_byte = rowstat_[sequence];
338
+ st_byte = static_cast<unsigned char>(st_byte & (~7)) ;
339
+ st_byte = static_cast<unsigned char>(st_byte | status) ;
340
+ }
341
+ /// Get row status
342
+ inline Status getRowStatus(int sequence) const
343
+ {return static_cast<Status> (rowstat_[sequence]&7);}
344
+ /// Check if artificial for this row is basic
345
+ inline bool rowIsBasic(int sequence) const
346
+ {return (static_cast<Status> (rowstat_[sequence]&7)==basic);}
347
+ /// Set column status (<i>i.e.</i>, status of primal variable)
348
+ inline void setColumnStatus(int sequence, Status status)
349
+ {
350
+ unsigned char & st_byte = colstat_[sequence];
351
+ st_byte = static_cast<unsigned char>(st_byte & (~7)) ;
352
+ st_byte = static_cast<unsigned char>(st_byte | status) ;
353
+
354
+ # ifdef PRESOLVE_DEBUG
355
+ switch (status)
356
+ { case isFree:
357
+ { if (clo_[sequence] > -PRESOLVE_INF || cup_[sequence] < PRESOLVE_INF)
358
+ { std::cout << "Bad status: Var " << sequence
359
+ << " isFree, lb = " << clo_[sequence]
360
+ << ", ub = " << cup_[sequence] << std::endl ; }
361
+ break ; }
362
+ case basic:
363
+ { break ; }
364
+ case atUpperBound:
365
+ { if (cup_[sequence] >= PRESOLVE_INF)
366
+ { std::cout << "Bad status: Var " << sequence
367
+ << " atUpperBound, lb = " << clo_[sequence]
368
+ << ", ub = " << cup_[sequence] << std::endl ; }
369
+ break ; }
370
+ case atLowerBound:
371
+ { if (clo_[sequence] <= -PRESOLVE_INF)
372
+ { std::cout << "Bad status: Var " << sequence
373
+ << " atLowerBound, lb = " << clo_[sequence]
374
+ << ", ub = " << cup_[sequence] << std::endl ; }
375
+ break ; }
376
+ case superBasic:
377
+ { if (clo_[sequence] <= -PRESOLVE_INF && cup_[sequence] >= PRESOLVE_INF)
378
+ { std::cout << "Bad status: Var " << sequence
379
+ << " superBasic, lb = " << clo_[sequence]
380
+ << ", ub = " << cup_[sequence] << std::endl ; }
381
+ break ; }
382
+ default:
383
+ { assert(false) ;
384
+ break ; } }
385
+ # endif
386
+ }
387
+ /// Get column (structural variable) status
388
+ inline Status getColumnStatus(int sequence) const
389
+ {return static_cast<Status> (colstat_[sequence]&7);}
390
+ /// Check if column (structural variable) is basic
391
+ inline bool columnIsBasic(int sequence) const
392
+ {return (static_cast<Status> (colstat_[sequence]&7)==basic);}
393
+ /*! \brief Set status of row (artificial variable) to the correct nonbasic
394
+ status given bounds and current value
395
+ */
396
+ void setRowStatusUsingValue(int iRow);
397
+ /*! \brief Set status of column (structural variable) to the correct
398
+ nonbasic status given bounds and current value
399
+ */
400
+ void setColumnStatusUsingValue(int iColumn);
401
+ /*! \brief Set column (structural variable) status vector */
402
+ void setStructuralStatus(const char *strucStatus, int lenParam) ;
403
+ /*! \brief Set row (artificial variable) status vector */
404
+ void setArtificialStatus(const char *artifStatus, int lenParam) ;
405
+ /*! \brief Set the status of all variables from a basis */
406
+ void setStatus(const CoinWarmStartBasis *basis) ;
407
+ /*! \brief Get status in the form of a CoinWarmStartBasis */
408
+ CoinWarmStartBasis *getStatus() ;
409
+ /*! \brief Return a print string for status of a column (structural
410
+ variable)
411
+ */
412
+ const char *columnStatusString(int j) const ;
413
+ /*! \brief Return a print string for status of a row (artificial
414
+ variable)
415
+ */
416
+ const char *rowStatusString(int i) const ;
417
+ //@}
418
+
419
+ /*! \name Functions to load problem and solution information
420
+
421
+ These functions can be used to load portions of the problem definition
422
+ and solution. See also the CoinPresolveMatrix and CoinPostsolveMatrix
423
+ classes.
424
+ */
425
+ //@{
426
+ /// Set the objective function offset for the original system.
427
+ void setObjOffset(double offset) ;
428
+ /*! \brief Set the objective sense (max/min)
429
+
430
+ Coded as 1.0 for min, -1.0 for max.
431
+ Yes, there's a method, and a matching attribute. No, you really
432
+ don't want to set this to maximise.
433
+ */
434
+ void setObjSense(double objSense) ;
435
+ /// Set the primal feasibility tolerance
436
+ void setPrimalTolerance(double primTol) ;
437
+ /// Set the dual feasibility tolerance
438
+ void setDualTolerance(double dualTol) ;
439
+ /// Set column lower bounds
440
+ void setColLower(const double *colLower, int lenParam) ;
441
+ /// Set column upper bounds
442
+ void setColUpper(const double *colUpper, int lenParam) ;
443
+ /// Set column solution
444
+ void setColSolution(const double *colSol, int lenParam) ;
445
+ /// Set objective coefficients
446
+ void setCost(const double *cost, int lenParam) ;
447
+ /// Set reduced costs
448
+ void setReducedCost(const double *redCost, int lenParam) ;
449
+ /// Set row lower bounds
450
+ void setRowLower(const double *rowLower, int lenParam) ;
451
+ /// Set row upper bounds
452
+ void setRowUpper(const double *rowUpper, int lenParam) ;
453
+ /// Set row solution
454
+ void setRowPrice(const double *rowSol, int lenParam) ;
455
+ /// Set row activity
456
+ void setRowActivity(const double *rowAct, int lenParam) ;
457
+ //@}
458
+
459
+ /*! \name Functions to retrieve problem and solution information */
460
+ //@{
461
+ /// Get current number of columns
462
+ inline int getNumCols() const
463
+ { return (ncols_) ; }
464
+ /// Get current number of rows
465
+ inline int getNumRows() const
466
+ { return (nrows_) ; }
467
+ /// Get current number of non-zero coefficients
468
+ inline int getNumElems() const
469
+ { return (nelems_) ; }
470
+ /// Get column start vector for column-major packed matrix
471
+ inline const CoinBigIndex *getColStarts() const
472
+ { return (mcstrt_) ; }
473
+ /// Get column length vector for column-major packed matrix
474
+ inline const int *getColLengths() const
475
+ { return (hincol_) ; }
476
+ /// Get vector of row indices for column-major packed matrix
477
+ inline const int *getRowIndicesByCol() const
478
+ { return (hrow_) ; }
479
+ /// Get vector of elements for column-major packed matrix
480
+ inline const double *getElementsByCol() const
481
+ { return (colels_) ; }
482
+ /// Get column lower bounds
483
+ inline const double *getColLower() const
484
+ { return (clo_) ; }
485
+ /// Get column upper bounds
486
+ inline const double *getColUpper() const
487
+ { return (cup_) ; }
488
+ /// Get objective coefficients
489
+ inline const double *getCost() const
490
+ { return (cost_) ; }
491
+ /// Get row lower bounds
492
+ inline const double *getRowLower() const
493
+ { return (rlo_) ; }
494
+ /// Get row upper bounds
495
+ inline const double *getRowUpper() const
496
+ { return (rup_) ; }
497
+ /// Get column solution (primal variable values)
498
+ inline const double *getColSolution() const
499
+ { return (sol_) ; }
500
+ /// Get row activity (constraint lhs values)
501
+ inline const double *getRowActivity() const
502
+ { return (acts_) ; }
503
+ /// Get row solution (dual variables)
504
+ inline const double *getRowPrice() const
505
+ { return (rowduals_) ; }
506
+ /// Get reduced costs
507
+ inline const double *getReducedCost() const
508
+ { return (rcosts_) ; }
509
+ /// Count empty columns
510
+ inline int countEmptyCols()
511
+ { int empty = 0 ;
512
+ for (int i = 0 ; i < ncols_ ; i++) if (hincol_[i] == 0) empty++ ;
513
+ return (empty) ; }
514
+ //@}
515
+
516
+
517
+ /*! \name Message handling */
518
+ //@{
519
+ /// Return message handler
520
+ inline CoinMessageHandler *messageHandler() const
521
+ { return handler_; }
522
+ /*! \brief Set message handler
523
+
524
+ The client retains responsibility for the handler --- it will not be
525
+ destroyed with the \c CoinPrePostsolveMatrix object.
526
+ */
527
+ inline void setMessageHandler(CoinMessageHandler *handler)
528
+ { if (defaultHandler_ == true)
529
+ { delete handler_ ;
530
+ defaultHandler_ = false ; }
531
+ handler_ = handler ; }
532
+ /// Return messages
533
+ inline CoinMessages messages() const
534
+ { return messages_; }
535
+ //@}
536
+
537
+ /*! \name Current and Allocated Size
538
+
539
+ During pre- and postsolve, the matrix will change in size. During presolve
540
+ it will shrink; during postsolve it will grow. Hence there are two sets of
541
+ size variables, one for the current size and one for the allocated size.
542
+ (See the general comments for the CoinPrePostsolveMatrix class for more
543
+ information.)
544
+ */
545
+ //@{
546
+
547
+ /// current number of columns
548
+ int ncols_;
549
+ /// current number of rows
550
+ int nrows_;
551
+ /// current number of coefficients
552
+ CoinBigIndex nelems_;
553
+
554
+ /// Allocated number of columns
555
+ int ncols0_;
556
+ /// Allocated number of rows
557
+ int nrows0_ ;
558
+ /// Allocated number of coefficients
559
+ CoinBigIndex nelems0_ ;
560
+ /*! \brief Allocated size of bulk storage for row indices and coefficients
561
+
562
+ This is the space allocated for hrow_ and colels_. This must be large
563
+ enough to allow columns to be copied into empty space when they need to
564
+ be expanded. For efficiency (to minimize the number of times the
565
+ representation must be compressed) it's recommended that this be at least
566
+ 2*nelems0_.
567
+ */
568
+ CoinBigIndex bulk0_ ;
569
+ /// Ratio of bulk0_ to nelems0_; default is 2.
570
+ double bulkRatio_;
571
+ //@}
572
+
573
+ /*! \name Problem representation
574
+
575
+ The matrix is the common column-major format: A pair of vectors with
576
+ positional correspondence to hold coefficients and row indices, and a
577
+ second pair of vectors giving the starting position and length of each
578
+ column in the first pair.
579
+ */
580
+ //@{
581
+ /// Vector of column start positions in #hrow_, #colels_
582
+ CoinBigIndex *mcstrt_;
583
+ /// Vector of column lengths
584
+ int *hincol_;
585
+ /// Row indices (positional correspondence with #colels_)
586
+ int *hrow_;
587
+ /// Coefficients (positional correspondence with #hrow_)
588
+ double *colels_;
589
+
590
+ /// Objective coefficients
591
+ double *cost_;
592
+ /// Original objective offset
593
+ double originalOffset_;
594
+
595
+ /// Column (primal variable) lower bounds
596
+ double *clo_;
597
+ /// Column (primal variable) upper bounds
598
+ double *cup_;
599
+
600
+ /// Row (constraint) lower bounds
601
+ double *rlo_;
602
+ /// Row (constraint) upper bounds
603
+ double *rup_;
604
+
605
+ /*! \brief Original column numbers
606
+
607
+ Over the current range of column numbers in the presolved problem,
608
+ the entry for column j will contain the index of the corresponding
609
+ column in the original problem.
610
+ */
611
+ int * originalColumn_;
612
+ /*! \brief Original row numbers
613
+
614
+ Over the current range of row numbers in the presolved problem, the
615
+ entry for row i will contain the index of the corresponding row in
616
+ the original problem.
617
+ */
618
+ int * originalRow_;
619
+
620
+ /// Primal feasibility tolerance
621
+ double ztolzb_;
622
+ /// Dual feasibility tolerance
623
+ double ztoldj_;
624
+
625
+ /*! \brief Maximization/minimization
626
+
627
+ Yes, there's a variable here. No, you really don't want to set this to
628
+ maximise. See the main notes for CoinPresolveMatrix.
629
+ */
630
+ double maxmin_;
631
+ //@}
632
+
633
+ /*! \name Problem solution information
634
+
635
+ The presolve phase will work without any solution information
636
+ (appropriate for initial optimisation) or with solution information
637
+ (appropriate for reoptimisation). When solution information is supplied,
638
+ presolve will maintain it to the best of its ability. #colstat_ is
639
+ checked to determine the presence/absence of status information. #sol_ is
640
+ checked for primal solution information, and #rowduals_ for dual solution
641
+ information.
642
+
643
+ The postsolve phase requires the complete solution information from the
644
+ presolved problem (status, primal and dual solutions). It will be
645
+ transformed into a correct solution for the original problem.
646
+ */
647
+ //@{
648
+ /*! \brief Vector of primal variable values
649
+
650
+ If #sol_ exists, it is assumed that primal solution information should be
651
+ updated and that #acts_ also exists.
652
+ */
653
+ double *sol_;
654
+ /*! \brief Vector of dual variable values
655
+
656
+ If #rowduals_ exists, it is assumed that dual solution information should
657
+ be updated and that #rcosts_ also exists.
658
+ */
659
+ double *rowduals_;
660
+ /*! \brief Vector of constraint left-hand-side values (row activity)
661
+
662
+ Produced by evaluating constraints according to #sol_. Updated iff
663
+ #sol_ exists.
664
+ */
665
+ double *acts_;
666
+ /*! \brief Vector of reduced costs
667
+
668
+ Produced by evaluating dual constraints according to #rowduals_. Updated
669
+ iff #rowduals_ exists.
670
+ */
671
+ double *rcosts_;
672
+
673
+ /*! \brief Status of primal variables
674
+
675
+ Coded with CoinPrePostSolveMatrix::Status, one code per char. colstat_ and
676
+ #rowstat_ <b>MUST</b> be allocated as a single vector. This is to maintain
677
+ compatibility with ClpPresolve and OsiPresolve, which do it this way.
678
+ */
679
+ unsigned char *colstat_;
680
+
681
+ /*! \brief Status of constraints
682
+
683
+ More accurately, the status of the logical variable associated with the
684
+ constraint. Coded with CoinPrePostSolveMatrix::Status, one code per char.
685
+ Note that this must be allocated as a single vector with #colstat_.
686
+ */
687
+ unsigned char *rowstat_;
688
+ //@}
689
+
690
+ /*! \name Message handling
691
+
692
+ Uses the standard COIN approach: a default handler is installed, and the
693
+ CoinPrePostsolveMatrix object takes responsibility for it. If the client
694
+ replaces the handler with one of their own, it becomes their
695
+ responsibility.
696
+ */
697
+ //@{
698
+ /// Message handler
699
+ CoinMessageHandler *handler_;
700
+ /// Indicates if the current #handler_ is default (true) or not (false).
701
+ bool defaultHandler_;
702
+ /// Standard COIN messages
703
+ CoinMessage messages_;
704
+ //@}
705
+
706
+ };
707
+
708
+ /*! \relates CoinPrePostsolveMatrix
709
+ \brief Generate a print string for a status code.
710
+ */
711
+ const char *statusName (CoinPrePostsolveMatrix::Status status) ;
712
+
713
+
714
+ /*! \class presolvehlink
715
+ \brief Links to aid in packed matrix modification
716
+
717
+ Currently, the matrices held by the CoinPrePostsolveMatrix and
718
+ CoinPresolveMatrix objects are represented in the same way as a
719
+ CoinPackedMatrix. In the course of presolve and postsolve transforms, it
720
+ will happen that a major-dimension vector needs to increase in size. In
721
+ order to check whether there is enough room to add another coefficient in
722
+ place, it helps to know the next vector (in memory order) in the bulk
723
+ storage area. To do that, a linked list of major-dimension vectors is
724
+ maintained; the "pre" and "suc" fields give the previous and next vector,
725
+ in memory order (that is, the vector whose mcstrt_ or mrstrt_ entry is
726
+ next smaller or larger).
727
+
728
+ Consider a column-major matrix with ncols columns. By definition,
729
+ presolvehlink[ncols].pre points to the column in the last occupied
730
+ position of the bulk storage arrays. There is no easy way to find the
731
+ column which occupies the first position (there is no presolvehlink[-1] to
732
+ consult). If the column that initially occupies the first position is
733
+ moved for expansion, there is no way to reclaim the space until the bulk
734
+ storage is compacted. The same holds for the last and first rows of a
735
+ row-major matrix, of course.
736
+ */
737
+
738
+ class presolvehlink
739
+ { public:
740
+ int pre, suc;
741
+ } ;
742
+
743
+ #define NO_LINK -66666666
744
+
745
+ /*! \relates presolvehlink
746
+ \brief unlink vector i
747
+
748
+ Remove vector i from the ordering.
749
+ */
750
+ inline void PRESOLVE_REMOVE_LINK(presolvehlink *link, int i)
751
+ {
752
+ int ipre = link[i].pre;
753
+ int isuc = link[i].suc;
754
+ if (ipre >= 0) {
755
+ link[ipre].suc = isuc;
756
+ }
757
+ if (isuc >= 0) {
758
+ link[isuc].pre = ipre;
759
+ }
760
+ link[i].pre = NO_LINK, link[i].suc = NO_LINK;
761
+ }
762
+
763
+ /*! \relates presolvehlink
764
+ \brief insert vector i after vector j
765
+
766
+ Insert vector i between j and j.suc.
767
+ */
768
+ inline void PRESOLVE_INSERT_LINK(presolvehlink *link, int i, int j)
769
+ {
770
+ int isuc = link[j].suc;
771
+ link[j].suc = i;
772
+ link[i].pre = j;
773
+ if (isuc >= 0) {
774
+ link[isuc].pre = i;
775
+ }
776
+ link[i].suc = isuc;
777
+ }
778
+
779
+ /*! \relates presolvehlink
780
+ \brief relink vector j in place of vector i
781
+
782
+ Replace vector i in the ordering with vector j. This is equivalent to
783
+ <pre>
784
+ int pre = link[i].pre;
785
+ PRESOLVE_REMOVE_LINK(link,i);
786
+ PRESOLVE_INSERT_LINK(link,j,pre);
787
+ </pre>
788
+ But, this routine will work even if i happens to be first in the order.
789
+ */
790
+ inline void PRESOLVE_MOVE_LINK(presolvehlink *link, int i, int j)
791
+ {
792
+ int ipre = link[i].pre;
793
+ int isuc = link[i].suc;
794
+ if (ipre >= 0) {
795
+ link[ipre].suc = j;
796
+ }
797
+ if (isuc >= 0) {
798
+ link[isuc].pre = j;
799
+ }
800
+ link[i].pre = NO_LINK, link[i].suc = NO_LINK;
801
+ }
802
+
803
+
804
+ /*! \class CoinPresolveMatrix
805
+ \brief Augments CoinPrePostsolveMatrix with information about the problem
806
+ that is only needed during presolve.
807
+
808
+ For problem manipulation, this class adds a row-major matrix
809
+ representation, linked lists that allow for easy manipulation of the matrix
810
+ when applying presolve transforms, and vectors to track row and column
811
+ processing status (changed, needs further processing, change prohibited)
812
+
813
+ For problem representation, this class adds information about variable type
814
+ (integer or continuous), an objective offset, and a feasibility tolerance.
815
+
816
+ <b>NOTE</b> that the #anyInteger_ and #anyProhibited_ flags are independent
817
+ of the vectors used to track this information for individual variables
818
+ (#integerType_ and #rowChanged_ and #colChanged_, respectively).
819
+
820
+ <b>NOTE</b> also that at the end of presolve the column-major and row-major
821
+ matrix representations are loosely packed (<i>i.e.</i>, there may be gaps
822
+ between columns in the bulk storage arrays).
823
+
824
+ <b>NOTE</b> that while you might think that CoinPresolve is prepared to
825
+ handle minimisation or maximisation, it's unlikely that this still works.
826
+ This is a good thing: better to convert objective coefficients and duals
827
+ once, before starting presolve, rather than doing it over and over in
828
+ each transform that considers dual variables.
829
+
830
+ The constructors that take an OSI or ClpSimplex as a parameter really should
831
+ not be here, but for historical reasons they will likely remain for the
832
+ forseeable future. -- lh, 111202 --
833
+ */
834
+
835
+ class CoinPresolveMatrix : public CoinPrePostsolveMatrix
836
+ {
837
+ public:
838
+
839
+ /*! \brief `Native' constructor
840
+
841
+ This constructor creates an empty object which must then be loaded.
842
+ On the other hand, it doesn't assume that the client is an
843
+ OsiSolverInterface.
844
+ */
845
+ CoinPresolveMatrix(int ncols_alloc, int nrows_alloc,
846
+ CoinBigIndex nelems_alloc) ;
847
+
848
+ /*! \brief Clp OSI constructor
849
+
850
+ See Clp code for the definition.
851
+ */
852
+ CoinPresolveMatrix(int ncols0,
853
+ double maxmin,
854
+ // end prepost members
855
+
856
+ ClpSimplex * si,
857
+
858
+ // rowrep
859
+ int nrows,
860
+ CoinBigIndex nelems,
861
+ bool doStatus,
862
+ double nonLinearVariable,
863
+ double bulkRatio);
864
+
865
+ /*! \brief Update the model held by a Clp OSI */
866
+ void update_model(ClpSimplex * si,
867
+ int nrows0,
868
+ int ncols0,
869
+ CoinBigIndex nelems0);
870
+ /*! \brief Generic OSI constructor
871
+
872
+ See OSI code for the definition.
873
+ */
874
+ CoinPresolveMatrix(int ncols0,
875
+ double maxmin,
876
+ // end prepost members
877
+ OsiSolverInterface * si,
878
+ // rowrep
879
+ int nrows,
880
+ CoinBigIndex nelems,
881
+ bool doStatus,
882
+ double nonLinearVariable,
883
+ const char * prohibited,
884
+ const char * rowProhibited=NULL);
885
+
886
+ /*! \brief Update the model held by a generic OSI */
887
+ void update_model(OsiSolverInterface * si,
888
+ int nrows0,
889
+ int ncols0,
890
+ CoinBigIndex nelems0);
891
+
892
+ /// Destructor
893
+ ~CoinPresolveMatrix();
894
+
895
+ /*! \brief Initialize a CoinPostsolveMatrix object, destroying the
896
+ CoinPresolveMatrix object.
897
+
898
+ See CoinPostsolveMatrix::assignPresolveToPostsolve.
899
+ */
900
+ friend void assignPresolveToPostsolve (CoinPresolveMatrix *&preObj) ;
901
+
902
+ /*! \name Functions to load the problem representation
903
+ */
904
+ //@{
905
+ /*! \brief Load the cofficient matrix.
906
+
907
+ Load the coefficient matrix before loading the other vectors (bounds,
908
+ objective, variable type) required to define the problem.
909
+ */
910
+ void setMatrix(const CoinPackedMatrix *mtx) ;
911
+
912
+ /// Count number of empty rows
913
+ inline int countEmptyRows()
914
+ { int empty = 0 ;
915
+ for (int i = 0 ; i < nrows_ ; i++) if (hinrow_[i] == 0) empty++ ;
916
+ return (empty) ; }
917
+
918
+ /*! \brief Set variable type information for a single variable
919
+
920
+ Set \p variableType to 0 for continous, 1 for integer.
921
+ Does not manipulate the #anyInteger_ flag.
922
+ */
923
+ inline void setVariableType(int i, int variableType)
924
+ { if (integerType_ == 0) integerType_ = new unsigned char [ncols0_] ;
925
+ integerType_[i] = static_cast<unsigned char>(variableType) ; }
926
+
927
+ /*! \brief Set variable type information for all variables
928
+
929
+ Set \p variableType[i] to 0 for continuous, 1 for integer.
930
+ Does not manipulate the #anyInteger_ flag.
931
+ */
932
+ void setVariableType(const unsigned char *variableType, int lenParam) ;
933
+
934
+ /*! \brief Set the type of all variables
935
+
936
+ allIntegers should be true to set the type to integer, false to set the
937
+ type to continuous.
938
+ */
939
+ void setVariableType (bool allIntegers, int lenParam) ;
940
+
941
+ /// Set a flag for presence (true) or absence (false) of integer variables
942
+ inline void setAnyInteger (bool anyInteger = true)
943
+ { anyInteger_ = anyInteger ; }
944
+ //@}
945
+
946
+ /*! \name Functions to retrieve problem information
947
+ */
948
+ //@{
949
+
950
+ /// Get row start vector for row-major packed matrix
951
+ inline const CoinBigIndex *getRowStarts() const
952
+ { return (mrstrt_) ; }
953
+ /// Get vector of column indices for row-major packed matrix
954
+ inline const int *getColIndicesByRow() const
955
+ { return (hcol_) ; }
956
+ /// Get vector of elements for row-major packed matrix
957
+ inline const double *getElementsByRow() const
958
+ { return (rowels_) ; }
959
+
960
+ /*! \brief Check for integrality of the specified variable.
961
+
962
+ Consults the #integerType_ vector if present; fallback is the
963
+ #anyInteger_ flag.
964
+ */
965
+ inline bool isInteger (int i) const
966
+ { if (integerType_ == 0)
967
+ { return (anyInteger_) ; }
968
+ else
969
+ if (integerType_[i] == 1)
970
+ { return (true) ; }
971
+ else
972
+ { return (false) ; } }
973
+
974
+ /*! \brief Check if there are any integer variables
975
+
976
+ Consults the #anyInteger_ flag
977
+ */
978
+ inline bool anyInteger () const
979
+ { return (anyInteger_) ; }
980
+ /// Picks up any special options
981
+ inline int presolveOptions() const
982
+ { return presolveOptions_;}
983
+ /// Sets any special options (see #presolveOptions_)
984
+ inline void setPresolveOptions(int value)
985
+ { presolveOptions_=value;}
986
+ //@}
987
+
988
+ /*! \name Matrix storage management links
989
+
990
+ Linked lists, modelled after the linked lists used in OSL
991
+ factorization. They are used for management of the bulk coefficient
992
+ and minor index storage areas.
993
+ */
994
+ //@{
995
+ /// Linked list for the column-major representation.
996
+ presolvehlink *clink_;
997
+ /// Linked list for the row-major representation.
998
+ presolvehlink *rlink_;
999
+ //@}
1000
+
1001
+ /// Objective function offset introduced during presolve
1002
+ double dobias_ ;
1003
+
1004
+ /// Adjust objective function constant offset
1005
+ inline void change_bias(double change_amount)
1006
+ {
1007
+ dobias_ += change_amount ;
1008
+ # if PRESOLVE_DEBUG > 2
1009
+ assert(fabs(change_amount)<1.0e50) ;
1010
+ if (change_amount)
1011
+ PRESOLVE_STMT(printf("changing bias by %g to %g\n",
1012
+ change_amount, dobias_)) ;
1013
+ # endif
1014
+ }
1015
+
1016
+ /*! \name Row-major representation
1017
+
1018
+ Common row-major format: A pair of vectors with positional
1019
+ correspondence to hold coefficients and column indices, and a second pair
1020
+ of vectors giving the starting position and length of each row in
1021
+ the first pair.
1022
+ */
1023
+ //@{
1024
+ /// Vector of row start positions in #hcol, #rowels_
1025
+ CoinBigIndex *mrstrt_;
1026
+ /// Vector of row lengths
1027
+ int *hinrow_;
1028
+ /// Coefficients (positional correspondence with #hcol_)
1029
+ double *rowels_;
1030
+ /// Column indices (positional correspondence with #rowels_)
1031
+ int *hcol_;
1032
+ //@}
1033
+
1034
+ /// Tracks integrality of columns (1 for integer, 0 for continuous)
1035
+ unsigned char *integerType_;
1036
+ /*! \brief Flag to say if any variables are integer
1037
+
1038
+ Note that this flag is <i>not</i> manipulated by the various
1039
+ \c setVariableType routines.
1040
+ */
1041
+ bool anyInteger_ ;
1042
+ /// Print statistics for tuning
1043
+ bool tuning_;
1044
+ /// Say we want statistics - also set time
1045
+ void statistics();
1046
+ /// Start time of presolve
1047
+ double startTime_;
1048
+
1049
+ /// Bounds can be moved by this to retain feasibility
1050
+ double feasibilityTolerance_;
1051
+ /// Return feasibility tolerance
1052
+ inline double feasibilityTolerance()
1053
+ { return (feasibilityTolerance_) ; }
1054
+ /// Set feasibility tolerance
1055
+ inline void setFeasibilityTolerance (double val)
1056
+ { feasibilityTolerance_ = val ; }
1057
+
1058
+ /*! \brief Output status: 0 = feasible, 1 = infeasible, 2 = unbounded
1059
+
1060
+ Actually implemented as single bit flags: 1^0 = infeasible, 1^1 =
1061
+ unbounded.
1062
+ */
1063
+ int status_;
1064
+ /// Returns problem status (0 = feasible, 1 = infeasible, 2 = unbounded)
1065
+ inline int status()
1066
+ { return (status_) ; }
1067
+ /// Set problem status
1068
+ inline void setStatus(int status)
1069
+ { status_ = (status&0x3) ; }
1070
+
1071
+ /*! \brief Presolve pass number
1072
+
1073
+ Should be incremented externally by the method controlling application of
1074
+ presolve transforms.
1075
+ Used to control the execution of testRedundant (evoked by the
1076
+ implied_free transform).
1077
+ */
1078
+ int pass_;
1079
+ /// Set pass number
1080
+ inline void setPass (int pass = 0)
1081
+ { pass_ = pass ; }
1082
+
1083
+ /*! \brief Maximum substitution level
1084
+
1085
+ Used to control the execution of subst from implied_free
1086
+ */
1087
+ int maxSubstLevel_;
1088
+ /// Set Maximum substitution level (normally 3)
1089
+ inline void setMaximumSubstitutionLevel (int level)
1090
+ { maxSubstLevel_ = level ; }
1091
+
1092
+
1093
+ /*! \name Row and column processing status
1094
+
1095
+ Information used to determine if rows or columns can be changed and
1096
+ if they require further processing due to changes.
1097
+
1098
+ There are four major lists: the [row,col]ToDo list, and the
1099
+ [row,col]NextToDo list. In general, a transform processes entries from
1100
+ the ToDo list and adds entries to the NextToDo list.
1101
+
1102
+ There are two vectors, [row,col]Changed, which track the status of
1103
+ individual rows and columns.
1104
+ */
1105
+ //@{
1106
+ /*! \brief Column change status information
1107
+
1108
+ Coded using the following bits:
1109
+ <ul>
1110
+ <li> 0x01: Column has changed
1111
+ <li> 0x02: preprocessing prohibited
1112
+ <li> 0x04: Column has been used
1113
+ <li> 0x08: Column originally had infinite ub
1114
+ </ul>
1115
+ */
1116
+ unsigned char * colChanged_;
1117
+ /// Input list of columns to process
1118
+ int * colsToDo_;
1119
+ /// Length of #colsToDo_
1120
+ int numberColsToDo_;
1121
+ /// Output list of columns to process next
1122
+ int * nextColsToDo_;
1123
+ /// Length of #nextColsToDo_
1124
+ int numberNextColsToDo_;
1125
+
1126
+ /*! \brief Row change status information
1127
+
1128
+ Coded using the following bits:
1129
+ <ul>
1130
+ <li> 0x01: Row has changed
1131
+ <li> 0x02: preprocessing prohibited
1132
+ <li> 0x04: Row has been used
1133
+ </ul>
1134
+ */
1135
+ unsigned char * rowChanged_;
1136
+ /// Input list of rows to process
1137
+ int * rowsToDo_;
1138
+ /// Length of #rowsToDo_
1139
+ int numberRowsToDo_;
1140
+ /// Output list of rows to process next
1141
+ int * nextRowsToDo_;
1142
+ /// Length of #nextRowsToDo_
1143
+ int numberNextRowsToDo_;
1144
+ /*! \brief Fine control over presolve actions
1145
+
1146
+ Set/clear the following bits to allow or suppress actions:
1147
+ - 0x01 allow duplicate column tests for integer variables
1148
+ - 0x02 not used
1149
+ - 0x04 set to inhibit x+y+z=1 mods
1150
+ - 0x08 not used
1151
+ - 0x10 set to allow stuff which won't unroll easily (overlapping
1152
+ duplicate rows; opportunistic fixing of variables from bound
1153
+ propagation).
1154
+ - 0x04000 allow presolve transforms to arbitrarily ignore infeasibility
1155
+ and set arbitrary feasible bounds.
1156
+ - 0x10000 instructs implied_free_action to be `more lightweight'; will
1157
+ return without doing anything after 15 presolve passes.
1158
+ - 0x(2,4,6)0000 instructs implied_free_action to remove small created elements
1159
+ - 0x80000000 set by presolve to say dupcol_action compressed columns
1160
+ */
1161
+ int presolveOptions_;
1162
+ /*! Flag to say if any rows or columns are marked as prohibited
1163
+
1164
+ Note that this flag is <i>not</i> manipulated by any of the
1165
+ various \c set*Prohibited routines.
1166
+ */
1167
+ bool anyProhibited_;
1168
+ //@}
1169
+
1170
+ /*! \name Scratch work arrays
1171
+
1172
+ Preallocated work arrays are useful to avoid having to allocate and free
1173
+ work arrays in individual presolve methods.
1174
+
1175
+ All are allocated from #setMatrix by #initializeStuff, freed from
1176
+ #~CoinPresolveMatrix. You can use #deleteStuff followed by
1177
+ #initializeStuff to remove and recreate them.
1178
+ */
1179
+ //@{
1180
+ /// Preallocated scratch work array, 3*nrows_
1181
+ int *usefulRowInt_ ;
1182
+ /// Preallocated scratch work array, 2*nrows_
1183
+ double *usefulRowDouble_ ;
1184
+ /// Preallocated scratch work array, 2*ncols_
1185
+ int *usefulColumnInt_ ;
1186
+ /// Preallocated scratch work array, ncols_
1187
+ double *usefulColumnDouble_ ;
1188
+ /// Array of random numbers (max row,column)
1189
+ double *randomNumber_ ;
1190
+
1191
+ /// Work array for count of infinite contributions to row lhs upper bound
1192
+ int *infiniteUp_ ;
1193
+ /// Work array for sum of finite contributions to row lhs upper bound
1194
+ double *sumUp_ ;
1195
+ /// Work array for count of infinite contributions to row lhs lower bound
1196
+ int *infiniteDown_ ;
1197
+ /// Work array for sum of finite contributions to row lhs lower bound
1198
+ double *sumDown_ ;
1199
+ //@}
1200
+
1201
+ /*! \brief Recompute row lhs bounds
1202
+
1203
+ Calculate finite contributions to row lhs upper and lower bounds
1204
+ and count infinite contributions. Returns the number of rows found
1205
+ to be infeasible.
1206
+
1207
+ If \p whichRow < 0, bounds are recomputed for all rows.
1208
+
1209
+ As of 110611, this seems to be a work in progress in the sense that it's
1210
+ barely used by the existing presolve code.
1211
+ */
1212
+ int recomputeSums(int whichRow) ;
1213
+
1214
+ /// Allocate scratch arrays
1215
+ void initializeStuff() ;
1216
+ /// Free scratch arrays
1217
+ void deleteStuff() ;
1218
+
1219
+ /*! \name Functions to manipulate row and column processing status */
1220
+ //@{
1221
+
1222
+ /*! \brief Initialise the column ToDo lists
1223
+
1224
+ Places all columns in the #colsToDo_ list except for columns marked
1225
+ as prohibited (<i>viz.</i> #colChanged_).
1226
+ */
1227
+ void initColsToDo () ;
1228
+
1229
+ /*! \brief Step column ToDo lists
1230
+
1231
+ Moves columns on the #nextColsToDo_ list to the #colsToDo_ list, emptying
1232
+ #nextColsToDo_. Returns the number of columns transferred.
1233
+ */
1234
+ int stepColsToDo () ;
1235
+
1236
+ /// Return the number of columns on the #colsToDo_ list
1237
+ inline int numberColsToDo()
1238
+ { return (numberColsToDo_) ; }
1239
+
1240
+ /// Has column been changed?
1241
+ inline bool colChanged(int i) const {
1242
+ return (colChanged_[i]&1)!=0;
1243
+ }
1244
+ /// Mark column as not changed
1245
+ inline void unsetColChanged(int i) {
1246
+ colChanged_[i] = static_cast<unsigned char>(colChanged_[i] & (~1)) ;
1247
+ }
1248
+ /// Mark column as changed.
1249
+ inline void setColChanged(int i) {
1250
+ colChanged_[i] = static_cast<unsigned char>(colChanged_[i] | (1)) ;
1251
+ }
1252
+ /// Mark column as changed and add to list of columns to process next
1253
+ inline void addCol(int i) {
1254
+ if ((colChanged_[i]&1)==0) {
1255
+ colChanged_[i] = static_cast<unsigned char>(colChanged_[i] | (1)) ;
1256
+ nextColsToDo_[numberNextColsToDo_++] = i;
1257
+ }
1258
+ }
1259
+ /// Test if column is eligible for preprocessing
1260
+ inline bool colProhibited(int i) const {
1261
+ return (colChanged_[i]&2)!=0;
1262
+ }
1263
+ /*! \brief Test if column is eligible for preprocessing
1264
+
1265
+ The difference between this method and #colProhibited() is that this
1266
+ method first tests #anyProhibited_ before examining the specific entry
1267
+ for the specified column.
1268
+ */
1269
+ inline bool colProhibited2(int i) const {
1270
+ if (!anyProhibited_)
1271
+ return false;
1272
+ else
1273
+ return (colChanged_[i]&2)!=0;
1274
+ }
1275
+ /// Mark column as ineligible for preprocessing
1276
+ inline void setColProhibited(int i) {
1277
+ colChanged_[i] = static_cast<unsigned char>(colChanged_[i] | (2)) ;
1278
+ }
1279
+ /*! \brief Test if column is marked as used
1280
+
1281
+ This is for doing faster lookups to see where two columns have entries
1282
+ in common.
1283
+ */
1284
+ inline bool colUsed(int i) const {
1285
+ return (colChanged_[i]&4)!=0;
1286
+ }
1287
+ /// Mark column as used
1288
+ inline void setColUsed(int i) {
1289
+ colChanged_[i] = static_cast<unsigned char>(colChanged_[i] | (4)) ;
1290
+ }
1291
+ /// Mark column as unused
1292
+ inline void unsetColUsed(int i) {
1293
+ colChanged_[i] = static_cast<unsigned char>(colChanged_[i] & (~4)) ;
1294
+ }
1295
+ /// Has column infinite ub (originally)
1296
+ inline bool colInfinite(int i) const {
1297
+ return (colChanged_[i]&8)!=0;
1298
+ }
1299
+ /// Mark column as not infinite ub (originally)
1300
+ inline void unsetColInfinite(int i) {
1301
+ colChanged_[i] = static_cast<unsigned char>(colChanged_[i] & (~8)) ;
1302
+ }
1303
+ /// Mark column as infinite ub (originally)
1304
+ inline void setColInfinite(int i) {
1305
+ colChanged_[i] = static_cast<unsigned char>(colChanged_[i] | (8)) ;
1306
+ }
1307
+
1308
+ /*! \brief Initialise the row ToDo lists
1309
+
1310
+ Places all rows in the #rowsToDo_ list except for rows marked
1311
+ as prohibited (<i>viz.</i> #rowChanged_).
1312
+ */
1313
+ void initRowsToDo () ;
1314
+
1315
+ /*! \brief Step row ToDo lists
1316
+
1317
+ Moves rows on the #nextRowsToDo_ list to the #rowsToDo_ list, emptying
1318
+ #nextRowsToDo_. Returns the number of rows transferred.
1319
+ */
1320
+ int stepRowsToDo () ;
1321
+
1322
+ /// Return the number of rows on the #rowsToDo_ list
1323
+ inline int numberRowsToDo()
1324
+ { return (numberRowsToDo_) ; }
1325
+
1326
+ /// Has row been changed?
1327
+ inline bool rowChanged(int i) const {
1328
+ return (rowChanged_[i]&1)!=0;
1329
+ }
1330
+ /// Mark row as not changed
1331
+ inline void unsetRowChanged(int i) {
1332
+ rowChanged_[i] = static_cast<unsigned char>(rowChanged_[i] & (~1)) ;
1333
+ }
1334
+ /// Mark row as changed
1335
+ inline void setRowChanged(int i) {
1336
+ rowChanged_[i] = static_cast<unsigned char>(rowChanged_[i] | (1)) ;
1337
+ }
1338
+ /// Mark row as changed and add to list of rows to process next
1339
+ inline void addRow(int i) {
1340
+ if ((rowChanged_[i]&1)==0) {
1341
+ rowChanged_[i] = static_cast<unsigned char>(rowChanged_[i] | (1)) ;
1342
+ nextRowsToDo_[numberNextRowsToDo_++] = i;
1343
+ }
1344
+ }
1345
+ /// Test if row is eligible for preprocessing
1346
+ inline bool rowProhibited(int i) const {
1347
+ return (rowChanged_[i]&2)!=0;
1348
+ }
1349
+ /*! \brief Test if row is eligible for preprocessing
1350
+
1351
+ The difference between this method and #rowProhibited() is that this
1352
+ method first tests #anyProhibited_ before examining the specific entry
1353
+ for the specified row.
1354
+ */
1355
+ inline bool rowProhibited2(int i) const {
1356
+ if (!anyProhibited_)
1357
+ return false;
1358
+ else
1359
+ return (rowChanged_[i]&2)!=0;
1360
+ }
1361
+ /// Mark row as ineligible for preprocessing
1362
+ inline void setRowProhibited(int i) {
1363
+ rowChanged_[i] = static_cast<unsigned char>(rowChanged_[i] | (2)) ;
1364
+ }
1365
+ /*! \brief Test if row is marked as used
1366
+
1367
+ This is for doing faster lookups to see where two rows have entries
1368
+ in common. It can be used anywhere as long as it ends up zeroed out.
1369
+ */
1370
+ inline bool rowUsed(int i) const {
1371
+ return (rowChanged_[i]&4)!=0;
1372
+ }
1373
+ /// Mark row as used
1374
+ inline void setRowUsed(int i) {
1375
+ rowChanged_[i] = static_cast<unsigned char>(rowChanged_[i] | (4)) ;
1376
+ }
1377
+ /// Mark row as unused
1378
+ inline void unsetRowUsed(int i) {
1379
+ rowChanged_[i] = static_cast<unsigned char>(rowChanged_[i] & (~4)) ;
1380
+ }
1381
+
1382
+
1383
+ /// Check if there are any prohibited rows or columns
1384
+ inline bool anyProhibited() const
1385
+ { return anyProhibited_;}
1386
+ /// Set a flag for presence of prohibited rows or columns
1387
+ inline void setAnyProhibited(bool val = true)
1388
+ { anyProhibited_ = val ; }
1389
+ //@}
1390
+
1391
+ };
1392
+
1393
+ /*! \class CoinPostsolveMatrix
1394
+ \brief Augments CoinPrePostsolveMatrix with information about the problem
1395
+ that is only needed during postsolve.
1396
+
1397
+ The notable point is that the matrix representation is threaded. The
1398
+ representation is column-major and starts with the standard two pairs of
1399
+ arrays: one pair to hold the row indices and coefficients, the second pair
1400
+ to hold the column starting positions and lengths. But the row indices and
1401
+ coefficients for a column do not necessarily occupy a contiguous block in
1402
+ their respective arrays. Instead, a link array gives the position of the
1403
+ next (row index,coefficient) pair. If the row index and value of a
1404
+ coefficient a<p,j> occupy position kp in their arrays, then the position of
1405
+ the next coefficient a<q,j> is found as kq = link[kp].
1406
+
1407
+ This threaded representation allows for efficient expansion of columns as
1408
+ rows are reintroduced during postsolve transformations. The basic packed
1409
+ structures are allocated to the expected size of the postsolved matrix,
1410
+ and as new coefficients are added, their location is simply added to the
1411
+ thread for the column.
1412
+
1413
+ There is no provision to convert the threaded representation to a packed
1414
+ representation. In the context of postsolve, it's not required. (You did
1415
+ keep a copy of the original matrix, eh?)
1416
+
1417
+ The constructors that take an OSI or ClpSimplex as a parameter really should
1418
+ not be here, but for historical reasons they will likely remain for the
1419
+ forseeable future. -- lh, 111202 --
1420
+ */
1421
+ class CoinPostsolveMatrix : public CoinPrePostsolveMatrix
1422
+ {
1423
+ public:
1424
+
1425
+ /*! \brief `Native' constructor
1426
+
1427
+ This constructor creates an empty object which must then be loaded.
1428
+ On the other hand, it doesn't assume that the client is an
1429
+ OsiSolverInterface.
1430
+ */
1431
+ CoinPostsolveMatrix(int ncols_alloc, int nrows_alloc,
1432
+ CoinBigIndex nelems_alloc) ;
1433
+
1434
+
1435
+ /*! \brief Clp OSI constructor
1436
+
1437
+ See Clp code for the definition.
1438
+ */
1439
+ CoinPostsolveMatrix(ClpSimplex * si,
1440
+
1441
+ int ncols0,
1442
+ int nrows0,
1443
+ CoinBigIndex nelems0,
1444
+
1445
+ double maxmin_,
1446
+ // end prepost members
1447
+
1448
+ double *sol,
1449
+ double *acts,
1450
+
1451
+ unsigned char *colstat,
1452
+ unsigned char *rowstat);
1453
+
1454
+ /*! \brief Generic OSI constructor
1455
+
1456
+ See OSI code for the definition.
1457
+ */
1458
+ CoinPostsolveMatrix(OsiSolverInterface * si,
1459
+
1460
+ int ncols0,
1461
+ int nrows0,
1462
+ CoinBigIndex nelems0,
1463
+
1464
+ double maxmin_,
1465
+ // end prepost members
1466
+
1467
+ double *sol,
1468
+ double *acts,
1469
+
1470
+ unsigned char *colstat,
1471
+ unsigned char *rowstat);
1472
+
1473
+ /*! \brief Load an empty CoinPostsolveMatrix from a CoinPresolveMatrix
1474
+
1475
+ This routine transfers the contents of the CoinPrePostsolveMatrix
1476
+ object from the CoinPresolveMatrix object to the CoinPostsolveMatrix
1477
+ object and completes initialisation of the CoinPostsolveMatrix object.
1478
+ The empty shell of the CoinPresolveMatrix object is destroyed.
1479
+
1480
+ The routine expects an empty CoinPostsolveMatrix object. If handed a loaded
1481
+ object, a lot of memory will leak.
1482
+ */
1483
+ void assignPresolveToPostsolve (CoinPresolveMatrix *&preObj) ;
1484
+
1485
+ /// Destructor
1486
+ ~CoinPostsolveMatrix();
1487
+
1488
+ /*! \name Column thread structures
1489
+
1490
+ As mentioned in the class documentation, the entries for a given column
1491
+ do not necessarily occupy a contiguous block of space. The #link_ array
1492
+ is used to maintain the threading. There is one thread for each column,
1493
+ and a single thread for all free entries in #hrow_ and #colels_.
1494
+
1495
+ The allocated size of #link_ must be at least as large as the allocated
1496
+ size of #hrow_ and #colels_.
1497
+ */
1498
+ //@{
1499
+
1500
+ /*! \brief First entry in free entries thread */
1501
+ CoinBigIndex free_list_;
1502
+ /// Allocated size of #link_
1503
+ int maxlink_;
1504
+ /*! \brief Thread array
1505
+
1506
+ Within a thread, link_[k] points to the next entry in the thread.
1507
+ */
1508
+ CoinBigIndex *link_;
1509
+
1510
+ //@}
1511
+
1512
+ /*! \name Debugging aids
1513
+
1514
+ These arrays are allocated only when CoinPresolve is compiled with
1515
+ PRESOLVE_DEBUG defined. They hold codes which track the reason that
1516
+ a column or row is added to the problem during postsolve.
1517
+ */
1518
+ //@{
1519
+ char *cdone_;
1520
+ char *rdone_;
1521
+ //@}
1522
+
1523
+ /// debug
1524
+ void check_nbasic();
1525
+
1526
+ };
1527
+
1528
+
1529
+ /*! \defgroup MtxManip Presolve Matrix Manipulation Functions
1530
+
1531
+ Functions to work with the loosely packed and threaded packed matrix
1532
+ structures used during presolve and postsolve.
1533
+ */
1534
+ //@{
1535
+
1536
+ /*! \relates CoinPrePostsolveMatrix
1537
+ \brief Initialise linked list for major vector order in bulk storage
1538
+ */
1539
+
1540
+ void presolve_make_memlists(/*CoinBigIndex *starts,*/ int *lengths,
1541
+ presolvehlink *link, int n);
1542
+
1543
+ /*! \relates CoinPrePostsolveMatrix
1544
+ \brief Make sure a major-dimension vector k has room for one more
1545
+ coefficient.
1546
+
1547
+ You can use this directly, or use the inline wrappers presolve_expand_col
1548
+ and presolve_expand_row
1549
+ */
1550
+ bool presolve_expand_major(CoinBigIndex *majstrts, double *majels,
1551
+ int *minndxs, int *majlens,
1552
+ presolvehlink *majlinks, int nmaj, int k) ;
1553
+
1554
+ /*! \relates CoinPrePostsolveMatrix
1555
+ \brief Make sure a column (colx) in a column-major matrix has room for
1556
+ one more coefficient
1557
+ */
1558
+
1559
+ inline bool presolve_expand_col(CoinBigIndex *mcstrt, double *colels,
1560
+ int *hrow, int *hincol,
1561
+ presolvehlink *clink, int ncols, int colx)
1562
+ { return presolve_expand_major(mcstrt,colels,
1563
+ hrow,hincol,clink,ncols,colx) ; }
1564
+
1565
+ /*! \relates CoinPrePostsolveMatrix
1566
+ \brief Make sure a row (rowx) in a row-major matrix has room for one
1567
+ more coefficient
1568
+ */
1569
+
1570
+ inline bool presolve_expand_row(CoinBigIndex *mrstrt, double *rowels,
1571
+ int *hcol, int *hinrow,
1572
+ presolvehlink *rlink, int nrows, int rowx)
1573
+ { return presolve_expand_major(mrstrt,rowels,
1574
+ hcol,hinrow,rlink,nrows,rowx) ; }
1575
+
1576
+
1577
+ /*! \relates CoinPrePostsolveMatrix
1578
+ \brief Find position of a minor index in a major vector.
1579
+
1580
+ The routine returns the position \c k in \p minndxs for the specified
1581
+ minor index \p tgt. It will abort if the entry does not exist. Can be
1582
+ used directly or via the inline wrappers presolve_find_row and
1583
+ presolve_find_col.
1584
+ */
1585
+ inline CoinBigIndex presolve_find_minor(int tgt,
1586
+ CoinBigIndex ks, CoinBigIndex ke,
1587
+ const int *minndxs)
1588
+ { CoinBigIndex k ;
1589
+ for (k = ks ; k < ke ; k++)
1590
+ #ifndef NDEBUG
1591
+ { if (minndxs[k] == tgt)
1592
+ return (k) ; }
1593
+ DIE("FIND_MINOR") ;
1594
+
1595
+ abort () ; return -1;
1596
+ #else
1597
+ { if (minndxs[k] == tgt)
1598
+ break ; }
1599
+ return (k) ;
1600
+ #endif
1601
+ }
1602
+
1603
+ /*! \relates CoinPrePostsolveMatrix
1604
+ \brief Find position of a row in a column in a column-major matrix.
1605
+
1606
+ The routine returns the position \c k in \p hrow for the specified \p row.
1607
+ It will abort if the entry does not exist.
1608
+ */
1609
+ inline CoinBigIndex presolve_find_row(int row, CoinBigIndex kcs,
1610
+ CoinBigIndex kce, const int *hrow)
1611
+ { return presolve_find_minor(row,kcs,kce,hrow) ; }
1612
+
1613
+ /*! \relates CoinPostsolveMatrix
1614
+ \brief Find position of a column in a row in a row-major matrix.
1615
+
1616
+ The routine returns the position \c k in \p hcol for the specified \p col.
1617
+ It will abort if the entry does not exist.
1618
+ */
1619
+ inline CoinBigIndex presolve_find_col(int col, CoinBigIndex krs,
1620
+ CoinBigIndex kre, const int *hcol)
1621
+ { return presolve_find_minor(col,krs,kre,hcol) ; }
1622
+
1623
+
1624
+ /*! \relates CoinPrePostsolveMatrix
1625
+ \brief Find position of a minor index in a major vector.
1626
+
1627
+ The routine returns the position \c k in \p minndxs for the specified
1628
+ minor index \p tgt. A return value of \p ke means the entry does not
1629
+ exist. Can be used directly or via the inline wrappers
1630
+ presolve_find_row1 and presolve_find_col1.
1631
+ */
1632
+ CoinBigIndex presolve_find_minor1(int tgt, CoinBigIndex ks, CoinBigIndex ke,
1633
+ const int *minndxs);
1634
+
1635
+ /*! \relates CoinPrePostsolveMatrix
1636
+ \brief Find position of a row in a column in a column-major matrix.
1637
+
1638
+ The routine returns the position \c k in \p hrow for the specified \p row.
1639
+ A return value of \p kce means the entry does not exist.
1640
+ */
1641
+ inline CoinBigIndex presolve_find_row1(int row, CoinBigIndex kcs,
1642
+ CoinBigIndex kce, const int *hrow)
1643
+ { return presolve_find_minor1(row,kcs,kce,hrow) ; }
1644
+
1645
+ /*! \relates CoinPrePostsolveMatrix
1646
+ \brief Find position of a column in a row in a row-major matrix.
1647
+
1648
+ The routine returns the position \c k in \p hcol for the specified \p col.
1649
+ A return value of \p kre means the entry does not exist.
1650
+ */
1651
+ inline CoinBigIndex presolve_find_col1(int col, CoinBigIndex krs,
1652
+ CoinBigIndex kre, const int *hcol)
1653
+ { return presolve_find_minor1(col,krs,kre,hcol) ; }
1654
+
1655
+ /*! \relates CoinPostsolveMatrix
1656
+ \brief Find position of a minor index in a major vector in a threaded
1657
+ matrix.
1658
+
1659
+ The routine returns the position \c k in \p minndxs for the specified
1660
+ minor index \p tgt. It will abort if the entry does not exist. Can be
1661
+ used directly or via the inline wrapper presolve_find_row2.
1662
+ */
1663
+ CoinBigIndex presolve_find_minor2(int tgt, CoinBigIndex ks, int majlen,
1664
+ const int *minndxs,
1665
+ const CoinBigIndex *majlinks) ;
1666
+
1667
+ /*! \relates CoinPostsolveMatrix
1668
+ \brief Find position of a row in a column in a column-major threaded
1669
+ matrix.
1670
+
1671
+ The routine returns the position \c k in \p hrow for the specified \p row.
1672
+ It will abort if the entry does not exist.
1673
+ */
1674
+ inline CoinBigIndex presolve_find_row2(int row, CoinBigIndex kcs, int collen,
1675
+ const int *hrow,
1676
+ const CoinBigIndex *clinks)
1677
+ { return presolve_find_minor2(row,kcs,collen,hrow,clinks) ; }
1678
+
1679
+ /*! \relates CoinPostsolveMatrix
1680
+ \brief Find position of a minor index in a major vector in a threaded
1681
+ matrix.
1682
+
1683
+ The routine returns the position \c k in \p minndxs for the specified
1684
+ minor index \p tgt. It will return -1 if the entry does not exist.
1685
+ Can be used directly or via the inline wrappers presolve_find_row3.
1686
+ */
1687
+ CoinBigIndex presolve_find_minor3(int tgt, CoinBigIndex ks, int majlen,
1688
+ const int *minndxs,
1689
+ const CoinBigIndex *majlinks) ;
1690
+
1691
+ /*! \relates CoinPostsolveMatrix
1692
+ \brief Find position of a row in a column in a column-major threaded
1693
+ matrix.
1694
+
1695
+ The routine returns the position \c k in \p hrow for the specified \p row.
1696
+ It will return -1 if the entry does not exist.
1697
+ */
1698
+ inline CoinBigIndex presolve_find_row3(int row, CoinBigIndex kcs, int collen,
1699
+ const int *hrow,
1700
+ const CoinBigIndex *clinks)
1701
+ { return presolve_find_minor3(row,kcs,collen,hrow,clinks) ; }
1702
+
1703
+ /*! \relates CoinPrePostsolveMatrix
1704
+ \brief Delete the entry for a minor index from a major vector.
1705
+
1706
+ Deletes the entry for \p minndx from the major vector \p majndx.
1707
+ Specifically, the relevant entries are removed from the minor index
1708
+ (\p minndxs) and coefficient (\p els) arrays and the vector length (\p
1709
+ majlens) is decremented. Loose packing is maintained by swapping the last
1710
+ entry in the row into the position occupied by the deleted entry.
1711
+ */
1712
+ inline void presolve_delete_from_major(int majndx, int minndx,
1713
+ const CoinBigIndex *majstrts,
1714
+ int *majlens, int *minndxs, double *els)
1715
+ {
1716
+ const CoinBigIndex ks = majstrts[majndx] ;
1717
+ const CoinBigIndex ke = ks+majlens[majndx] ;
1718
+
1719
+ const CoinBigIndex kmi = presolve_find_minor(minndx,ks,ke,minndxs) ;
1720
+
1721
+ minndxs[kmi] = minndxs[ke-1] ;
1722
+ els[kmi] = els[ke-1] ;
1723
+ majlens[majndx]-- ;
1724
+
1725
+ return ;
1726
+ }
1727
+
1728
+ /*! \relates CoinPrePostsolveMatrix
1729
+ \brief Delete marked entries
1730
+
1731
+ Removes the entries specified in \p marked, compressing the major vector
1732
+ to maintain loose packing. \p marked is cleared in the process.
1733
+ */
1734
+ inline void presolve_delete_many_from_major(int majndx, char *marked,
1735
+ const CoinBigIndex *majstrts,
1736
+ int *majlens, int *minndxs, double *els)
1737
+ {
1738
+ const CoinBigIndex ks = majstrts[majndx] ;
1739
+ const CoinBigIndex ke = ks+majlens[majndx] ;
1740
+ CoinBigIndex put = ks ;
1741
+ for (CoinBigIndex k = ks ; k < ke ; k++) {
1742
+ int iMinor = minndxs[k] ;
1743
+ if (!marked[iMinor]) {
1744
+ minndxs[put] = iMinor ;
1745
+ els[put++] = els[k] ;
1746
+ } else {
1747
+ marked[iMinor] = 0 ;
1748
+ }
1749
+ }
1750
+ majlens[majndx] = put-ks ;
1751
+ return ;
1752
+ }
1753
+
1754
+ /*! \relates CoinPrePostsolveMatrix
1755
+ \brief Delete the entry for row \p row from column \p col in a
1756
+ column-major matrix
1757
+
1758
+ Deletes the entry for \p row from the major vector for \p col.
1759
+ Specifically, the relevant entries are removed from the row index (\p
1760
+ hrow) and coefficient (\p colels) arrays and the vector length (\p
1761
+ hincol) is decremented. Loose packing is maintained by swapping the last
1762
+ entry in the row into the position occupied by the deleted entry.
1763
+ */
1764
+ inline void presolve_delete_from_col(int row, int col,
1765
+ const CoinBigIndex *mcstrt,
1766
+ int *hincol, int *hrow, double *colels)
1767
+ { presolve_delete_from_major(col,row,mcstrt,hincol,hrow,colels) ; }
1768
+
1769
+ /*! \relates CoinPrePostsolveMatrix
1770
+ \brief Delete the entry for column \p col from row \p row in a
1771
+ row-major matrix
1772
+
1773
+ Deletes the entry for \p col from the major vector for \p row.
1774
+ Specifically, the relevant entries are removed from the column index (\p
1775
+ hcol) and coefficient (\p rowels) arrays and the vector length (\p
1776
+ hinrow) is decremented. Loose packing is maintained by swapping the last
1777
+ entry in the column into the position occupied by the deleted entry.
1778
+ */
1779
+ inline void presolve_delete_from_row(int row, int col,
1780
+ const CoinBigIndex *mrstrt,
1781
+ int *hinrow, int *hcol, double *rowels)
1782
+ { presolve_delete_from_major(row,col,mrstrt,hinrow,hcol,rowels) ; }
1783
+
1784
+ /*! \relates CoinPostsolveMatrix
1785
+ \brief Delete the entry for a minor index from a major vector in a
1786
+ threaded matrix.
1787
+
1788
+ Deletes the entry for \p minndx from the major vector \p majndx.
1789
+ Specifically, the relevant entries are removed from the minor index (\p
1790
+ minndxs) and coefficient (\p els) arrays and the vector length (\p
1791
+ majlens) is decremented. The thread for the major vector is relinked
1792
+ around the deleted entry and the space is returned to the free list.
1793
+ */
1794
+ void presolve_delete_from_major2 (int majndx, int minndx,
1795
+ CoinBigIndex *majstrts, int *majlens,
1796
+ int *minndxs, int *majlinks,
1797
+ CoinBigIndex *free_listp) ;
1798
+
1799
+ /*! \relates CoinPostsolveMatrix
1800
+ \brief Delete the entry for row \p row from column \p col in a
1801
+ column-major threaded matrix
1802
+
1803
+ Deletes the entry for \p row from the major vector for \p col.
1804
+ Specifically, the relevant entries are removed from the row index (\p
1805
+ hrow) and coefficient (\p colels) arrays and the vector length (\p
1806
+ hincol) is decremented. The thread for the major vector is relinked
1807
+ around the deleted entry and the space is returned to the free list.
1808
+ */
1809
+ inline void presolve_delete_from_col2(int row, int col, CoinBigIndex *mcstrt,
1810
+ int *hincol, int *hrow,
1811
+ int *clinks, CoinBigIndex *free_listp)
1812
+ { presolve_delete_from_major2(col,row,mcstrt,hincol,hrow,clinks,free_listp) ; }
1813
+
1814
+ //@}
1815
+
1816
+ /*! \defgroup PresolveUtilities Presolve Utility Functions
1817
+
1818
+ Utilities used by multiple presolve transform objects.
1819
+ */
1820
+ //@{
1821
+
1822
+ /*! \brief Duplicate a major-dimension vector; optionally omit the entry
1823
+ with minor index \p tgt.
1824
+
1825
+ Designed to copy a major-dimension vector from the paired coefficient
1826
+ (\p elems) and minor index (\p indices) arrays used in the standard
1827
+ packed matrix representation. Copies \p length entries starting at
1828
+ \p offset.
1829
+
1830
+ If \p tgt is specified, the entry with minor index == \p tgt is
1831
+ omitted from the copy.
1832
+ */
1833
+ double *presolve_dupmajor(const double *elems, const int *indices,
1834
+ int length, CoinBigIndex offset, int tgt = -1);
1835
+
1836
+ /// Initialize a vector with random numbers
1837
+ void coin_init_random_vec(double *work, int n);
1838
+
1839
+ //@}
1840
+
1841
+
1842
+ #endif