ruby-cbc 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (303) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +4 -0
  6. data/README.md +203 -0
  7. data/Rakefile +40 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +7 -0
  10. data/ext/ruby-cbc/cbc.i +15 -0
  11. data/ext/ruby-cbc/cbc_wrap.c +4618 -0
  12. data/ext/ruby-cbc/extconf.rb +60 -0
  13. data/ext/ruby-cbc/install/bin/cbc +0 -0
  14. data/ext/ruby-cbc/install/bin/clp +0 -0
  15. data/ext/ruby-cbc/install/include/coin/CbcBranchActual.hpp +24 -0
  16. data/ext/ruby-cbc/install/include/coin/CbcBranchAllDifferent.hpp +62 -0
  17. data/ext/ruby-cbc/install/include/coin/CbcBranchBase.hpp +78 -0
  18. data/ext/ruby-cbc/install/include/coin/CbcBranchCut.hpp +183 -0
  19. data/ext/ruby-cbc/install/include/coin/CbcBranchDecision.hpp +129 -0
  20. data/ext/ruby-cbc/install/include/coin/CbcBranchDefaultDecision.hpp +100 -0
  21. data/ext/ruby-cbc/install/include/coin/CbcBranchDynamic.hpp +206 -0
  22. data/ext/ruby-cbc/install/include/coin/CbcBranchLotsize.hpp +242 -0
  23. data/ext/ruby-cbc/install/include/coin/CbcBranchToFixLots.hpp +94 -0
  24. data/ext/ruby-cbc/install/include/coin/CbcBranchingObject.hpp +236 -0
  25. data/ext/ruby-cbc/install/include/coin/CbcClique.hpp +303 -0
  26. data/ext/ruby-cbc/install/include/coin/CbcCompare.hpp +39 -0
  27. data/ext/ruby-cbc/install/include/coin/CbcCompareActual.hpp +14 -0
  28. data/ext/ruby-cbc/install/include/coin/CbcCompareBase.hpp +142 -0
  29. data/ext/ruby-cbc/install/include/coin/CbcCompareDefault.hpp +120 -0
  30. data/ext/ruby-cbc/install/include/coin/CbcCompareDepth.hpp +47 -0
  31. data/ext/ruby-cbc/install/include/coin/CbcCompareEstimate.hpp +48 -0
  32. data/ext/ruby-cbc/install/include/coin/CbcCompareObjective.hpp +49 -0
  33. data/ext/ruby-cbc/install/include/coin/CbcConfig.h +14 -0
  34. data/ext/ruby-cbc/install/include/coin/CbcConsequence.hpp +49 -0
  35. data/ext/ruby-cbc/install/include/coin/CbcCountRowCut.hpp +168 -0
  36. data/ext/ruby-cbc/install/include/coin/CbcCutGenerator.hpp +482 -0
  37. data/ext/ruby-cbc/install/include/coin/CbcCutModifier.hpp +57 -0
  38. data/ext/ruby-cbc/install/include/coin/CbcCutSubsetModifier.hpp +66 -0
  39. data/ext/ruby-cbc/install/include/coin/CbcDummyBranchingObject.hpp +83 -0
  40. data/ext/ruby-cbc/install/include/coin/CbcEventHandler.hpp +245 -0
  41. data/ext/ruby-cbc/install/include/coin/CbcFathom.hpp +137 -0
  42. data/ext/ruby-cbc/install/include/coin/CbcFathomDynamicProgramming.hpp +169 -0
  43. data/ext/ruby-cbc/install/include/coin/CbcFeasibilityBase.hpp +56 -0
  44. data/ext/ruby-cbc/install/include/coin/CbcFixVariable.hpp +67 -0
  45. data/ext/ruby-cbc/install/include/coin/CbcFollowOn.hpp +207 -0
  46. data/ext/ruby-cbc/install/include/coin/CbcFullNodeInfo.hpp +161 -0
  47. data/ext/ruby-cbc/install/include/coin/CbcGeneral.hpp +60 -0
  48. data/ext/ruby-cbc/install/include/coin/CbcGeneralDepth.hpp +279 -0
  49. data/ext/ruby-cbc/install/include/coin/CbcHeuristic.hpp +682 -0
  50. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDINS.hpp +96 -0
  51. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDW.hpp +309 -0
  52. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDive.hpp +192 -0
  53. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveCoefficient.hpp +52 -0
  54. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveFractional.hpp +52 -0
  55. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveGuided.hpp +55 -0
  56. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveLineSearch.hpp +52 -0
  57. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDivePseudoCost.hpp +60 -0
  58. data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveVectorLength.hpp +52 -0
  59. data/ext/ruby-cbc/install/include/coin/CbcHeuristicFPump.hpp +340 -0
  60. data/ext/ruby-cbc/install/include/coin/CbcHeuristicGreedy.hpp +280 -0
  61. data/ext/ruby-cbc/install/include/coin/CbcHeuristicLocal.hpp +271 -0
  62. data/ext/ruby-cbc/install/include/coin/CbcHeuristicPivotAndFix.hpp +58 -0
  63. data/ext/ruby-cbc/install/include/coin/CbcHeuristicRENS.hpp +77 -0
  64. data/ext/ruby-cbc/install/include/coin/CbcHeuristicRINS.hpp +102 -0
  65. data/ext/ruby-cbc/install/include/coin/CbcHeuristicRandRound.hpp +58 -0
  66. data/ext/ruby-cbc/install/include/coin/CbcHeuristicVND.hpp +94 -0
  67. data/ext/ruby-cbc/install/include/coin/CbcLinked.hpp +1406 -0
  68. data/ext/ruby-cbc/install/include/coin/CbcMessage.hpp +94 -0
  69. data/ext/ruby-cbc/install/include/coin/CbcMipStartIO.hpp +26 -0
  70. data/ext/ruby-cbc/install/include/coin/CbcModel.hpp +2952 -0
  71. data/ext/ruby-cbc/install/include/coin/CbcNWay.hpp +166 -0
  72. data/ext/ruby-cbc/install/include/coin/CbcNode.hpp +351 -0
  73. data/ext/ruby-cbc/install/include/coin/CbcNodeInfo.hpp +349 -0
  74. data/ext/ruby-cbc/install/include/coin/CbcObject.hpp +272 -0
  75. data/ext/ruby-cbc/install/include/coin/CbcObjectUpdateData.hpp +64 -0
  76. data/ext/ruby-cbc/install/include/coin/CbcOrClpParam.cpp +4134 -0
  77. data/ext/ruby-cbc/install/include/coin/CbcOrClpParam.hpp +532 -0
  78. data/ext/ruby-cbc/install/include/coin/CbcParam.hpp +324 -0
  79. data/ext/ruby-cbc/install/include/coin/CbcPartialNodeInfo.hpp +110 -0
  80. data/ext/ruby-cbc/install/include/coin/CbcSOS.hpp +279 -0
  81. data/ext/ruby-cbc/install/include/coin/CbcSimpleInteger.hpp +286 -0
  82. data/ext/ruby-cbc/install/include/coin/CbcSimpleIntegerDynamicPseudoCost.hpp +564 -0
  83. data/ext/ruby-cbc/install/include/coin/CbcSimpleIntegerPseudoCost.hpp +114 -0
  84. data/ext/ruby-cbc/install/include/coin/CbcSolver.hpp +447 -0
  85. data/ext/ruby-cbc/install/include/coin/CbcStrategy.hpp +258 -0
  86. data/ext/ruby-cbc/install/include/coin/CbcSubProblem.hpp +83 -0
  87. data/ext/ruby-cbc/install/include/coin/CbcTree.hpp +490 -0
  88. data/ext/ruby-cbc/install/include/coin/CbcTreeLocal.hpp +372 -0
  89. data/ext/ruby-cbc/install/include/coin/Cbc_C_Interface.h +381 -0
  90. data/ext/ruby-cbc/install/include/coin/Cgl012cut.hpp +464 -0
  91. data/ext/ruby-cbc/install/include/coin/CglAllDifferent.hpp +115 -0
  92. data/ext/ruby-cbc/install/include/coin/CglClique.hpp +308 -0
  93. data/ext/ruby-cbc/install/include/coin/CglConfig.h +19 -0
  94. data/ext/ruby-cbc/install/include/coin/CglCutGenerator.hpp +121 -0
  95. data/ext/ruby-cbc/install/include/coin/CglDuplicateRow.hpp +189 -0
  96. data/ext/ruby-cbc/install/include/coin/CglFlowCover.hpp +371 -0
  97. data/ext/ruby-cbc/install/include/coin/CglGMI.hpp +364 -0
  98. data/ext/ruby-cbc/install/include/coin/CglGMIParam.hpp +313 -0
  99. data/ext/ruby-cbc/install/include/coin/CglGomory.hpp +204 -0
  100. data/ext/ruby-cbc/install/include/coin/CglKnapsackCover.hpp +310 -0
  101. data/ext/ruby-cbc/install/include/coin/CglLandP.hpp +306 -0
  102. data/ext/ruby-cbc/install/include/coin/CglLandPValidator.hpp +130 -0
  103. data/ext/ruby-cbc/install/include/coin/CglLiftAndProject.hpp +104 -0
  104. data/ext/ruby-cbc/install/include/coin/CglMessage.hpp +50 -0
  105. data/ext/ruby-cbc/install/include/coin/CglMixedIntegerRounding.hpp +429 -0
  106. data/ext/ruby-cbc/install/include/coin/CglMixedIntegerRounding2.hpp +427 -0
  107. data/ext/ruby-cbc/install/include/coin/CglOddHole.hpp +160 -0
  108. data/ext/ruby-cbc/install/include/coin/CglParam.hpp +93 -0
  109. data/ext/ruby-cbc/install/include/coin/CglPreProcess.hpp +492 -0
  110. data/ext/ruby-cbc/install/include/coin/CglProbing.hpp +543 -0
  111. data/ext/ruby-cbc/install/include/coin/CglRedSplit.hpp +448 -0
  112. data/ext/ruby-cbc/install/include/coin/CglRedSplit2.hpp +494 -0
  113. data/ext/ruby-cbc/install/include/coin/CglRedSplit2Param.hpp +495 -0
  114. data/ext/ruby-cbc/install/include/coin/CglRedSplitParam.hpp +272 -0
  115. data/ext/ruby-cbc/install/include/coin/CglResidualCapacity.hpp +240 -0
  116. data/ext/ruby-cbc/install/include/coin/CglSimpleRounding.hpp +174 -0
  117. data/ext/ruby-cbc/install/include/coin/CglStored.hpp +125 -0
  118. data/ext/ruby-cbc/install/include/coin/CglTreeInfo.hpp +180 -0
  119. data/ext/ruby-cbc/install/include/coin/CglTwomir.hpp +565 -0
  120. data/ext/ruby-cbc/install/include/coin/CglZeroHalf.hpp +133 -0
  121. data/ext/ruby-cbc/install/include/coin/ClpAmplObjective.hpp +113 -0
  122. data/ext/ruby-cbc/install/include/coin/ClpCholeskyBase.hpp +294 -0
  123. data/ext/ruby-cbc/install/include/coin/ClpCholeskyDense.hpp +162 -0
  124. data/ext/ruby-cbc/install/include/coin/ClpConfig.h +17 -0
  125. data/ext/ruby-cbc/install/include/coin/ClpConstraint.hpp +125 -0
  126. data/ext/ruby-cbc/install/include/coin/ClpConstraintAmpl.hpp +108 -0
  127. data/ext/ruby-cbc/install/include/coin/ClpConstraintLinear.hpp +110 -0
  128. data/ext/ruby-cbc/install/include/coin/ClpConstraintQuadratic.hpp +119 -0
  129. data/ext/ruby-cbc/install/include/coin/ClpDualRowDantzig.hpp +71 -0
  130. data/ext/ruby-cbc/install/include/coin/ClpDualRowPivot.hpp +129 -0
  131. data/ext/ruby-cbc/install/include/coin/ClpDualRowSteepest.hpp +153 -0
  132. data/ext/ruby-cbc/install/include/coin/ClpDummyMatrix.hpp +183 -0
  133. data/ext/ruby-cbc/install/include/coin/ClpDynamicExampleMatrix.hpp +186 -0
  134. data/ext/ruby-cbc/install/include/coin/ClpDynamicMatrix.hpp +381 -0
  135. data/ext/ruby-cbc/install/include/coin/ClpEventHandler.hpp +187 -0
  136. data/ext/ruby-cbc/install/include/coin/ClpFactorization.hpp +432 -0
  137. data/ext/ruby-cbc/install/include/coin/ClpGubDynamicMatrix.hpp +247 -0
  138. data/ext/ruby-cbc/install/include/coin/ClpGubMatrix.hpp +358 -0
  139. data/ext/ruby-cbc/install/include/coin/ClpInterior.hpp +570 -0
  140. data/ext/ruby-cbc/install/include/coin/ClpLinearObjective.hpp +103 -0
  141. data/ext/ruby-cbc/install/include/coin/ClpMatrixBase.hpp +524 -0
  142. data/ext/ruby-cbc/install/include/coin/ClpMessage.hpp +131 -0
  143. data/ext/ruby-cbc/install/include/coin/ClpModel.hpp +1307 -0
  144. data/ext/ruby-cbc/install/include/coin/ClpNetworkMatrix.hpp +229 -0
  145. data/ext/ruby-cbc/install/include/coin/ClpNode.hpp +349 -0
  146. data/ext/ruby-cbc/install/include/coin/ClpNonLinearCost.hpp +401 -0
  147. data/ext/ruby-cbc/install/include/coin/ClpObjective.hpp +134 -0
  148. data/ext/ruby-cbc/install/include/coin/ClpPackedMatrix.hpp +638 -0
  149. data/ext/ruby-cbc/install/include/coin/ClpParameters.hpp +126 -0
  150. data/ext/ruby-cbc/install/include/coin/ClpPdcoBase.hpp +103 -0
  151. data/ext/ruby-cbc/install/include/coin/ClpPlusMinusOneMatrix.hpp +290 -0
  152. data/ext/ruby-cbc/install/include/coin/ClpPresolve.hpp +299 -0
  153. data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnDantzig.hpp +72 -0
  154. data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnPivot.hpp +155 -0
  155. data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnSteepest.hpp +247 -0
  156. data/ext/ruby-cbc/install/include/coin/ClpQuadraticObjective.hpp +155 -0
  157. data/ext/ruby-cbc/install/include/coin/ClpSimplex.hpp +1797 -0
  158. data/ext/ruby-cbc/install/include/coin/ClpSimplexDual.hpp +300 -0
  159. data/ext/ruby-cbc/install/include/coin/ClpSimplexNonlinear.hpp +117 -0
  160. data/ext/ruby-cbc/install/include/coin/ClpSimplexOther.hpp +277 -0
  161. data/ext/ruby-cbc/install/include/coin/ClpSimplexPrimal.hpp +244 -0
  162. data/ext/ruby-cbc/install/include/coin/ClpSolve.hpp +446 -0
  163. data/ext/ruby-cbc/install/include/coin/Clp_C_Interface.h +525 -0
  164. data/ext/ruby-cbc/install/include/coin/CoinAlloc.hpp +176 -0
  165. data/ext/ruby-cbc/install/include/coin/CoinBuild.hpp +149 -0
  166. data/ext/ruby-cbc/install/include/coin/CoinDenseFactorization.hpp +419 -0
  167. data/ext/ruby-cbc/install/include/coin/CoinDenseVector.hpp +383 -0
  168. data/ext/ruby-cbc/install/include/coin/CoinDistance.hpp +48 -0
  169. data/ext/ruby-cbc/install/include/coin/CoinError.hpp +257 -0
  170. data/ext/ruby-cbc/install/include/coin/CoinFactorization.hpp +2044 -0
  171. data/ext/ruby-cbc/install/include/coin/CoinFileIO.hpp +166 -0
  172. data/ext/ruby-cbc/install/include/coin/CoinFinite.hpp +34 -0
  173. data/ext/ruby-cbc/install/include/coin/CoinFloatEqual.hpp +177 -0
  174. data/ext/ruby-cbc/install/include/coin/CoinHelperFunctions.hpp +1111 -0
  175. data/ext/ruby-cbc/install/include/coin/CoinIndexedVector.hpp +1164 -0
  176. data/ext/ruby-cbc/install/include/coin/CoinLpIO.hpp +805 -0
  177. data/ext/ruby-cbc/install/include/coin/CoinMessage.hpp +96 -0
  178. data/ext/ruby-cbc/install/include/coin/CoinMessageHandler.hpp +666 -0
  179. data/ext/ruby-cbc/install/include/coin/CoinModel.hpp +1054 -0
  180. data/ext/ruby-cbc/install/include/coin/CoinModelUseful.hpp +441 -0
  181. data/ext/ruby-cbc/install/include/coin/CoinMpsIO.hpp +1056 -0
  182. data/ext/ruby-cbc/install/include/coin/CoinOslFactorization.hpp +280 -0
  183. data/ext/ruby-cbc/install/include/coin/CoinPackedMatrix.hpp +947 -0
  184. data/ext/ruby-cbc/install/include/coin/CoinPackedVector.hpp +657 -0
  185. data/ext/ruby-cbc/install/include/coin/CoinPackedVectorBase.hpp +269 -0
  186. data/ext/ruby-cbc/install/include/coin/CoinParam.hpp +644 -0
  187. data/ext/ruby-cbc/install/include/coin/CoinPragma.hpp +26 -0
  188. data/ext/ruby-cbc/install/include/coin/CoinPresolveDoubleton.hpp +73 -0
  189. data/ext/ruby-cbc/install/include/coin/CoinPresolveDual.hpp +85 -0
  190. data/ext/ruby-cbc/install/include/coin/CoinPresolveDupcol.hpp +226 -0
  191. data/ext/ruby-cbc/install/include/coin/CoinPresolveEmpty.hpp +116 -0
  192. data/ext/ruby-cbc/install/include/coin/CoinPresolveFixed.hpp +181 -0
  193. data/ext/ruby-cbc/install/include/coin/CoinPresolveForcing.hpp +61 -0
  194. data/ext/ruby-cbc/install/include/coin/CoinPresolveImpliedFree.hpp +60 -0
  195. data/ext/ruby-cbc/install/include/coin/CoinPresolveIsolated.hpp +51 -0
  196. data/ext/ruby-cbc/install/include/coin/CoinPresolveMatrix.hpp +1842 -0
  197. data/ext/ruby-cbc/install/include/coin/CoinPresolveMonitor.hpp +105 -0
  198. data/ext/ruby-cbc/install/include/coin/CoinPresolvePsdebug.hpp +166 -0
  199. data/ext/ruby-cbc/install/include/coin/CoinPresolveSingleton.hpp +112 -0
  200. data/ext/ruby-cbc/install/include/coin/CoinPresolveSubst.hpp +101 -0
  201. data/ext/ruby-cbc/install/include/coin/CoinPresolveTighten.hpp +55 -0
  202. data/ext/ruby-cbc/install/include/coin/CoinPresolveTripleton.hpp +66 -0
  203. data/ext/ruby-cbc/install/include/coin/CoinPresolveUseless.hpp +63 -0
  204. data/ext/ruby-cbc/install/include/coin/CoinPresolveZeros.hpp +60 -0
  205. data/ext/ruby-cbc/install/include/coin/CoinRational.hpp +44 -0
  206. data/ext/ruby-cbc/install/include/coin/CoinSearchTree.hpp +465 -0
  207. data/ext/ruby-cbc/install/include/coin/CoinShallowPackedVector.hpp +148 -0
  208. data/ext/ruby-cbc/install/include/coin/CoinSignal.hpp +117 -0
  209. data/ext/ruby-cbc/install/include/coin/CoinSimpFactorization.hpp +431 -0
  210. data/ext/ruby-cbc/install/include/coin/CoinSmartPtr.hpp +528 -0
  211. data/ext/ruby-cbc/install/include/coin/CoinSnapshot.hpp +476 -0
  212. data/ext/ruby-cbc/install/include/coin/CoinSort.hpp +678 -0
  213. data/ext/ruby-cbc/install/include/coin/CoinStructuredModel.hpp +247 -0
  214. data/ext/ruby-cbc/install/include/coin/CoinTime.hpp +310 -0
  215. data/ext/ruby-cbc/install/include/coin/CoinTypes.hpp +64 -0
  216. data/ext/ruby-cbc/install/include/coin/CoinUtility.hpp +19 -0
  217. data/ext/ruby-cbc/install/include/coin/CoinUtilsConfig.h +34 -0
  218. data/ext/ruby-cbc/install/include/coin/CoinWarmStart.hpp +58 -0
  219. data/ext/ruby-cbc/install/include/coin/CoinWarmStartBasis.hpp +456 -0
  220. data/ext/ruby-cbc/install/include/coin/CoinWarmStartDual.hpp +166 -0
  221. data/ext/ruby-cbc/install/include/coin/CoinWarmStartPrimalDual.hpp +211 -0
  222. data/ext/ruby-cbc/install/include/coin/CoinWarmStartVector.hpp +488 -0
  223. data/ext/ruby-cbc/install/include/coin/Coin_C_defines.h +115 -0
  224. data/ext/ruby-cbc/install/include/coin/Idiot.hpp +298 -0
  225. data/ext/ruby-cbc/install/include/coin/OsiAuxInfo.hpp +206 -0
  226. data/ext/ruby-cbc/install/include/coin/OsiBranchingObject.hpp +1005 -0
  227. data/ext/ruby-cbc/install/include/coin/OsiCbcSolverInterface.hpp +764 -0
  228. data/ext/ruby-cbc/install/include/coin/OsiChooseVariable.hpp +534 -0
  229. data/ext/ruby-cbc/install/include/coin/OsiClpSolverInterface.hpp +1509 -0
  230. data/ext/ruby-cbc/install/include/coin/OsiColCut.hpp +324 -0
  231. data/ext/ruby-cbc/install/include/coin/OsiCollections.hpp +35 -0
  232. data/ext/ruby-cbc/install/include/coin/OsiConfig.h +19 -0
  233. data/ext/ruby-cbc/install/include/coin/OsiCut.hpp +245 -0
  234. data/ext/ruby-cbc/install/include/coin/OsiCuts.hpp +474 -0
  235. data/ext/ruby-cbc/install/include/coin/OsiPresolve.hpp +252 -0
  236. data/ext/ruby-cbc/install/include/coin/OsiRowCut.hpp +331 -0
  237. data/ext/ruby-cbc/install/include/coin/OsiRowCutDebugger.hpp +187 -0
  238. data/ext/ruby-cbc/install/include/coin/OsiSolverBranch.hpp +152 -0
  239. data/ext/ruby-cbc/install/include/coin/OsiSolverInterface.hpp +2143 -0
  240. data/ext/ruby-cbc/install/include/coin/OsiSolverParameters.hpp +142 -0
  241. data/ext/ruby-cbc/install/include/coin/OsiUnitTests.hpp +374 -0
  242. data/ext/ruby-cbc/install/lib/libCbc.la +35 -0
  243. data/ext/ruby-cbc/install/lib/libCbc.so +0 -0
  244. data/ext/ruby-cbc/install/lib/libCbc.so.3 +0 -0
  245. data/ext/ruby-cbc/install/lib/libCbc.so.3.9.7 +0 -0
  246. data/ext/ruby-cbc/install/lib/libCbcSolver.la +35 -0
  247. data/ext/ruby-cbc/install/lib/libCbcSolver.so +0 -0
  248. data/ext/ruby-cbc/install/lib/libCbcSolver.so.3 +0 -0
  249. data/ext/ruby-cbc/install/lib/libCbcSolver.so.3.9.7 +0 -0
  250. data/ext/ruby-cbc/install/lib/libCgl.la +35 -0
  251. data/ext/ruby-cbc/install/lib/libCgl.so +0 -0
  252. data/ext/ruby-cbc/install/lib/libCgl.so.1 +0 -0
  253. data/ext/ruby-cbc/install/lib/libCgl.so.1.9.7 +0 -0
  254. data/ext/ruby-cbc/install/lib/libClp.la +35 -0
  255. data/ext/ruby-cbc/install/lib/libClp.so +0 -0
  256. data/ext/ruby-cbc/install/lib/libClp.so.1 +0 -0
  257. data/ext/ruby-cbc/install/lib/libClp.so.1.13.9 +0 -0
  258. data/ext/ruby-cbc/install/lib/libClpSolver.la +35 -0
  259. data/ext/ruby-cbc/install/lib/libClpSolver.so +0 -0
  260. data/ext/ruby-cbc/install/lib/libClpSolver.so.1 +0 -0
  261. data/ext/ruby-cbc/install/lib/libClpSolver.so.1.13.9 +0 -0
  262. data/ext/ruby-cbc/install/lib/libCoinUtils.la +35 -0
  263. data/ext/ruby-cbc/install/lib/libCoinUtils.so +0 -0
  264. data/ext/ruby-cbc/install/lib/libCoinUtils.so.3 +0 -0
  265. data/ext/ruby-cbc/install/lib/libCoinUtils.so.3.10.11 +0 -0
  266. data/ext/ruby-cbc/install/lib/libOsi.la +35 -0
  267. data/ext/ruby-cbc/install/lib/libOsi.so +0 -0
  268. data/ext/ruby-cbc/install/lib/libOsi.so.1 +0 -0
  269. data/ext/ruby-cbc/install/lib/libOsi.so.1.12.6 +0 -0
  270. data/ext/ruby-cbc/install/lib/libOsiCbc.la +35 -0
  271. data/ext/ruby-cbc/install/lib/libOsiCbc.so +0 -0
  272. data/ext/ruby-cbc/install/lib/libOsiCbc.so.3 +0 -0
  273. data/ext/ruby-cbc/install/lib/libOsiCbc.so.3.9.7 +0 -0
  274. data/ext/ruby-cbc/install/lib/libOsiClp.la +35 -0
  275. data/ext/ruby-cbc/install/lib/libOsiClp.so +0 -0
  276. data/ext/ruby-cbc/install/lib/libOsiClp.so.1 +0 -0
  277. data/ext/ruby-cbc/install/lib/libOsiClp.so.1.13.9 +0 -0
  278. data/ext/ruby-cbc/install/lib/libOsiCommonTests.la +35 -0
  279. data/ext/ruby-cbc/install/lib/libOsiCommonTests.so +0 -0
  280. data/ext/ruby-cbc/install/lib/libOsiCommonTests.so.1 +0 -0
  281. data/ext/ruby-cbc/install/lib/libOsiCommonTests.so.1.12.6 +0 -0
  282. data/ext/ruby-cbc/install/lib/pkgconfig/cbc.pc +12 -0
  283. data/ext/ruby-cbc/install/lib/pkgconfig/cgl.pc +12 -0
  284. data/ext/ruby-cbc/install/lib/pkgconfig/clp.pc +12 -0
  285. data/ext/ruby-cbc/install/lib/pkgconfig/coindatamiplib3.pc +9 -0
  286. data/ext/ruby-cbc/install/lib/pkgconfig/coindatasample.pc +9 -0
  287. data/ext/ruby-cbc/install/lib/pkgconfig/coinutils.pc +12 -0
  288. data/ext/ruby-cbc/install/lib/pkgconfig/osi-cbc.pc +12 -0
  289. data/ext/ruby-cbc/install/lib/pkgconfig/osi-clp.pc +12 -0
  290. data/ext/ruby-cbc/install/lib/pkgconfig/osi-unittests.pc +12 -0
  291. data/ext/ruby-cbc/install/lib/pkgconfig/osi.pc +12 -0
  292. data/lib/ruby-cbc/ilp/constant.rb +44 -0
  293. data/lib/ruby-cbc/ilp/constraint.rb +32 -0
  294. data/lib/ruby-cbc/ilp/objective.rb +26 -0
  295. data/lib/ruby-cbc/ilp/term.rb +47 -0
  296. data/lib/ruby-cbc/ilp/term_array.rb +80 -0
  297. data/lib/ruby-cbc/ilp/var.rb +62 -0
  298. data/lib/ruby-cbc/model.rb +125 -0
  299. data/lib/ruby-cbc/problem.rb +170 -0
  300. data/lib/ruby-cbc/version.rb +3 -0
  301. data/lib/ruby-cbc.rb +21 -0
  302. data/ruby-cbc.gemspec +36 -0
  303. metadata +431 -0
@@ -0,0 +1,2143 @@
1
+ // Copyright (C) 2000, International Business Machines
2
+ // Corporation and others. All Rights Reserved.
3
+ // This code is licensed under the terms of the Eclipse Public License (EPL).
4
+
5
+ #ifndef OsiSolverInterface_H
6
+ #define OsiSolverInterface_H
7
+
8
+ #include <cstdlib>
9
+ #include <string>
10
+ #include <vector>
11
+
12
+ #include "CoinTypes.hpp"
13
+ #include "CoinMessageHandler.hpp"
14
+ #include "CoinPackedVectorBase.hpp"
15
+ #include "CoinPackedMatrix.hpp"
16
+ #include "CoinWarmStart.hpp"
17
+ #include "CoinFinite.hpp"
18
+ #include "CoinError.hpp"
19
+
20
+ #include "OsiCollections.hpp"
21
+ #include "OsiSolverParameters.hpp"
22
+
23
+ class CoinSnapshot;
24
+ class CoinLpIO;
25
+ class CoinMpsIO;
26
+
27
+ class OsiCuts;
28
+ class OsiAuxInfo;
29
+ class OsiRowCut;
30
+ class OsiRowCutDebugger;
31
+ class CoinSet;
32
+ class CoinBuild;
33
+ class CoinModel;
34
+ class OsiSolverBranch;
35
+ class OsiSolverResult;
36
+ class OsiObject;
37
+
38
+
39
+ //#############################################################################
40
+
41
+ /*! \brief Abstract Base Class for describing an interface to a solver.
42
+
43
+ Many OsiSolverInterface query methods return a const pointer to the
44
+ requested read-only data. If the model data is changed or the solver
45
+ is called, these pointers may no longer be valid and should be
46
+ refreshed by invoking the member function to obtain an updated copy
47
+ of the pointer.
48
+ For example:
49
+ \code
50
+ OsiSolverInterface solverInterfacePtr ;
51
+ const double * ruBnds = solverInterfacePtr->getRowUpper();
52
+ solverInterfacePtr->applyCuts(someSetOfCuts);
53
+ // ruBnds is no longer a valid pointer and must be refreshed
54
+ ruBnds = solverInterfacePtr->getRowUpper();
55
+ \endcode
56
+
57
+ Querying a problem that has no data associated with it will result in
58
+ zeros for the number of rows and columns, and NULL pointers from
59
+ the methods that return vectors.
60
+ */
61
+
62
+ class OsiSolverInterface {
63
+ friend void OsiSolverInterfaceCommonUnitTest(
64
+ const OsiSolverInterface* emptySi,
65
+ const std::string & mpsDir,
66
+ const std::string & netlibDir);
67
+ friend void OsiSolverInterfaceMpsUnitTest(
68
+ const std::vector<OsiSolverInterface*> & vecSiP,
69
+ const std::string & mpsDir);
70
+
71
+ public:
72
+
73
+ /// Internal class for obtaining status from the applyCuts method
74
+ class ApplyCutsReturnCode {
75
+ friend class OsiSolverInterface;
76
+ friend class OsiClpSolverInterface;
77
+ friend class OsiGrbSolverInterface;
78
+
79
+ public:
80
+ ///@name Constructors and desctructors
81
+ //@{
82
+ /// Default constructor
83
+ ApplyCutsReturnCode():
84
+ intInconsistent_(0),
85
+ extInconsistent_(0),
86
+ infeasible_(0),
87
+ ineffective_(0),
88
+ applied_(0) {}
89
+ /// Copy constructor
90
+ ApplyCutsReturnCode(const ApplyCutsReturnCode & rhs):
91
+ intInconsistent_(rhs.intInconsistent_),
92
+ extInconsistent_(rhs.extInconsistent_),
93
+ infeasible_(rhs.infeasible_),
94
+ ineffective_(rhs.ineffective_),
95
+ applied_(rhs.applied_) {}
96
+ /// Assignment operator
97
+ ApplyCutsReturnCode & operator=(const ApplyCutsReturnCode& rhs)
98
+ {
99
+ if (this != &rhs) {
100
+ intInconsistent_ = rhs.intInconsistent_;
101
+ extInconsistent_ = rhs.extInconsistent_;
102
+ infeasible_ = rhs.infeasible_;
103
+ ineffective_ = rhs.ineffective_;
104
+ applied_ = rhs.applied_;
105
+ }
106
+ return *this;
107
+ }
108
+ /// Destructor
109
+ ~ApplyCutsReturnCode(){}
110
+ //@}
111
+
112
+ /**@name Accessing return code attributes */
113
+ //@{
114
+ /// Number of logically inconsistent cuts
115
+ inline int getNumInconsistent() const
116
+ {return intInconsistent_;}
117
+ /// Number of cuts inconsistent with the current model
118
+ inline int getNumInconsistentWrtIntegerModel() const
119
+ {return extInconsistent_;}
120
+ /// Number of cuts that cause obvious infeasibility
121
+ inline int getNumInfeasible() const
122
+ {return infeasible_;}
123
+ /// Number of redundant or ineffective cuts
124
+ inline int getNumIneffective() const
125
+ {return ineffective_;}
126
+ /// Number of cuts applied
127
+ inline int getNumApplied() const
128
+ {return applied_;}
129
+ //@}
130
+
131
+ private:
132
+ /**@name Private methods */
133
+ //@{
134
+ /// Increment logically inconsistent cut counter
135
+ inline void incrementInternallyInconsistent(){intInconsistent_++;}
136
+ /// Increment model-inconsistent counter
137
+ inline void incrementExternallyInconsistent(){extInconsistent_++;}
138
+ /// Increment infeasible cut counter
139
+ inline void incrementInfeasible(){infeasible_++;}
140
+ /// Increment ineffective cut counter
141
+ inline void incrementIneffective(){ineffective_++;}
142
+ /// Increment applied cut counter
143
+ inline void incrementApplied(){applied_++;}
144
+ //@}
145
+
146
+ ///@name Private member data
147
+ //@{
148
+ /// Counter for logically inconsistent cuts
149
+ int intInconsistent_;
150
+ /// Counter for model-inconsistent cuts
151
+ int extInconsistent_;
152
+ /// Counter for infeasible cuts
153
+ int infeasible_;
154
+ /// Counter for ineffective cuts
155
+ int ineffective_;
156
+ /// Counter for applied cuts
157
+ int applied_;
158
+ //@}
159
+ };
160
+
161
+ //---------------------------------------------------------------------------
162
+
163
+ ///@name Solve methods
164
+ //@{
165
+ /// Solve initial LP relaxation
166
+ virtual void initialSolve() = 0;
167
+
168
+ /*! \brief Resolve an LP relaxation after problem modification
169
+
170
+ Note the `re-' in `resolve'. initialSolve() should be used to solve the
171
+ problem for the first time.
172
+ */
173
+ virtual void resolve() = 0;
174
+
175
+ /// Invoke solver's built-in enumeration algorithm
176
+ virtual void branchAndBound() = 0;
177
+
178
+ #ifdef CBC_NEXT_VERSION
179
+ /*
180
+ Would it make sense to collect all of these routines in a `MIP Helper'
181
+ section? It'd make it easier for users and implementors to find them.
182
+ */
183
+ /**
184
+ Solve 2**N (N==depth) problems and return solutions and bases.
185
+ There are N branches each of which changes bounds on both sides
186
+ as given by branch. The user should provide an array of (empty)
187
+ results which will be filled in. See OsiSolveResult for more details
188
+ (in OsiSolveBranch.?pp) but it will include a basis and primal solution.
189
+
190
+ The order of results is left to right at feasible leaf nodes so first one
191
+ is down, down, .....
192
+
193
+ Returns number of feasible leaves. Also sets number of solves done and number
194
+ of iterations.
195
+
196
+ This is provided so a solver can do faster.
197
+
198
+ If forceBranch true then branch done even if satisfied
199
+ */
200
+ virtual int solveBranches(int depth,const OsiSolverBranch * branch,
201
+ OsiSolverResult * result,
202
+ int & numberSolves, int & numberIterations,
203
+ bool forceBranch=false);
204
+ #endif
205
+ //@}
206
+
207
+ //---------------------------------------------------------------------------
208
+ /**@name Parameter set/get methods
209
+
210
+ The set methods return true if the parameter was set to the given value,
211
+ false otherwise. When a set method returns false, the original value (if
212
+ any) should be unchanged. There can be various reasons for failure: the
213
+ given parameter is not applicable for the solver (e.g., refactorization
214
+ frequency for the volume algorithm), the parameter is not yet
215
+ implemented for the solver or simply the value of the parameter is out
216
+ of the range the solver accepts. If a parameter setting call returns
217
+ false check the details of your solver.
218
+
219
+ The get methods return true if the given parameter is applicable for the
220
+ solver and is implemented. In this case the value of the parameter is
221
+ returned in the second argument. Otherwise they return false.
222
+
223
+ \note
224
+ There is a default implementation of the set/get
225
+ methods, namely to store/retrieve the given value using an array in the
226
+ base class. A specific solver implementation can use this feature, for
227
+ example, to store parameters that should be used later on. Implementors
228
+ of a solver interface should overload these functions to provide the
229
+ proper interface to and accurately reflect the capabilities of a
230
+ specific solver.
231
+
232
+ The format for hints is slightly different in that a boolean specifies
233
+ the sense of the hint and an enum specifies the strength of the hint.
234
+ Hints should be initialised when a solver is instantiated.
235
+ (See OsiSolverParameters.hpp for defined hint parameters and strength.)
236
+ When specifying the sense of the hint, a value of true means to work with
237
+ the hint, false to work against it. For example,
238
+ <ul>
239
+ <li> \code setHintParam(OsiDoScale,true,OsiHintTry) \endcode
240
+ is a mild suggestion to the solver to scale the constraint
241
+ system.
242
+ <li> \code setHintParam(OsiDoScale,false,OsiForceDo) \endcode
243
+ tells the solver to disable scaling, or throw an exception if
244
+ it cannot comply.
245
+ </ul>
246
+ As another example, a solver interface could use the value and strength
247
+ of the \c OsiDoReducePrint hint to adjust the amount of information
248
+ printed by the interface and/or solver. The extent to which a solver
249
+ obeys hints is left to the solver. The value and strength returned by
250
+ \c getHintParam will match the most recent call to \c setHintParam,
251
+ and will not necessarily reflect the solver's ability to comply with the
252
+ hint. If the hint strength is \c OsiForceDo, the solver is required to
253
+ throw an exception if it cannot perform the specified action.
254
+
255
+ \note
256
+ As with the other set/get methods, there is a default implementation
257
+ which maintains arrays in the base class for hint sense and strength.
258
+ The default implementation does not store the \c otherInformation
259
+ pointer, and always throws an exception for strength \c OsiForceDo.
260
+ Implementors of a solver interface should override these functions to
261
+ provide the proper interface to and accurately reflect the capabilities
262
+ of a specific solver.
263
+ */
264
+ //@{
265
+ //! Set an integer parameter
266
+ virtual bool setIntParam(OsiIntParam key, int value) {
267
+ if (key == OsiLastIntParam) return (false) ;
268
+ intParam_[key] = value;
269
+ return true;
270
+ }
271
+ //! Set a double parameter
272
+ virtual bool setDblParam(OsiDblParam key, double value) {
273
+ if (key == OsiLastDblParam) return (false) ;
274
+ dblParam_[key] = value;
275
+ return true;
276
+ }
277
+ //! Set a string parameter
278
+ virtual bool setStrParam(OsiStrParam key, const std::string & value) {
279
+ if (key == OsiLastStrParam) return (false) ;
280
+ strParam_[key] = value;
281
+ return true;
282
+ }
283
+ /*! \brief Set a hint parameter
284
+
285
+ The \c otherInformation parameter can be used to pass in an arbitrary
286
+ block of information which is interpreted by the OSI and the underlying
287
+ solver. Users are cautioned that this hook is solver-specific.
288
+
289
+ Implementors:
290
+ The default implementation completely ignores \c otherInformation and
291
+ always throws an exception for OsiForceDo. This is almost certainly not
292
+ the behaviour you want; you really should override this method.
293
+ */
294
+ virtual bool setHintParam(OsiHintParam key, bool yesNo=true,
295
+ OsiHintStrength strength=OsiHintTry,
296
+ void * /*otherInformation*/ = NULL) {
297
+ if (key==OsiLastHintParam)
298
+ return false;
299
+ hintParam_[key] = yesNo;
300
+ hintStrength_[key] = strength;
301
+ if (strength == OsiForceDo)
302
+ throw CoinError("OsiForceDo illegal",
303
+ "setHintParam", "OsiSolverInterface");
304
+ return true;
305
+ }
306
+ //! Get an integer parameter
307
+ virtual bool getIntParam(OsiIntParam key, int& value) const {
308
+ if (key == OsiLastIntParam) return (false) ;
309
+ value = intParam_[key];
310
+ return true;
311
+ }
312
+ //! Get a double parameter
313
+ virtual bool getDblParam(OsiDblParam key, double& value) const {
314
+ if (key == OsiLastDblParam) return (false) ;
315
+ value = dblParam_[key];
316
+ return true;
317
+ }
318
+ //! Get a string parameter
319
+ virtual bool getStrParam(OsiStrParam key, std::string& value) const {
320
+ if (key == OsiLastStrParam) return (false) ;
321
+ value = strParam_[key];
322
+ return true;
323
+ }
324
+ /*! \brief Get a hint parameter (all information)
325
+
326
+ Return all available information for the hint: sense, strength,
327
+ and any extra information associated with the hint.
328
+
329
+ Implementors: The default implementation will always set
330
+ \c otherInformation to NULL. This is almost certainly not the
331
+ behaviour you want; you really should override this method.
332
+ */
333
+ virtual bool getHintParam(OsiHintParam key, bool& yesNo,
334
+ OsiHintStrength& strength,
335
+ void *& otherInformation) const {
336
+ if (key==OsiLastHintParam)
337
+ return false;
338
+ yesNo = hintParam_[key];
339
+ strength = hintStrength_[key];
340
+ otherInformation=NULL;
341
+ return true;
342
+ }
343
+ /*! \brief Get a hint parameter (sense and strength only)
344
+
345
+ Return only the sense and strength of the hint.
346
+ */
347
+ virtual bool getHintParam(OsiHintParam key, bool& yesNo,
348
+ OsiHintStrength& strength) const {
349
+ if (key==OsiLastHintParam)
350
+ return false;
351
+ yesNo = hintParam_[key];
352
+ strength = hintStrength_[key];
353
+ return true;
354
+ }
355
+ /*! \brief Get a hint parameter (sense only)
356
+
357
+ Return only the sense (true/false) of the hint.
358
+ */
359
+ virtual bool getHintParam(OsiHintParam key, bool& yesNo) const {
360
+ if (key==OsiLastHintParam)
361
+ return false;
362
+ yesNo = hintParam_[key];
363
+ return true;
364
+ }
365
+ /*! \brief Copy all parameters in this section from one solver to another
366
+
367
+ Note that the current implementation also copies the appData block,
368
+ message handler, and rowCutDebugger. Arguably these should have
369
+ independent copy methods.
370
+ */
371
+ void copyParameters(OsiSolverInterface & rhs);
372
+
373
+ /** \brief Return the integrality tolerance of the underlying solver.
374
+
375
+ We should be able to get an integrality tolerance, but
376
+ until that time just use the primal tolerance
377
+
378
+ \todo
379
+ This method should be replaced; it's architecturally wrong. This
380
+ should be an honest dblParam with a keyword. Underlying solvers
381
+ that do not support integer variables should return false for set and
382
+ get on this parameter. Underlying solvers that support integrality
383
+ should add this to the parameters they support, using whatever
384
+ tolerance is appropriate. -lh, 091021-
385
+ */
386
+ inline double getIntegerTolerance() const
387
+ { return dblParam_[OsiPrimalTolerance];}
388
+ //@}
389
+
390
+ //---------------------------------------------------------------------------
391
+ ///@name Methods returning info on how the solution process terminated
392
+ //@{
393
+ /// Are there numerical difficulties?
394
+ virtual bool isAbandoned() const = 0;
395
+ /// Is optimality proven?
396
+ virtual bool isProvenOptimal() const = 0;
397
+ /// Is primal infeasibility proven?
398
+ virtual bool isProvenPrimalInfeasible() const = 0;
399
+ /// Is dual infeasibility proven?
400
+ virtual bool isProvenDualInfeasible() const = 0;
401
+ /// Is the given primal objective limit reached?
402
+ virtual bool isPrimalObjectiveLimitReached() const;
403
+ /// Is the given dual objective limit reached?
404
+ virtual bool isDualObjectiveLimitReached() const;
405
+ /// Iteration limit reached?
406
+ virtual bool isIterationLimitReached() const = 0;
407
+ //@}
408
+
409
+ //---------------------------------------------------------------------------
410
+ /** \name Warm start methods
411
+
412
+ Note that the warm start methods return a generic CoinWarmStart object.
413
+ The precise characteristics of this object are solver-dependent. Clients
414
+ who wish to maintain a maximum degree of solver independence should take
415
+ care to avoid unnecessary assumptions about the properties of a warm start
416
+ object.
417
+ */
418
+ //@{
419
+ /*! \brief Get an empty warm start object
420
+
421
+ This routine returns an empty warm start object. Its purpose is
422
+ to provide a way for a client to acquire a warm start object of the
423
+ appropriate type for the solver, which can then be resized and modified
424
+ as desired.
425
+ */
426
+
427
+ virtual CoinWarmStart *getEmptyWarmStart () const = 0 ;
428
+
429
+ /** \brief Get warm start information.
430
+
431
+ Return warm start information for the current state of the solver
432
+ interface. If there is no valid warm start information, an empty warm
433
+ start object wil be returned.
434
+ */
435
+ virtual CoinWarmStart* getWarmStart() const = 0;
436
+ /** \brief Get warm start information.
437
+
438
+ Return warm start information for the current state of the solver
439
+ interface. If there is no valid warm start information, an empty warm
440
+ start object wil be returned. This does not necessarily create an
441
+ object - may just point to one. must Delete set true if user
442
+ should delete returned object.
443
+ */
444
+ virtual CoinWarmStart* getPointerToWarmStart(bool & mustDelete) ;
445
+
446
+ /** \brief Set warm start information.
447
+
448
+ Return true or false depending on whether the warm start information was
449
+ accepted or not.
450
+ By definition, a call to setWarmStart with a null parameter should
451
+ cause the solver interface to refresh its warm start information
452
+ from the underlying solver.
453
+ */
454
+ virtual bool setWarmStart(const CoinWarmStart* warmstart) = 0;
455
+ //@}
456
+
457
+ //---------------------------------------------------------------------------
458
+ /**@name Hot start methods
459
+
460
+ Primarily used in strong branching. The user can create a hot start
461
+ object --- a snapshot of the optimization process --- then reoptimize
462
+ over and over again, starting from the same point.
463
+
464
+ \note
465
+ <ul>
466
+ <li> Between hot started optimizations only bound changes are allowed.
467
+ <li> The copy constructor and assignment operator should NOT copy any
468
+ hot start information.
469
+ <li> The default implementation simply extracts a warm start object in
470
+ \c markHotStart, resets to the warm start object in
471
+ \c solveFromHotStart, and deletes the warm start object in
472
+ \c unmarkHotStart.
473
+ <em>Actual solver implementations are encouraged to do better.</em>
474
+ </ul>
475
+
476
+ */
477
+ //@{
478
+ /// Create a hot start snapshot of the optimization process.
479
+ virtual void markHotStart();
480
+ /// Optimize starting from the hot start snapshot.
481
+ virtual void solveFromHotStart();
482
+ /// Delete the hot start snapshot.
483
+ virtual void unmarkHotStart();
484
+ //@}
485
+
486
+ //---------------------------------------------------------------------------
487
+ /**@name Problem query methods
488
+
489
+ Querying a problem that has no data associated with it will result in
490
+ zeros for the number of rows and columns, and NULL pointers from the
491
+ methods that return vectors.
492
+
493
+ Const pointers returned from any data-query method are valid as long as
494
+ the data is unchanged and the solver is not called.
495
+ */
496
+ //@{
497
+ /// Get the number of columns
498
+ virtual int getNumCols() const = 0;
499
+
500
+ /// Get the number of rows
501
+ virtual int getNumRows() const = 0;
502
+
503
+ /// Get the number of nonzero elements
504
+ virtual int getNumElements() const = 0;
505
+
506
+ /// Get the number of integer variables
507
+ virtual int getNumIntegers() const ;
508
+
509
+ /// Get a pointer to an array[getNumCols()] of column lower bounds
510
+ virtual const double * getColLower() const = 0;
511
+
512
+ /// Get a pointer to an array[getNumCols()] of column upper bounds
513
+ virtual const double * getColUpper() const = 0;
514
+
515
+ /*! \brief Get a pointer to an array[getNumRows()] of row constraint senses.
516
+
517
+ <ul>
518
+ <li>'L': <= constraint
519
+ <li>'E': = constraint
520
+ <li>'G': >= constraint
521
+ <li>'R': ranged constraint
522
+ <li>'N': free constraint
523
+ </ul>
524
+ */
525
+ virtual const char * getRowSense() const = 0;
526
+
527
+ /*! \brief Get a pointer to an array[getNumRows()] of row right-hand sides
528
+
529
+ <ul>
530
+ <li> if getRowSense()[i] == 'L' then
531
+ getRightHandSide()[i] == getRowUpper()[i]
532
+ <li> if getRowSense()[i] == 'G' then
533
+ getRightHandSide()[i] == getRowLower()[i]
534
+ <li> if getRowSense()[i] == 'R' then
535
+ getRightHandSide()[i] == getRowUpper()[i]
536
+ <li> if getRowSense()[i] == 'N' then
537
+ getRightHandSide()[i] == 0.0
538
+ </ul>
539
+ */
540
+ virtual const double * getRightHandSide() const = 0;
541
+
542
+ /*! \brief Get a pointer to an array[getNumRows()] of row ranges.
543
+
544
+ <ul>
545
+ <li> if getRowSense()[i] == 'R' then
546
+ getRowRange()[i] == getRowUpper()[i] - getRowLower()[i]
547
+ <li> if getRowSense()[i] != 'R' then
548
+ getRowRange()[i] is 0.0
549
+ </ul>
550
+ */
551
+ virtual const double * getRowRange() const = 0;
552
+
553
+ /// Get a pointer to an array[getNumRows()] of row lower bounds
554
+ virtual const double * getRowLower() const = 0;
555
+
556
+ /// Get a pointer to an array[getNumRows()] of row upper bounds
557
+ virtual const double * getRowUpper() const = 0;
558
+
559
+ /*! \brief Get a pointer to an array[getNumCols()] of objective
560
+ function coefficients.
561
+ */
562
+ virtual const double * getObjCoefficients() const = 0;
563
+
564
+ /*! \brief Get the objective function sense
565
+
566
+ - 1 for minimisation (default)
567
+ - -1 for maximisation
568
+ */
569
+ virtual double getObjSense() const = 0;
570
+
571
+ /// Return true if the variable is continuous
572
+ virtual bool isContinuous(int colIndex) const = 0;
573
+
574
+ /// Return true if the variable is binary
575
+ virtual bool isBinary(int colIndex) const;
576
+
577
+ /*! \brief Return true if the variable is integer.
578
+
579
+ This method returns true if the variable is binary or general integer.
580
+ */
581
+ virtual bool isInteger(int colIndex) const;
582
+
583
+ /// Return true if the variable is general integer
584
+ virtual bool isIntegerNonBinary(int colIndex) const;
585
+
586
+ /// Return true if the variable is binary and not fixed
587
+ virtual bool isFreeBinary(int colIndex) const;
588
+
589
+ /*! \brief Return an array[getNumCols()] of column types
590
+
591
+ \deprecated See #getColType
592
+ */
593
+ inline const char *columnType(bool refresh=false) const
594
+ { return getColType(refresh); }
595
+
596
+ /*! \brief Return an array[getNumCols()] of column types
597
+
598
+ - 0 - continuous
599
+ - 1 - binary
600
+ - 2 - general integer
601
+
602
+ If \p refresh is true, the classification of integer variables as
603
+ binary or general integer will be reevaluated. If the current bounds
604
+ are [0,1], or if the variable is fixed at 0 or 1, it will be classified
605
+ as binary, otherwise it will be classified as general integer.
606
+ */
607
+ virtual const char * getColType(bool refresh=false) const;
608
+
609
+ /// Get a pointer to a row-wise copy of the matrix
610
+ virtual const CoinPackedMatrix * getMatrixByRow() const = 0;
611
+
612
+ /// Get a pointer to a column-wise copy of the matrix
613
+ virtual const CoinPackedMatrix * getMatrixByCol() const = 0;
614
+
615
+ /*! \brief Get a pointer to a mutable row-wise copy of the matrix.
616
+
617
+ Returns NULL if the request is not meaningful (i.e., the OSI will not
618
+ recognise any modifications to the matrix).
619
+ */
620
+ virtual CoinPackedMatrix * getMutableMatrixByRow() const {return NULL;}
621
+
622
+ /*! \brief Get a pointer to a mutable column-wise copy of the matrix
623
+
624
+ Returns NULL if the request is not meaningful (i.e., the OSI will not
625
+ recognise any modifications to the matrix).
626
+ */
627
+ virtual CoinPackedMatrix * getMutableMatrixByCol() const {return NULL;}
628
+
629
+ /// Get the solver's value for infinity
630
+ virtual double getInfinity() const = 0;
631
+ //@}
632
+
633
+ /**@name Solution query methods */
634
+ //@{
635
+ /// Get a pointer to an array[getNumCols()] of primal variable values
636
+ virtual const double * getColSolution() const = 0;
637
+
638
+ /** Get a pointer to an array[getNumCols()] of primal variable values
639
+ guaranteed to be between the column lower and upper bounds.
640
+ */
641
+ virtual const double * getStrictColSolution();
642
+
643
+ /// Get pointer to array[getNumRows()] of dual variable values
644
+ virtual const double * getRowPrice() const = 0;
645
+
646
+ /// Get a pointer to an array[getNumCols()] of reduced costs
647
+ virtual const double * getReducedCost() const = 0;
648
+
649
+ /** Get a pointer to array[getNumRows()] of row activity levels.
650
+
651
+ The row activity for a row is the left-hand side evaluated at the
652
+ current solution.
653
+ */
654
+ virtual const double * getRowActivity() const = 0;
655
+
656
+ /// Get the objective function value.
657
+ virtual double getObjValue() const = 0;
658
+
659
+ /** Get the number of iterations it took to solve the problem (whatever
660
+ `iteration' means to the solver).
661
+ */
662
+ virtual int getIterationCount() const = 0;
663
+
664
+ /** Get as many dual rays as the solver can provide. In case of proven
665
+ primal infeasibility there should (with high probability) be at least
666
+ one.
667
+
668
+ The first getNumRows() ray components will always be associated with
669
+ the row duals (as returned by getRowPrice()). If \c fullRay is true,
670
+ the final getNumCols() entries will correspond to the ray components
671
+ associated with the nonbasic variables. If the full ray is requested
672
+ and the method cannot provide it, it will throw an exception.
673
+
674
+ \note
675
+ Implementors of solver interfaces note that the double pointers in
676
+ the vector should point to arrays of length getNumRows() (fullRay =
677
+ false) or (getNumRows()+getNumCols()) (fullRay = true) and they should
678
+ be allocated with new[].
679
+
680
+ \note
681
+ Clients of solver interfaces note that it is the client's
682
+ responsibility to free the double pointers in the vector using
683
+ delete[]. Clients are reminded that a problem can be dual and primal
684
+ infeasible.
685
+ */
686
+ virtual std::vector<double*> getDualRays(int maxNumRays,
687
+ bool fullRay = false) const = 0;
688
+
689
+ /** Get as many primal rays as the solver can provide. In case of proven
690
+ dual infeasibility there should (with high probability) be at least
691
+ one.
692
+
693
+ \note
694
+ Implementors of solver interfaces note that the double pointers in
695
+ the vector should point to arrays of length getNumCols() and they
696
+ should be allocated with new[].
697
+
698
+ \note
699
+ Clients of solver interfaces note that it is the client's
700
+ responsibility to free the double pointers in the vector using
701
+ delete[]. Clients are reminded that a problem can be dual and primal
702
+ infeasible.
703
+ */
704
+ virtual std::vector<double*> getPrimalRays(int maxNumRays) const = 0;
705
+
706
+ /** Get vector of indices of primal variables which are integer variables
707
+ but have fractional values in the current solution. */
708
+ virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05)
709
+ const;
710
+ //@}
711
+
712
+ //-------------------------------------------------------------------------
713
+ /**@name Methods to modify the objective, bounds, and solution
714
+
715
+ For functions which take a set of indices as parameters
716
+ (\c setObjCoeffSet(), \c setColSetBounds(), \c setRowSetBounds(),
717
+ \c setRowSetTypes()), the parameters follow the C++ STL iterator
718
+ convention: \c indexFirst points to the first index in the
719
+ set, and \c indexLast points to a position one past the last index
720
+ in the set.
721
+
722
+ */
723
+ //@{
724
+ /** Set an objective function coefficient */
725
+ virtual void setObjCoeff( int elementIndex, double elementValue ) = 0;
726
+
727
+ /** Set a set of objective function coefficients */
728
+ virtual void setObjCoeffSet(const int* indexFirst,
729
+ const int* indexLast,
730
+ const double* coeffList);
731
+
732
+ /** Set the objective coefficients for all columns.
733
+
734
+ array [getNumCols()] is an array of values for the objective.
735
+ This defaults to a series of set operations and is here for speed.
736
+ */
737
+ virtual void setObjective(const double * array);
738
+
739
+ /** Set the objective function sense.
740
+
741
+ Use 1 for minimisation (default), -1 for maximisation.
742
+
743
+ \note
744
+ Implementors note that objective function sense is a parameter of
745
+ the OSI, not a property of the problem. Objective sense can be
746
+ set prior to problem load and should not be affected by loading a
747
+ new problem.
748
+ */
749
+ virtual void setObjSense(double s) = 0;
750
+
751
+
752
+ /** Set a single column lower bound.
753
+ Use -getInfinity() for -infinity. */
754
+ virtual void setColLower( int elementIndex, double elementValue ) = 0;
755
+
756
+ /** Set the lower bounds for all columns.
757
+
758
+ array [getNumCols()] is an array of values for the lower bounds.
759
+ This defaults to a series of set operations and is here for speed.
760
+ */
761
+ virtual void setColLower(const double * array);
762
+
763
+ /** Set a single column upper bound.
764
+ Use getInfinity() for infinity. */
765
+ virtual void setColUpper( int elementIndex, double elementValue ) = 0;
766
+
767
+ /** Set the upper bounds for all columns.
768
+
769
+ array [getNumCols()] is an array of values for the upper bounds.
770
+ This defaults to a series of set operations and is here for speed.
771
+ */
772
+ virtual void setColUpper(const double * array);
773
+
774
+
775
+ /** Set a single column lower and upper bound.
776
+ The default implementation just invokes setColLower() and
777
+ setColUpper() */
778
+ virtual void setColBounds( int elementIndex,
779
+ double lower, double upper ) {
780
+ setColLower(elementIndex, lower);
781
+ setColUpper(elementIndex, upper);
782
+ }
783
+
784
+ /** Set the upper and lower bounds of a set of columns.
785
+
786
+ The default implementation just invokes setColBounds() over and over
787
+ again. For each column, boundList must contain both a lower and
788
+ upper bound, in that order.
789
+ */
790
+ virtual void setColSetBounds(const int* indexFirst,
791
+ const int* indexLast,
792
+ const double* boundList);
793
+
794
+ /** Set a single row lower bound.
795
+ Use -getInfinity() for -infinity. */
796
+ virtual void setRowLower( int elementIndex, double elementValue ) = 0;
797
+
798
+ /** Set a single row upper bound.
799
+ Use getInfinity() for infinity. */
800
+ virtual void setRowUpper( int elementIndex, double elementValue ) = 0;
801
+
802
+ /** Set a single row lower and upper bound.
803
+ The default implementation just invokes setRowLower() and
804
+ setRowUpper() */
805
+ virtual void setRowBounds( int elementIndex,
806
+ double lower, double upper ) {
807
+ setRowLower(elementIndex, lower);
808
+ setRowUpper(elementIndex, upper);
809
+ }
810
+
811
+ /** Set the bounds on a set of rows.
812
+
813
+ The default implementation just invokes setRowBounds() over and over
814
+ again. For each row, boundList must contain both a lower and
815
+ upper bound, in that order.
816
+ */
817
+ virtual void setRowSetBounds(const int* indexFirst,
818
+ const int* indexLast,
819
+ const double* boundList);
820
+
821
+
822
+ /** Set the type of a single row */
823
+ virtual void setRowType(int index, char sense, double rightHandSide,
824
+ double range) = 0;
825
+
826
+ /** Set the type of a set of rows.
827
+ The default implementation just invokes setRowType()
828
+ over and over again.
829
+ */
830
+ virtual void setRowSetTypes(const int* indexFirst,
831
+ const int* indexLast,
832
+ const char* senseList,
833
+ const double* rhsList,
834
+ const double* rangeList);
835
+
836
+ /** Set the primal solution variable values
837
+
838
+ colsol[getNumCols()] is an array of values for the primal variables.
839
+ These values are copied to memory owned by the solver interface
840
+ object or the solver. They will be returned as the result of
841
+ getColSolution() until changed by another call to setColSolution() or
842
+ by a call to any solver routine. Whether the solver makes use of the
843
+ solution in any way is solver-dependent.
844
+ */
845
+ virtual void setColSolution(const double *colsol) = 0;
846
+
847
+ /** Set dual solution variable values
848
+
849
+ rowprice[getNumRows()] is an array of values for the dual variables.
850
+ These values are copied to memory owned by the solver interface
851
+ object or the solver. They will be returned as the result of
852
+ getRowPrice() until changed by another call to setRowPrice() or by a
853
+ call to any solver routine. Whether the solver makes use of the
854
+ solution in any way is solver-dependent.
855
+ */
856
+ virtual void setRowPrice(const double * rowprice) = 0;
857
+
858
+ /** Fix variables at bound based on reduced cost
859
+
860
+ For variables currently at bound, fix the variable at bound if the
861
+ reduced cost exceeds the gap. Return the number of variables fixed.
862
+
863
+ If justInteger is set to false, the routine will also fix continuous
864
+ variables, but the test still assumes a delta of 1.0.
865
+ */
866
+ virtual int reducedCostFix(double gap, bool justInteger=true);
867
+ //@}
868
+
869
+ //-------------------------------------------------------------------------
870
+ /**@name Methods to set variable type */
871
+ //@{
872
+ /** Set the index-th variable to be a continuous variable */
873
+ virtual void setContinuous(int index) = 0;
874
+ /** Set the index-th variable to be an integer variable */
875
+ virtual void setInteger(int index) = 0;
876
+ /** Set the variables listed in indices (which is of length len) to be
877
+ continuous variables */
878
+ virtual void setContinuous(const int* indices, int len);
879
+ /** Set the variables listed in indices (which is of length len) to be
880
+ integer variables */
881
+ virtual void setInteger(const int* indices, int len);
882
+ //@}
883
+ //-------------------------------------------------------------------------
884
+
885
+ //-------------------------------------------------------------------------
886
+
887
+ /*! \brief Data type for name vectors. */
888
+ typedef std::vector<std::string> OsiNameVec ;
889
+
890
+ /*! \name Methods for row and column names
891
+
892
+ Osi defines three name management disciplines: `auto names' (0), `lazy
893
+ names' (1), and `full names' (2). See the description of
894
+ #OsiNameDiscipline for details. Changing the name discipline (via
895
+ setIntParam()) will not automatically add or remove name information,
896
+ but setting the discipline to auto will make existing information
897
+ inaccessible until the discipline is reset to lazy or full.
898
+
899
+ By definition, a row index of getNumRows() (<i>i.e.</i>, one larger than
900
+ the largest valid row index) refers to the objective function.
901
+
902
+ OSI users and implementors: While the OSI base class can define an
903
+ interface and provide rudimentary support, use of names really depends
904
+ on support by the OsiXXX class to ensure that names are managed
905
+ correctly. If an OsiXXX class does not support names, it should return
906
+ false for calls to getIntParam() or setIntParam() that reference
907
+ OsiNameDiscipline.
908
+ */
909
+ //@{
910
+
911
+ /*! \brief Generate a standard name of the form Rnnnnnnn or Cnnnnnnn
912
+
913
+ Set \p rc to 'r' for a row name, 'c' for a column name.
914
+ The `nnnnnnn' part is generated from ndx and will contain 7 digits
915
+ by default, padded with zeros if necessary. As a special case,
916
+ ndx = getNumRows() is interpreted as a request for the name of the
917
+ objective function. OBJECTIVE is returned, truncated to digits+1
918
+ characters to match the row and column names.
919
+ */
920
+ virtual std::string dfltRowColName(char rc,
921
+ int ndx, unsigned digits = 7) const ;
922
+
923
+ /*! \brief Return the name of the objective function */
924
+
925
+ virtual std::string getObjName (unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
926
+
927
+ /*! \brief Set the name of the objective function */
928
+
929
+ virtual inline void setObjName (std::string name)
930
+ { objName_ = name ; }
931
+
932
+ /*! \brief Return the name of the row.
933
+
934
+ The routine will <i>always</i> return some name, regardless of the name
935
+ discipline or the level of support by an OsiXXX derived class. Use
936
+ maxLen to limit the length.
937
+ */
938
+ virtual std::string getRowName(int rowIndex,
939
+ unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
940
+
941
+ /*! \brief Return a pointer to a vector of row names
942
+
943
+ If the name discipline (#OsiNameDiscipline) is auto, the return value
944
+ will be a vector of length zero. If the name discipline is lazy, the
945
+ vector will contain only names supplied by the client and will be no
946
+ larger than needed to hold those names; entries not supplied will be
947
+ null strings. In particular, the objective name is <i>not</i>
948
+ included in the vector for lazy names. If the name discipline is
949
+ full, the vector will have getNumRows() names, either supplied or
950
+ generated, plus one additional entry for the objective name.
951
+ */
952
+ virtual const OsiNameVec &getRowNames() ;
953
+
954
+ /*! \brief Set a row name
955
+
956
+ Quietly does nothing if the name discipline (#OsiNameDiscipline) is
957
+ auto. Quietly fails if the row index is invalid.
958
+ */
959
+ virtual void setRowName(int ndx, std::string name) ;
960
+
961
+ /*! \brief Set multiple row names
962
+
963
+ The run of len entries starting at srcNames[srcStart] are installed as
964
+ row names starting at row index tgtStart. The base class implementation
965
+ makes repeated calls to setRowName.
966
+ */
967
+ virtual void setRowNames(OsiNameVec &srcNames,
968
+ int srcStart, int len, int tgtStart) ;
969
+
970
+ /*! \brief Delete len row names starting at index tgtStart
971
+
972
+ The specified row names are removed and the remaining row names are
973
+ copied down to close the gap.
974
+ */
975
+ virtual void deleteRowNames(int tgtStart, int len) ;
976
+
977
+ /*! \brief Return the name of the column
978
+
979
+ The routine will <i>always</i> return some name, regardless of the name
980
+ discipline or the level of support by an OsiXXX derived class. Use
981
+ maxLen to limit the length.
982
+ */
983
+ virtual std::string getColName(int colIndex,
984
+ unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
985
+
986
+ /*! \brief Return a pointer to a vector of column names
987
+
988
+ If the name discipline (#OsiNameDiscipline) is auto, the return value
989
+ will be a vector of length zero. If the name discipline is lazy, the
990
+ vector will contain only names supplied by the client and will be no
991
+ larger than needed to hold those names; entries not supplied will be
992
+ null strings. If the name discipline is full, the vector will have
993
+ getNumCols() names, either supplied or generated.
994
+ */
995
+ virtual const OsiNameVec &getColNames() ;
996
+
997
+ /*! \brief Set a column name
998
+
999
+ Quietly does nothing if the name discipline (#OsiNameDiscipline) is
1000
+ auto. Quietly fails if the column index is invalid.
1001
+ */
1002
+ virtual void setColName(int ndx, std::string name) ;
1003
+
1004
+ /*! \brief Set multiple column names
1005
+
1006
+ The run of len entries starting at srcNames[srcStart] are installed as
1007
+ column names starting at column index tgtStart. The base class
1008
+ implementation makes repeated calls to setColName.
1009
+ */
1010
+ virtual void setColNames(OsiNameVec &srcNames,
1011
+ int srcStart, int len, int tgtStart) ;
1012
+
1013
+ /*! \brief Delete len column names starting at index tgtStart
1014
+
1015
+ The specified column names are removed and the remaining column names
1016
+ are copied down to close the gap.
1017
+ */
1018
+ virtual void deleteColNames(int tgtStart, int len) ;
1019
+
1020
+
1021
+ /*! \brief Set row and column names from a CoinMpsIO object.
1022
+
1023
+ Also sets the name of the objective function. If the name discipline
1024
+ is auto, you get what you asked for. This routine does not use
1025
+ setRowName or setColName.
1026
+ */
1027
+ void setRowColNames(const CoinMpsIO &mps) ;
1028
+
1029
+ /*! \brief Set row and column names from a CoinModel object.
1030
+
1031
+ If the name discipline is auto, you get what you asked for.
1032
+ This routine does not use setRowName or setColName.
1033
+ */
1034
+ void setRowColNames(CoinModel &mod) ;
1035
+
1036
+ /*! \brief Set row and column names from a CoinLpIO object.
1037
+
1038
+ Also sets the name of the objective function. If the name discipline is
1039
+ auto, you get what you asked for. This routine does not use setRowName
1040
+ or setColName.
1041
+ */
1042
+ void setRowColNames(CoinLpIO &mod) ;
1043
+
1044
+ //@}
1045
+ //-------------------------------------------------------------------------
1046
+
1047
+ //-------------------------------------------------------------------------
1048
+ /**@name Methods to modify the constraint system.
1049
+
1050
+ Note that new columns are added as continuous variables.
1051
+ */
1052
+ //@{
1053
+
1054
+ /** Add a column (primal variable) to the problem. */
1055
+ virtual void addCol(const CoinPackedVectorBase& vec,
1056
+ const double collb, const double colub,
1057
+ const double obj) = 0;
1058
+
1059
+ /*! \brief Add a named column (primal variable) to the problem.
1060
+
1061
+ The default implementation adds the column, then changes the name. This
1062
+ can surely be made more efficient within an OsiXXX class.
1063
+ */
1064
+ virtual void addCol(const CoinPackedVectorBase& vec,
1065
+ const double collb, const double colub,
1066
+ const double obj, std::string name) ;
1067
+
1068
+ /** Add a column (primal variable) to the problem. */
1069
+ virtual void addCol(int numberElements,
1070
+ const int* rows, const double* elements,
1071
+ const double collb, const double colub,
1072
+ const double obj) ;
1073
+
1074
+ /*! \brief Add a named column (primal variable) to the problem.
1075
+
1076
+ The default implementation adds the column, then changes the name. This
1077
+ can surely be made more efficient within an OsiXXX class.
1078
+ */
1079
+ virtual void addCol(int numberElements,
1080
+ const int* rows, const double* elements,
1081
+ const double collb, const double colub,
1082
+ const double obj, std::string name) ;
1083
+
1084
+ /** Add a set of columns (primal variables) to the problem.
1085
+
1086
+ The default implementation simply makes repeated calls to
1087
+ addCol().
1088
+ */
1089
+ virtual void addCols(const int numcols,
1090
+ const CoinPackedVectorBase * const * cols,
1091
+ const double* collb, const double* colub,
1092
+ const double* obj);
1093
+
1094
+ /** Add a set of columns (primal variables) to the problem.
1095
+
1096
+ The default implementation simply makes repeated calls to
1097
+ addCol().
1098
+ */
1099
+ virtual void addCols(const int numcols, const int* columnStarts,
1100
+ const int* rows, const double* elements,
1101
+ const double* collb, const double* colub,
1102
+ const double* obj);
1103
+
1104
+ /// Add columns using a CoinBuild object
1105
+ void addCols(const CoinBuild & buildObject);
1106
+
1107
+ /** Add columns from a model object. returns
1108
+ -1 if object in bad state (i.e. has row information)
1109
+ otherwise number of errors
1110
+ modelObject non const as can be regularized as part of build
1111
+ */
1112
+ int addCols(CoinModel & modelObject);
1113
+
1114
+ #if 0
1115
+ /** */
1116
+ virtual void addCols(const CoinPackedMatrix& matrix,
1117
+ const double* collb, const double* colub,
1118
+ const double* obj);
1119
+ #endif
1120
+
1121
+ /** \brief Remove a set of columns (primal variables) from the
1122
+ problem.
1123
+
1124
+ The solver interface for a basis-oriented solver will maintain valid
1125
+ warm start information if all deleted variables are nonbasic.
1126
+ */
1127
+ virtual void deleteCols(const int num, const int * colIndices) = 0;
1128
+
1129
+ /*! \brief Add a row (constraint) to the problem. */
1130
+ virtual void addRow(const CoinPackedVectorBase& vec,
1131
+ const double rowlb, const double rowub) = 0;
1132
+
1133
+ /*! \brief Add a named row (constraint) to the problem.
1134
+
1135
+ The default implementation adds the row, then changes the name. This
1136
+ can surely be made more efficient within an OsiXXX class.
1137
+ */
1138
+ virtual void addRow(const CoinPackedVectorBase& vec,
1139
+ const double rowlb, const double rowub,
1140
+ std::string name) ;
1141
+
1142
+ /*! \brief Add a row (constraint) to the problem. */
1143
+ virtual void addRow(const CoinPackedVectorBase& vec,
1144
+ const char rowsen, const double rowrhs,
1145
+ const double rowrng) = 0;
1146
+
1147
+ /*! \brief Add a named row (constraint) to the problem.
1148
+
1149
+ The default implementation adds the row, then changes the name. This
1150
+ can surely be made more efficient within an OsiXXX class.
1151
+ */
1152
+ virtual void addRow(const CoinPackedVectorBase& vec,
1153
+ const char rowsen, const double rowrhs,
1154
+ const double rowrng, std::string name) ;
1155
+
1156
+ /*! Add a row (constraint) to the problem.
1157
+
1158
+ Converts to addRow(CoinPackedVectorBase&,const double,const double).
1159
+ */
1160
+ virtual void addRow(int numberElements,
1161
+ const int *columns, const double *element,
1162
+ const double rowlb, const double rowub) ;
1163
+
1164
+ /*! Add a set of rows (constraints) to the problem.
1165
+
1166
+ The default implementation simply makes repeated calls to
1167
+ addRow().
1168
+ */
1169
+ virtual void addRows(const int numrows,
1170
+ const CoinPackedVectorBase * const * rows,
1171
+ const double* rowlb, const double* rowub);
1172
+
1173
+ /** Add a set of rows (constraints) to the problem.
1174
+
1175
+ The default implementation simply makes repeated calls to
1176
+ addRow().
1177
+ */
1178
+ virtual void addRows(const int numrows,
1179
+ const CoinPackedVectorBase * const * rows,
1180
+ const char* rowsen, const double* rowrhs,
1181
+ const double* rowrng);
1182
+
1183
+ /** Add a set of rows (constraints) to the problem.
1184
+
1185
+ The default implementation simply makes repeated calls to
1186
+ addRow().
1187
+ */
1188
+ virtual void addRows(const int numrows, const int *rowStarts,
1189
+ const int *columns, const double *element,
1190
+ const double *rowlb, const double *rowub);
1191
+
1192
+ /// Add rows using a CoinBuild object
1193
+ void addRows(const CoinBuild &buildObject);
1194
+
1195
+ /*! Add rows from a CoinModel object.
1196
+
1197
+ Returns -1 if the object is in the wrong state (<i>i.e.</i>, has
1198
+ column-major information), otherwise the number of errors.
1199
+
1200
+ The modelObject is not const as it can be regularized as part of
1201
+ the build.
1202
+ */
1203
+ int addRows(CoinModel &modelObject);
1204
+
1205
+ #if 0
1206
+ /** */
1207
+ virtual void addRows(const CoinPackedMatrix& matrix,
1208
+ const double* rowlb, const double* rowub);
1209
+ /** */
1210
+ virtual void addRows(const CoinPackedMatrix& matrix,
1211
+ const char* rowsen, const double* rowrhs,
1212
+ const double* rowrng);
1213
+ #endif
1214
+
1215
+ /** \brief Delete a set of rows (constraints) from the problem.
1216
+
1217
+ The solver interface for a basis-oriented solver will maintain valid
1218
+ warm start information if all deleted rows are loose.
1219
+ */
1220
+ virtual void deleteRows(const int num, const int * rowIndices) = 0;
1221
+
1222
+ /** \brief Replace the constraint matrix
1223
+
1224
+ I (JJF) am getting annoyed because I can't just replace a matrix.
1225
+ The default behavior of this is do nothing so only use where that would
1226
+ not matter, e.g. strengthening a matrix for MIP.
1227
+ */
1228
+ virtual void replaceMatrixOptional(const CoinPackedMatrix & ) {}
1229
+
1230
+ /** \brief Replace the constraint matrix
1231
+
1232
+ And if it does matter (not used at present)
1233
+ */
1234
+ virtual void replaceMatrix(const CoinPackedMatrix & ) {abort();}
1235
+
1236
+ /** \brief Save a copy of the base model
1237
+
1238
+ If solver wants it can save a copy of "base" (continuous) model here.
1239
+ */
1240
+ virtual void saveBaseModel() {}
1241
+
1242
+ /** \brief Reduce the constraint system to the specified number of
1243
+ constraints.
1244
+
1245
+ If solver wants it can restore a copy of "base" (continuous) model
1246
+ here.
1247
+
1248
+ \note
1249
+ The name is somewhat misleading. Implementors should consider
1250
+ the opportunity to optimise behaviour in the common case where
1251
+ \p numberRows is exactly the number of original constraints. Do not,
1252
+ however, neglect the possibility that \p numberRows does not equal
1253
+ the number of original constraints.
1254
+ */
1255
+ virtual void restoreBaseModel(int numberRows);
1256
+ //-----------------------------------------------------------------------
1257
+ /** Apply a collection of cuts.
1258
+
1259
+ Only cuts which have an <code>effectiveness >= effectivenessLb</code>
1260
+ are applied.
1261
+ <ul>
1262
+ <li> ReturnCode.getNumineffective() -- number of cuts which were
1263
+ not applied because they had an
1264
+ <code>effectiveness < effectivenessLb</code>
1265
+ <li> ReturnCode.getNuminconsistent() -- number of invalid cuts
1266
+ <li> ReturnCode.getNuminconsistentWrtIntegerModel() -- number of
1267
+ cuts that are invalid with respect to this integer model
1268
+ <li> ReturnCode.getNuminfeasible() -- number of cuts that would
1269
+ make this integer model infeasible
1270
+ <li> ReturnCode.getNumApplied() -- number of integer cuts which
1271
+ were applied to the integer model
1272
+ <li> cs.size() == getNumineffective() +
1273
+ getNuminconsistent() +
1274
+ getNuminconsistentWrtIntegerModel() +
1275
+ getNuminfeasible() +
1276
+ getNumApplied()
1277
+ </ul>
1278
+ */
1279
+ virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs,
1280
+ double effectivenessLb = 0.0);
1281
+
1282
+ /** Apply a collection of row cuts which are all effective.
1283
+ applyCuts seems to do one at a time which seems inefficient.
1284
+ Would be even more efficient to pass an array of pointers.
1285
+ */
1286
+ virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts);
1287
+
1288
+ /** Apply a collection of row cuts which are all effective.
1289
+ This is passed in as an array of pointers.
1290
+ */
1291
+ virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts);
1292
+
1293
+ /// Deletes branching information before columns deleted
1294
+ void deleteBranchingInfo(int numberDeleted, const int * which);
1295
+
1296
+ //@}
1297
+
1298
+ //---------------------------------------------------------------------------
1299
+
1300
+ /**@name Methods for problem input and output */
1301
+ //@{
1302
+ /*! \brief Load in a problem by copying the arguments. The constraints on
1303
+ the rows are given by lower and upper bounds.
1304
+
1305
+ If a pointer is 0 then the following values are the default:
1306
+ <ul>
1307
+ <li> <code>colub</code>: all columns have upper bound infinity
1308
+ <li> <code>collb</code>: all columns have lower bound 0
1309
+ <li> <code>rowub</code>: all rows have upper bound infinity
1310
+ <li> <code>rowlb</code>: all rows have lower bound -infinity
1311
+ <li> <code>obj</code>: all variables have 0 objective coefficient
1312
+ </ul>
1313
+
1314
+ Note that the default values for rowub and rowlb produce the
1315
+ constraint -infty <= ax <= infty. This is probably not what you want.
1316
+ */
1317
+ virtual void loadProblem (const CoinPackedMatrix& matrix,
1318
+ const double* collb, const double* colub,
1319
+ const double* obj,
1320
+ const double* rowlb, const double* rowub) = 0;
1321
+
1322
+ /*! \brief Load in a problem by assuming ownership of the arguments.
1323
+ The constraints on the rows are given by lower and upper bounds.
1324
+
1325
+ For default argument values see the matching loadProblem method.
1326
+
1327
+ \warning
1328
+ The arguments passed to this method will be freed using the
1329
+ C++ <code>delete</code> and <code>delete[]</code> functions.
1330
+ */
1331
+ virtual void assignProblem (CoinPackedMatrix*& matrix,
1332
+ double*& collb, double*& colub, double*& obj,
1333
+ double*& rowlb, double*& rowub) = 0;
1334
+
1335
+ /*! \brief Load in a problem by copying the arguments.
1336
+ The constraints on the rows are given by sense/rhs/range triplets.
1337
+
1338
+ If a pointer is 0 then the following values are the default:
1339
+ <ul>
1340
+ <li> <code>colub</code>: all columns have upper bound infinity
1341
+ <li> <code>collb</code>: all columns have lower bound 0
1342
+ <li> <code>obj</code>: all variables have 0 objective coefficient
1343
+ <li> <code>rowsen</code>: all rows are >=
1344
+ <li> <code>rowrhs</code>: all right hand sides are 0
1345
+ <li> <code>rowrng</code>: 0 for the ranged rows
1346
+ </ul>
1347
+
1348
+ Note that the default values for rowsen, rowrhs, and rowrng produce the
1349
+ constraint ax >= 0.
1350
+ */
1351
+ virtual void loadProblem (const CoinPackedMatrix& matrix,
1352
+ const double* collb, const double* colub,
1353
+ const double* obj,
1354
+ const char* rowsen, const double* rowrhs,
1355
+ const double* rowrng) = 0;
1356
+
1357
+ /*! \brief Load in a problem by assuming ownership of the arguments.
1358
+ The constraints on the rows are given by sense/rhs/range triplets.
1359
+
1360
+ For default argument values see the matching loadProblem method.
1361
+
1362
+ \warning
1363
+ The arguments passed to this method will be freed using the
1364
+ C++ <code>delete</code> and <code>delete[]</code> functions.
1365
+ */
1366
+ virtual void assignProblem (CoinPackedMatrix*& matrix,
1367
+ double*& collb, double*& colub, double*& obj,
1368
+ char*& rowsen, double*& rowrhs,
1369
+ double*& rowrng) = 0;
1370
+
1371
+ /*! \brief Load in a problem by copying the arguments. The constraint
1372
+ matrix is is specified with standard column-major
1373
+ column starts / row indices / coefficients vectors.
1374
+ The constraints on the rows are given by lower and upper bounds.
1375
+
1376
+ The matrix vectors must be gap-free. Note that <code>start</code> must
1377
+ have <code>numcols+1</code> entries so that the length of the last column
1378
+ can be calculated as <code>start[numcols]-start[numcols-1]</code>.
1379
+
1380
+ See the previous loadProblem method using rowlb and rowub for default
1381
+ argument values.
1382
+ */
1383
+ virtual void loadProblem (const int numcols, const int numrows,
1384
+ const CoinBigIndex * start, const int* index,
1385
+ const double* value,
1386
+ const double* collb, const double* colub,
1387
+ const double* obj,
1388
+ const double* rowlb, const double* rowub) = 0;
1389
+
1390
+ /*! \brief Load in a problem by copying the arguments. The constraint
1391
+ matrix is is specified with standard column-major
1392
+ column starts / row indices / coefficients vectors.
1393
+ The constraints on the rows are given by sense/rhs/range triplets.
1394
+
1395
+ The matrix vectors must be gap-free. Note that <code>start</code> must
1396
+ have <code>numcols+1</code> entries so that the length of the last column
1397
+ can be calculated as <code>start[numcols]-start[numcols-1]</code>.
1398
+
1399
+ See the previous loadProblem method using sense/rhs/range for default
1400
+ argument values.
1401
+ */
1402
+ virtual void loadProblem (const int numcols, const int numrows,
1403
+ const CoinBigIndex * start, const int* index,
1404
+ const double* value,
1405
+ const double* collb, const double* colub,
1406
+ const double* obj,
1407
+ const char* rowsen, const double* rowrhs,
1408
+ const double* rowrng) = 0;
1409
+
1410
+ /*! \brief Load a model from a CoinModel object. Return the number of
1411
+ errors encountered.
1412
+
1413
+ The modelObject parameter cannot be const as it may be changed as part
1414
+ of process. If keepSolution is true will try and keep warmStart.
1415
+ */
1416
+ virtual int loadFromCoinModel (CoinModel & modelObject,
1417
+ bool keepSolution=false);
1418
+
1419
+ /*! \brief Read a problem in MPS format from the given filename.
1420
+
1421
+ The default implementation uses CoinMpsIO::readMps() to read
1422
+ the MPS file and returns the number of errors encountered.
1423
+ */
1424
+ virtual int readMps (const char *filename,
1425
+ const char *extension = "mps") ;
1426
+
1427
+ /*! \brief Read a problem in MPS format from the given full filename.
1428
+
1429
+ This uses CoinMpsIO::readMps() to read the MPS file and returns the
1430
+ number of errors encountered. It also may return an array of set
1431
+ information
1432
+ */
1433
+ virtual int readMps (const char *filename, const char*extension,
1434
+ int & numberSets, CoinSet ** & sets);
1435
+
1436
+ /*! \brief Read a problem in GMPL format from the given filenames.
1437
+
1438
+ The default implementation uses CoinMpsIO::readGMPL(). This capability
1439
+ is available only if the third-party package Glpk is installed.
1440
+ */
1441
+ virtual int readGMPL (const char *filename, const char *dataname=NULL);
1442
+
1443
+ /*! \brief Write the problem in MPS format to the specified file.
1444
+
1445
+ If objSense is non-zero, a value of -1.0 causes the problem to be
1446
+ written with a maximization objective; +1.0 forces a minimization
1447
+ objective. If objSense is zero, the choice is left to the implementation.
1448
+ */
1449
+ virtual void writeMps (const char *filename,
1450
+ const char *extension = "mps",
1451
+ double objSense=0.0) const = 0;
1452
+
1453
+ /*! \brief Write the problem in MPS format to the specified file with
1454
+ more control over the output.
1455
+
1456
+ Row and column names may be null.
1457
+ formatType is
1458
+ <ul>
1459
+ <li> 0 - normal
1460
+ <li> 1 - extra accuracy
1461
+ <li> 2 - IEEE hex
1462
+ </ul>
1463
+
1464
+ Returns non-zero on I/O error
1465
+ */
1466
+ int writeMpsNative (const char *filename,
1467
+ const char ** rowNames, const char ** columnNames,
1468
+ int formatType=0,int numberAcross=2,
1469
+ double objSense=0.0, int numberSOS=0,
1470
+ const CoinSet * setInfo=NULL) const ;
1471
+
1472
+ /***********************************************************************/
1473
+ // Lp files
1474
+
1475
+ /** Write the problem into an Lp file of the given filename with the
1476
+ specified extension.
1477
+ Coefficients with value less than epsilon away from an integer value
1478
+ are written as integers.
1479
+ Write at most numberAcross monomials on a line.
1480
+ Write non integer numbers with decimals digits after the decimal point.
1481
+
1482
+ The written problem is always a minimization problem.
1483
+ If the current problem is a maximization problem, the
1484
+ intended objective function for the written problem is the current
1485
+ objective function multiplied by -1. If the current problem is a
1486
+ minimization problem, the intended objective function for the
1487
+ written problem is the current objective function.
1488
+ If objSense < 0, the intended objective function is multiplied by -1
1489
+ before writing the problem. It is left unchanged otherwise.
1490
+
1491
+ Write objective function name and constraint names if useRowNames is
1492
+ true. This version calls writeLpNative().
1493
+ */
1494
+ virtual void writeLp(const char *filename,
1495
+ const char *extension = "lp",
1496
+ double epsilon = 1e-5,
1497
+ int numberAcross = 10,
1498
+ int decimals = 5,
1499
+ double objSense = 0.0,
1500
+ bool useRowNames = true) const;
1501
+
1502
+ /** Write the problem into the file pointed to by the parameter fp.
1503
+ Other parameters are similar to
1504
+ those of writeLp() with first parameter filename.
1505
+ */
1506
+ virtual void writeLp(FILE *fp,
1507
+ double epsilon = 1e-5,
1508
+ int numberAcross = 10,
1509
+ int decimals = 5,
1510
+ double objSense = 0.0,
1511
+ bool useRowNames = true) const;
1512
+
1513
+ /** Write the problem into an Lp file. Parameters are similar to
1514
+ those of writeLp(), but in addition row names and column names
1515
+ may be given.
1516
+
1517
+ Parameter rowNames may be NULL, in which case default row names
1518
+ are used. If rowNames is not NULL, it must have exactly one entry
1519
+ per row in the problem and one additional
1520
+ entry (rowNames[getNumRows()] with the objective function name.
1521
+ These getNumRows()+1 entries must be distinct. If this is not the
1522
+ case, default row names
1523
+ are used. In addition, format restrictions are imposed on names
1524
+ (see CoinLpIO::is_invalid_name() for details).
1525
+
1526
+ Similar remarks can be made for the parameter columnNames which
1527
+ must either be NULL or have exactly getNumCols() distinct entries.
1528
+
1529
+ Write objective function name and constraint names if
1530
+ useRowNames is true. */
1531
+ int writeLpNative(const char *filename,
1532
+ char const * const * const rowNames,
1533
+ char const * const * const columnNames,
1534
+ const double epsilon = 1.0e-5,
1535
+ const int numberAcross = 10,
1536
+ const int decimals = 5,
1537
+ const double objSense = 0.0,
1538
+ const bool useRowNames = true) const;
1539
+
1540
+ /** Write the problem into the file pointed to by the parameter fp.
1541
+ Other parameters are similar to
1542
+ those of writeLpNative() with first parameter filename.
1543
+ */
1544
+ int writeLpNative(FILE *fp,
1545
+ char const * const * const rowNames,
1546
+ char const * const * const columnNames,
1547
+ const double epsilon = 1.0e-5,
1548
+ const int numberAcross = 10,
1549
+ const int decimals = 5,
1550
+ const double objSense = 0.0,
1551
+ const bool useRowNames = true) const;
1552
+
1553
+ /// Read file in LP format from file with name filename.
1554
+ /// See class CoinLpIO for description of this format.
1555
+ virtual int readLp(const char *filename, const double epsilon = 1e-5);
1556
+
1557
+ /// Read file in LP format from the file pointed to by fp.
1558
+ /// See class CoinLpIO for description of this format.
1559
+ int readLp(FILE *fp, const double epsilon = 1e-5);
1560
+
1561
+ //@}
1562
+
1563
+ //---------------------------------------------------------------------------
1564
+
1565
+ /**@name Miscellaneous */
1566
+ //@{
1567
+ /** Check two models against each other. Return nonzero if different.
1568
+ Ignore names if that set.
1569
+ (Note initial version does not check names)
1570
+ May modify both models by cleaning up
1571
+ */
1572
+ int differentModel(OsiSolverInterface & other,
1573
+ bool ignoreNames=true);
1574
+ #ifdef COIN_SNAPSHOT
1575
+ /// Return a CoinSnapshot
1576
+ virtual CoinSnapshot * snapshot(bool createArrays=true) const;
1577
+ #endif
1578
+ #ifdef COIN_FACTORIZATION_INFO
1579
+ /// Return number of entries in L part of current factorization
1580
+ virtual CoinBigIndex getSizeL() const;
1581
+ /// Return number of entries in U part of current factorization
1582
+ virtual CoinBigIndex getSizeU() const;
1583
+ #endif
1584
+ //@}
1585
+
1586
+ //---------------------------------------------------------------------------
1587
+
1588
+ /**@name Setting/Accessing application data */
1589
+ //@{
1590
+ /** Set application data.
1591
+
1592
+ This is a pointer that the application can store into and
1593
+ retrieve from the solver interface.
1594
+ This field is available for the application to optionally
1595
+ define and use.
1596
+ */
1597
+ void setApplicationData (void * appData);
1598
+ /** Create a clone of an Auxiliary Information object.
1599
+ The base class just stores an application data pointer
1600
+ but can be more general. Application data pointer is
1601
+ designed for one user while this can be extended to cope
1602
+ with more general extensions.
1603
+ */
1604
+ void setAuxiliaryInfo(OsiAuxInfo * auxiliaryInfo);
1605
+
1606
+ /// Get application data
1607
+ void * getApplicationData() const;
1608
+ /// Get pointer to auxiliary info object
1609
+ OsiAuxInfo * getAuxiliaryInfo() const;
1610
+ //@}
1611
+ //---------------------------------------------------------------------------
1612
+
1613
+ /**@name Message handling
1614
+
1615
+ See the COIN library documentation for additional information about
1616
+ COIN message facilities.
1617
+
1618
+ */
1619
+ //@{
1620
+ /** Pass in a message handler
1621
+
1622
+ It is the client's responsibility to destroy a message handler installed
1623
+ by this routine; it will not be destroyed when the solver interface is
1624
+ destroyed.
1625
+ */
1626
+ virtual void passInMessageHandler(CoinMessageHandler * handler);
1627
+ /// Set language
1628
+ void newLanguage(CoinMessages::Language language);
1629
+ inline void setLanguage(CoinMessages::Language language)
1630
+ {newLanguage(language);}
1631
+ /// Return a pointer to the current message handler
1632
+ inline CoinMessageHandler * messageHandler() const
1633
+ {return handler_;}
1634
+ /// Return the current set of messages
1635
+ inline CoinMessages messages()
1636
+ {return messages_;}
1637
+ /// Return a pointer to the current set of messages
1638
+ inline CoinMessages * messagesPointer()
1639
+ {return &messages_;}
1640
+ /// Return true if default handler
1641
+ inline bool defaultHandler() const
1642
+ { return defaultHandler_;}
1643
+ //@}
1644
+ //---------------------------------------------------------------------------
1645
+ /**@name Methods for dealing with discontinuities other than integers.
1646
+
1647
+ Osi should be able to know about SOS and other types. This is an optional
1648
+ section where such information can be stored.
1649
+
1650
+ */
1651
+ //@{
1652
+ /** \brief Identify integer variables and create corresponding objects.
1653
+
1654
+ Record integer variables and create an OsiSimpleInteger object for each
1655
+ one. All existing OsiSimpleInteger objects will be destroyed.
1656
+ If justCount then no objects created and we just store numberIntegers_
1657
+ */
1658
+
1659
+ void findIntegers(bool justCount);
1660
+ /** \brief Identify integer variables and SOS and create corresponding objects.
1661
+
1662
+ Record integer variables and create an OsiSimpleInteger object for each
1663
+ one. All existing OsiSimpleInteger objects will be destroyed.
1664
+ If the solver supports SOS then do the same for SOS.
1665
+
1666
+ If justCount then no objects created and we just store numberIntegers_
1667
+ Returns number of SOS
1668
+ */
1669
+
1670
+ virtual int findIntegersAndSOS(bool justCount);
1671
+ /// Get the number of objects
1672
+ inline int numberObjects() const { return numberObjects_;}
1673
+ /// Set the number of objects
1674
+ inline void setNumberObjects(int number)
1675
+ { numberObjects_=number;}
1676
+
1677
+ /// Get the array of objects
1678
+ inline OsiObject ** objects() const { return object_;}
1679
+
1680
+ /// Get the specified object
1681
+ const inline OsiObject * object(int which) const { return object_[which];}
1682
+ /// Get the specified object
1683
+ inline OsiObject * modifiableObject(int which) const { return object_[which];}
1684
+
1685
+ /// Delete all object information
1686
+ void deleteObjects();
1687
+
1688
+ /** Add in object information.
1689
+
1690
+ Objects are cloned; the owner can delete the originals.
1691
+ */
1692
+ void addObjects(int numberObjects, OsiObject ** objects);
1693
+ /** Use current solution to set bounds so current integer feasible solution will stay feasible.
1694
+ Only feasible bounds will be used, even if current solution outside bounds. The amount of
1695
+ such violation will be returned (and if small can be ignored)
1696
+ */
1697
+ double forceFeasible();
1698
+ //@}
1699
+ //---------------------------------------------------------------------------
1700
+
1701
+ /*! @name Methods related to testing generated cuts
1702
+
1703
+ See the documentation for OsiRowCutDebugger for additional details.
1704
+ */
1705
+ //@{
1706
+ /*! \brief Activate the row cut debugger.
1707
+
1708
+ If \p modelName is in the set of known models then all cuts are
1709
+ checked to see that they do NOT cut off the optimal solution known
1710
+ to the debugger.
1711
+ */
1712
+ virtual void activateRowCutDebugger (const char *modelName);
1713
+
1714
+ /*! \brief Activate the row cut debugger using a full solution array.
1715
+
1716
+
1717
+ Activate the debugger for a model not included in the debugger's
1718
+ internal database. Cuts will be checked to see that they do NOT
1719
+ cut off the given solution.
1720
+
1721
+ \p solution must be a full solution vector, but only the integer
1722
+ variables need to be correct. The debugger will fill in the continuous
1723
+ variables by solving an lp relaxation with the integer variables
1724
+ fixed as specified. If the given values for the continuous variables
1725
+ should be preserved, set \p keepContinuous to true.
1726
+ */
1727
+ virtual void activateRowCutDebugger(const double *solution,
1728
+ bool enforceOptimality = true);
1729
+
1730
+ /*! \brief Get the row cut debugger provided the solution known to the
1731
+ debugger is within the feasible region held in the solver.
1732
+
1733
+ If there is a row cut debugger object associated with model AND if
1734
+ the solution known to the debugger is within the solver's current
1735
+ feasible region (i.e., the column bounds held in the solver are
1736
+ compatible with the known solution) then a pointer to the debugger
1737
+ is returned which may be used to test validity of cuts.
1738
+
1739
+ Otherwise NULL is returned
1740
+ */
1741
+ const OsiRowCutDebugger *getRowCutDebugger() const;
1742
+
1743
+ /*! \brief Get the row cut debugger object
1744
+
1745
+ Return the row cut debugger object if it exists. One common usage of
1746
+ this method is to obtain a debugger object in order to execute
1747
+ OsiRowCutDebugger::redoSolution (so that the stored solution is again
1748
+ compatible with the problem held in the solver).
1749
+ */
1750
+ OsiRowCutDebugger * getRowCutDebuggerAlways() const;
1751
+ //@}
1752
+
1753
+ /*! \name OsiSimplexInterface
1754
+ \brief Simplex Interface
1755
+
1756
+ Methods for an advanced interface to a simplex solver. The interface
1757
+ comprises two groups of methods. Group 1 contains methods for tableau
1758
+ access. Group 2 contains methods for dictating individual simplex pivots.
1759
+ */
1760
+ //@{
1761
+
1762
+ /*! \brief Return the simplex implementation level.
1763
+
1764
+ The return codes are:
1765
+ - 0: the simplex interface is not implemented.
1766
+ - 1: the Group 1 (tableau access) methods are implemented.
1767
+ - 2: the Group 2 (pivoting) methods are implemented
1768
+
1769
+ The codes are cumulative - a solver which implements Group 2 also
1770
+ implements Group 1.
1771
+ */
1772
+ virtual int canDoSimplexInterface() const ;
1773
+ //@}
1774
+
1775
+ /*! \name OsiSimplex Group 1
1776
+ \brief Tableau access methods.
1777
+
1778
+ This group of methods provides access to rows and columns of the basis
1779
+ inverse and to rows and columns of the tableau.
1780
+ */
1781
+ //@{
1782
+
1783
+ /*! \brief Prepare the solver for the use of tableau access methods.
1784
+
1785
+ Prepares the solver for the use of the tableau access methods, if
1786
+ any such preparation is required.
1787
+
1788
+ The \c const attribute is required due to the places this method
1789
+ may be called (e.g., within CglCutGenerator::generateCuts()).
1790
+ */
1791
+ virtual void enableFactorization() const ;
1792
+
1793
+ /*! \brief Undo the effects of #enableFactorization. */
1794
+ virtual void disableFactorization() const ;
1795
+
1796
+ /*! \brief Check if an optimal basis is available.
1797
+
1798
+ Returns true if the problem has been solved to optimality and a
1799
+ basis is available. This should be used to see if the tableau access
1800
+ operations are possible and meaningful.
1801
+
1802
+ \note
1803
+ Implementors please note that this method may be called
1804
+ before #enableFactorization.
1805
+ */
1806
+ virtual bool basisIsAvailable() const ;
1807
+
1808
+ /// Synonym for #basisIsAvailable
1809
+ inline bool optimalBasisIsAvailable() const { return basisIsAvailable() ; }
1810
+
1811
+ /*! \brief Retrieve status information for column and row variables.
1812
+
1813
+ This method returns status as integer codes:
1814
+ <ul>
1815
+ <li> 0: free
1816
+ <li> 1: basic
1817
+ <li> 2: nonbasic at upper bound
1818
+ <li> 3: nonbasic at lower bound
1819
+ </ul>
1820
+
1821
+ The #getWarmStart method provides essentially the same functionality
1822
+ for a simplex-oriented solver, but the implementation details are very
1823
+ different.
1824
+
1825
+ \note
1826
+ Logical variables associated with rows are all assumed to have +1
1827
+ coefficients, so for a <= constraint the logical will be at lower
1828
+ bound if the constraint is tight.
1829
+
1830
+ \note
1831
+ Implementors may choose to implement this method as a wrapper which
1832
+ converts a CoinWarmStartBasis to the requested representation.
1833
+ */
1834
+ virtual void getBasisStatus(int* cstat, int* rstat) const ;
1835
+
1836
+ /*! \brief Set the status of column and row variables and update
1837
+ the basis factorization and solution.
1838
+
1839
+ Status information should be coded as documented for #getBasisStatus.
1840
+ Returns 0 if all goes well, 1 if something goes wrong.
1841
+
1842
+ This method differs from #setWarmStart in the format of the input
1843
+ and in its immediate effect. Think of it as #setWarmStart immediately
1844
+ followed by #resolve, but no pivots are allowed.
1845
+
1846
+ \note
1847
+ Implementors may choose to implement this method as a wrapper that calls
1848
+ #setWarmStart and #resolve if the no pivot requirement can be satisfied.
1849
+ */
1850
+ virtual int setBasisStatus(const int* cstat, const int* rstat) ;
1851
+
1852
+ /*! \brief Calculate duals and reduced costs for the given objective
1853
+ coefficients.
1854
+
1855
+ The solver's objective coefficient vector is not changed.
1856
+ */
1857
+ virtual void getReducedGradient(double* columnReducedCosts,
1858
+ double* duals, const double* c) const ;
1859
+
1860
+ /*! \brief Get a row of the tableau
1861
+
1862
+ If \p slack is not null, it will be loaded with the coefficients for
1863
+ the artificial (logical) variables (i.e., the row of the basis inverse).
1864
+ */
1865
+ virtual void getBInvARow(int row, double* z, double* slack = NULL) const ;
1866
+
1867
+ /*! \brief Get a row of the basis inverse */
1868
+ virtual void getBInvRow(int row, double* z) const ;
1869
+
1870
+ /*! \brief Get a column of the tableau */
1871
+ virtual void getBInvACol(int col, double* vec) const ;
1872
+
1873
+ /*! \brief Get a column of the basis inverse */
1874
+ virtual void getBInvCol(int col, double* vec) const ;
1875
+
1876
+ /*! \brief Get indices of basic variables
1877
+
1878
+ If the logical (artificial) for row i is basic, the index should be coded
1879
+ as (#getNumCols + i).
1880
+ The order of indices must match the order of elements in the vectors
1881
+ returned by #getBInvACol and #getBInvCol.
1882
+ */
1883
+ virtual void getBasics(int* index) const ;
1884
+
1885
+ //@}
1886
+
1887
+ /*! \name OsiSimplex Group 2
1888
+ \brief Pivoting methods
1889
+
1890
+ This group of methods provides for control of individual pivots by a
1891
+ simplex solver.
1892
+ */
1893
+ //@{
1894
+
1895
+ /**Enables normal operation of subsequent functions.
1896
+ This method is supposed to ensure that all typical things (like
1897
+ reduced costs, etc.) are updated when individual pivots are executed
1898
+ and can be queried by other methods. says whether will be
1899
+ doing primal or dual
1900
+ */
1901
+ virtual void enableSimplexInterface(bool doingPrimal) ;
1902
+
1903
+ ///Undo whatever setting changes the above method had to make
1904
+ virtual void disableSimplexInterface() ;
1905
+ /** Perform a pivot by substituting a colIn for colOut in the basis.
1906
+ The status of the leaving variable is given in outStatus. Where
1907
+ 1 is to upper bound, -1 to lower bound
1908
+ Return code was undefined - now for OsiClp is 0 for okay,
1909
+ 1 if inaccuracy forced re-factorization (should be okay) and
1910
+ -1 for singular factorization
1911
+ */
1912
+ virtual int pivot(int colIn, int colOut, int outStatus) ;
1913
+
1914
+ /** Obtain a result of the primal pivot
1915
+ Outputs: colOut -- leaving column, outStatus -- its status,
1916
+ t -- step size, and, if dx!=NULL, *dx -- primal ray direction.
1917
+ Inputs: colIn -- entering column, sign -- direction of its change (+/-1).
1918
+ Both for colIn and colOut, artificial variables are index by
1919
+ the negative of the row index minus 1.
1920
+ Return code (for now): 0 -- leaving variable found,
1921
+ -1 -- everything else?
1922
+ Clearly, more informative set of return values is required
1923
+ Primal and dual solutions are updated
1924
+ */
1925
+ virtual int primalPivotResult(int colIn, int sign,
1926
+ int& colOut, int& outStatus,
1927
+ double& t, CoinPackedVector* dx);
1928
+
1929
+ /** Obtain a result of the dual pivot (similar to the previous method)
1930
+ Differences: entering variable and a sign of its change are now
1931
+ the outputs, the leaving variable and its statuts -- the inputs
1932
+ If dx!=NULL, then *dx contains dual ray
1933
+ Return code: same
1934
+ */
1935
+ virtual int dualPivotResult(int& colIn, int& sign,
1936
+ int colOut, int outStatus,
1937
+ double& t, CoinPackedVector* dx) ;
1938
+ //@}
1939
+
1940
+ //---------------------------------------------------------------------------
1941
+
1942
+ ///@name Constructors and destructors
1943
+ //@{
1944
+ /// Default Constructor
1945
+ OsiSolverInterface();
1946
+
1947
+ /** Clone
1948
+
1949
+ The result of calling clone(false) is defined to be equivalent to
1950
+ calling the default constructor OsiSolverInterface().
1951
+ */
1952
+ virtual OsiSolverInterface * clone(bool copyData = true) const = 0;
1953
+
1954
+ /// Copy constructor
1955
+ OsiSolverInterface(const OsiSolverInterface &);
1956
+
1957
+ /// Assignment operator
1958
+ OsiSolverInterface & operator=(const OsiSolverInterface& rhs);
1959
+
1960
+ /// Destructor
1961
+ virtual ~OsiSolverInterface ();
1962
+
1963
+ /** Reset the solver interface.
1964
+
1965
+ A call to reset() returns the solver interface to the same state as
1966
+ it would have if it had just been constructed by calling the default
1967
+ constructor OsiSolverInterface().
1968
+ */
1969
+ virtual void reset();
1970
+ //@}
1971
+
1972
+ //---------------------------------------------------------------------------
1973
+
1974
+ protected:
1975
+ ///@name Protected methods
1976
+ //@{
1977
+ /** Apply a row cut (append to the constraint matrix). */
1978
+ virtual void applyRowCut( const OsiRowCut & rc ) = 0;
1979
+
1980
+ /** Apply a column cut (adjust the bounds of one or more variables). */
1981
+ virtual void applyColCut( const OsiColCut & cc ) = 0;
1982
+
1983
+ /** A quick inlined function to convert from the lb/ub style of
1984
+ constraint definition to the sense/rhs/range style */
1985
+ inline void
1986
+ convertBoundToSense(const double lower, const double upper,
1987
+ char& sense, double& right, double& range) const;
1988
+ /** A quick inlined function to convert from the sense/rhs/range style
1989
+ of constraint definition to the lb/ub style */
1990
+ inline void
1991
+ convertSenseToBound(const char sense, const double right,
1992
+ const double range,
1993
+ double& lower, double& upper) const;
1994
+ /** A quick inlined function to force a value to be between a minimum and
1995
+ a maximum value */
1996
+ template <class T> inline T
1997
+ forceIntoRange(const T value, const T lower, const T upper) const {
1998
+ return value < lower ? lower : (value > upper ? upper : value);
1999
+ }
2000
+ /** Set OsiSolverInterface object state for default constructor
2001
+
2002
+ This routine establishes the initial values of data fields in the
2003
+ OsiSolverInterface object when the object is created using the
2004
+ default constructor.
2005
+ */
2006
+ void setInitialData();
2007
+ //@}
2008
+
2009
+ ///@name Protected member data
2010
+ //@{
2011
+ /*! \brief Pointer to row cut debugger object
2012
+
2013
+ Mutable so that we can update the solution held in the debugger while
2014
+ maintaining const'ness for the Osi object.
2015
+ */
2016
+ mutable OsiRowCutDebugger * rowCutDebugger_;
2017
+ // Why not just make useful stuff protected?
2018
+ /// Message handler
2019
+ CoinMessageHandler * handler_;
2020
+ /** Flag to say if the currrent handler is the default handler.
2021
+ Indicates if the solver interface object is responsible
2022
+ for destruction of the handler (true) or if the client is
2023
+ responsible (false).
2024
+ */
2025
+ bool defaultHandler_;
2026
+ /// Messages
2027
+ CoinMessages messages_;
2028
+ /// Number of integers
2029
+ int numberIntegers_;
2030
+ /// Total number of objects
2031
+ int numberObjects_;
2032
+
2033
+ /// Integer and ... information (integer info normally at beginning)
2034
+ OsiObject ** object_;
2035
+ /** Column type
2036
+ 0 - continuous
2037
+ 1 - binary (may get fixed later)
2038
+ 2 - general integer (may get fixed later)
2039
+ */
2040
+ mutable char * columnType_;
2041
+
2042
+ //@}
2043
+
2044
+ //---------------------------------------------------------------------------
2045
+
2046
+ private:
2047
+ ///@name Private member data
2048
+ //@{
2049
+ /// Pointer to user-defined data structure - and more if user wants
2050
+ OsiAuxInfo * appDataEtc_;
2051
+ /// Array of integer parameters
2052
+ int intParam_[OsiLastIntParam];
2053
+ /// Array of double parameters
2054
+ double dblParam_[OsiLastDblParam];
2055
+ /// Array of string parameters
2056
+ std::string strParam_[OsiLastStrParam];
2057
+ /// Array of hint parameters
2058
+ bool hintParam_[OsiLastHintParam];
2059
+ /// Array of hint strengths
2060
+ OsiHintStrength hintStrength_[OsiLastHintParam];
2061
+ /** Warm start information used for hot starts when the default
2062
+ hot start implementation is used. */
2063
+ CoinWarmStart* ws_;
2064
+ /// Column solution satisfying lower and upper column bounds
2065
+ std::vector<double> strictColSolution_;
2066
+
2067
+ /// Row names
2068
+ OsiNameVec rowNames_ ;
2069
+ /// Column names
2070
+ OsiNameVec colNames_ ;
2071
+ /// Objective name
2072
+ std::string objName_ ;
2073
+
2074
+ //@}
2075
+ };
2076
+
2077
+ //#############################################################################
2078
+ /** A quick inlined function to convert from the lb/ub style of constraint
2079
+ definition to the sense/rhs/range style */
2080
+ inline void
2081
+ OsiSolverInterface::convertBoundToSense(const double lower, const double upper,
2082
+ char& sense, double& right,
2083
+ double& range) const
2084
+ {
2085
+ double inf = getInfinity();
2086
+ range = 0.0;
2087
+ if (lower > -inf) {
2088
+ if (upper < inf) {
2089
+ right = upper;
2090
+ if (upper==lower) {
2091
+ sense = 'E';
2092
+ } else {
2093
+ sense = 'R';
2094
+ range = upper - lower;
2095
+ }
2096
+ } else {
2097
+ sense = 'G';
2098
+ right = lower;
2099
+ }
2100
+ } else {
2101
+ if (upper < inf) {
2102
+ sense = 'L';
2103
+ right = upper;
2104
+ } else {
2105
+ sense = 'N';
2106
+ right = 0.0;
2107
+ }
2108
+ }
2109
+ }
2110
+
2111
+ //-----------------------------------------------------------------------------
2112
+ /** A quick inlined function to convert from the sense/rhs/range style of
2113
+ constraint definition to the lb/ub style */
2114
+ inline void
2115
+ OsiSolverInterface::convertSenseToBound(const char sense, const double right,
2116
+ const double range,
2117
+ double& lower, double& upper) const
2118
+ {
2119
+ double inf=getInfinity();
2120
+ switch (sense) {
2121
+ case 'E':
2122
+ lower = upper = right;
2123
+ break;
2124
+ case 'L':
2125
+ lower = -inf;
2126
+ upper = right;
2127
+ break;
2128
+ case 'G':
2129
+ lower = right;
2130
+ upper = inf;
2131
+ break;
2132
+ case 'R':
2133
+ lower = right - range;
2134
+ upper = right;
2135
+ break;
2136
+ case 'N':
2137
+ lower = -inf;
2138
+ upper = inf;
2139
+ break;
2140
+ }
2141
+ }
2142
+
2143
+ #endif