lpsolver 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1165) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/README.md +70 -26
  4. data/ext/lpsolver/Makefile +273 -0
  5. data/ext/lpsolver/ext.c +353 -0
  6. data/ext/lpsolver/ext.o +0 -0
  7. data/ext/lpsolver/extconf.rb +79 -0
  8. data/ext/lpsolver/native.so +0 -0
  9. data/ext/lpsolver-highs/AUTHORS +7 -0
  10. data/ext/lpsolver-highs/BUILD.bazel +243 -0
  11. data/ext/lpsolver-highs/CITATION.cff +29 -0
  12. data/ext/lpsolver-highs/CMakeCache.txt +406 -0
  13. data/ext/lpsolver-highs/CMakeFiles/3.31.4/CMakeCCompiler.cmake +81 -0
  14. data/ext/lpsolver-highs/CMakeFiles/3.31.4/CMakeCXXCompiler.cmake +101 -0
  15. data/ext/lpsolver-highs/CMakeFiles/3.31.4/CMakeDetermineCompilerABI_C.bin +0 -0
  16. data/ext/lpsolver-highs/CMakeFiles/3.31.4/CMakeDetermineCompilerABI_CXX.bin +0 -0
  17. data/ext/lpsolver-highs/CMakeFiles/3.31.4/CMakeSystem.cmake +15 -0
  18. data/ext/lpsolver-highs/CMakeFiles/3.31.4/CompilerIdC/CMakeCCompilerId.c +904 -0
  19. data/ext/lpsolver-highs/CMakeFiles/3.31.4/CompilerIdC/a.out +0 -0
  20. data/ext/lpsolver-highs/CMakeFiles/3.31.4/CompilerIdCXX/CMakeCXXCompilerId.cpp +919 -0
  21. data/ext/lpsolver-highs/CMakeFiles/3.31.4/CompilerIdCXX/a.out +0 -0
  22. data/ext/lpsolver-highs/CMakeFiles/CMakeConfigureLog.yaml +576 -0
  23. data/ext/lpsolver-highs/CMakeFiles/cmake.check_cache +1 -0
  24. data/ext/lpsolver-highs/CMakeLists.txt +983 -0
  25. data/ext/lpsolver-highs/CODE_OF_CONDUCT.md +128 -0
  26. data/ext/lpsolver-highs/CONTRIBUTING.md +31 -0
  27. data/ext/lpsolver-highs/FEATURES.md +61 -0
  28. data/ext/lpsolver-highs/LICENSE.txt +21 -0
  29. data/ext/lpsolver-highs/MODULE.bazel +38 -0
  30. data/ext/lpsolver-highs/README.md +281 -0
  31. data/ext/lpsolver-highs/THIRD_PARTY_NOTICES.md +78 -0
  32. data/ext/lpsolver-highs/Version.txt +4 -0
  33. data/ext/lpsolver-highs/WORKSPACE +33 -0
  34. data/ext/lpsolver-highs/app/CMakeLists.txt +110 -0
  35. data/ext/lpsolver-highs/app/HighsRuntimeOptions.h +292 -0
  36. data/ext/lpsolver-highs/app/RunHighs.cpp +147 -0
  37. data/ext/lpsolver-highs/app/highs_webdemo_shell.html +73 -0
  38. data/ext/lpsolver-highs/build/bin/highs +0 -0
  39. data/ext/lpsolver-highs/build/include/highs/HConfig.h +22 -0
  40. data/ext/lpsolver-highs/build/include/highs/Highs.h +1812 -0
  41. data/ext/lpsolver-highs/build/include/highs/interfaces/highs_c_api.h +2651 -0
  42. data/ext/lpsolver-highs/build/include/highs/io/Filereader.h +45 -0
  43. data/ext/lpsolver-highs/build/include/highs/io/FilereaderLp.h +49 -0
  44. data/ext/lpsolver-highs/build/include/highs/io/FilereaderMps.h +27 -0
  45. data/ext/lpsolver-highs/build/include/highs/io/HMPSIO.h +78 -0
  46. data/ext/lpsolver-highs/build/include/highs/io/HMpsFF.h +245 -0
  47. data/ext/lpsolver-highs/build/include/highs/io/HighsIO.h +118 -0
  48. data/ext/lpsolver-highs/build/include/highs/io/LoadOptions.h +24 -0
  49. data/ext/lpsolver-highs/build/include/highs/io/filereaderlp/builder.hpp +25 -0
  50. data/ext/lpsolver-highs/build/include/highs/io/filereaderlp/def.hpp +19 -0
  51. data/ext/lpsolver-highs/build/include/highs/io/filereaderlp/model.hpp +68 -0
  52. data/ext/lpsolver-highs/build/include/highs/io/filereaderlp/reader.hpp +10 -0
  53. data/ext/lpsolver-highs/build/include/highs/ipm/IpxSolution.h +32 -0
  54. data/ext/lpsolver-highs/build/include/highs/ipm/IpxWrapper.h +106 -0
  55. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu.h +161 -0
  56. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_factorize.h +247 -0
  57. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_get_factors.h +108 -0
  58. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_initialize.h +119 -0
  59. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_factorize.h +34 -0
  60. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_free.h +19 -0
  61. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_get_factors.h +34 -0
  62. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_initialize.h +46 -0
  63. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_solve_dense.h +29 -0
  64. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_solve_for_update.h +42 -0
  65. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_solve_sparse.h +32 -0
  66. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_update.h +31 -0
  67. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_object.h +30 -0
  68. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_solve_dense.h +75 -0
  69. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_solve_for_update.h +169 -0
  70. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_solve_sparse.h +112 -0
  71. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_update.h +125 -0
  72. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/lu_def.h +39 -0
  73. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/lu_file.h +21 -0
  74. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/lu_internal.h +220 -0
  75. data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/lu_list.h +173 -0
  76. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/basiclu_kernel.h +20 -0
  77. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/basiclu_wrapper.h +47 -0
  78. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/basis.h +350 -0
  79. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/conjugate_residuals.h +74 -0
  80. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/control.h +167 -0
  81. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/crossover.h +157 -0
  82. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/diagonal_precond.h +45 -0
  83. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/forrest_tomlin.h +102 -0
  84. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/guess_basis.h +21 -0
  85. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/indexed_vector.h +113 -0
  86. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/info.h +27 -0
  87. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipm.h +94 -0
  88. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_c.h +47 -0
  89. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_config.h +9 -0
  90. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_info.h +111 -0
  91. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_internal.h +89 -0
  92. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_parameters.h +76 -0
  93. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_status.h +57 -0
  94. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/iterate.h +331 -0
  95. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/kkt_solver.h +70 -0
  96. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/kkt_solver_basis.h +66 -0
  97. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/kkt_solver_diag.h +48 -0
  98. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/linear_operator.h +26 -0
  99. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/lp_solver.h +204 -0
  100. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/lu_factorization.h +79 -0
  101. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/lu_update.h +129 -0
  102. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/maxvolume.h +54 -0
  103. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/model.h +413 -0
  104. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/multistream.h +52 -0
  105. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/normal_matrix.h +44 -0
  106. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/power_method.h +44 -0
  107. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/sparse_matrix.h +195 -0
  108. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/sparse_utils.h +58 -0
  109. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/splitted_normal_matrix.h +63 -0
  110. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/starting_basis.h +39 -0
  111. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/symbolic_invert.h +29 -0
  112. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/timer.h +25 -0
  113. data/ext/lpsolver-highs/build/include/highs/ipm/ipx/utils.h +37 -0
  114. data/ext/lpsolver-highs/build/include/highs/lp_data/HConst.h +430 -0
  115. data/ext/lpsolver-highs/build/include/highs/lp_data/HStruct.h +213 -0
  116. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsAnalysis.h +23 -0
  117. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsCallback.h +104 -0
  118. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsCallbackStruct.h +70 -0
  119. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsDebug.h +34 -0
  120. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsIis.h +139 -0
  121. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsInfo.h +421 -0
  122. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsInfoDebug.h +27 -0
  123. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsLp.h +97 -0
  124. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsLpSolverObject.h +47 -0
  125. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsLpUtils.h +330 -0
  126. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsModelUtils.h +129 -0
  127. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsOptions.h +1715 -0
  128. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsRanging.h +43 -0
  129. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsSolution.h +179 -0
  130. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsSolutionDebug.h +87 -0
  131. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsSolve.h +29 -0
  132. data/ext/lpsolver-highs/build/include/highs/lp_data/HighsStatus.h +29 -0
  133. data/ext/lpsolver-highs/build/include/highs/mip/HighsCliqueTable.h +329 -0
  134. data/ext/lpsolver-highs/build/include/highs/mip/HighsConflictPool.h +109 -0
  135. data/ext/lpsolver-highs/build/include/highs/mip/HighsCutGeneration.h +108 -0
  136. data/ext/lpsolver-highs/build/include/highs/mip/HighsCutPool.h +168 -0
  137. data/ext/lpsolver-highs/build/include/highs/mip/HighsDebugSol.h +133 -0
  138. data/ext/lpsolver-highs/build/include/highs/mip/HighsDomain.h +657 -0
  139. data/ext/lpsolver-highs/build/include/highs/mip/HighsDomainChange.h +48 -0
  140. data/ext/lpsolver-highs/build/include/highs/mip/HighsDynamicRowMatrix.h +104 -0
  141. data/ext/lpsolver-highs/build/include/highs/mip/HighsGFkSolve.h +439 -0
  142. data/ext/lpsolver-highs/build/include/highs/mip/HighsImplications.h +194 -0
  143. data/ext/lpsolver-highs/build/include/highs/mip/HighsLpAggregator.h +50 -0
  144. data/ext/lpsolver-highs/build/include/highs/mip/HighsLpRelaxation.h +361 -0
  145. data/ext/lpsolver-highs/build/include/highs/mip/HighsMipAnalysis.h +71 -0
  146. data/ext/lpsolver-highs/build/include/highs/mip/HighsMipSolver.h +159 -0
  147. data/ext/lpsolver-highs/build/include/highs/mip/HighsMipSolverData.h +313 -0
  148. data/ext/lpsolver-highs/build/include/highs/mip/HighsModkSeparator.h +60 -0
  149. data/ext/lpsolver-highs/build/include/highs/mip/HighsNodeQueue.h +312 -0
  150. data/ext/lpsolver-highs/build/include/highs/mip/HighsObjectiveFunction.h +71 -0
  151. data/ext/lpsolver-highs/build/include/highs/mip/HighsPathSeparator.h +39 -0
  152. data/ext/lpsolver-highs/build/include/highs/mip/HighsPrimalHeuristics.h +75 -0
  153. data/ext/lpsolver-highs/build/include/highs/mip/HighsPseudocost.h +366 -0
  154. data/ext/lpsolver-highs/build/include/highs/mip/HighsRedcostFixing.h +42 -0
  155. data/ext/lpsolver-highs/build/include/highs/mip/HighsSearch.h +241 -0
  156. data/ext/lpsolver-highs/build/include/highs/mip/HighsSeparation.h +41 -0
  157. data/ext/lpsolver-highs/build/include/highs/mip/HighsSeparator.h +60 -0
  158. data/ext/lpsolver-highs/build/include/highs/mip/HighsTableauSeparator.h +34 -0
  159. data/ext/lpsolver-highs/build/include/highs/mip/HighsTransformedLp.h +63 -0
  160. data/ext/lpsolver-highs/build/include/highs/mip/MipTimer.h +544 -0
  161. data/ext/lpsolver-highs/build/include/highs/mip/feasibilityjump.hh +800 -0
  162. data/ext/lpsolver-highs/build/include/highs/model/HighsHessian.h +54 -0
  163. data/ext/lpsolver-highs/build/include/highs/model/HighsHessianUtils.h +47 -0
  164. data/ext/lpsolver-highs/build/include/highs/model/HighsModel.h +42 -0
  165. data/ext/lpsolver-highs/build/include/highs/parallel/HighsBinarySemaphore.h +108 -0
  166. data/ext/lpsolver-highs/build/include/highs/parallel/HighsCacheAlign.h +82 -0
  167. data/ext/lpsolver-highs/build/include/highs/parallel/HighsCombinable.h +116 -0
  168. data/ext/lpsolver-highs/build/include/highs/parallel/HighsMutex.h +124 -0
  169. data/ext/lpsolver-highs/build/include/highs/parallel/HighsParallel.h +128 -0
  170. data/ext/lpsolver-highs/build/include/highs/parallel/HighsRaceTimer.h +38 -0
  171. data/ext/lpsolver-highs/build/include/highs/parallel/HighsSchedulerConstants.h +19 -0
  172. data/ext/lpsolver-highs/build/include/highs/parallel/HighsSpinMutex.h +48 -0
  173. data/ext/lpsolver-highs/build/include/highs/parallel/HighsSplitDeque.h +606 -0
  174. data/ext/lpsolver-highs/build/include/highs/parallel/HighsTask.h +170 -0
  175. data/ext/lpsolver-highs/build/include/highs/parallel/HighsTaskExecutor.h +217 -0
  176. data/ext/lpsolver-highs/build/include/highs/pdlp/CupdlpWrapper.h +108 -0
  177. data/ext/lpsolver-highs/build/include/highs/pdlp/HiPdlpTimer.h +155 -0
  178. data/ext/lpsolver-highs/build/include/highs/pdlp/HiPdlpWrapper.h +26 -0
  179. data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_cs.h +40 -0
  180. data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_defs.h +447 -0
  181. data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_linalg.h +189 -0
  182. data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_proj.h +19 -0
  183. data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_restart.h +31 -0
  184. data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_scaling.h +26 -0
  185. data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_solver.h +105 -0
  186. data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_step.h +37 -0
  187. data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_utils.c +1850 -0
  188. data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/defs.hpp +222 -0
  189. data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/linalg.hpp +61 -0
  190. data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/logger.hpp +80 -0
  191. data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/pdhg.hpp +358 -0
  192. data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/restart.hpp +96 -0
  193. data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/scaling.hpp +74 -0
  194. data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/solver_results.hpp +65 -0
  195. data/ext/lpsolver-highs/build/include/highs/pdqsort/pdqsort.h +532 -0
  196. data/ext/lpsolver-highs/build/include/highs/presolve/HPresolve.h +505 -0
  197. data/ext/lpsolver-highs/build/include/highs/presolve/HPresolveAnalysis.h +52 -0
  198. data/ext/lpsolver-highs/build/include/highs/presolve/HighsPostsolveStack.h +943 -0
  199. data/ext/lpsolver-highs/build/include/highs/presolve/HighsSymmetry.h +284 -0
  200. data/ext/lpsolver-highs/build/include/highs/presolve/ICrash.h +124 -0
  201. data/ext/lpsolver-highs/build/include/highs/presolve/ICrashUtil.h +62 -0
  202. data/ext/lpsolver-highs/build/include/highs/presolve/ICrashX.h +23 -0
  203. data/ext/lpsolver-highs/build/include/highs/presolve/PresolveComponent.h +90 -0
  204. data/ext/lpsolver-highs/build/include/highs/qpsolver/a_asm.hpp +77 -0
  205. data/ext/lpsolver-highs/build/include/highs/qpsolver/a_quass.hpp +22 -0
  206. data/ext/lpsolver-highs/build/include/highs/qpsolver/basis.hpp +159 -0
  207. data/ext/lpsolver-highs/build/include/highs/qpsolver/crashsolution.hpp +20 -0
  208. data/ext/lpsolver-highs/build/include/highs/qpsolver/dantzigpricing.hpp +80 -0
  209. data/ext/lpsolver-highs/build/include/highs/qpsolver/devexpricing.hpp +108 -0
  210. data/ext/lpsolver-highs/build/include/highs/qpsolver/eventhandler.hpp +30 -0
  211. data/ext/lpsolver-highs/build/include/highs/qpsolver/factor.hpp +408 -0
  212. data/ext/lpsolver-highs/build/include/highs/qpsolver/feasibility_bounded.hpp +114 -0
  213. data/ext/lpsolver-highs/build/include/highs/qpsolver/feasibility_highs.hpp +301 -0
  214. data/ext/lpsolver-highs/build/include/highs/qpsolver/gradient.hpp +46 -0
  215. data/ext/lpsolver-highs/build/include/highs/qpsolver/instance.hpp +70 -0
  216. data/ext/lpsolver-highs/build/include/highs/qpsolver/matrix.hpp +342 -0
  217. data/ext/lpsolver-highs/build/include/highs/qpsolver/perturbation.hpp +15 -0
  218. data/ext/lpsolver-highs/build/include/highs/qpsolver/pricing.hpp +22 -0
  219. data/ext/lpsolver-highs/build/include/highs/qpsolver/qpconst.hpp +34 -0
  220. data/ext/lpsolver-highs/build/include/highs/qpsolver/qpvector.hpp +242 -0
  221. data/ext/lpsolver-highs/build/include/highs/qpsolver/quass.hpp +27 -0
  222. data/ext/lpsolver-highs/build/include/highs/qpsolver/ratiotest.hpp +26 -0
  223. data/ext/lpsolver-highs/build/include/highs/qpsolver/runtime.hpp +45 -0
  224. data/ext/lpsolver-highs/build/include/highs/qpsolver/scaling.hpp +15 -0
  225. data/ext/lpsolver-highs/build/include/highs/qpsolver/settings.hpp +84 -0
  226. data/ext/lpsolver-highs/build/include/highs/qpsolver/snippets.hpp +36 -0
  227. data/ext/lpsolver-highs/build/include/highs/qpsolver/statistics.hpp +30 -0
  228. data/ext/lpsolver-highs/build/include/highs/qpsolver/steepestedgepricing.hpp +173 -0
  229. data/ext/lpsolver-highs/build/include/highs/simplex/HApp.h +550 -0
  230. data/ext/lpsolver-highs/build/include/highs/simplex/HEkk.h +419 -0
  231. data/ext/lpsolver-highs/build/include/highs/simplex/HEkkDual.h +513 -0
  232. data/ext/lpsolver-highs/build/include/highs/simplex/HEkkDualRHS.h +134 -0
  233. data/ext/lpsolver-highs/build/include/highs/simplex/HEkkDualRow.h +201 -0
  234. data/ext/lpsolver-highs/build/include/highs/simplex/HEkkPrimal.h +191 -0
  235. data/ext/lpsolver-highs/build/include/highs/simplex/HSimplex.h +42 -0
  236. data/ext/lpsolver-highs/build/include/highs/simplex/HSimplexDebug.h +48 -0
  237. data/ext/lpsolver-highs/build/include/highs/simplex/HSimplexNla.h +158 -0
  238. data/ext/lpsolver-highs/build/include/highs/simplex/HSimplexReport.h +21 -0
  239. data/ext/lpsolver-highs/build/include/highs/simplex/HighsSimplexAnalysis.h +500 -0
  240. data/ext/lpsolver-highs/build/include/highs/simplex/SimplexConst.h +273 -0
  241. data/ext/lpsolver-highs/build/include/highs/simplex/SimplexStruct.h +263 -0
  242. data/ext/lpsolver-highs/build/include/highs/simplex/SimplexTimer.h +414 -0
  243. data/ext/lpsolver-highs/build/include/highs/test_kkt/DevKkt.h +143 -0
  244. data/ext/lpsolver-highs/build/include/highs/test_kkt/KktCh2.h +79 -0
  245. data/ext/lpsolver-highs/build/include/highs/util/FactorTimer.h +199 -0
  246. data/ext/lpsolver-highs/build/include/highs/util/HFactor.h +587 -0
  247. data/ext/lpsolver-highs/build/include/highs/util/HFactorConst.h +81 -0
  248. data/ext/lpsolver-highs/build/include/highs/util/HFactorDebug.h +55 -0
  249. data/ext/lpsolver-highs/build/include/highs/util/HSet.h +89 -0
  250. data/ext/lpsolver-highs/build/include/highs/util/HVector.h +22 -0
  251. data/ext/lpsolver-highs/build/include/highs/util/HVectorBase.h +102 -0
  252. data/ext/lpsolver-highs/build/include/highs/util/HighsCDouble.h +323 -0
  253. data/ext/lpsolver-highs/build/include/highs/util/HighsComponent.h +53 -0
  254. data/ext/lpsolver-highs/build/include/highs/util/HighsDataStack.h +83 -0
  255. data/ext/lpsolver-highs/build/include/highs/util/HighsDisjointSets.h +107 -0
  256. data/ext/lpsolver-highs/build/include/highs/util/HighsHash.h +1274 -0
  257. data/ext/lpsolver-highs/build/include/highs/util/HighsHashTree.h +1461 -0
  258. data/ext/lpsolver-highs/build/include/highs/util/HighsInt.h +36 -0
  259. data/ext/lpsolver-highs/build/include/highs/util/HighsIntegers.h +212 -0
  260. data/ext/lpsolver-highs/build/include/highs/util/HighsLinearSumBounds.h +203 -0
  261. data/ext/lpsolver-highs/build/include/highs/util/HighsMatrixPic.h +37 -0
  262. data/ext/lpsolver-highs/build/include/highs/util/HighsMatrixSlice.h +561 -0
  263. data/ext/lpsolver-highs/build/include/highs/util/HighsMatrixUtils.h +57 -0
  264. data/ext/lpsolver-highs/build/include/highs/util/HighsMemoryAllocation.h +63 -0
  265. data/ext/lpsolver-highs/build/include/highs/util/HighsRandom.h +242 -0
  266. data/ext/lpsolver-highs/build/include/highs/util/HighsRbTree.h +452 -0
  267. data/ext/lpsolver-highs/build/include/highs/util/HighsSort.h +131 -0
  268. data/ext/lpsolver-highs/build/include/highs/util/HighsSparseMatrix.h +151 -0
  269. data/ext/lpsolver-highs/build/include/highs/util/HighsSparseVectorSum.h +95 -0
  270. data/ext/lpsolver-highs/build/include/highs/util/HighsSplay.h +135 -0
  271. data/ext/lpsolver-highs/build/include/highs/util/HighsTimer.h +385 -0
  272. data/ext/lpsolver-highs/build/include/highs/util/HighsUtils.h +272 -0
  273. data/ext/lpsolver-highs/build/include/highs/util/stringutil.h +46 -0
  274. data/ext/lpsolver-highs/build/include/highs/zstr/strict_fstream.hpp +237 -0
  275. data/ext/lpsolver-highs/build/include/highs/zstr/zstr.hpp +473 -0
  276. data/ext/lpsolver-highs/build/include/highs_export.h +43 -0
  277. data/ext/lpsolver-highs/build/lib/cmake/highs/highs-config-version.cmake +65 -0
  278. data/ext/lpsolver-highs/build/lib/cmake/highs/highs-config.cmake +36 -0
  279. data/ext/lpsolver-highs/build/lib/cmake/highs/highs-targets-release.cmake +19 -0
  280. data/ext/lpsolver-highs/build/lib/cmake/highs/highs-targets.cmake +111 -0
  281. data/ext/lpsolver-highs/build/lib/libhighs.a +0 -0
  282. data/ext/lpsolver-highs/build/lib/pkgconfig/highs.pc +12 -0
  283. data/ext/lpsolver-highs/build/share/doc/HIGHS/AUTHORS +7 -0
  284. data/ext/lpsolver-highs/build/share/doc/HIGHS/CITATION.cff +29 -0
  285. data/ext/lpsolver-highs/build/share/doc/HIGHS/CODE_OF_CONDUCT.md +128 -0
  286. data/ext/lpsolver-highs/build/share/doc/HIGHS/CONTRIBUTING.md +31 -0
  287. data/ext/lpsolver-highs/build/share/doc/HIGHS/FEATURES.md +61 -0
  288. data/ext/lpsolver-highs/build/share/doc/HIGHS/LICENSE.txt +21 -0
  289. data/ext/lpsolver-highs/build/share/doc/HIGHS/README.md +281 -0
  290. data/ext/lpsolver-highs/build_webdemo.sh +46 -0
  291. data/ext/lpsolver-highs/check/Avgas.cpp +245 -0
  292. data/ext/lpsolver-highs/check/Avgas.h +44 -0
  293. data/ext/lpsolver-highs/check/CMakeLists.txt +573 -0
  294. data/ext/lpsolver-highs/check/HCheckConfig.h.bazel.in +6 -0
  295. data/ext/lpsolver-highs/check/HCheckConfig.h.in +12 -0
  296. data/ext/lpsolver-highs/check/HCheckConfig.h.meson.in +6 -0
  297. data/ext/lpsolver-highs/check/SpecialLps.h +405 -0
  298. data/ext/lpsolver-highs/check/TestAlienBasis.cpp +720 -0
  299. data/ext/lpsolver-highs/check/TestBasis.cpp +359 -0
  300. data/ext/lpsolver-highs/check/TestBasisSolves.cpp +669 -0
  301. data/ext/lpsolver-highs/check/TestCAPI.c +2513 -0
  302. data/ext/lpsolver-highs/check/TestCallbacks.cpp +608 -0
  303. data/ext/lpsolver-highs/check/TestCheckSolution.cpp +740 -0
  304. data/ext/lpsolver-highs/check/TestCrossover.cpp +111 -0
  305. data/ext/lpsolver-highs/check/TestDualize.cpp +172 -0
  306. data/ext/lpsolver-highs/check/TestEkk.cpp +100 -0
  307. data/ext/lpsolver-highs/check/TestFactor.cpp +389 -0
  308. data/ext/lpsolver-highs/check/TestFilereader.cpp +568 -0
  309. data/ext/lpsolver-highs/check/TestFortranAPI.f90 +65 -0
  310. data/ext/lpsolver-highs/check/TestHSet.cpp +80 -0
  311. data/ext/lpsolver-highs/check/TestHighsCDouble.cpp +109 -0
  312. data/ext/lpsolver-highs/check/TestHighsGFkSolve.cpp +102 -0
  313. data/ext/lpsolver-highs/check/TestHighsHash.cpp +126 -0
  314. data/ext/lpsolver-highs/check/TestHighsHessian.cpp +329 -0
  315. data/ext/lpsolver-highs/check/TestHighsIntegers.cpp +42 -0
  316. data/ext/lpsolver-highs/check/TestHighsModel.cpp +134 -0
  317. data/ext/lpsolver-highs/check/TestHighsParallel.cpp +277 -0
  318. data/ext/lpsolver-highs/check/TestHighsRbTree.cpp +109 -0
  319. data/ext/lpsolver-highs/check/TestHighsSparseMatrix.cpp +126 -0
  320. data/ext/lpsolver-highs/check/TestHighsVersion.cpp +61 -0
  321. data/ext/lpsolver-highs/check/TestHipo.cpp +122 -0
  322. data/ext/lpsolver-highs/check/TestICrash.cpp +46 -0
  323. data/ext/lpsolver-highs/check/TestIO.cpp +163 -0
  324. data/ext/lpsolver-highs/check/TestIis.cpp +1063 -0
  325. data/ext/lpsolver-highs/check/TestInfo.cpp +116 -0
  326. data/ext/lpsolver-highs/check/TestIpm.cpp +226 -0
  327. data/ext/lpsolver-highs/check/TestIpx.cpp +96 -0
  328. data/ext/lpsolver-highs/check/TestLPFileFormat.cpp +22 -0
  329. data/ext/lpsolver-highs/check/TestLogging.cpp +69 -0
  330. data/ext/lpsolver-highs/check/TestLpModification.cpp +2497 -0
  331. data/ext/lpsolver-highs/check/TestLpOrientation.cpp +121 -0
  332. data/ext/lpsolver-highs/check/TestLpSolvers.cpp +555 -0
  333. data/ext/lpsolver-highs/check/TestLpValidation.cpp +689 -0
  334. data/ext/lpsolver-highs/check/TestMain.cpp +6 -0
  335. data/ext/lpsolver-highs/check/TestMipSolver.cpp +1406 -0
  336. data/ext/lpsolver-highs/check/TestModelProperties.cpp +143 -0
  337. data/ext/lpsolver-highs/check/TestMultiObjective.cpp +198 -0
  338. data/ext/lpsolver-highs/check/TestNames.cpp +187 -0
  339. data/ext/lpsolver-highs/check/TestOptions.cpp +544 -0
  340. data/ext/lpsolver-highs/check/TestPdlp.cpp +327 -0
  341. data/ext/lpsolver-highs/check/TestPdlpHi.cpp +40 -0
  342. data/ext/lpsolver-highs/check/TestPresolve.cpp +912 -0
  343. data/ext/lpsolver-highs/check/TestQpSolver.cpp +1345 -0
  344. data/ext/lpsolver-highs/check/TestRanging.cpp +558 -0
  345. data/ext/lpsolver-highs/check/TestRays.cpp +1010 -0
  346. data/ext/lpsolver-highs/check/TestSemiVariables.cpp +329 -0
  347. data/ext/lpsolver-highs/check/TestSetup.cpp +12 -0
  348. data/ext/lpsolver-highs/check/TestSort.cpp +247 -0
  349. data/ext/lpsolver-highs/check/TestSpecialLps.cpp +775 -0
  350. data/ext/lpsolver-highs/check/TestThrow.cpp +83 -0
  351. data/ext/lpsolver-highs/check/TestTspSolver.cpp +19 -0
  352. data/ext/lpsolver-highs/check/TestUserScale.cpp +444 -0
  353. data/ext/lpsolver-highs/check/cublas_example.cpp +76 -0
  354. data/ext/lpsolver-highs/check/cublas_gpu_start.cpp +88 -0
  355. data/ext/lpsolver-highs/check/hipo_test_option_files/hipo_options_0 +1 -0
  356. data/ext/lpsolver-highs/check/instances/1448.lp +1 -0
  357. data/ext/lpsolver-highs/check/instances/1449a.lp +1 -0
  358. data/ext/lpsolver-highs/check/instances/1449b.lp +1 -0
  359. data/ext/lpsolver-highs/check/instances/1451.lp +8 -0
  360. data/ext/lpsolver-highs/check/instances/2122.lp +1822 -0
  361. data/ext/lpsolver-highs/check/instances/2171.mps +717 -0
  362. data/ext/lpsolver-highs/check/instances/25fv47.mps +6919 -0
  363. data/ext/lpsolver-highs/check/instances/2821-duplicate.mps +31 -0
  364. data/ext/lpsolver-highs/check/instances/2821-qmatrix.mps +31 -0
  365. data/ext/lpsolver-highs/check/instances/2821-quadobj.mps +29 -0
  366. data/ext/lpsolver-highs/check/instances/2821-summation.mps +30 -0
  367. data/ext/lpsolver-highs/check/instances/2821.mps +29 -0
  368. data/ext/lpsolver-highs/check/instances/2894.mps +89 -0
  369. data/ext/lpsolver-highs/check/instances/80bau3b.mps +23732 -0
  370. data/ext/lpsolver-highs/check/instances/WithInf.set +3 -0
  371. data/ext/lpsolver-highs/check/instances/adlittle.mps +335 -0
  372. data/ext/lpsolver-highs/check/instances/afiro.mps +83 -0
  373. data/ext/lpsolver-highs/check/instances/avgas.mps +51 -0
  374. data/ext/lpsolver-highs/check/instances/bell5.mps +384 -0
  375. data/ext/lpsolver-highs/check/instances/bgetam.mps +2112 -0
  376. data/ext/lpsolver-highs/check/instances/blending.mps +13 -0
  377. data/ext/lpsolver-highs/check/instances/box1.mps +1085 -0
  378. data/ext/lpsolver-highs/check/instances/chip.mps +13 -0
  379. data/ext/lpsolver-highs/check/instances/comment.mps +23 -0
  380. data/ext/lpsolver-highs/check/instances/cplex1.mps +9674 -0
  381. data/ext/lpsolver-highs/check/instances/dD2e.mps +10 -0
  382. data/ext/lpsolver-highs/check/instances/dcmulti.mps +2310 -0
  383. data/ext/lpsolver-highs/check/instances/e226.mps +1733 -0
  384. data/ext/lpsolver-highs/check/instances/egout-ac.mps +473 -0
  385. data/ext/lpsolver-highs/check/instances/egout.mps +403 -0
  386. data/ext/lpsolver-highs/check/instances/etamacro.mps +2084 -0
  387. data/ext/lpsolver-highs/check/instances/ex72a.mps +849 -0
  388. data/ext/lpsolver-highs/check/instances/fixed-binary.lp +11 -0
  389. data/ext/lpsolver-highs/check/instances/flugpl.mps +111 -0
  390. data/ext/lpsolver-highs/check/instances/flugpl_illegal_integer.sol +24 -0
  391. data/ext/lpsolver-highs/check/instances/flugpl_integer.sol +25 -0
  392. data/ext/lpsolver-highs/check/instances/forest6.mps +261 -0
  393. data/ext/lpsolver-highs/check/instances/galenet.mps +34 -0
  394. data/ext/lpsolver-highs/check/instances/gams10am.mps +478 -0
  395. data/ext/lpsolver-highs/check/instances/garbage.ems +3 -0
  396. data/ext/lpsolver-highs/check/instances/garbage.lp +3 -0
  397. data/ext/lpsolver-highs/check/instances/garbage.mps +3 -0
  398. data/ext/lpsolver-highs/check/instances/gas11.mps +2924 -0
  399. data/ext/lpsolver-highs/check/instances/gesa2.mps +5459 -0
  400. data/ext/lpsolver-highs/check/instances/greenbea.mps +19215 -0
  401. data/ext/lpsolver-highs/check/instances/gt2.mps +534 -0
  402. data/ext/lpsolver-highs/check/instances/infeasible-mip0.mps +140 -0
  403. data/ext/lpsolver-highs/check/instances/infeasible-mip1.mps +371 -0
  404. data/ext/lpsolver-highs/check/instances/israel.mps +1490 -0
  405. data/ext/lpsolver-highs/check/instances/issue-2095.mps +836 -0
  406. data/ext/lpsolver-highs/check/instances/issue-2173.mps +3331 -0
  407. data/ext/lpsolver-highs/check/instances/issue-2204.mps +143 -0
  408. data/ext/lpsolver-highs/check/instances/issue-2290.mps +158 -0
  409. data/ext/lpsolver-highs/check/instances/issue-2388.lp +76 -0
  410. data/ext/lpsolver-highs/check/instances/issue-2402.mps +435 -0
  411. data/ext/lpsolver-highs/check/instances/issue-2446.mps +9154 -0
  412. data/ext/lpsolver-highs/check/instances/issue-2585.lp +16 -0
  413. data/ext/lpsolver-highs/check/instances/issue-2874-3.mps +97 -0
  414. data/ext/lpsolver-highs/check/instances/klein1.mps +422 -0
  415. data/ext/lpsolver-highs/check/instances/lseu.mps +371 -0
  416. data/ext/lpsolver-highs/check/instances/model.xyz +1 -0
  417. data/ext/lpsolver-highs/check/instances/nan0.mps +13 -0
  418. data/ext/lpsolver-highs/check/instances/nan1.mps +13 -0
  419. data/ext/lpsolver-highs/check/instances/nan2.mps +13 -0
  420. data/ext/lpsolver-highs/check/instances/no-newline-eof.lp +5 -0
  421. data/ext/lpsolver-highs/check/instances/p01.mps +909 -0
  422. data/ext/lpsolver-highs/check/instances/p0548.mps +1992 -0
  423. data/ext/lpsolver-highs/check/instances/primal1.mps +3909 -0
  424. data/ext/lpsolver-highs/check/instances/qap04.mps +606 -0
  425. data/ext/lpsolver-highs/check/instances/qcqp.lp +8 -0
  426. data/ext/lpsolver-highs/check/instances/qjh.lp +9 -0
  427. data/ext/lpsolver-highs/check/instances/qjh.mps +18 -0
  428. data/ext/lpsolver-highs/check/instances/qjh_qmatrix.mps +19 -0
  429. data/ext/lpsolver-highs/check/instances/qjh_quadobj.mps +18 -0
  430. data/ext/lpsolver-highs/check/instances/qjh_quadobj_qmatrix.mps +25 -0
  431. data/ext/lpsolver-highs/check/instances/qjh_uncon.lp +10 -0
  432. data/ext/lpsolver-highs/check/instances/qjh_uncon.mps +17 -0
  433. data/ext/lpsolver-highs/check/instances/qpinfeasible.lp +8 -0
  434. data/ext/lpsolver-highs/check/instances/qptestnw.lp +7 -0
  435. data/ext/lpsolver-highs/check/instances/qpunbounded.lp +5 -0
  436. data/ext/lpsolver-highs/check/instances/refinery.mps +1882 -0
  437. data/ext/lpsolver-highs/check/instances/rgn.mps +559 -0
  438. data/ext/lpsolver-highs/check/instances/scrs8.mps +2717 -0
  439. data/ext/lpsolver-highs/check/instances/sctest.mps +66 -0
  440. data/ext/lpsolver-highs/check/instances/semi-continuous.lp +13 -0
  441. data/ext/lpsolver-highs/check/instances/semi-continuous.mps +24 -0
  442. data/ext/lpsolver-highs/check/instances/semi-integer.lp +15 -0
  443. data/ext/lpsolver-highs/check/instances/semi-integer.mps +22 -0
  444. data/ext/lpsolver-highs/check/instances/shell.mps +4039 -0
  445. data/ext/lpsolver-highs/check/instances/silly-names.mps +14 -0
  446. data/ext/lpsolver-highs/check/instances/small_mip.mps +87 -0
  447. data/ext/lpsolver-highs/check/instances/smalllp.mps +21 -0
  448. data/ext/lpsolver-highs/check/instances/sp150x300d.mps +1983 -0
  449. data/ext/lpsolver-highs/check/instances/stair.mps +2499 -0
  450. data/ext/lpsolver-highs/check/instances/standata.mps +2317 -0
  451. data/ext/lpsolver-highs/check/instances/standgub.mps +2428 -0
  452. data/ext/lpsolver-highs/check/instances/standmps.mps +2695 -0
  453. data/ext/lpsolver-highs/check/instances/test.mps +53 -0
  454. data/ext/lpsolver-highs/check/instances/vol1.mps +1895 -0
  455. data/ext/lpsolver-highs/check/instances/warnings.mps +68 -0
  456. data/ext/lpsolver-highs/check/instances/woodinfe.mps +216 -0
  457. data/ext/lpsolver-highs/check/matrix_multiplication.hpp +49 -0
  458. data/ext/lpsolver-highs/check/meson.build +92 -0
  459. data/ext/lpsolver-highs/check/pythontest.py +11 -0
  460. data/ext/lpsolver-highs/check/sample_options_file +8 -0
  461. data/ext/lpsolver-highs/cmake/CheckAtomic.cmake +74 -0
  462. data/ext/lpsolver-highs/cmake/FindCUDAConf.cmake +44 -0
  463. data/ext/lpsolver-highs/cmake/FindHipoDeps.cmake +351 -0
  464. data/ext/lpsolver-highs/cmake/README.md +243 -0
  465. data/ext/lpsolver-highs/cmake/cpp-highs.cmake +243 -0
  466. data/ext/lpsolver-highs/cmake/dotnet.cmake +94 -0
  467. data/ext/lpsolver-highs/cmake/highs-config.cmake.in +22 -0
  468. data/ext/lpsolver-highs/cmake/python-highs.cmake +74 -0
  469. data/ext/lpsolver-highs/cmake/set-version.cmake +26 -0
  470. data/ext/lpsolver-highs/cmake/sources-python.cmake +461 -0
  471. data/ext/lpsolver-highs/cmake/sources.cmake +618 -0
  472. data/ext/lpsolver-highs/docs/HiGHS_CopyrightHeader.pl +78 -0
  473. data/ext/lpsolver-highs/docs/HiGHS_CopyrightHeaderUpdateAll +32 -0
  474. data/ext/lpsolver-highs/docs/Project.toml +7 -0
  475. data/ext/lpsolver-highs/docs/README.md +27 -0
  476. data/ext/lpsolver-highs/docs/c_api_gen/HConfig.h +1 -0
  477. data/ext/lpsolver-highs/docs/c_api_gen/build.jl +48 -0
  478. data/ext/lpsolver-highs/docs/make.jl +115 -0
  479. data/ext/lpsolver-highs/docs/src/assets/logo.png +0 -0
  480. data/ext/lpsolver-highs/docs/src/callbacks.md +171 -0
  481. data/ext/lpsolver-highs/docs/src/executable.md +88 -0
  482. data/ext/lpsolver-highs/docs/src/guide/advanced.md +66 -0
  483. data/ext/lpsolver-highs/docs/src/guide/basic.md +116 -0
  484. data/ext/lpsolver-highs/docs/src/guide/further.md +193 -0
  485. data/ext/lpsolver-highs/docs/src/guide/gpu.md +58 -0
  486. data/ext/lpsolver-highs/docs/src/guide/index.md +18 -0
  487. data/ext/lpsolver-highs/docs/src/guide/kkt.md +219 -0
  488. data/ext/lpsolver-highs/docs/src/guide/numerics.md +55 -0
  489. data/ext/lpsolver-highs/docs/src/index.md +86 -0
  490. data/ext/lpsolver-highs/docs/src/installation.md +130 -0
  491. data/ext/lpsolver-highs/docs/src/interfaces/c_api.md +6 -0
  492. data/ext/lpsolver-highs/docs/src/interfaces/cpp/examples.md +1 -0
  493. data/ext/lpsolver-highs/docs/src/interfaces/cpp/index.md +29 -0
  494. data/ext/lpsolver-highs/docs/src/interfaces/cpp/library.md +107 -0
  495. data/ext/lpsolver-highs/docs/src/interfaces/csharp.md +55 -0
  496. data/ext/lpsolver-highs/docs/src/interfaces/fortran.md +11 -0
  497. data/ext/lpsolver-highs/docs/src/interfaces/julia/index.md +130 -0
  498. data/ext/lpsolver-highs/docs/src/interfaces/other.md +41 -0
  499. data/ext/lpsolver-highs/docs/src/interfaces/python/example-py.md +275 -0
  500. data/ext/lpsolver-highs/docs/src/interfaces/python/index.md +91 -0
  501. data/ext/lpsolver-highs/docs/src/interfaces/python/model-py.md +90 -0
  502. data/ext/lpsolver-highs/docs/src/options/definitions.md +529 -0
  503. data/ext/lpsolver-highs/docs/src/options/intro.md +46 -0
  504. data/ext/lpsolver-highs/docs/src/parallel.md +88 -0
  505. data/ext/lpsolver-highs/docs/src/solvers.md +168 -0
  506. data/ext/lpsolver-highs/docs/src/structures/classes/HighsHessian.md +9 -0
  507. data/ext/lpsolver-highs/docs/src/structures/classes/HighsIis.md +16 -0
  508. data/ext/lpsolver-highs/docs/src/structures/classes/HighsLp.md +19 -0
  509. data/ext/lpsolver-highs/docs/src/structures/classes/HighsModel.md +6 -0
  510. data/ext/lpsolver-highs/docs/src/structures/classes/HighsSparseMatrix.md +10 -0
  511. data/ext/lpsolver-highs/docs/src/structures/classes/index.md +11 -0
  512. data/ext/lpsolver-highs/docs/src/structures/enums.md +114 -0
  513. data/ext/lpsolver-highs/docs/src/structures/index.md +12 -0
  514. data/ext/lpsolver-highs/docs/src/structures/structs/HighsBasis.md +8 -0
  515. data/ext/lpsolver-highs/docs/src/structures/structs/HighsInfo.md +148 -0
  516. data/ext/lpsolver-highs/docs/src/structures/structs/HighsLinearObjective.md +11 -0
  517. data/ext/lpsolver-highs/docs/src/structures/structs/HighsSolution.md +10 -0
  518. data/ext/lpsolver-highs/docs/src/structures/structs/index.md +10 -0
  519. data/ext/lpsolver-highs/docs/src/terminology.md +163 -0
  520. data/ext/lpsolver-highs/examples/CMakeLists.txt +26 -0
  521. data/ext/lpsolver-highs/examples/Docs.py +104 -0
  522. data/ext/lpsolver-highs/examples/branch-and-price.py +465 -0
  523. data/ext/lpsolver-highs/examples/call_highs_from_c.c +685 -0
  524. data/ext/lpsolver-highs/examples/call_highs_from_c_minimal.c +659 -0
  525. data/ext/lpsolver-highs/examples/call_highs_from_cpp.cpp +178 -0
  526. data/ext/lpsolver-highs/examples/call_highs_from_csharp.cs +83 -0
  527. data/ext/lpsolver-highs/examples/call_highs_from_fortran.f90 +579 -0
  528. data/ext/lpsolver-highs/examples/call_highs_from_python.py +448 -0
  529. data/ext/lpsolver-highs/examples/call_highs_from_python_highspy.py +71 -0
  530. data/ext/lpsolver-highs/examples/call_highs_from_python_mps.py +59 -0
  531. data/ext/lpsolver-highs/examples/callback_gap.py +71 -0
  532. data/ext/lpsolver-highs/examples/chip.py +43 -0
  533. data/ext/lpsolver-highs/examples/chip0.py +29 -0
  534. data/ext/lpsolver-highs/examples/distillation.py +77 -0
  535. data/ext/lpsolver-highs/examples/knapsack.py +43 -0
  536. data/ext/lpsolver-highs/examples/minimal.py +11 -0
  537. data/ext/lpsolver-highs/examples/multi_objective.py +139 -0
  538. data/ext/lpsolver-highs/examples/multiple_objective.py +120 -0
  539. data/ext/lpsolver-highs/examples/network_flow.py +37 -0
  540. data/ext/lpsolver-highs/examples/nqueens.py +29 -0
  541. data/ext/lpsolver-highs/examples/plot_highs_log.py +134 -0
  542. data/ext/lpsolver-highs/extern/CLI11.hpp +11546 -0
  543. data/ext/lpsolver-highs/extern/LICENCE_1_0.txt +23 -0
  544. data/ext/lpsolver-highs/extern/amd/License.txt +35 -0
  545. data/ext/lpsolver-highs/extern/amd/SuiteSparse_config.c +54 -0
  546. data/ext/lpsolver-highs/extern/amd/SuiteSparse_config.h +56 -0
  547. data/ext/lpsolver-highs/extern/amd/amd.h +357 -0
  548. data/ext/lpsolver-highs/extern/amd/amd_1.c +172 -0
  549. data/ext/lpsolver-highs/extern/amd/amd_2.c +1761 -0
  550. data/ext/lpsolver-highs/extern/amd/amd_aat.c +179 -0
  551. data/ext/lpsolver-highs/extern/amd/amd_control.c +65 -0
  552. data/ext/lpsolver-highs/extern/amd/amd_defaults.c +37 -0
  553. data/ext/lpsolver-highs/extern/amd/amd_info.c +120 -0
  554. data/ext/lpsolver-highs/extern/amd/amd_internal.h +137 -0
  555. data/ext/lpsolver-highs/extern/amd/amd_order.c +195 -0
  556. data/ext/lpsolver-highs/extern/amd/amd_post_tree.c +105 -0
  557. data/ext/lpsolver-highs/extern/amd/amd_postorder.c +140 -0
  558. data/ext/lpsolver-highs/extern/amd/amd_preprocess.c +107 -0
  559. data/ext/lpsolver-highs/extern/amd/amd_valid.c +93 -0
  560. data/ext/lpsolver-highs/extern/amd/changes.txt +8 -0
  561. data/ext/lpsolver-highs/extern/catch.hpp +18861 -0
  562. data/ext/lpsolver-highs/extern/metis/Changes.txt +31 -0
  563. data/ext/lpsolver-highs/extern/metis/GKlib/GKlib.h +62 -0
  564. data/ext/lpsolver-highs/extern/metis/GKlib/error.c +21 -0
  565. data/ext/lpsolver-highs/extern/metis/GKlib/gk_arch.h +64 -0
  566. data/ext/lpsolver-highs/extern/metis/GKlib/gk_defs.h +19 -0
  567. data/ext/lpsolver-highs/extern/metis/GKlib/gk_macros.h +50 -0
  568. data/ext/lpsolver-highs/extern/metis/GKlib/gk_mkblas.h +51 -0
  569. data/ext/lpsolver-highs/extern/metis/GKlib/gk_mkmemory.h +80 -0
  570. data/ext/lpsolver-highs/extern/metis/GKlib/gk_mkpqueue.h +329 -0
  571. data/ext/lpsolver-highs/extern/metis/GKlib/gk_mkrandom.h +89 -0
  572. data/ext/lpsolver-highs/extern/metis/GKlib/gk_mksort.h +271 -0
  573. data/ext/lpsolver-highs/extern/metis/GKlib/gk_ms_inttypes.h +41 -0
  574. data/ext/lpsolver-highs/extern/metis/GKlib/gk_ms_stat.h +22 -0
  575. data/ext/lpsolver-highs/extern/metis/GKlib/gk_ms_stdint.h +41 -0
  576. data/ext/lpsolver-highs/extern/metis/GKlib/gk_proto.h +50 -0
  577. data/ext/lpsolver-highs/extern/metis/GKlib/gk_struct.h +66 -0
  578. data/ext/lpsolver-highs/extern/metis/GKlib/gk_types.h +15 -0
  579. data/ext/lpsolver-highs/extern/metis/GKlib/mcore.c +176 -0
  580. data/ext/lpsolver-highs/extern/metis/GKlib/memory.c +23 -0
  581. data/ext/lpsolver-highs/extern/metis/GKlib/random.c +37 -0
  582. data/ext/lpsolver-highs/extern/metis/LICENSE.txt +18 -0
  583. data/ext/lpsolver-highs/extern/metis/libmetis/auxapi.c +27 -0
  584. data/ext/lpsolver-highs/extern/metis/libmetis/balance.c +491 -0
  585. data/ext/lpsolver-highs/extern/metis/libmetis/bucketsort.c +44 -0
  586. data/ext/lpsolver-highs/extern/metis/libmetis/coarsen.c +895 -0
  587. data/ext/lpsolver-highs/extern/metis/libmetis/compress.c +231 -0
  588. data/ext/lpsolver-highs/extern/metis/libmetis/contig.c +83 -0
  589. data/ext/lpsolver-highs/extern/metis/libmetis/defs.h +39 -0
  590. data/ext/lpsolver-highs/extern/metis/libmetis/fm.c +527 -0
  591. data/ext/lpsolver-highs/extern/metis/libmetis/gklib.c +55 -0
  592. data/ext/lpsolver-highs/extern/metis/libmetis/gklib_defs.h +33 -0
  593. data/ext/lpsolver-highs/extern/metis/libmetis/graph.c +268 -0
  594. data/ext/lpsolver-highs/extern/metis/libmetis/initpart.c +385 -0
  595. data/ext/lpsolver-highs/extern/metis/libmetis/macros.h +59 -0
  596. data/ext/lpsolver-highs/extern/metis/libmetis/mcutil.c +162 -0
  597. data/ext/lpsolver-highs/extern/metis/libmetis/metislib.h +35 -0
  598. data/ext/lpsolver-highs/extern/metis/libmetis/mmd.c +598 -0
  599. data/ext/lpsolver-highs/extern/metis/libmetis/ometis.c +661 -0
  600. data/ext/lpsolver-highs/extern/metis/libmetis/options.c +260 -0
  601. data/ext/lpsolver-highs/extern/metis/libmetis/proto.h +172 -0
  602. data/ext/lpsolver-highs/extern/metis/libmetis/refine.c +99 -0
  603. data/ext/lpsolver-highs/extern/metis/libmetis/separator.c +57 -0
  604. data/ext/lpsolver-highs/extern/metis/libmetis/sfm.c +581 -0
  605. data/ext/lpsolver-highs/extern/metis/libmetis/srefine.c +152 -0
  606. data/ext/lpsolver-highs/extern/metis/libmetis/stdheaders.h +29 -0
  607. data/ext/lpsolver-highs/extern/metis/libmetis/struct.h +117 -0
  608. data/ext/lpsolver-highs/extern/metis/libmetis/util.c +59 -0
  609. data/ext/lpsolver-highs/extern/metis/libmetis/wspace.c +91 -0
  610. data/ext/lpsolver-highs/extern/metis/metis.h +271 -0
  611. data/ext/lpsolver-highs/extern/pdqsort/license.txt +16 -0
  612. data/ext/lpsolver-highs/extern/pdqsort/pdqsort.h +532 -0
  613. data/ext/lpsolver-highs/extern/rcm/LICENSE +19 -0
  614. data/ext/lpsolver-highs/extern/rcm/rcm.cpp +873 -0
  615. data/ext/lpsolver-highs/extern/rcm/rcm.h +22 -0
  616. data/ext/lpsolver-highs/extern/zstr/LICENSE +21 -0
  617. data/ext/lpsolver-highs/extern/zstr/strict_fstream.hpp +237 -0
  618. data/ext/lpsolver-highs/extern/zstr/zstr.hpp +473 -0
  619. data/ext/lpsolver-highs/flake.lock +61 -0
  620. data/ext/lpsolver-highs/flake.nix +73 -0
  621. data/ext/lpsolver-highs/highs/CMakeLists.txt +499 -0
  622. data/ext/lpsolver-highs/highs/HConfig.h.bazel.in +25 -0
  623. data/ext/lpsolver-highs/highs/HConfig.h.in +22 -0
  624. data/ext/lpsolver-highs/highs/HConfig.h.meson.in +17 -0
  625. data/ext/lpsolver-highs/highs/Highs.h +1812 -0
  626. data/ext/lpsolver-highs/highs/HighsRun.md +143 -0
  627. data/ext/lpsolver-highs/highs/highs_bindings.cpp +1826 -0
  628. data/ext/lpsolver-highs/highs/highspy/__init__.py +93 -0
  629. data/ext/lpsolver-highs/highs/highspy/__init__.pyi +91 -0
  630. data/ext/lpsolver-highs/highs/highspy/_core/__init__.pyi +1058 -0
  631. data/ext/lpsolver-highs/highs/highspy/_core/cb.pyi +118 -0
  632. data/ext/lpsolver-highs/highs/highspy/_core/simplex_constants.pyi +472 -0
  633. data/ext/lpsolver-highs/highs/highspy/highs.py +2430 -0
  634. data/ext/lpsolver-highs/highs/interfaces/highs_c_api.cpp +1812 -0
  635. data/ext/lpsolver-highs/highs/interfaces/highs_c_api.h +2651 -0
  636. data/ext/lpsolver-highs/highs/interfaces/highs_csharp_api.cs +1142 -0
  637. data/ext/lpsolver-highs/highs/interfaces/highs_fortran_api.f90 +873 -0
  638. data/ext/lpsolver-highs/highs/io/Filereader.cpp +87 -0
  639. data/ext/lpsolver-highs/highs/io/Filereader.h +45 -0
  640. data/ext/lpsolver-highs/highs/io/FilereaderLp.cpp +539 -0
  641. data/ext/lpsolver-highs/highs/io/FilereaderLp.h +49 -0
  642. data/ext/lpsolver-highs/highs/io/FilereaderMps.cpp +86 -0
  643. data/ext/lpsolver-highs/highs/io/FilereaderMps.h +27 -0
  644. data/ext/lpsolver-highs/highs/io/HMPSIO.cpp +1001 -0
  645. data/ext/lpsolver-highs/highs/io/HMPSIO.h +78 -0
  646. data/ext/lpsolver-highs/highs/io/HMpsFF.cpp +2113 -0
  647. data/ext/lpsolver-highs/highs/io/HMpsFF.h +245 -0
  648. data/ext/lpsolver-highs/highs/io/HighsIO.cpp +371 -0
  649. data/ext/lpsolver-highs/highs/io/HighsIO.h +118 -0
  650. data/ext/lpsolver-highs/highs/io/LoadOptions.cpp +60 -0
  651. data/ext/lpsolver-highs/highs/io/LoadOptions.h +24 -0
  652. data/ext/lpsolver-highs/highs/io/filereaderlp/LICENSE +19 -0
  653. data/ext/lpsolver-highs/highs/io/filereaderlp/builder.hpp +25 -0
  654. data/ext/lpsolver-highs/highs/io/filereaderlp/def.hpp +19 -0
  655. data/ext/lpsolver-highs/highs/io/filereaderlp/model.hpp +68 -0
  656. data/ext/lpsolver-highs/highs/io/filereaderlp/reader.cpp +1375 -0
  657. data/ext/lpsolver-highs/highs/io/filereaderlp/reader.hpp +10 -0
  658. data/ext/lpsolver-highs/highs/ipm/IpxSolution.h +32 -0
  659. data/ext/lpsolver-highs/highs/ipm/IpxWrapper.cpp +1526 -0
  660. data/ext/lpsolver-highs/highs/ipm/IpxWrapper.h +106 -0
  661. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu.h +161 -0
  662. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_factorize.c +132 -0
  663. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_factorize.h +247 -0
  664. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_get_factors.c +148 -0
  665. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_get_factors.h +108 -0
  666. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_initialize.c +24 -0
  667. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_initialize.h +119 -0
  668. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_factorize.h +34 -0
  669. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_free.h +19 -0
  670. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_get_factors.h +34 -0
  671. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_initialize.h +46 -0
  672. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_solve_dense.h +29 -0
  673. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_solve_for_update.h +42 -0
  674. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_solve_sparse.h +32 -0
  675. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_update.h +31 -0
  676. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_object.c +325 -0
  677. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_object.h +30 -0
  678. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_dense.c +46 -0
  679. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_dense.h +75 -0
  680. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_for_update.c +79 -0
  681. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_for_update.h +169 -0
  682. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_sparse.c +63 -0
  683. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_sparse.h +112 -0
  684. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_update.c +44 -0
  685. data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_update.h +125 -0
  686. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_build_factors.c +441 -0
  687. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_condest.c +124 -0
  688. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_def.h +39 -0
  689. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_dfs.c +141 -0
  690. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_factorize_bump.c +56 -0
  691. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_file.c +184 -0
  692. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_file.h +21 -0
  693. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_garbage_perm.c +53 -0
  694. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_initialize.c +56 -0
  695. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_internal.c +352 -0
  696. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_internal.h +220 -0
  697. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_list.h +173 -0
  698. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_markowitz.c +188 -0
  699. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_matrix_norm.c +51 -0
  700. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_pivot.c +1247 -0
  701. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_residual_test.c +155 -0
  702. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_setup_bump.c +198 -0
  703. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_singletons.c +511 -0
  704. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_solve_dense.c +129 -0
  705. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_solve_for_update.c +360 -0
  706. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_solve_sparse.c +284 -0
  707. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_solve_symbolic.c +48 -0
  708. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_solve_triangular.c +140 -0
  709. data/ext/lpsolver-highs/highs/ipm/basiclu/lu_update.c +908 -0
  710. data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/Auxiliary.cpp +301 -0
  711. data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/Auxiliary.h +104 -0
  712. data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/IntConfig.h +27 -0
  713. data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/KrylovMethods.cpp +193 -0
  714. data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/KrylovMethods.h +30 -0
  715. data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/Log.cpp +60 -0
  716. data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/Log.h +62 -0
  717. data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/OrderingPrint.h +10 -0
  718. data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/VectorOperations.cpp +117 -0
  719. data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/VectorOperations.h +59 -0
  720. data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/mycblas.h +85 -0
  721. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Analyse.cpp +1367 -0
  722. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Analyse.h +122 -0
  723. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/CallAndTimeBlas.cpp +114 -0
  724. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/CallAndTimeBlas.h +46 -0
  725. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/CliqueStack.cpp +82 -0
  726. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/CliqueStack.h +83 -0
  727. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DataCollector.cpp +326 -0
  728. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DataCollector.h +86 -0
  729. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DenseFact.h +48 -0
  730. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DenseFactHybrid.cpp +279 -0
  731. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DenseFactKernel.cpp +284 -0
  732. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DgemmParallel.cpp +38 -0
  733. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DgemmParallel.h +32 -0
  734. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/FactorHiGHS.cpp +57 -0
  735. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/FactorHiGHS.h +112 -0
  736. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/FactorHiGHSSettings.h +63 -0
  737. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Factorise.cpp +405 -0
  738. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Factorise.h +85 -0
  739. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/FormatHandler.cpp +46 -0
  740. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/FormatHandler.h +95 -0
  741. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/HybridHybridFormatHandler.cpp +238 -0
  742. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/HybridHybridFormatHandler.h +31 -0
  743. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/HybridSolveHandler.cpp +272 -0
  744. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/HybridSolveHandler.h +26 -0
  745. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/KrylovMethodsIpm.cpp +83 -0
  746. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/KrylovMethodsIpm.h +45 -0
  747. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Numeric.cpp +54 -0
  748. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Numeric.h +46 -0
  749. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/ReturnValues.h +19 -0
  750. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/SolveHandler.cpp +10 -0
  751. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/SolveHandler.h +48 -0
  752. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Swaps.cpp +70 -0
  753. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Swaps.h +19 -0
  754. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Symbolic.cpp +101 -0
  755. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Symbolic.h +220 -0
  756. data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Timing.h +114 -0
  757. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Control.cpp +38 -0
  758. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Control.h +41 -0
  759. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/FactorHiGHSSolver.cpp +887 -0
  760. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/FactorHiGHSSolver.h +92 -0
  761. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Info.h +58 -0
  762. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/IpmData.cpp +8 -0
  763. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/IpmData.h +37 -0
  764. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Iterate.cpp +640 -0
  765. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Iterate.h +172 -0
  766. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/LinearSolver.h +81 -0
  767. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/LogHighs.cpp +71 -0
  768. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/LogHighs.h +33 -0
  769. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Model.cpp +403 -0
  770. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Model.h +136 -0
  771. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Options.h +35 -0
  772. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Parameters.h +63 -0
  773. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/PreProcess.cpp +646 -0
  774. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/PreProcess.h +94 -0
  775. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Refine.cpp +214 -0
  776. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Solver.cpp +1346 -0
  777. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Solver.h +338 -0
  778. data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Status.h +88 -0
  779. data/ext/lpsolver-highs/highs/ipm/ipx/basiclu_kernel.cc +71 -0
  780. data/ext/lpsolver-highs/highs/ipm/ipx/basiclu_kernel.h +20 -0
  781. data/ext/lpsolver-highs/highs/ipm/ipx/basiclu_wrapper.cc +299 -0
  782. data/ext/lpsolver-highs/highs/ipm/ipx/basiclu_wrapper.h +47 -0
  783. data/ext/lpsolver-highs/highs/ipm/ipx/basis.cc +966 -0
  784. data/ext/lpsolver-highs/highs/ipm/ipx/basis.h +350 -0
  785. data/ext/lpsolver-highs/highs/ipm/ipx/conjugate_residuals.cc +217 -0
  786. data/ext/lpsolver-highs/highs/ipm/ipx/conjugate_residuals.h +74 -0
  787. data/ext/lpsolver-highs/highs/ipm/ipx/control.cc +151 -0
  788. data/ext/lpsolver-highs/highs/ipm/ipx/control.h +167 -0
  789. data/ext/lpsolver-highs/highs/ipm/ipx/crossover.cc +479 -0
  790. data/ext/lpsolver-highs/highs/ipm/ipx/crossover.h +157 -0
  791. data/ext/lpsolver-highs/highs/ipm/ipx/diagonal_precond.cc +70 -0
  792. data/ext/lpsolver-highs/highs/ipm/ipx/diagonal_precond.h +45 -0
  793. data/ext/lpsolver-highs/highs/ipm/ipx/forrest_tomlin.cc +360 -0
  794. data/ext/lpsolver-highs/highs/ipm/ipx/forrest_tomlin.h +102 -0
  795. data/ext/lpsolver-highs/highs/ipm/ipx/guess_basis.cc +233 -0
  796. data/ext/lpsolver-highs/highs/ipm/ipx/guess_basis.h +21 -0
  797. data/ext/lpsolver-highs/highs/ipm/ipx/indexed_vector.cc +30 -0
  798. data/ext/lpsolver-highs/highs/ipm/ipx/indexed_vector.h +113 -0
  799. data/ext/lpsolver-highs/highs/ipm/ipx/info.cc +124 -0
  800. data/ext/lpsolver-highs/highs/ipm/ipx/info.h +27 -0
  801. data/ext/lpsolver-highs/highs/ipm/ipx/ipm.cc +897 -0
  802. data/ext/lpsolver-highs/highs/ipm/ipx/ipm.h +94 -0
  803. data/ext/lpsolver-highs/highs/ipm/ipx/ipx_c.cc +83 -0
  804. data/ext/lpsolver-highs/highs/ipm/ipx/ipx_c.h +47 -0
  805. data/ext/lpsolver-highs/highs/ipm/ipx/ipx_config.h +9 -0
  806. data/ext/lpsolver-highs/highs/ipm/ipx/ipx_info.h +111 -0
  807. data/ext/lpsolver-highs/highs/ipm/ipx/ipx_internal.h +89 -0
  808. data/ext/lpsolver-highs/highs/ipm/ipx/ipx_parameters.h +76 -0
  809. data/ext/lpsolver-highs/highs/ipm/ipx/ipx_status.h +57 -0
  810. data/ext/lpsolver-highs/highs/ipm/ipx/iterate.cc +683 -0
  811. data/ext/lpsolver-highs/highs/ipm/ipx/iterate.h +331 -0
  812. data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver.cc +23 -0
  813. data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver.h +70 -0
  814. data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver_basis.cc +387 -0
  815. data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver_basis.h +66 -0
  816. data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver_diag.cc +120 -0
  817. data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver_diag.h +48 -0
  818. data/ext/lpsolver-highs/highs/ipm/ipx/linear_operator.cc +10 -0
  819. data/ext/lpsolver-highs/highs/ipm/ipx/linear_operator.h +26 -0
  820. data/ext/lpsolver-highs/highs/ipm/ipx/lp_solver.cc +686 -0
  821. data/ext/lpsolver-highs/highs/ipm/ipx/lp_solver.h +204 -0
  822. data/ext/lpsolver-highs/highs/ipm/ipx/lu_factorization.cc +131 -0
  823. data/ext/lpsolver-highs/highs/ipm/ipx/lu_factorization.h +79 -0
  824. data/ext/lpsolver-highs/highs/ipm/ipx/lu_update.cc +62 -0
  825. data/ext/lpsolver-highs/highs/ipm/ipx/lu_update.h +129 -0
  826. data/ext/lpsolver-highs/highs/ipm/ipx/maxvolume.cc +337 -0
  827. data/ext/lpsolver-highs/highs/ipm/ipx/maxvolume.h +54 -0
  828. data/ext/lpsolver-highs/highs/ipm/ipx/model.cc +1528 -0
  829. data/ext/lpsolver-highs/highs/ipm/ipx/model.h +413 -0
  830. data/ext/lpsolver-highs/highs/ipm/ipx/multistream.h +52 -0
  831. data/ext/lpsolver-highs/highs/ipm/ipx/normal_matrix.cc +126 -0
  832. data/ext/lpsolver-highs/highs/ipm/ipx/normal_matrix.h +44 -0
  833. data/ext/lpsolver-highs/highs/ipm/ipx/power_method.h +44 -0
  834. data/ext/lpsolver-highs/highs/ipm/ipx/sparse_matrix.cc +382 -0
  835. data/ext/lpsolver-highs/highs/ipm/ipx/sparse_matrix.h +195 -0
  836. data/ext/lpsolver-highs/highs/ipm/ipx/sparse_utils.cc +92 -0
  837. data/ext/lpsolver-highs/highs/ipm/ipx/sparse_utils.h +58 -0
  838. data/ext/lpsolver-highs/highs/ipm/ipx/splitted_normal_matrix.cc +117 -0
  839. data/ext/lpsolver-highs/highs/ipm/ipx/splitted_normal_matrix.h +63 -0
  840. data/ext/lpsolver-highs/highs/ipm/ipx/starting_basis.cc +182 -0
  841. data/ext/lpsolver-highs/highs/ipm/ipx/starting_basis.h +39 -0
  842. data/ext/lpsolver-highs/highs/ipm/ipx/symbolic_invert.cc +183 -0
  843. data/ext/lpsolver-highs/highs/ipm/ipx/symbolic_invert.h +29 -0
  844. data/ext/lpsolver-highs/highs/ipm/ipx/timer.cc +16 -0
  845. data/ext/lpsolver-highs/highs/ipm/ipx/timer.h +25 -0
  846. data/ext/lpsolver-highs/highs/ipm/ipx/utils.cc +95 -0
  847. data/ext/lpsolver-highs/highs/ipm/ipx/utils.h +37 -0
  848. data/ext/lpsolver-highs/highs/lp_data/HConst.h +430 -0
  849. data/ext/lpsolver-highs/highs/lp_data/HStruct.h +213 -0
  850. data/ext/lpsolver-highs/highs/lp_data/Highs.cpp +4949 -0
  851. data/ext/lpsolver-highs/highs/lp_data/HighsAnalysis.h +23 -0
  852. data/ext/lpsolver-highs/highs/lp_data/HighsCallback.cpp +323 -0
  853. data/ext/lpsolver-highs/highs/lp_data/HighsCallback.h +104 -0
  854. data/ext/lpsolver-highs/highs/lp_data/HighsCallbackStruct.h +70 -0
  855. data/ext/lpsolver-highs/highs/lp_data/HighsDebug.cpp +54 -0
  856. data/ext/lpsolver-highs/highs/lp_data/HighsDebug.h +34 -0
  857. data/ext/lpsolver-highs/highs/lp_data/HighsDeprecated.cpp +181 -0
  858. data/ext/lpsolver-highs/highs/lp_data/HighsIis.cpp +1290 -0
  859. data/ext/lpsolver-highs/highs/lp_data/HighsIis.h +139 -0
  860. data/ext/lpsolver-highs/highs/lp_data/HighsInfo.cpp +426 -0
  861. data/ext/lpsolver-highs/highs/lp_data/HighsInfo.h +421 -0
  862. data/ext/lpsolver-highs/highs/lp_data/HighsInfoDebug.cpp +175 -0
  863. data/ext/lpsolver-highs/highs/lp_data/HighsInfoDebug.h +27 -0
  864. data/ext/lpsolver-highs/highs/lp_data/HighsInterface.cpp +4344 -0
  865. data/ext/lpsolver-highs/highs/lp_data/HighsLp.cpp +564 -0
  866. data/ext/lpsolver-highs/highs/lp_data/HighsLp.h +97 -0
  867. data/ext/lpsolver-highs/highs/lp_data/HighsLpSolverObject.h +47 -0
  868. data/ext/lpsolver-highs/highs/lp_data/HighsLpUtils.cpp +3794 -0
  869. data/ext/lpsolver-highs/highs/lp_data/HighsLpUtils.h +330 -0
  870. data/ext/lpsolver-highs/highs/lp_data/HighsModelUtils.cpp +1650 -0
  871. data/ext/lpsolver-highs/highs/lp_data/HighsModelUtils.h +129 -0
  872. data/ext/lpsolver-highs/highs/lp_data/HighsOptions.cpp +1176 -0
  873. data/ext/lpsolver-highs/highs/lp_data/HighsOptions.h +1715 -0
  874. data/ext/lpsolver-highs/highs/lp_data/HighsRanging.cpp +733 -0
  875. data/ext/lpsolver-highs/highs/lp_data/HighsRanging.h +43 -0
  876. data/ext/lpsolver-highs/highs/lp_data/HighsSolution.cpp +2194 -0
  877. data/ext/lpsolver-highs/highs/lp_data/HighsSolution.h +179 -0
  878. data/ext/lpsolver-highs/highs/lp_data/HighsSolutionDebug.cpp +490 -0
  879. data/ext/lpsolver-highs/highs/lp_data/HighsSolutionDebug.h +87 -0
  880. data/ext/lpsolver-highs/highs/lp_data/HighsSolve.cpp +747 -0
  881. data/ext/lpsolver-highs/highs/lp_data/HighsSolve.h +29 -0
  882. data/ext/lpsolver-highs/highs/lp_data/HighsStatus.cpp +48 -0
  883. data/ext/lpsolver-highs/highs/lp_data/HighsStatus.h +29 -0
  884. data/ext/lpsolver-highs/highs/lp_data/Iis.md +113 -0
  885. data/ext/lpsolver-highs/highs/meson.build +433 -0
  886. data/ext/lpsolver-highs/highs/mip/HighsCliqueTable.cpp +2236 -0
  887. data/ext/lpsolver-highs/highs/mip/HighsCliqueTable.h +329 -0
  888. data/ext/lpsolver-highs/highs/mip/HighsConflictPool.cpp +201 -0
  889. data/ext/lpsolver-highs/highs/mip/HighsConflictPool.h +109 -0
  890. data/ext/lpsolver-highs/highs/mip/HighsCutGeneration.cpp +1491 -0
  891. data/ext/lpsolver-highs/highs/mip/HighsCutGeneration.h +108 -0
  892. data/ext/lpsolver-highs/highs/mip/HighsCutPool.cpp +526 -0
  893. data/ext/lpsolver-highs/highs/mip/HighsCutPool.h +168 -0
  894. data/ext/lpsolver-highs/highs/mip/HighsDebugSol.cpp +313 -0
  895. data/ext/lpsolver-highs/highs/mip/HighsDebugSol.h +133 -0
  896. data/ext/lpsolver-highs/highs/mip/HighsDomain.cpp +3861 -0
  897. data/ext/lpsolver-highs/highs/mip/HighsDomain.h +657 -0
  898. data/ext/lpsolver-highs/highs/mip/HighsDomainChange.h +48 -0
  899. data/ext/lpsolver-highs/highs/mip/HighsDynamicRowMatrix.cpp +199 -0
  900. data/ext/lpsolver-highs/highs/mip/HighsDynamicRowMatrix.h +104 -0
  901. data/ext/lpsolver-highs/highs/mip/HighsFeasibilityJump.cpp +139 -0
  902. data/ext/lpsolver-highs/highs/mip/HighsGFkSolve.cpp +106 -0
  903. data/ext/lpsolver-highs/highs/mip/HighsGFkSolve.h +439 -0
  904. data/ext/lpsolver-highs/highs/mip/HighsImplications.cpp +915 -0
  905. data/ext/lpsolver-highs/highs/mip/HighsImplications.h +194 -0
  906. data/ext/lpsolver-highs/highs/mip/HighsLpAggregator.cpp +56 -0
  907. data/ext/lpsolver-highs/highs/mip/HighsLpAggregator.h +50 -0
  908. data/ext/lpsolver-highs/highs/mip/HighsLpRelaxation.cpp +1609 -0
  909. data/ext/lpsolver-highs/highs/mip/HighsLpRelaxation.h +361 -0
  910. data/ext/lpsolver-highs/highs/mip/HighsMipAnalysis.cpp +313 -0
  911. data/ext/lpsolver-highs/highs/mip/HighsMipAnalysis.h +71 -0
  912. data/ext/lpsolver-highs/highs/mip/HighsMipSolver.cpp +1002 -0
  913. data/ext/lpsolver-highs/highs/mip/HighsMipSolver.h +159 -0
  914. data/ext/lpsolver-highs/highs/mip/HighsMipSolverData.cpp +2936 -0
  915. data/ext/lpsolver-highs/highs/mip/HighsMipSolverData.h +313 -0
  916. data/ext/lpsolver-highs/highs/mip/HighsModkSeparator.cpp +267 -0
  917. data/ext/lpsolver-highs/highs/mip/HighsModkSeparator.h +60 -0
  918. data/ext/lpsolver-highs/highs/mip/HighsNodeQueue.cpp +443 -0
  919. data/ext/lpsolver-highs/highs/mip/HighsNodeQueue.h +312 -0
  920. data/ext/lpsolver-highs/highs/mip/HighsObjectiveFunction.cpp +124 -0
  921. data/ext/lpsolver-highs/highs/mip/HighsObjectiveFunction.h +71 -0
  922. data/ext/lpsolver-highs/highs/mip/HighsPathSeparator.cpp +549 -0
  923. data/ext/lpsolver-highs/highs/mip/HighsPathSeparator.h +39 -0
  924. data/ext/lpsolver-highs/highs/mip/HighsPrimalHeuristics.cpp +1673 -0
  925. data/ext/lpsolver-highs/highs/mip/HighsPrimalHeuristics.h +75 -0
  926. data/ext/lpsolver-highs/highs/mip/HighsPseudocost.cpp +129 -0
  927. data/ext/lpsolver-highs/highs/mip/HighsPseudocost.h +366 -0
  928. data/ext/lpsolver-highs/highs/mip/HighsRedcostFixing.cpp +316 -0
  929. data/ext/lpsolver-highs/highs/mip/HighsRedcostFixing.h +42 -0
  930. data/ext/lpsolver-highs/highs/mip/HighsSearch.cpp +1881 -0
  931. data/ext/lpsolver-highs/highs/mip/HighsSearch.h +241 -0
  932. data/ext/lpsolver-highs/highs/mip/HighsSeparation.cpp +186 -0
  933. data/ext/lpsolver-highs/highs/mip/HighsSeparation.h +41 -0
  934. data/ext/lpsolver-highs/highs/mip/HighsSeparator.cpp +39 -0
  935. data/ext/lpsolver-highs/highs/mip/HighsSeparator.h +60 -0
  936. data/ext/lpsolver-highs/highs/mip/HighsTableauSeparator.cpp +244 -0
  937. data/ext/lpsolver-highs/highs/mip/HighsTableauSeparator.h +34 -0
  938. data/ext/lpsolver-highs/highs/mip/HighsTransformedLp.cpp +563 -0
  939. data/ext/lpsolver-highs/highs/mip/HighsTransformedLp.h +63 -0
  940. data/ext/lpsolver-highs/highs/mip/MipTimer.h +544 -0
  941. data/ext/lpsolver-highs/highs/mip/feasibilityjump.hh +800 -0
  942. data/ext/lpsolver-highs/highs/model/HighsHessian.cpp +263 -0
  943. data/ext/lpsolver-highs/highs/model/HighsHessian.h +54 -0
  944. data/ext/lpsolver-highs/highs/model/HighsHessianUtils.cpp +584 -0
  945. data/ext/lpsolver-highs/highs/model/HighsHessianUtils.h +47 -0
  946. data/ext/lpsolver-highs/highs/model/HighsModel.cpp +46 -0
  947. data/ext/lpsolver-highs/highs/model/HighsModel.h +42 -0
  948. data/ext/lpsolver-highs/highs/parallel/HighsBinarySemaphore.h +108 -0
  949. data/ext/lpsolver-highs/highs/parallel/HighsCacheAlign.h +82 -0
  950. data/ext/lpsolver-highs/highs/parallel/HighsCombinable.h +116 -0
  951. data/ext/lpsolver-highs/highs/parallel/HighsMutex.h +124 -0
  952. data/ext/lpsolver-highs/highs/parallel/HighsParallel.h +128 -0
  953. data/ext/lpsolver-highs/highs/parallel/HighsRaceTimer.h +38 -0
  954. data/ext/lpsolver-highs/highs/parallel/HighsSchedulerConstants.h +19 -0
  955. data/ext/lpsolver-highs/highs/parallel/HighsSpinMutex.h +48 -0
  956. data/ext/lpsolver-highs/highs/parallel/HighsSplitDeque.h +606 -0
  957. data/ext/lpsolver-highs/highs/parallel/HighsTask.h +170 -0
  958. data/ext/lpsolver-highs/highs/parallel/HighsTaskExecutor.cpp +43 -0
  959. data/ext/lpsolver-highs/highs/parallel/HighsTaskExecutor.h +217 -0
  960. data/ext/lpsolver-highs/highs/pdlp/CupdlpWrapper.cpp +848 -0
  961. data/ext/lpsolver-highs/highs/pdlp/CupdlpWrapper.h +108 -0
  962. data/ext/lpsolver-highs/highs/pdlp/HiPdlpTimer.h +155 -0
  963. data/ext/lpsolver-highs/highs/pdlp/HiPdlpWrapper.cpp +141 -0
  964. data/ext/lpsolver-highs/highs/pdlp/HiPdlpWrapper.h +26 -0
  965. data/ext/lpsolver-highs/highs/pdlp/cupdlp/Diff +12 -0
  966. data/ext/lpsolver-highs/highs/pdlp/cupdlp/Meld +7 -0
  967. data/ext/lpsolver-highs/highs/pdlp/cupdlp/Merge +2 -0
  968. data/ext/lpsolver-highs/highs/pdlp/cupdlp/README.md +95 -0
  969. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/CMakeLists.txt +58 -0
  970. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/cupdlp_cuda_kernels.cu +338 -0
  971. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/cupdlp_cuda_kernels.cuh +319 -0
  972. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/cupdlp_cudalinalg.cu +386 -0
  973. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/cupdlp_cudalinalg.cuh +149 -0
  974. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/test_cublas.c +154 -0
  975. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/test_cuda_linalg.c +79 -0
  976. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp.h +16 -0
  977. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_cs.c +214 -0
  978. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_cs.h +40 -0
  979. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_defs.h +447 -0
  980. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_linalg.c +802 -0
  981. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_linalg.h +189 -0
  982. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_proj.c +148 -0
  983. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_proj.h +19 -0
  984. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_restart.c +124 -0
  985. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_restart.h +31 -0
  986. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_scaling.c +425 -0
  987. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_scaling.h +26 -0
  988. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_solver.c +1498 -0
  989. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_solver.h +105 -0
  990. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_step.c +478 -0
  991. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_step.h +37 -0
  992. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_utils.c +1850 -0
  993. data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_utils.h +212 -0
  994. data/ext/lpsolver-highs/highs/pdlp/cupdlp/glbopts.h +342 -0
  995. data/ext/lpsolver-highs/highs/pdlp/hipdlp/defs.hpp +222 -0
  996. data/ext/lpsolver-highs/highs/pdlp/hipdlp/linalg.cc +231 -0
  997. data/ext/lpsolver-highs/highs/pdlp/hipdlp/linalg.hpp +61 -0
  998. data/ext/lpsolver-highs/highs/pdlp/hipdlp/logger.cc +225 -0
  999. data/ext/lpsolver-highs/highs/pdlp/hipdlp/logger.hpp +80 -0
  1000. data/ext/lpsolver-highs/highs/pdlp/hipdlp/pdhg.cc +2798 -0
  1001. data/ext/lpsolver-highs/highs/pdlp/hipdlp/pdhg.cu +497 -0
  1002. data/ext/lpsolver-highs/highs/pdlp/hipdlp/pdhg.hpp +358 -0
  1003. data/ext/lpsolver-highs/highs/pdlp/hipdlp/pdhg_kernels.hpp +77 -0
  1004. data/ext/lpsolver-highs/highs/pdlp/hipdlp/pdlp_gpu_debug.hpp +62 -0
  1005. data/ext/lpsolver-highs/highs/pdlp/hipdlp/restart.cc +132 -0
  1006. data/ext/lpsolver-highs/highs/pdlp/hipdlp/restart.hpp +96 -0
  1007. data/ext/lpsolver-highs/highs/pdlp/hipdlp/scaling.cc +307 -0
  1008. data/ext/lpsolver-highs/highs/pdlp/hipdlp/scaling.hpp +74 -0
  1009. data/ext/lpsolver-highs/highs/pdlp/hipdlp/solver_results.hpp +65 -0
  1010. data/ext/lpsolver-highs/highs/presolve/HPresolve.cpp +8511 -0
  1011. data/ext/lpsolver-highs/highs/presolve/HPresolve.h +505 -0
  1012. data/ext/lpsolver-highs/highs/presolve/HPresolveAnalysis.cpp +239 -0
  1013. data/ext/lpsolver-highs/highs/presolve/HPresolveAnalysis.h +52 -0
  1014. data/ext/lpsolver-highs/highs/presolve/HighsPostsolveStack.cpp +1368 -0
  1015. data/ext/lpsolver-highs/highs/presolve/HighsPostsolveStack.h +943 -0
  1016. data/ext/lpsolver-highs/highs/presolve/HighsSymmetry.cpp +1921 -0
  1017. data/ext/lpsolver-highs/highs/presolve/HighsSymmetry.h +284 -0
  1018. data/ext/lpsolver-highs/highs/presolve/ICrash.cpp +474 -0
  1019. data/ext/lpsolver-highs/highs/presolve/ICrash.h +124 -0
  1020. data/ext/lpsolver-highs/highs/presolve/ICrashUtil.cpp +267 -0
  1021. data/ext/lpsolver-highs/highs/presolve/ICrashUtil.h +62 -0
  1022. data/ext/lpsolver-highs/highs/presolve/ICrashX.cpp +173 -0
  1023. data/ext/lpsolver-highs/highs/presolve/ICrashX.h +23 -0
  1024. data/ext/lpsolver-highs/highs/presolve/PresolveComponent.cpp +45 -0
  1025. data/ext/lpsolver-highs/highs/presolve/PresolveComponent.h +90 -0
  1026. data/ext/lpsolver-highs/highs/qpsolver/README.md +185 -0
  1027. data/ext/lpsolver-highs/highs/qpsolver/a_asm.cpp +139 -0
  1028. data/ext/lpsolver-highs/highs/qpsolver/a_asm.hpp +77 -0
  1029. data/ext/lpsolver-highs/highs/qpsolver/a_quass.cpp +194 -0
  1030. data/ext/lpsolver-highs/highs/qpsolver/a_quass.hpp +22 -0
  1031. data/ext/lpsolver-highs/highs/qpsolver/basis.cpp +443 -0
  1032. data/ext/lpsolver-highs/highs/qpsolver/basis.hpp +159 -0
  1033. data/ext/lpsolver-highs/highs/qpsolver/crashsolution.hpp +20 -0
  1034. data/ext/lpsolver-highs/highs/qpsolver/dantzigpricing.hpp +80 -0
  1035. data/ext/lpsolver-highs/highs/qpsolver/devexharrispricing.hpp +98 -0
  1036. data/ext/lpsolver-highs/highs/qpsolver/devexpricing.hpp +108 -0
  1037. data/ext/lpsolver-highs/highs/qpsolver/eventhandler.hpp +30 -0
  1038. data/ext/lpsolver-highs/highs/qpsolver/factor.hpp +408 -0
  1039. data/ext/lpsolver-highs/highs/qpsolver/feasibility_bounded.hpp +114 -0
  1040. data/ext/lpsolver-highs/highs/qpsolver/feasibility_highs.hpp +301 -0
  1041. data/ext/lpsolver-highs/highs/qpsolver/gradient.hpp +46 -0
  1042. data/ext/lpsolver-highs/highs/qpsolver/instance.hpp +70 -0
  1043. data/ext/lpsolver-highs/highs/qpsolver/matrix.hpp +342 -0
  1044. data/ext/lpsolver-highs/highs/qpsolver/perturbation.cpp +41 -0
  1045. data/ext/lpsolver-highs/highs/qpsolver/perturbation.hpp +15 -0
  1046. data/ext/lpsolver-highs/highs/qpsolver/pricing.hpp +22 -0
  1047. data/ext/lpsolver-highs/highs/qpsolver/qpconst.hpp +34 -0
  1048. data/ext/lpsolver-highs/highs/qpsolver/qpvector.hpp +242 -0
  1049. data/ext/lpsolver-highs/highs/qpsolver/quass.cpp +551 -0
  1050. data/ext/lpsolver-highs/highs/qpsolver/quass.hpp +27 -0
  1051. data/ext/lpsolver-highs/highs/qpsolver/ratiotest.cpp +146 -0
  1052. data/ext/lpsolver-highs/highs/qpsolver/ratiotest.hpp +26 -0
  1053. data/ext/lpsolver-highs/highs/qpsolver/reducedcosts.hpp +46 -0
  1054. data/ext/lpsolver-highs/highs/qpsolver/reducedgradient.hpp +95 -0
  1055. data/ext/lpsolver-highs/highs/qpsolver/runtime.hpp +45 -0
  1056. data/ext/lpsolver-highs/highs/qpsolver/scaling.cpp +123 -0
  1057. data/ext/lpsolver-highs/highs/qpsolver/scaling.hpp +15 -0
  1058. data/ext/lpsolver-highs/highs/qpsolver/settings.hpp +84 -0
  1059. data/ext/lpsolver-highs/highs/qpsolver/snippets.hpp +36 -0
  1060. data/ext/lpsolver-highs/highs/qpsolver/statistics.hpp +30 -0
  1061. data/ext/lpsolver-highs/highs/qpsolver/steepestedgepricing.hpp +173 -0
  1062. data/ext/lpsolver-highs/highs/simplex/HApp.h +550 -0
  1063. data/ext/lpsolver-highs/highs/simplex/HEkk.cpp +4404 -0
  1064. data/ext/lpsolver-highs/highs/simplex/HEkk.h +419 -0
  1065. data/ext/lpsolver-highs/highs/simplex/HEkkControl.cpp +146 -0
  1066. data/ext/lpsolver-highs/highs/simplex/HEkkDebug.cpp +1722 -0
  1067. data/ext/lpsolver-highs/highs/simplex/HEkkDual.cpp +3003 -0
  1068. data/ext/lpsolver-highs/highs/simplex/HEkkDual.h +513 -0
  1069. data/ext/lpsolver-highs/highs/simplex/HEkkDualMulti.cpp +1020 -0
  1070. data/ext/lpsolver-highs/highs/simplex/HEkkDualRHS.cpp +535 -0
  1071. data/ext/lpsolver-highs/highs/simplex/HEkkDualRHS.h +134 -0
  1072. data/ext/lpsolver-highs/highs/simplex/HEkkDualRow.cpp +697 -0
  1073. data/ext/lpsolver-highs/highs/simplex/HEkkDualRow.h +201 -0
  1074. data/ext/lpsolver-highs/highs/simplex/HEkkInterface.cpp +26 -0
  1075. data/ext/lpsolver-highs/highs/simplex/HEkkPrimal.cpp +2984 -0
  1076. data/ext/lpsolver-highs/highs/simplex/HEkkPrimal.h +191 -0
  1077. data/ext/lpsolver-highs/highs/simplex/HSimplex.cpp +330 -0
  1078. data/ext/lpsolver-highs/highs/simplex/HSimplex.h +42 -0
  1079. data/ext/lpsolver-highs/highs/simplex/HSimplexDebug.cpp +145 -0
  1080. data/ext/lpsolver-highs/highs/simplex/HSimplexDebug.h +48 -0
  1081. data/ext/lpsolver-highs/highs/simplex/HSimplexNla.cpp +517 -0
  1082. data/ext/lpsolver-highs/highs/simplex/HSimplexNla.h +158 -0
  1083. data/ext/lpsolver-highs/highs/simplex/HSimplexNlaDebug.cpp +373 -0
  1084. data/ext/lpsolver-highs/highs/simplex/HSimplexNlaFreeze.cpp +28 -0
  1085. data/ext/lpsolver-highs/highs/simplex/HSimplexNlaProductForm.cpp +113 -0
  1086. data/ext/lpsolver-highs/highs/simplex/HSimplexReport.cpp +77 -0
  1087. data/ext/lpsolver-highs/highs/simplex/HSimplexReport.h +21 -0
  1088. data/ext/lpsolver-highs/highs/simplex/HighsSimplexAnalysis.cpp +1495 -0
  1089. data/ext/lpsolver-highs/highs/simplex/HighsSimplexAnalysis.h +500 -0
  1090. data/ext/lpsolver-highs/highs/simplex/SimplexConst.h +273 -0
  1091. data/ext/lpsolver-highs/highs/simplex/SimplexStruct.h +263 -0
  1092. data/ext/lpsolver-highs/highs/simplex/SimplexTimer.h +414 -0
  1093. data/ext/lpsolver-highs/highs/test_kkt/DevKkt.cpp +469 -0
  1094. data/ext/lpsolver-highs/highs/test_kkt/DevKkt.h +143 -0
  1095. data/ext/lpsolver-highs/highs/test_kkt/KktCh2.cpp +305 -0
  1096. data/ext/lpsolver-highs/highs/test_kkt/KktCh2.h +79 -0
  1097. data/ext/lpsolver-highs/highs/util/FactorTimer.h +199 -0
  1098. data/ext/lpsolver-highs/highs/util/HFactor.cpp +2597 -0
  1099. data/ext/lpsolver-highs/highs/util/HFactor.h +587 -0
  1100. data/ext/lpsolver-highs/highs/util/HFactorConst.h +81 -0
  1101. data/ext/lpsolver-highs/highs/util/HFactorDebug.cpp +231 -0
  1102. data/ext/lpsolver-highs/highs/util/HFactorDebug.h +55 -0
  1103. data/ext/lpsolver-highs/highs/util/HFactorExtend.cpp +229 -0
  1104. data/ext/lpsolver-highs/highs/util/HFactorRefactor.cpp +304 -0
  1105. data/ext/lpsolver-highs/highs/util/HFactorUtils.cpp +122 -0
  1106. data/ext/lpsolver-highs/highs/util/HSet.cpp +197 -0
  1107. data/ext/lpsolver-highs/highs/util/HSet.h +89 -0
  1108. data/ext/lpsolver-highs/highs/util/HVector.h +22 -0
  1109. data/ext/lpsolver-highs/highs/util/HVectorBase.cpp +271 -0
  1110. data/ext/lpsolver-highs/highs/util/HVectorBase.h +102 -0
  1111. data/ext/lpsolver-highs/highs/util/HighsCDouble.h +323 -0
  1112. data/ext/lpsolver-highs/highs/util/HighsComponent.h +53 -0
  1113. data/ext/lpsolver-highs/highs/util/HighsDataStack.h +83 -0
  1114. data/ext/lpsolver-highs/highs/util/HighsDisjointSets.h +107 -0
  1115. data/ext/lpsolver-highs/highs/util/HighsHash.cpp +10 -0
  1116. data/ext/lpsolver-highs/highs/util/HighsHash.h +1274 -0
  1117. data/ext/lpsolver-highs/highs/util/HighsHashTree.h +1461 -0
  1118. data/ext/lpsolver-highs/highs/util/HighsInt.h +36 -0
  1119. data/ext/lpsolver-highs/highs/util/HighsIntegers.h +212 -0
  1120. data/ext/lpsolver-highs/highs/util/HighsLinearSumBounds.cpp +267 -0
  1121. data/ext/lpsolver-highs/highs/util/HighsLinearSumBounds.h +203 -0
  1122. data/ext/lpsolver-highs/highs/util/HighsMatrixPic.cpp +146 -0
  1123. data/ext/lpsolver-highs/highs/util/HighsMatrixPic.h +37 -0
  1124. data/ext/lpsolver-highs/highs/util/HighsMatrixSlice.h +561 -0
  1125. data/ext/lpsolver-highs/highs/util/HighsMatrixUtils.cpp +407 -0
  1126. data/ext/lpsolver-highs/highs/util/HighsMatrixUtils.h +57 -0
  1127. data/ext/lpsolver-highs/highs/util/HighsMemoryAllocation.h +63 -0
  1128. data/ext/lpsolver-highs/highs/util/HighsRandom.h +242 -0
  1129. data/ext/lpsolver-highs/highs/util/HighsRbTree.h +452 -0
  1130. data/ext/lpsolver-highs/highs/util/HighsSort.cpp +364 -0
  1131. data/ext/lpsolver-highs/highs/util/HighsSort.h +131 -0
  1132. data/ext/lpsolver-highs/highs/util/HighsSparseMatrix.cpp +1746 -0
  1133. data/ext/lpsolver-highs/highs/util/HighsSparseMatrix.h +151 -0
  1134. data/ext/lpsolver-highs/highs/util/HighsSparseVectorSum.h +95 -0
  1135. data/ext/lpsolver-highs/highs/util/HighsSplay.h +135 -0
  1136. data/ext/lpsolver-highs/highs/util/HighsTimer.h +385 -0
  1137. data/ext/lpsolver-highs/highs/util/HighsUtils.cpp +1259 -0
  1138. data/ext/lpsolver-highs/highs/util/HighsUtils.h +272 -0
  1139. data/ext/lpsolver-highs/highs/util/stringutil.cpp +131 -0
  1140. data/ext/lpsolver-highs/highs/util/stringutil.h +46 -0
  1141. data/ext/lpsolver-highs/highs.pc.in +12 -0
  1142. data/ext/lpsolver-highs/meson.build +198 -0
  1143. data/ext/lpsolver-highs/meson_options.txt +31 -0
  1144. data/ext/lpsolver-highs/nuget/HiGHS_Logo.png +0 -0
  1145. data/ext/lpsolver-highs/nuget/Highs.csproj +25 -0
  1146. data/ext/lpsolver-highs/nuget/Highs.csproj.in +36 -0
  1147. data/ext/lpsolver-highs/nuget/HowToAlternative.md +77 -0
  1148. data/ext/lpsolver-highs/nuget/README.md +38 -0
  1149. data/ext/lpsolver-highs/nuget/arm-toolchain.cmake +15 -0
  1150. data/ext/lpsolver-highs/nuget/build_linux-arm.sh +13 -0
  1151. data/ext/lpsolver-highs/nuget/build_linux.sh +10 -0
  1152. data/ext/lpsolver-highs/nuget/build_windows.ps1 +27 -0
  1153. data/ext/lpsolver-highs/nuget/generatePackage.ps1 +28 -0
  1154. data/ext/lpsolver-highs/pyproject.toml +221 -0
  1155. data/ext/lpsolver-highs/subprojects/pybind11.wrap +13 -0
  1156. data/ext/lpsolver-highs/tests/test_highspy.py +2310 -0
  1157. data/ext/lpsolver-highs/version.rc.in +50 -0
  1158. data/lib/lpsolver/highs +0 -0
  1159. data/lib/lpsolver/model.rb +28 -4
  1160. data/lib/lpsolver/native.so +0 -0
  1161. data/lib/lpsolver/native_model.rb +261 -0
  1162. data/lib/lpsolver/solution.rb +72 -7
  1163. data/lib/lpsolver/version.rb +1 -1
  1164. data/lpsolver.gemspec +4 -1
  1165. metadata +1176 -4
@@ -0,0 +1,1673 @@
1
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2
+ /* */
3
+ /* This file is part of the HiGHS linear optimization suite */
4
+ /* */
5
+ /* Available as open-source under the MIT License */
6
+ /* */
7
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
8
+ #include "mip/HighsPrimalHeuristics.h"
9
+
10
+ #include <numeric>
11
+ #include <unordered_set>
12
+
13
+ #include "../extern/pdqsort/pdqsort.h"
14
+ #include "io/HighsIO.h"
15
+ #include "lp_data/HConst.h"
16
+ #include "lp_data/HighsLpUtils.h"
17
+ #include "mip/HighsCutGeneration.h"
18
+ #include "mip/HighsDomainChange.h"
19
+ #include "mip/HighsLpRelaxation.h"
20
+ #include "mip/HighsMipSolverData.h"
21
+ #include "mip/MipTimer.h"
22
+ #include "util/HighsHash.h"
23
+ #include "util/HighsIntegers.h"
24
+
25
+ // GCC floating point errors are well-known for 32-bit architectures;
26
+ // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323.
27
+ // An easy workaround is to add the "volatile" keyword to avoid
28
+ // problematic GCC optimizations that impact precision.
29
+ #ifdef __i386__
30
+ #define FP_32BIT_VOLATILE volatile
31
+ #else
32
+ #define FP_32BIT_VOLATILE
33
+ #endif
34
+
35
+ HighsPrimalHeuristics::HighsPrimalHeuristics(HighsMipSolver& mipsolver)
36
+ : mipsolver(mipsolver),
37
+ total_repair_lp(0),
38
+ total_repair_lp_feasible(0),
39
+ total_repair_lp_iterations(0),
40
+ lp_iterations(0),
41
+ randgen(mipsolver.options_mip_->random_seed) {
42
+ successObservations = 0;
43
+ numSuccessObservations = 0;
44
+ infeasObservations = 0;
45
+ numInfeasObservations = 0;
46
+ }
47
+
48
+ void HighsPrimalHeuristics::setupIntCols() {
49
+ intcols = mipsolver.mipdata_->integer_cols;
50
+
51
+ pdqsort(intcols.begin(), intcols.end(), [&](HighsInt c1, HighsInt c2) {
52
+ const FP_32BIT_VOLATILE double lockScore1 =
53
+ (mipsolver.mipdata_->feastol + mipsolver.mipdata_->uplocks[c1]) *
54
+ (mipsolver.mipdata_->feastol + mipsolver.mipdata_->downlocks[c1]);
55
+
56
+ const FP_32BIT_VOLATILE double lockScore2 =
57
+ (mipsolver.mipdata_->feastol + mipsolver.mipdata_->uplocks[c2]) *
58
+ (mipsolver.mipdata_->feastol + mipsolver.mipdata_->downlocks[c2]);
59
+
60
+ if (lockScore1 > lockScore2) return true;
61
+ if (lockScore2 > lockScore1) return false;
62
+
63
+ const FP_32BIT_VOLATILE double cliqueScore1 =
64
+ (mipsolver.mipdata_->feastol +
65
+ mipsolver.mipdata_->cliquetable.getNumImplications(c1, 1)) *
66
+ (mipsolver.mipdata_->feastol +
67
+ mipsolver.mipdata_->cliquetable.getNumImplications(c1, 0));
68
+
69
+ const FP_32BIT_VOLATILE double cliqueScore2 =
70
+ (mipsolver.mipdata_->feastol +
71
+ mipsolver.mipdata_->cliquetable.getNumImplications(c2, 1)) *
72
+ (mipsolver.mipdata_->feastol +
73
+ mipsolver.mipdata_->cliquetable.getNumImplications(c2, 0));
74
+
75
+ return std::make_tuple(cliqueScore1, HighsHashHelpers::hash(uint64_t(c1)),
76
+ c1) >
77
+ std::make_tuple(cliqueScore2, HighsHashHelpers::hash(uint64_t(c2)),
78
+ c2);
79
+ });
80
+ }
81
+
82
+ bool HighsPrimalHeuristics::solveSubMip(
83
+ const HighsLp& lp, const HighsBasis& basis, double fixingRate,
84
+ std::vector<double> colLower, std::vector<double> colUpper,
85
+ HighsInt maxleaves, HighsInt maxnodes, HighsInt stallnodes) {
86
+ HighsOptions submipoptions = *mipsolver.options_mip_;
87
+ HighsLp submip = lp;
88
+
89
+ // set bounds and restore integrality of the lp relaxation copy
90
+ submip.col_lower_ = std::move(colLower);
91
+ submip.col_upper_ = std::move(colUpper);
92
+ submip.integrality_ = mipsolver.model_->integrality_;
93
+ submip.offset_ = 0;
94
+
95
+ // set limits
96
+ submipoptions.mip_max_leaves = maxleaves;
97
+ submipoptions.output_flag = false;
98
+
99
+ const bool allow_submip_log = true;
100
+ if (allow_submip_log && lp.num_col_ == -54 && lp.num_row_ == -172) {
101
+ submipoptions.output_flag = true;
102
+ printf(
103
+ "HighsPrimalHeuristics::solveSubMip (%d, %d) with output_flag = %s\n",
104
+ int(lp.num_col_), int(lp.num_row_),
105
+ highsBoolToString(submipoptions.output_flag).c_str());
106
+ }
107
+
108
+ submipoptions.mip_max_nodes = maxnodes;
109
+ submipoptions.mip_max_stall_nodes = stallnodes;
110
+ submipoptions.mip_pscost_minreliable = 0;
111
+ submipoptions.time_limit -= mipsolver.timer_.read();
112
+ submipoptions.objective_bound = mipsolver.mipdata_->upper_limit;
113
+
114
+ if (!mipsolver.submip) {
115
+ double curr_abs_gap =
116
+ mipsolver.mipdata_->upper_limit - mipsolver.mipdata_->lower_bound;
117
+
118
+ if (curr_abs_gap == kHighsInf) {
119
+ curr_abs_gap = fabs(mipsolver.mipdata_->lower_bound);
120
+ if (curr_abs_gap == kHighsInf) curr_abs_gap = 0.0;
121
+ }
122
+
123
+ submipoptions.mip_rel_gap = 0.0;
124
+ submipoptions.mip_abs_gap =
125
+ mipsolver.mipdata_->feastol * std::max(curr_abs_gap, 1000.0);
126
+ }
127
+
128
+ // check if only root presolve is allowed
129
+ if (submipoptions.mip_root_presolve_only)
130
+ submipoptions.presolve = kHighsOffString;
131
+ else
132
+ submipoptions.presolve = kHighsOnString;
133
+ submipoptions.mip_detect_symmetry = false;
134
+ submipoptions.mip_heuristic_effort = 0.8;
135
+ // setup solver and run it
136
+
137
+ HighsSolution solution;
138
+ solution.value_valid = false;
139
+ solution.dual_valid = false;
140
+ if (!mipsolver.submip) {
141
+ mipsolver.analysis_.mipTimerStart(kMipClockSubMipSolve);
142
+ // Remember to accumulate time for sub-MIP solves!
143
+ mipsolver.sub_solver_call_time_.run_time[kSubSolverSubMip] -=
144
+ mipsolver.timer_.read();
145
+ }
146
+ // Create HighsMipSolver instance for sub-MIP
147
+ HighsMipSolver submipsolver(*mipsolver.callback_, submipoptions, submip,
148
+ solution, true, mipsolver.submip_level + 1);
149
+ // Initialise termination_status_ and propagate any terminator to
150
+ // the sub-MIP
151
+ submipsolver.initialiseTerminator(mipsolver);
152
+ submipsolver.rootbasis = &basis;
153
+ HighsPseudocostInitialization pscostinit(mipsolver.mipdata_->pseudocost, 1);
154
+ submipsolver.pscostinit = &pscostinit;
155
+ submipsolver.clqtableinit = &mipsolver.mipdata_->cliquetable;
156
+ submipsolver.implicinit = &mipsolver.mipdata_->implications;
157
+ // Solve the sub-MIP
158
+ submipsolver.run();
159
+ mipsolver.max_submip_level =
160
+ std::max(submipsolver.max_submip_level + 1, mipsolver.max_submip_level);
161
+ if (!mipsolver.submip) {
162
+ mipsolver.analysis_.mipTimerStop(kMipClockSubMipSolve);
163
+ mipsolver.sub_solver_call_time_.num_call[kSubSolverSubMip]++;
164
+ mipsolver.sub_solver_call_time_.run_time[kSubSolverSubMip] +=
165
+ mipsolver.timer_.read();
166
+ }
167
+ // 22/07/25: Seems impossible for submipsolver.mipdata_ to be a null
168
+ // pointer after calling HighsMipSolver::run(), and assert isn't
169
+ // triggered for anything in ctest, but use direct test of
170
+ // submipsolver.termination_status_, rather than
171
+ // submipsolver.mipdata_.terminatorTerminated()
172
+ if (!submipsolver.mipdata_) {
173
+ printf(
174
+ "HighsPrimalHeuristics::solveSubMip: submipsolver.mipdata_ is "
175
+ "nullptr\n");
176
+ assert(submipsolver.mipdata_);
177
+ }
178
+ if (submipsolver.termination_status_ != HighsModelStatus::kNotset) {
179
+ mipsolver.termination_status_ = submipsolver.termination_status_;
180
+ return false;
181
+ }
182
+ if (submipsolver.mipdata_) {
183
+ double numUnfixed = mipsolver.mipdata_->integral_cols.size() +
184
+ mipsolver.mipdata_->continuous_cols.size();
185
+ double adjustmentfactor =
186
+ ((1 - fixingRate) * mipsolver.mipdata_->integral_cols.size() +
187
+ mipsolver.mipdata_->continuous_cols.size()) /
188
+ std::max(1.0, numUnfixed);
189
+ // (double)mipsolver.orig_model_->a_matrix_.value_.size();
190
+ int64_t adjusted_lp_iterations =
191
+ (size_t)(adjustmentfactor * submipsolver.mipdata_->total_lp_iterations);
192
+ lp_iterations += adjusted_lp_iterations;
193
+ total_repair_lp += submipsolver.mipdata_->total_repair_lp;
194
+ total_repair_lp_feasible += submipsolver.mipdata_->total_repair_lp_feasible;
195
+ total_repair_lp_iterations +=
196
+ submipsolver.mipdata_->total_repair_lp_iterations;
197
+ if (mipsolver.submip)
198
+ mipsolver.mipdata_->num_nodes += std::max(
199
+ int64_t{1}, int64_t(adjustmentfactor * submipsolver.node_count_));
200
+ }
201
+
202
+ if (submipsolver.modelstatus_ == HighsModelStatus::kInfeasible) {
203
+ infeasObservations += fixingRate;
204
+ ++numInfeasObservations;
205
+ }
206
+ if (submipsolver.node_count_ <= 1 &&
207
+ submipsolver.modelstatus_ == HighsModelStatus::kInfeasible)
208
+ return false;
209
+ HighsInt oldNumImprovingSols = mipsolver.mipdata_->numImprovingSols;
210
+ if (submipsolver.modelstatus_ != HighsModelStatus::kInfeasible &&
211
+ !submipsolver.solution_.empty()) {
212
+ mipsolver.mipdata_->trySolution(submipsolver.solution_,
213
+ kSolutionSourceSubMip);
214
+ }
215
+
216
+ if (mipsolver.mipdata_->numImprovingSols != oldNumImprovingSols) {
217
+ // remember fixing rate as good
218
+ successObservations += fixingRate;
219
+ ++numSuccessObservations;
220
+ }
221
+
222
+ return true;
223
+ }
224
+
225
+ double HighsPrimalHeuristics::determineTargetFixingRate() {
226
+ double lowFixingRate = 0.6;
227
+ double highFixingRate = 0.6;
228
+
229
+ if (numInfeasObservations != 0) {
230
+ double infeasRate = infeasObservations / numInfeasObservations;
231
+ highFixingRate = 0.9 * infeasRate;
232
+ lowFixingRate = std::min(lowFixingRate, highFixingRate);
233
+ }
234
+
235
+ if (numSuccessObservations != 0) {
236
+ double successFixingRate = successObservations / numSuccessObservations;
237
+ lowFixingRate = std::min(lowFixingRate, 0.9 * successFixingRate);
238
+ highFixingRate = std::max(successFixingRate * 1.1, highFixingRate);
239
+ }
240
+
241
+ double fixingRate = randgen.real(lowFixingRate, highFixingRate);
242
+ // if (!mipsolver.submip) printf("fixing rate: %.2f\n", 100.0 * fixingRate);
243
+ return fixingRate;
244
+ }
245
+
246
+ class HeuristicNeighbourhood {
247
+ HighsDomain& localdom;
248
+ HighsInt numFixed;
249
+ HighsHashTable<HighsInt> fixedCols;
250
+ size_t startCheckedChanges;
251
+ size_t nCheckedChanges;
252
+ HighsInt numTotal;
253
+
254
+ public:
255
+ HeuristicNeighbourhood(HighsMipSolver& mipsolver, HighsDomain& localdom)
256
+ : localdom(localdom),
257
+ numFixed(0),
258
+ startCheckedChanges(localdom.getDomainChangeStack().size()),
259
+ nCheckedChanges(startCheckedChanges) {
260
+ for (HighsInt i : mipsolver.mipdata_->integral_cols)
261
+ if (localdom.col_lower_[i] == localdom.col_upper_[i]) ++numFixed;
262
+
263
+ numTotal = mipsolver.mipdata_->integral_cols.size() - numFixed;
264
+ }
265
+
266
+ double getFixingRate() {
267
+ while (nCheckedChanges < localdom.getDomainChangeStack().size()) {
268
+ HighsInt col = localdom.getDomainChangeStack()[nCheckedChanges++].column;
269
+ if (localdom.variableType(col) == HighsVarType::kContinuous) continue;
270
+ if (localdom.isFixed(col)) fixedCols.insert(col);
271
+ }
272
+
273
+ return numTotal ? static_cast<double>(fixedCols.size()) /
274
+ static_cast<double>(numTotal)
275
+ : 0.0;
276
+ }
277
+
278
+ void backtracked() {
279
+ nCheckedChanges = startCheckedChanges;
280
+ if (fixedCols.size()) fixedCols.clear();
281
+ }
282
+ };
283
+
284
+ void HighsPrimalHeuristics::rootReducedCost() {
285
+ std::vector<std::pair<double, HighsDomainChange>> lurkingBounds =
286
+ mipsolver.mipdata_->redcostfixing.getLurkingBounds(mipsolver);
287
+ if (10 * lurkingBounds.size() < mipsolver.mipdata_->integral_cols.size())
288
+ return;
289
+ pdqsort(lurkingBounds.begin(), lurkingBounds.end(),
290
+ [](const std::pair<double, HighsDomainChange>& a,
291
+ const std::pair<double, HighsDomainChange>& b) {
292
+ return a.first > b.first;
293
+ });
294
+
295
+ auto localdom = mipsolver.mipdata_->domain;
296
+
297
+ HeuristicNeighbourhood neighbourhood(mipsolver, localdom);
298
+
299
+ double currCutoff = kHighsInf;
300
+ double lower_bound =
301
+ mipsolver.mipdata_->lower_bound + mipsolver.mipdata_->feastol;
302
+
303
+ for (const std::pair<double, HighsDomainChange>& domchg : lurkingBounds) {
304
+ currCutoff = domchg.first;
305
+
306
+ if (currCutoff <= lower_bound) break;
307
+
308
+ if (localdom.isActive(domchg.second)) continue;
309
+ localdom.changeBound(domchg.second);
310
+
311
+ while (true) {
312
+ localdom.propagate();
313
+ if (localdom.infeasible()) {
314
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
315
+
316
+ mipsolver.mipdata_->updateLowerBound(
317
+ std::max(mipsolver.mipdata_->lower_bound, currCutoff));
318
+
319
+ localdom.backtrack();
320
+ if (localdom.getBranchDepth() == 0) break;
321
+ neighbourhood.backtracked();
322
+ continue;
323
+ }
324
+ break;
325
+ }
326
+ double fixingRate = neighbourhood.getFixingRate();
327
+ if (fixingRate >= 0.5) break;
328
+ // double gap = (currCutoff - mipsolver.mipdata_->lower_bound) /
329
+ // std::max(std::abs(mipsolver.mipdata_->lower_bound), 1.0);
330
+ // if (gap < 0.001) break;
331
+ }
332
+
333
+ double fixingRate = neighbourhood.getFixingRate();
334
+ if (fixingRate < 0.3) return;
335
+
336
+ solveSubMip(*mipsolver.model_, mipsolver.mipdata_->firstrootbasis, fixingRate,
337
+ localdom.col_lower_, localdom.col_upper_,
338
+ 500, // std::max(50, int(0.05 *
339
+ // (mipsolver.mipdata_->num_leaves))),
340
+ 200 + static_cast<HighsInt>(mipsolver.mipdata_->num_nodes / 20),
341
+ 12);
342
+ }
343
+
344
+ static double calcFixVal(double rootchange, double fracval, double cost) {
345
+ // reinforce direction of this solution away from root
346
+ // solution if the change is at least 0.4
347
+ // otherwise take the direction where the objective gets worse
348
+ // if objective is zero round to nearest integer
349
+ if (rootchange >= 0.4)
350
+ return std::ceil(fracval);
351
+ else if (rootchange <= -0.4)
352
+ return std::floor(fracval);
353
+ else if (cost > 0.0)
354
+ return std::ceil(fracval);
355
+ else if (cost < 0.0)
356
+ return std::floor(fracval);
357
+ else
358
+ return std::floor(fracval + 0.5);
359
+ }
360
+
361
+ void HighsPrimalHeuristics::RENS(const std::vector<double>& tmp) {
362
+ // return if domain is infeasible
363
+ if (mipsolver.mipdata_->domain.infeasible()) return;
364
+
365
+ HighsPseudocost pscost(mipsolver.mipdata_->pseudocost);
366
+ HighsSearch heur(mipsolver, pscost);
367
+ HighsDomain& localdom = heur.getLocalDomain();
368
+ heur.setHeuristic(true);
369
+
370
+ intcols.erase(std::remove_if(intcols.begin(), intcols.end(),
371
+ [&](HighsInt i) {
372
+ return mipsolver.mipdata_->domain.isFixed(i);
373
+ }),
374
+ intcols.end());
375
+
376
+ HighsLpRelaxation heurlp(mipsolver.mipdata_->lp);
377
+ // only use the global upper limit as LP limit so that dual proofs are valid
378
+ heurlp.setObjectiveLimit(mipsolver.mipdata_->upper_limit);
379
+ heurlp.setAdjustSymmetricBranchingCol(false);
380
+ heur.setLpRelaxation(&heurlp);
381
+
382
+ heurlp.getLpSolver().changeColsBounds(0, mipsolver.numCol() - 1,
383
+ localdom.col_lower_.data(),
384
+ localdom.col_upper_.data());
385
+ localdom.clearChangedCols();
386
+ heur.createNewNode();
387
+
388
+ // determine the initial number of unfixed variables fixing rate to decide if
389
+ // the problem is restricted enough to be considered for solving a submip
390
+ double maxfixingrate = determineTargetFixingRate();
391
+ double fixingrate = 0.0;
392
+ bool stop = false;
393
+ // heurlp.setIterationLimit(2 * mipsolver.mipdata_->maxrootlpiters);
394
+ // printf("iterlimit: %" HIGHSINT_FORMAT "\n",
395
+ // heurlp.getLpSolver().getOptions().simplex_iteration_limit);
396
+ HighsInt targetdepth = 1;
397
+ HighsInt nbacktracks = -1;
398
+ HeuristicNeighbourhood neighbourhood(mipsolver, localdom);
399
+ retry:
400
+ ++nbacktracks;
401
+ neighbourhood.backtracked();
402
+ // printf("current depth : %" HIGHSINT_FORMAT
403
+ // " target depth : %" HIGHSINT_FORMAT "\n",
404
+ // heur.getCurrentDepth(), targetdepth);
405
+ if (heur.getCurrentDepth() > targetdepth) {
406
+ if (!heur.backtrackUntilDepth(targetdepth)) {
407
+ lp_iterations += heur.getLocalLpIterations();
408
+ return;
409
+ }
410
+ }
411
+
412
+ // printf("fixingrate before loop is %g\n", fixingrate);
413
+ assert(heur.hasNode());
414
+ while (true) {
415
+ // printf("evaluating node\n");
416
+ heur.evaluateNode();
417
+ // printf("done evaluating node\n");
418
+ if (heur.currentNodePruned()) {
419
+ ++nbacktracks;
420
+ if (mipsolver.mipdata_->domain.infeasible()) {
421
+ lp_iterations += heur.getLocalLpIterations();
422
+ return;
423
+ }
424
+
425
+ if (!heur.backtrack()) break;
426
+ neighbourhood.backtracked();
427
+ continue;
428
+ }
429
+
430
+ fixingrate = neighbourhood.getFixingRate();
431
+ // printf("after evaluating node current fixingrate is %g\n", fixingrate);
432
+ if (fixingrate >= maxfixingrate) break;
433
+ if (stop) break;
434
+ if (nbacktracks >= 10) break;
435
+
436
+ HighsInt numBranched = 0;
437
+ double stopFixingRate = std::min(
438
+ 1.0 - (1.0 - neighbourhood.getFixingRate()) * 0.9, maxfixingrate);
439
+ const auto& relaxationsol = heurlp.getSolution().col_value;
440
+ for (HighsInt i : intcols) {
441
+ if (localdom.col_lower_[i] == localdom.col_upper_[i]) continue;
442
+
443
+ double downval =
444
+ std::floor(relaxationsol[i] + mipsolver.mipdata_->feastol);
445
+ double upval = std::ceil(relaxationsol[i] - mipsolver.mipdata_->feastol);
446
+
447
+ downval = std::min(downval, localdom.col_upper_[i]);
448
+ upval = std::max(upval, localdom.col_lower_[i]);
449
+ if (localdom.col_lower_[i] < downval) {
450
+ ++numBranched;
451
+ heur.branchUpwards(i, downval, downval - 0.5);
452
+ localdom.propagate();
453
+ if (localdom.infeasible()) {
454
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
455
+ break;
456
+ }
457
+ }
458
+ if (localdom.col_upper_[i] > upval) {
459
+ ++numBranched;
460
+ heur.branchDownwards(i, upval, upval + 0.5);
461
+ localdom.propagate();
462
+ if (localdom.infeasible()) {
463
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
464
+ break;
465
+ }
466
+ }
467
+
468
+ if (neighbourhood.getFixingRate() >= stopFixingRate) break;
469
+ }
470
+
471
+ if (numBranched == 0) {
472
+ auto getFixVal = [&](HighsInt col, double fracval) {
473
+ // reinforce direction of this solution away from root
474
+ // solution if the change is at least 0.4
475
+ // otherwise take the direction where the objective gets worse
476
+ // if objective is zero round to nearest integer
477
+ double fixval =
478
+ calcFixVal(mipsolver.mipdata_->rootlpsol.empty()
479
+ ? 0.0
480
+ : fracval - mipsolver.mipdata_->rootlpsol[col],
481
+ fracval, mipsolver.model_->col_cost_[col]);
482
+ // make sure we do not set an infeasible domain
483
+ fixval = std::min(localdom.col_upper_[col], fixval);
484
+ fixval = std::max(localdom.col_lower_[col], fixval);
485
+ return fixval;
486
+ };
487
+
488
+ pdqsort(heurlp.getFractionalIntegers().begin(),
489
+ heurlp.getFractionalIntegers().end(),
490
+ [&](const std::pair<HighsInt, double>& a,
491
+ const std::pair<HighsInt, double>& b) {
492
+ return std::make_pair(
493
+ std::abs(getFixVal(a.first, a.second) - a.second),
494
+ HighsHashHelpers::hash(
495
+ (uint64_t(a.first) << 32) +
496
+ heurlp.getFractionalIntegers().size())) <
497
+ std::make_pair(
498
+ std::abs(getFixVal(b.first, b.second) - b.second),
499
+ HighsHashHelpers::hash(
500
+ (uint64_t(b.first) << 32) +
501
+ heurlp.getFractionalIntegers().size()));
502
+ });
503
+
504
+ double change = 0.0;
505
+ // select a set of fractional variables to fix
506
+ for (auto fracint : heurlp.getFractionalIntegers()) {
507
+ double fixval = getFixVal(fracint.first, fracint.second);
508
+
509
+ if (localdom.col_lower_[fracint.first] < fixval) {
510
+ ++numBranched;
511
+ heur.branchUpwards(fracint.first, fixval, fracint.second);
512
+ localdom.propagate();
513
+ if (localdom.infeasible()) {
514
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
515
+ break;
516
+ }
517
+
518
+ fixingrate = neighbourhood.getFixingRate();
519
+ }
520
+
521
+ if (localdom.col_upper_[fracint.first] > fixval) {
522
+ ++numBranched;
523
+ heur.branchDownwards(fracint.first, fixval, fracint.second);
524
+ localdom.propagate();
525
+ if (localdom.infeasible()) {
526
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
527
+ break;
528
+ }
529
+
530
+ fixingrate = neighbourhood.getFixingRate();
531
+ }
532
+
533
+ if (fixingrate >= maxfixingrate) break;
534
+
535
+ change += std::abs(fixval - fracint.second);
536
+ if (change >= 0.5) break;
537
+ }
538
+ }
539
+
540
+ if (numBranched == 0) break;
541
+ heurlp.flushDomain(localdom);
542
+ }
543
+
544
+ // printf("stopped heur dive with fixing rate %g\n", fixingrate);
545
+ // if there is no node left it means we backtracked to the global domain and
546
+ // the subproblem was solved with the dive
547
+ if (!heur.hasNode()) {
548
+ lp_iterations += heur.getLocalLpIterations();
549
+ return;
550
+ }
551
+ // determine the fixing rate to decide if the problem is restricted enough to
552
+ // be considered for solving a submip
553
+
554
+ fixingrate = neighbourhood.getFixingRate();
555
+ // printf("fixing rate is %g\n", fixingrate);
556
+ if (fixingrate < 0.1 ||
557
+ (mipsolver.submip && mipsolver.mipdata_->numImprovingSols != 0)) {
558
+ // heur.childselrule = ChildSelectionRule::kBestCost;
559
+ heur.setMinReliable(0);
560
+ heur.solveDepthFirst(10);
561
+ lp_iterations += heur.getLocalLpIterations();
562
+ if (mipsolver.submip) mipsolver.mipdata_->num_nodes += heur.getLocalNodes();
563
+ // lpiterations += heur.lpiterations;
564
+ // pseudocost = heur.pseudocost;
565
+ return;
566
+ }
567
+
568
+ heurlp.removeObsoleteRows(false);
569
+ const bool solve_sub_mip_return =
570
+ solveSubMip(heurlp.getLp(), heurlp.getLpSolver().getBasis(), fixingrate,
571
+ localdom.col_lower_, localdom.col_upper_,
572
+ 500, // std::max(50, int(0.05 *
573
+ // (mipsolver.mipdata_->num_leaves))),
574
+ 200 + mipsolver.mipdata_->num_nodes / 20, 12);
575
+ if (mipsolver.mipdata_->terminatorTerminated()) return;
576
+ if (!solve_sub_mip_return) {
577
+ int64_t new_lp_iterations = lp_iterations + heur.getLocalLpIterations();
578
+ if (new_lp_iterations + mipsolver.mipdata_->heuristic_lp_iterations >
579
+ 100000 + ((mipsolver.mipdata_->total_lp_iterations -
580
+ mipsolver.mipdata_->heuristic_lp_iterations -
581
+ mipsolver.mipdata_->sb_lp_iterations) >>
582
+ 1)) {
583
+ lp_iterations = new_lp_iterations;
584
+ return;
585
+ }
586
+
587
+ targetdepth = heur.getCurrentDepth() / 2;
588
+ if (targetdepth <= 1 || mipsolver.mipdata_->checkLimits()) {
589
+ lp_iterations = new_lp_iterations;
590
+ return;
591
+ }
592
+ maxfixingrate = fixingrate * 0.5;
593
+ // printf("infeasible in root node, trying with lower fixing rate %g\n",
594
+ // maxfixingrate);
595
+ goto retry;
596
+ }
597
+
598
+ lp_iterations += heur.getLocalLpIterations();
599
+ }
600
+
601
+ void HighsPrimalHeuristics::RINS(const std::vector<double>& relaxationsol) {
602
+ // return if domain is infeasible
603
+ if (mipsolver.mipdata_->domain.infeasible()) return;
604
+
605
+ if (relaxationsol.size() != static_cast<size_t>(mipsolver.numCol())) return;
606
+
607
+ intcols.erase(std::remove_if(intcols.begin(), intcols.end(),
608
+ [&](HighsInt i) {
609
+ return mipsolver.mipdata_->domain.isFixed(i);
610
+ }),
611
+ intcols.end());
612
+
613
+ HighsPseudocost pscost(mipsolver.mipdata_->pseudocost);
614
+ HighsSearch heur(mipsolver, pscost);
615
+ HighsDomain& localdom = heur.getLocalDomain();
616
+ heur.setHeuristic(true);
617
+
618
+ HighsLpRelaxation heurlp(mipsolver.mipdata_->lp);
619
+ // only use the global upper limit as LP limit so that dual proofs are valid
620
+ heurlp.setObjectiveLimit(mipsolver.mipdata_->upper_limit);
621
+ heurlp.setAdjustSymmetricBranchingCol(false);
622
+ heur.setLpRelaxation(&heurlp);
623
+
624
+ heurlp.getLpSolver().changeColsBounds(0, mipsolver.numCol() - 1,
625
+ localdom.col_lower_.data(),
626
+ localdom.col_upper_.data());
627
+ localdom.clearChangedCols();
628
+ heur.createNewNode();
629
+
630
+ // determine the initial number of unfixed variables fixing rate to decide if
631
+ // the problem is restricted enough to be considered for solving a submip
632
+ double maxfixingrate = determineTargetFixingRate();
633
+ double minfixingrate = 0.25;
634
+ double fixingrate = 0.0;
635
+ bool stop = false;
636
+ HighsInt nbacktracks = -1;
637
+ HighsInt targetdepth = 1;
638
+ HeuristicNeighbourhood neighbourhood(mipsolver, localdom);
639
+ retry:
640
+ ++nbacktracks;
641
+ neighbourhood.backtracked();
642
+ // printf("current depth : %" HIGHSINT_FORMAT " target depth : %"
643
+ // HIGHSINT_FORMAT "\n", heur.getCurrentDepth(),
644
+ // targetdepth);
645
+ if (heur.getCurrentDepth() > targetdepth) {
646
+ if (!heur.backtrackUntilDepth(targetdepth)) {
647
+ lp_iterations += heur.getLocalLpIterations();
648
+ return;
649
+ }
650
+ }
651
+
652
+ assert(heur.hasNode());
653
+
654
+ while (true) {
655
+ heur.evaluateNode();
656
+ if (heur.currentNodePruned()) {
657
+ ++nbacktracks;
658
+ // printf("backtrack1\n");
659
+ if (mipsolver.mipdata_->domain.infeasible()) {
660
+ lp_iterations += heur.getLocalLpIterations();
661
+ return;
662
+ }
663
+
664
+ if (!heur.backtrack()) break;
665
+ neighbourhood.backtracked();
666
+ continue;
667
+ }
668
+
669
+ fixingrate = neighbourhood.getFixingRate();
670
+
671
+ if (stop) break;
672
+ if (fixingrate >= maxfixingrate) break;
673
+ if (nbacktracks >= 10) break;
674
+
675
+ std::vector<std::pair<HighsInt, double>>::iterator fixcandend;
676
+
677
+ // partition the fractional variables to consider which ones should we fix
678
+ // in this dive first if there is an incumbent, we dive towards the RINS
679
+ // neighbourhood
680
+ fixcandend = std::partition(
681
+ heurlp.getFractionalIntegers().begin(),
682
+ heurlp.getFractionalIntegers().end(),
683
+ [&](const std::pair<HighsInt, double>& fracvar) {
684
+ return std::abs(relaxationsol[fracvar.first] -
685
+ mipsolver.mipdata_->incumbent[fracvar.first]) <=
686
+ mipsolver.mipdata_->feastol;
687
+ });
688
+
689
+ bool fixtolpsol = true;
690
+
691
+ auto getFixVal = [&](HighsInt col, double fracval) {
692
+ double fixval;
693
+ if (fixtolpsol) {
694
+ // RINS neighbourhood (with extension)
695
+ fixval = std::floor(relaxationsol[col] + 0.5);
696
+ } else {
697
+ // reinforce direction of this solution away from root
698
+ // solution if the change is at least 0.4
699
+ // otherwise take the direction where the objective gets worse
700
+ // if objective is zero round to nearest integer
701
+ fixval = calcFixVal(fracval - mipsolver.mipdata_->rootlpsol[col],
702
+ fracval, mipsolver.model_->col_cost_[col]);
703
+ }
704
+ // make sure we do not set an infeasible domain
705
+ fixval = std::min(localdom.col_upper_[col], fixval);
706
+ fixval = std::max(localdom.col_lower_[col], fixval);
707
+ return fixval;
708
+ };
709
+
710
+ // no candidates left to fix for getting to the neighbourhood, therefore we
711
+ // switch to a different diving strategy until the minimal fixing rate is
712
+ // reached
713
+ HighsInt numBranched = 0;
714
+ if (heurlp.getFractionalIntegers().begin() == fixcandend) {
715
+ fixingrate = neighbourhood.getFixingRate();
716
+ double stopFixingRate =
717
+ std::min(maxfixingrate, 1.0 - (1.0 - fixingrate) * 0.9);
718
+ const auto& currlpsol = heurlp.getSolution().col_value;
719
+ for (HighsInt i : intcols) {
720
+ if (localdom.col_lower_[i] == localdom.col_upper_[i]) continue;
721
+
722
+ if (std::abs(currlpsol[i] - mipsolver.mipdata_->incumbent[i]) <=
723
+ mipsolver.mipdata_->feastol) {
724
+ double fixval = HighsIntegers::nearestInteger(currlpsol[i]);
725
+ if (localdom.col_lower_[i] < fixval) {
726
+ ++numBranched;
727
+ heur.branchUpwards(i, fixval, fixval - 0.5);
728
+ localdom.propagate();
729
+ if (localdom.infeasible()) {
730
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
731
+ break;
732
+ }
733
+
734
+ fixingrate = neighbourhood.getFixingRate();
735
+ }
736
+ if (localdom.col_upper_[i] > fixval) {
737
+ ++numBranched;
738
+ heur.branchDownwards(i, fixval, fixval + 0.5);
739
+ localdom.propagate();
740
+ if (localdom.infeasible()) {
741
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
742
+ break;
743
+ }
744
+
745
+ fixingrate = neighbourhood.getFixingRate();
746
+ }
747
+
748
+ if (fixingrate >= stopFixingRate) break;
749
+ }
750
+ }
751
+
752
+ if (numBranched != 0) {
753
+ // printf(
754
+ // "fixed %" HIGHSINT_FORMAT " additional cols, old fixing rate:
755
+ // %.2f%%, new fixing " "rate: %.2f%%\n", numBranched, fixingrate,
756
+ // getFixingRate());
757
+ heurlp.flushDomain(localdom);
758
+ continue;
759
+ }
760
+
761
+ if (fixingrate >= minfixingrate)
762
+ break; // if the RINS neighbourhood achieved a high enough fixing rate
763
+ // by itself we stop here
764
+ fixcandend = heurlp.getFractionalIntegers().end();
765
+ // now sort the variables by their distance towards the value they will
766
+ // be fixed to
767
+ fixtolpsol = false;
768
+ }
769
+
770
+ // now sort the variables by their distance towards the value they will be
771
+ // fixed to
772
+ pdqsort(heurlp.getFractionalIntegers().begin(), fixcandend,
773
+ [&](const std::pair<HighsInt, double>& a,
774
+ const std::pair<HighsInt, double>& b) {
775
+ return std::make_pair(
776
+ std::abs(getFixVal(a.first, a.second) - a.second),
777
+ HighsHashHelpers::hash(
778
+ (uint64_t(a.first) << 32) +
779
+ heurlp.getFractionalIntegers().size())) <
780
+ std::make_pair(
781
+ std::abs(getFixVal(b.first, b.second) - b.second),
782
+ HighsHashHelpers::hash(
783
+ (uint64_t(b.first) << 32) +
784
+ heurlp.getFractionalIntegers().size()));
785
+ });
786
+
787
+ double change = 0.0;
788
+ // select a set of fractional variables to fix
789
+ for (auto fracint = heurlp.getFractionalIntegers().begin();
790
+ fracint != fixcandend; ++fracint) {
791
+ double fixval = getFixVal(fracint->first, fracint->second);
792
+
793
+ if (localdom.col_lower_[fracint->first] < fixval) {
794
+ ++numBranched;
795
+ heur.branchUpwards(fracint->first, fixval, fracint->second);
796
+ if (localdom.infeasible()) {
797
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
798
+ break;
799
+ }
800
+
801
+ fixingrate = neighbourhood.getFixingRate();
802
+ }
803
+
804
+ if (localdom.col_upper_[fracint->first] > fixval) {
805
+ ++numBranched;
806
+ heur.branchDownwards(fracint->first, fixval, fracint->second);
807
+ if (localdom.infeasible()) {
808
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
809
+ break;
810
+ }
811
+
812
+ fixingrate = neighbourhood.getFixingRate();
813
+ }
814
+
815
+ if (fixingrate >= maxfixingrate) break;
816
+
817
+ change += std::abs(fixval - fracint->second);
818
+ if (change >= 0.5) break;
819
+ }
820
+
821
+ if (numBranched == 0) break;
822
+
823
+ heurlp.flushDomain(localdom);
824
+
825
+ // printf("%" HIGHSINT_FORMAT "/%" HIGHSINT_FORMAT " fixed, fixingrate is
826
+ // %g\n", nfixed, ntotal, fixingrate);
827
+ }
828
+
829
+ // if there is no node left it means we backtracked to the global domain and
830
+ // the subproblem was solved with the dive
831
+ if (!heur.hasNode()) {
832
+ lp_iterations += heur.getLocalLpIterations();
833
+ return;
834
+ }
835
+ // determine the fixing rate to decide if the problem is restricted enough
836
+ // to be considered for solving a submip
837
+
838
+ // printf("fixing rate is %g\n", fixingrate);
839
+ fixingrate = neighbourhood.getFixingRate();
840
+ if (fixingrate < 0.1 ||
841
+ (mipsolver.submip && mipsolver.mipdata_->numImprovingSols != 0)) {
842
+ // heur.childselrule = ChildSelectionRule::kBestCost;
843
+ heur.setMinReliable(0);
844
+ heur.solveDepthFirst(10);
845
+ lp_iterations += heur.getLocalLpIterations();
846
+ if (mipsolver.submip) mipsolver.mipdata_->num_nodes += heur.getLocalNodes();
847
+ // lpiterations += heur.lpiterations;
848
+ // pseudocost = heur.pseudocost;
849
+ return;
850
+ }
851
+
852
+ heurlp.removeObsoleteRows(false);
853
+ const bool solve_sub_mip_return =
854
+ solveSubMip(heurlp.getLp(), heurlp.getLpSolver().getBasis(), fixingrate,
855
+ localdom.col_lower_, localdom.col_upper_,
856
+ 500, // std::max(50, int(0.05 *
857
+ // (mipsolver.mipdata_->num_leaves))),
858
+ 200 + mipsolver.mipdata_->num_nodes / 20, 12);
859
+ if (mipsolver.mipdata_->terminatorTerminated()) return;
860
+ if (!solve_sub_mip_return) {
861
+ int64_t new_lp_iterations = lp_iterations + heur.getLocalLpIterations();
862
+ if (new_lp_iterations + mipsolver.mipdata_->heuristic_lp_iterations >
863
+ 100000 + ((mipsolver.mipdata_->total_lp_iterations -
864
+ mipsolver.mipdata_->heuristic_lp_iterations -
865
+ mipsolver.mipdata_->sb_lp_iterations) >>
866
+ 1)) {
867
+ lp_iterations = new_lp_iterations;
868
+ return;
869
+ }
870
+
871
+ targetdepth = heur.getCurrentDepth() / 2;
872
+ if (targetdepth <= 1 || mipsolver.mipdata_->checkLimits()) {
873
+ lp_iterations = new_lp_iterations;
874
+ return;
875
+ }
876
+ // printf("infeasible in root node, trying with lower fixing rate\n");
877
+ maxfixingrate = fixingrate * 0.5;
878
+ goto retry;
879
+ }
880
+
881
+ lp_iterations += heur.getLocalLpIterations();
882
+ }
883
+
884
+ bool HighsPrimalHeuristics::tryRoundedPoint(const std::vector<double>& point,
885
+ const int solution_source) {
886
+ auto localdom = mipsolver.mipdata_->domain;
887
+ bool integerFeasible = true;
888
+
889
+ HighsInt numintcols = intcols.size();
890
+ for (HighsInt i = 0; i != numintcols; ++i) {
891
+ HighsInt col = intcols[i];
892
+ double intval = point[col];
893
+ double rounded;
894
+ // check if solution value of integer-constrained variable is actually
895
+ // integral
896
+ bool feasible =
897
+ fractionality(intval, &rounded) <= mipsolver.mipdata_->feastol;
898
+ integerFeasible = integerFeasible && feasible;
899
+ if (!feasible) continue;
900
+ // use rounded solution value and check against bounds
901
+ intval = rounded;
902
+ intval = std::min(localdom.col_upper_[col], intval);
903
+ intval = std::max(localdom.col_lower_[col], intval);
904
+
905
+ localdom.fixCol(col, intval, HighsDomain::Reason::branching());
906
+ if (localdom.infeasible()) {
907
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
908
+ return false;
909
+ }
910
+ localdom.propagate();
911
+ if (localdom.infeasible()) {
912
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
913
+ return false;
914
+ }
915
+ }
916
+
917
+ if (numintcols != mipsolver.numCol()) {
918
+ HighsLpRelaxation lprelax(mipsolver);
919
+ lprelax.loadModel();
920
+ lprelax.setIterationLimit(
921
+ std::max(int64_t{10000}, 2 * mipsolver.mipdata_->firstrootlpiters));
922
+ lprelax.getLpSolver().changeColsBounds(0, mipsolver.numCol() - 1,
923
+ localdom.col_lower_.data(),
924
+ localdom.col_upper_.data());
925
+
926
+ // check if only root presolve is allowed
927
+ if (mipsolver.options_mip_->mip_root_presolve_only)
928
+ lprelax.getLpSolver().setOptionValue("presolve", kHighsOffString);
929
+ if (!mipsolver.options_mip_->mip_root_presolve_only &&
930
+ (5 * numintcols) / mipsolver.numCol() >= 1)
931
+ lprelax.getLpSolver().setOptionValue("presolve", kHighsOnString);
932
+ else
933
+ lprelax.getLpSolver().setBasis(mipsolver.mipdata_->firstrootbasis,
934
+ "HighsPrimalHeuristics::tryRoundedPoint");
935
+
936
+ HighsLpRelaxation::Status st = lprelax.resolveLp();
937
+
938
+ if (st == HighsLpRelaxation::Status::kInfeasible) {
939
+ std::vector<HighsInt> inds;
940
+ std::vector<double> vals;
941
+ double rhs;
942
+ if (lprelax.computeDualInfProof(mipsolver.mipdata_->domain, inds, vals,
943
+ rhs)) {
944
+ HighsCutGeneration cutGen(lprelax, mipsolver.mipdata_->cutpool);
945
+ cutGen.generateConflict(localdom, inds, vals, rhs);
946
+ }
947
+ return false;
948
+ } else if (lprelax.unscaledPrimalFeasible(st)) {
949
+ const auto& lpsol = lprelax.getLpSolver().getSolution().col_value;
950
+ if (!integerFeasible) {
951
+ // there may be fractional integer variables -> try ziRound heuristic
952
+ ziRound(lpsol);
953
+ return mipsolver.mipdata_->trySolution(lpsol, solution_source);
954
+ } else {
955
+ // all integer variables are fixed -> add incumbent
956
+ mipsolver.mipdata_->addIncumbent(lpsol, lprelax.getObjective(),
957
+ solution_source);
958
+ return true;
959
+ }
960
+ }
961
+ }
962
+
963
+ return mipsolver.mipdata_->trySolution(localdom.col_lower_, solution_source);
964
+ }
965
+
966
+ bool HighsPrimalHeuristics::linesearchRounding(
967
+ const std::vector<double>& point1, const std::vector<double>& point2,
968
+ const int solution_source) {
969
+ std::vector<double> roundedpoint;
970
+
971
+ HighsInt numintcols = intcols.size();
972
+ roundedpoint.resize(mipsolver.numCol());
973
+
974
+ double alpha = 0.0;
975
+ assert(int(mipsolver.mipdata_->uplocks.size()) == mipsolver.numCol());
976
+ assert(int(point1.size()) == mipsolver.numCol());
977
+ assert(int(point2.size()) == mipsolver.numCol());
978
+
979
+ while (alpha < 1.0) {
980
+ double nextalpha = 1.0;
981
+ bool reachedpoint2 = true;
982
+ // printf("trying alpha = %g\n", alpha);
983
+ for (HighsInt i = 0; i != numintcols; ++i) {
984
+ HighsInt col = intcols[i];
985
+ assert(col >= 0);
986
+ assert(col < mipsolver.numCol());
987
+ if (mipsolver.mipdata_->uplocks[col] == 0) {
988
+ roundedpoint[col] = std::ceil(std::max(point1[col], point2[col]) -
989
+ mipsolver.mipdata_->feastol);
990
+ continue;
991
+ }
992
+
993
+ if (mipsolver.mipdata_->downlocks[col] == 0) {
994
+ roundedpoint[col] = std::floor(std::min(point1[col], point2[col]) +
995
+ mipsolver.mipdata_->feastol);
996
+ continue;
997
+ }
998
+
999
+ double convexcomb = (1.0 - alpha) * point1[col] + alpha * point2[col];
1000
+ double intpoint2 = std::floor(point2[col] + 0.5);
1001
+ roundedpoint[col] = std::floor(convexcomb + 0.5);
1002
+
1003
+ if (roundedpoint[col] == intpoint2) continue;
1004
+
1005
+ reachedpoint2 = false;
1006
+ double tmpalpha = (roundedpoint[col] + 0.5 + mipsolver.mipdata_->feastol -
1007
+ point1[col]) /
1008
+ std::abs(point2[col] - point1[col]);
1009
+ if (tmpalpha < nextalpha && tmpalpha > alpha + 1e-2) nextalpha = tmpalpha;
1010
+ }
1011
+
1012
+ if (tryRoundedPoint(roundedpoint, solution_source)) return true;
1013
+
1014
+ if (reachedpoint2) return false;
1015
+
1016
+ alpha = nextalpha;
1017
+ }
1018
+
1019
+ return false;
1020
+ }
1021
+
1022
+ void HighsPrimalHeuristics::randomizedRounding(
1023
+ const std::vector<double>& relaxationsol) {
1024
+ if (relaxationsol.size() != static_cast<size_t>(mipsolver.numCol())) return;
1025
+
1026
+ auto localdom = mipsolver.mipdata_->domain;
1027
+
1028
+ for (HighsInt i : intcols) {
1029
+ double intval;
1030
+ if (mipsolver.mipdata_->uplocks[i] == 0)
1031
+ intval = std::ceil(relaxationsol[i] - mipsolver.mipdata_->feastol);
1032
+ else if (mipsolver.mipdata_->downlocks[i] == 0)
1033
+ intval = std::floor(relaxationsol[i] + mipsolver.mipdata_->feastol);
1034
+ else
1035
+ intval = std::floor(relaxationsol[i] + randgen.real(0.1, 0.9));
1036
+
1037
+ intval = std::min(localdom.col_upper_[i], intval);
1038
+ intval = std::max(localdom.col_lower_[i], intval);
1039
+
1040
+ localdom.fixCol(i, intval, HighsDomain::Reason::branching());
1041
+ if (localdom.infeasible()) {
1042
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
1043
+ return;
1044
+ }
1045
+ localdom.propagate();
1046
+ if (localdom.infeasible()) {
1047
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
1048
+ return;
1049
+ }
1050
+ }
1051
+
1052
+ if (mipsolver.mipdata_->integer_cols.size() !=
1053
+ static_cast<size_t>(mipsolver.numCol())) {
1054
+ HighsLpRelaxation lprelax(mipsolver);
1055
+ lprelax.loadModel();
1056
+ lprelax.setIterationLimit(
1057
+ std::max(int64_t{10000}, 2 * mipsolver.mipdata_->firstrootlpiters));
1058
+ lprelax.getLpSolver().changeColsBounds(0, mipsolver.numCol() - 1,
1059
+ localdom.col_lower_.data(),
1060
+ localdom.col_upper_.data());
1061
+
1062
+ // check if only root presolve is allowed
1063
+ if (mipsolver.options_mip_->mip_root_presolve_only)
1064
+ lprelax.getLpSolver().setOptionValue("presolve", kHighsOffString);
1065
+
1066
+ if (!mipsolver.options_mip_->mip_root_presolve_only &&
1067
+ (5 * intcols.size()) / mipsolver.numCol() >= 1) {
1068
+ // LP to solve is very much smaller, so use presolve rather than
1069
+ // the root basis
1070
+ lprelax.getLpSolver().setOptionValue("presolve", kHighsOnString);
1071
+ } else {
1072
+ lprelax.getLpSolver().setBasis(
1073
+ mipsolver.mipdata_->firstrootbasis,
1074
+ "HighsPrimalHeuristics::randomizedRounding");
1075
+ }
1076
+
1077
+ HighsLpRelaxation::Status st = lprelax.resolveLp();
1078
+
1079
+ if (st == HighsLpRelaxation::Status::kInfeasible) {
1080
+ std::vector<HighsInt> inds;
1081
+ std::vector<double> vals;
1082
+ double rhs;
1083
+ if (lprelax.computeDualInfProof(mipsolver.mipdata_->domain, inds, vals,
1084
+ rhs)) {
1085
+ HighsCutGeneration cutGen(lprelax, mipsolver.mipdata_->cutpool);
1086
+ cutGen.generateConflict(localdom, inds, vals, rhs);
1087
+ }
1088
+
1089
+ } else if (lprelax.unscaledPrimalFeasible(st))
1090
+ mipsolver.mipdata_->addIncumbent(
1091
+ lprelax.getLpSolver().getSolution().col_value, lprelax.getObjective(),
1092
+ kSolutionSourceRandomizedRounding);
1093
+ } else {
1094
+ mipsolver.mipdata_->trySolution(localdom.col_lower_,
1095
+ kSolutionSourceRandomizedRounding);
1096
+ }
1097
+ }
1098
+
1099
+ void HighsPrimalHeuristics::shifting(const std::vector<double>& relaxationsol) {
1100
+ if (relaxationsol.size() != static_cast<size_t>(mipsolver.numCol())) return;
1101
+
1102
+ std::vector<double> current_relax_solution = relaxationsol;
1103
+ HighsInt t = 0;
1104
+ const HighsLp& currentLp = *mipsolver.model_;
1105
+ HighsLpRelaxation lprelax(mipsolver.mipdata_->lp);
1106
+ std::vector<std::pair<HighsInt, double>> current_fractional_integers =
1107
+ lprelax.getFractionalIntegers();
1108
+ std::vector<std::tuple<HighsInt, HighsInt, double>> current_infeasible_rows =
1109
+ mipsolver.mipdata_->getInfeasibleRows(current_relax_solution);
1110
+ size_t previous_infeasible_rows_size = current_infeasible_rows.size();
1111
+ bool hasInfeasibleConstraints = current_infeasible_rows.size() != 0;
1112
+ HighsInt iterationsWithoutReductions = 0;
1113
+ HighsInt maxIterationsWithoutReductions = 5;
1114
+ std::unordered_map<HighsInt, std::vector<HighsInt>> shift_iterations_set;
1115
+ std::vector<HighsInt> shifts;
1116
+
1117
+ auto findPairByIndex = [](std::vector<std::pair<HighsInt, double>>& vec,
1118
+ HighsInt k) {
1119
+ return std::find_if(
1120
+ vec.begin(), vec.end(),
1121
+ [k](const std::pair<HighsInt, double>& p) { return p.first == k; });
1122
+ };
1123
+
1124
+ auto findShiftsByIndex =
1125
+ [](const std::unordered_map<HighsInt, std::vector<HighsInt>>& shifts,
1126
+ HighsInt k) -> std::vector<HighsInt> {
1127
+ auto it = shifts.find(k);
1128
+ if (it != shifts.end()) {
1129
+ return it->second;
1130
+ }
1131
+ return {};
1132
+ };
1133
+
1134
+ while ((current_fractional_integers.size() > 0 || hasInfeasibleConstraints) &&
1135
+ iterationsWithoutReductions <= maxIterationsWithoutReductions &&
1136
+ t <= static_cast<HighsInt>(mipsolver.mipdata_->integer_cols.size())) {
1137
+ t++;
1138
+ bool fractionalIntegersReduced = false;
1139
+ iterationsWithoutReductions++;
1140
+ if (hasInfeasibleConstraints) {
1141
+ // find an infeasible row that has a non-zero coefficient a(row,col) where
1142
+ // col in currentFractInt
1143
+ bool fractionalIntegerFound = false;
1144
+ HighsInt rIndex = 0;
1145
+ while (!fractionalIntegerFound &&
1146
+ rIndex != static_cast<HighsInt>(current_infeasible_rows.size())) {
1147
+ HighsInt r = std::get<0>(current_infeasible_rows[rIndex]);
1148
+ HighsInt start = mipsolver.mipdata_->ARstart_[r];
1149
+ HighsInt end = mipsolver.mipdata_->ARstart_[r + 1];
1150
+ for (HighsInt jInd = start; jInd != end; ++jInd) {
1151
+ auto it = findPairByIndex(current_fractional_integers,
1152
+ mipsolver.mipdata_->ARindex_[jInd]);
1153
+ fractionalIntegerFound = it != current_fractional_integers.end();
1154
+ if (fractionalIntegerFound) break;
1155
+ }
1156
+ rIndex++;
1157
+ }
1158
+ HighsInt row_index = rIndex - 1;
1159
+ if (!fractionalIntegerFound) {
1160
+ // otherwise select a random infeasible row
1161
+ row_index = randgen.integer(current_infeasible_rows.size());
1162
+ }
1163
+
1164
+ HighsInt row = std::get<0>(current_infeasible_rows[row_index]);
1165
+ HighsInt row_sense = std::get<1>(current_infeasible_rows[row_index]);
1166
+ double infeasibility = std::get<2>(current_infeasible_rows[row_index]);
1167
+ double score_min = kHighsInf;
1168
+ HighsInt j_min = std::numeric_limits<HighsInt>::max();
1169
+ double x_j_min = kHighsInf;
1170
+ double aij_min = 0.0;
1171
+ bool moveValueUp = false;
1172
+ HighsInt start = mipsolver.mipdata_->ARstart_[row];
1173
+ HighsInt end = mipsolver.mipdata_->ARstart_[row + 1];
1174
+ for (HighsInt jInd = start; jInd != end; ++jInd) {
1175
+ HighsInt j = mipsolver.mipdata_->ARindex_[jInd];
1176
+
1177
+ // skip fixed variables
1178
+ if (currentLp.col_lower_[j] == currentLp.col_upper_[j]) continue;
1179
+
1180
+ // lambda for finding best shift
1181
+ auto repair = [&findPairByIndex, &current_fractional_integers,
1182
+ &findShiftsByIndex, &shift_iterations_set, &t,
1183
+ &score_min, &j_min, &aij_min, &x_j_min,
1184
+ &current_relax_solution, &moveValueUp](
1185
+ HighsInt col, HighsInt direction, HighsInt row_sense,
1186
+ HighsInt numLocks, double coef, double cost,
1187
+ bool isMaximization, bool isInteger, bool isAtBound) {
1188
+ if ((row_sense < 0 || direction * coef > 0) &&
1189
+ (row_sense > 0 || direction * coef < 0))
1190
+ return;
1191
+
1192
+ // skip variables at bounds
1193
+ if (isAtBound) return;
1194
+
1195
+ // search for column
1196
+ auto it = findPairByIndex(current_fractional_integers, col);
1197
+
1198
+ // add data
1199
+ bool found = it != current_fractional_integers.end();
1200
+
1201
+ double score = kHighsInf;
1202
+ if (found) {
1203
+ score = -1.0 + 1.0 / static_cast<double>(numLocks + 1);
1204
+ } else {
1205
+ const auto& shifts = findShiftsByIndex(shift_iterations_set, col);
1206
+ if (shifts.empty())
1207
+ score = direction * (isMaximization ? -cost : cost);
1208
+ else {
1209
+ score = 0.0;
1210
+ for (double shift : shifts) {
1211
+ if (direction * shift > 0)
1212
+ score += pow(1.1, direction * shift - t);
1213
+ }
1214
+ }
1215
+ if (isInteger) score += 1;
1216
+ }
1217
+
1218
+ if (score < score_min) {
1219
+ score_min = score;
1220
+ j_min = col;
1221
+ aij_min = coef;
1222
+ x_j_min = current_relax_solution[col];
1223
+ moveValueUp = direction > 0;
1224
+ }
1225
+ };
1226
+
1227
+ // repair with up-rounding
1228
+ repair(j, HighsInt{1}, row_sense, mipsolver.mipdata_->downlocks[j],
1229
+ mipsolver.mipdata_->ARvalue_[jInd], currentLp.col_cost_[j],
1230
+ mipsolver.orig_model_->sense_ == ObjSense::kMaximize,
1231
+ currentLp.integrality_[j] == HighsVarType::kInteger,
1232
+ std::abs(currentLp.col_upper_[j] - current_relax_solution[j]) <=
1233
+ mipsolver.mipdata_->feastol);
1234
+
1235
+ // repair with down-rounding
1236
+ repair(j, HighsInt{-1}, row_sense, mipsolver.mipdata_->uplocks[j],
1237
+ mipsolver.mipdata_->ARvalue_[jInd], currentLp.col_cost_[j],
1238
+ mipsolver.orig_model_->sense_ == ObjSense::kMaximize,
1239
+ currentLp.integrality_[j] == HighsVarType::kInteger,
1240
+ std::abs(current_relax_solution[j] - currentLp.col_lower_[j]) <=
1241
+ mipsolver.mipdata_->feastol);
1242
+ }
1243
+
1244
+ if (j_min != std::numeric_limits<HighsInt>::max()) {
1245
+ // Update current_fractional_integers
1246
+ auto it = findPairByIndex(current_fractional_integers, j_min);
1247
+ if (it != current_fractional_integers.end()) {
1248
+ current_fractional_integers.erase(it);
1249
+ fractionalIntegersReduced = true;
1250
+ }
1251
+ // Update current_relax_solution and shift_iterations_set (for not
1252
+ // fractional integers)
1253
+ if (moveValueUp) {
1254
+ if (fractionalIntegersReduced) {
1255
+ current_relax_solution[j_min] =
1256
+ std::ceil(x_j_min - mipsolver.mipdata_->feastol);
1257
+ } else {
1258
+ if (currentLp.integrality_[j_min] == HighsVarType::kInteger) {
1259
+ // variable is integer and not at the upper bound, so increment
1260
+ // by 1.
1261
+ current_relax_solution[j_min] = x_j_min + 1.0;
1262
+ } else {
1263
+ current_relax_solution[j_min] = std::min(
1264
+ x_j_min + infeasibility / std::abs(aij_min),
1265
+ currentLp.col_upper_[j_min] + mipsolver.mipdata_->feastol);
1266
+ }
1267
+ shift_iterations_set[j_min].push_back(t);
1268
+ }
1269
+ } else {
1270
+ if (fractionalIntegersReduced) {
1271
+ current_relax_solution[j_min] =
1272
+ std::floor(x_j_min + mipsolver.mipdata_->feastol);
1273
+ } else {
1274
+ if (currentLp.integrality_[j_min] == HighsVarType::kInteger) {
1275
+ // variable is integer and not at the lower bound, so decrement
1276
+ // by 1.
1277
+ current_relax_solution[j_min] = x_j_min - 1.0;
1278
+ } else {
1279
+ current_relax_solution[j_min] = std::max(
1280
+ x_j_min - infeasibility / std::abs(aij_min),
1281
+ currentLp.col_lower_[j_min] - mipsolver.mipdata_->feastol);
1282
+ }
1283
+
1284
+ shift_iterations_set[j_min].push_back(-t);
1285
+ }
1286
+ }
1287
+ }
1288
+ } else {
1289
+ double xi_max = -1;
1290
+ double delta_c_min = kHighsInf;
1291
+ HighsInt pind_j_min = std::numeric_limits<HighsInt>::max();
1292
+ HighsInt j_min = std::numeric_limits<HighsInt>::max();
1293
+ double x_j_min = kHighsInf;
1294
+ HighsInt sigma = 0;
1295
+ for (HighsInt i = 0;
1296
+ i != static_cast<HighsInt>(current_fractional_integers.size());
1297
+ ++i) {
1298
+ std::pair<HighsInt, double> it = current_fractional_integers[i];
1299
+ HighsInt col = it.first;
1300
+ assert(col >= 0);
1301
+ assert(col < mipsolver.numCol());
1302
+
1303
+ auto isBetter = [&currentLp, &it, &xi_max, &delta_c_min, &pind_j_min,
1304
+ &j_min, &x_j_min, &sigma,
1305
+ &i](double col, double xi, double roundedval,
1306
+ HighsInt direction) {
1307
+ double c_min = currentLp.col_cost_[col] * (roundedval - it.second);
1308
+ if (xi > xi_max || (xi == xi_max && c_min < delta_c_min)) {
1309
+ xi_max = xi;
1310
+ delta_c_min = c_min;
1311
+ pind_j_min = i;
1312
+ j_min = col;
1313
+ x_j_min = roundedval;
1314
+ sigma = direction;
1315
+ }
1316
+ };
1317
+
1318
+ isBetter(col, mipsolver.mipdata_->uplocks[col],
1319
+ std::floor(it.second + mipsolver.mipdata_->feastol),
1320
+ HighsInt{-1});
1321
+ isBetter(col, mipsolver.mipdata_->downlocks[col],
1322
+ std::ceil(it.second - mipsolver.mipdata_->feastol),
1323
+ HighsInt{1});
1324
+ }
1325
+ if (sigma != 0) {
1326
+ current_relax_solution[j_min] = x_j_min;
1327
+ }
1328
+ if (pind_j_min != std::numeric_limits<HighsInt>::max()) {
1329
+ current_fractional_integers.erase(current_fractional_integers.begin() +
1330
+ pind_j_min);
1331
+ fractionalIntegersReduced = true;
1332
+ }
1333
+ }
1334
+ current_infeasible_rows =
1335
+ mipsolver.mipdata_->getInfeasibleRows(current_relax_solution);
1336
+ hasInfeasibleConstraints = current_infeasible_rows.size() != 0;
1337
+ if (current_infeasible_rows.size() < previous_infeasible_rows_size ||
1338
+ fractionalIntegersReduced)
1339
+ iterationsWithoutReductions = 0;
1340
+ previous_infeasible_rows_size = current_infeasible_rows.size();
1341
+ }
1342
+ // re-check for feasibility and add incumbent
1343
+ if (hasInfeasibleConstraints) {
1344
+ tryRoundedPoint(current_relax_solution, kSolutionSourceShifting);
1345
+ } else {
1346
+ if (current_fractional_integers.size() > 0)
1347
+ ziRound(current_relax_solution);
1348
+ else
1349
+ mipsolver.mipdata_->trySolution(current_relax_solution,
1350
+ kSolutionSourceShifting);
1351
+ }
1352
+ }
1353
+
1354
+ void HighsPrimalHeuristics::ziRound(const std::vector<double>& relaxationsol) {
1355
+ // if (mipsolver.submip) return;
1356
+ if (relaxationsol.size() != static_cast<size_t>(mipsolver.numCol())) return;
1357
+
1358
+ std::vector<double> current_relax_solution = relaxationsol;
1359
+
1360
+ auto zi = [this](double x) {
1361
+ return std::min(std::ceil(x - mipsolver.mipdata_->feastol) - x,
1362
+ x - std::floor(x + mipsolver.mipdata_->feastol));
1363
+ };
1364
+
1365
+ // auto localdom = mipsolver.mipdata_->domain;
1366
+
1367
+ HighsCDouble zi_total = 0.0;
1368
+ for (HighsInt i : intcols) {
1369
+ zi_total += zi(current_relax_solution[i]);
1370
+ }
1371
+
1372
+ if (zi_total <= mipsolver.mipdata_->feastol) return;
1373
+
1374
+ const HighsLp& currentLp = *mipsolver.model_;
1375
+
1376
+ std::vector<double> rowActivities;
1377
+ std::vector<double> XrowLower;
1378
+ std::vector<double> XrowUpper;
1379
+ rowActivities.resize(currentLp.num_row_);
1380
+ XrowLower.resize(currentLp.num_row_);
1381
+ XrowUpper.resize(currentLp.num_row_);
1382
+
1383
+ HighsInt loop_count = 0;
1384
+ HighsInt max_loop_count = 5;
1385
+ HighsCDouble previous_zi_total;
1386
+ HighsCDouble improvement_in_feasibility = kHighsInf;
1387
+
1388
+ while (zi_total > mipsolver.mipdata_->feastol &&
1389
+ improvement_in_feasibility > mipsolver.mipdata_->feastol &&
1390
+ loop_count <= max_loop_count) {
1391
+ previous_zi_total = zi_total;
1392
+ loop_count++;
1393
+
1394
+ if (currentLp.num_row_ > 0)
1395
+ getLpRowBounds(currentLp, 0, currentLp.num_row_ - 1, XrowLower.data(),
1396
+ XrowUpper.data());
1397
+
1398
+ for (HighsInt j : intcols) {
1399
+ double relax_solution = current_relax_solution[j];
1400
+ if (fractionality(relax_solution) <= mipsolver.mipdata_->feastol)
1401
+ continue;
1402
+
1403
+ rowActivities.assign(currentLp.num_row_, 0.0);
1404
+ calculateRowValuesQuad(currentLp, current_relax_solution, rowActivities);
1405
+
1406
+ double min_row_ratio_for_upper = kHighsInf;
1407
+ double min_row_ratio_for_lower = kHighsInf;
1408
+
1409
+ for (HighsInt el = currentLp.a_matrix_.start_[j];
1410
+ el < currentLp.a_matrix_.start_[j + 1]; el++) {
1411
+ HighsInt i = currentLp.a_matrix_.index_[el];
1412
+ double aij = currentLp.a_matrix_.value_[el];
1413
+
1414
+ double slack_upper = XrowUpper[i] - rowActivities[i];
1415
+ double slack_lower = rowActivities[i] - XrowLower[i];
1416
+ min_row_ratio_for_upper =
1417
+ std::min(min_row_ratio_for_upper,
1418
+ (aij > 0 ? slack_upper : -slack_lower) / aij);
1419
+ min_row_ratio_for_lower =
1420
+ std::min(min_row_ratio_for_lower,
1421
+ (aij > 0 ? slack_lower : -slack_upper) / aij);
1422
+ }
1423
+
1424
+ double upper_bound = std::min(currentLp.col_upper_[j] - relax_solution,
1425
+ min_row_ratio_for_upper);
1426
+ double lower_bound = std::min(relax_solution - currentLp.col_lower_[j],
1427
+ min_row_ratio_for_lower);
1428
+
1429
+ auto performUpdates = [&](HighsInt col, double change) {
1430
+ double old_relax_solution = current_relax_solution[col];
1431
+ current_relax_solution[col] += change;
1432
+ zi_total =
1433
+ zi_total - zi(old_relax_solution) + zi(current_relax_solution[col]);
1434
+ };
1435
+
1436
+ if (std::abs(zi(relax_solution + upper_bound) -
1437
+ zi(relax_solution - lower_bound)) <=
1438
+ mipsolver.mipdata_->feastol &&
1439
+ zi(relax_solution + upper_bound) < zi(relax_solution)) {
1440
+ double XcolCost = currentLp.col_cost_[j];
1441
+ bool ubObjChangeSmaller = XcolCost * (relax_solution + upper_bound) <=
1442
+ XcolCost * (relax_solution - lower_bound);
1443
+ bool isMinimization = currentLp.sense_ == ObjSense::kMinimize;
1444
+ if ((isMinimization && ubObjChangeSmaller) ||
1445
+ (!isMinimization && !ubObjChangeSmaller)) {
1446
+ performUpdates(j, upper_bound);
1447
+ } else {
1448
+ performUpdates(j, -lower_bound);
1449
+ }
1450
+ } else if (zi(relax_solution + upper_bound) <
1451
+ zi(relax_solution - lower_bound) &&
1452
+ zi(relax_solution + upper_bound) < zi(relax_solution)) {
1453
+ performUpdates(j, upper_bound);
1454
+ } else if (zi(relax_solution + upper_bound) >
1455
+ zi(relax_solution - lower_bound) &&
1456
+ zi(relax_solution - lower_bound) < zi(relax_solution)) {
1457
+ performUpdates(j, -lower_bound);
1458
+ }
1459
+ }
1460
+ improvement_in_feasibility = previous_zi_total - zi_total;
1461
+ }
1462
+ // re-check for feasibility and add incumbent
1463
+ mipsolver.mipdata_->trySolution(current_relax_solution,
1464
+ kSolutionSourceZiRound);
1465
+ }
1466
+
1467
+ void HighsPrimalHeuristics::feasibilityPump() {
1468
+ HighsLpRelaxation lprelax(mipsolver.mipdata_->lp);
1469
+ std::unordered_set<std::vector<HighsInt>, HighsVectorHasher, HighsVectorEqual>
1470
+ referencepoints;
1471
+ std::vector<double> roundedsol;
1472
+ HighsLpRelaxation::Status status = lprelax.resolveLp();
1473
+ lp_iterations += lprelax.getNumLpIterations();
1474
+
1475
+ std::vector<double> fracintcost;
1476
+ std::vector<HighsInt> fracintset;
1477
+
1478
+ std::vector<HighsInt> mask(mipsolver.numCol(), 1);
1479
+ std::vector<double> cost(mipsolver.numCol(), 0.0);
1480
+
1481
+ lprelax.getLpSolver().setOptionValue("simplex_strategy",
1482
+ kSimplexStrategyPrimal);
1483
+ lprelax.setObjectiveLimit();
1484
+ lprelax.getLpSolver().setOptionValue(
1485
+ "primal_simplex_bound_perturbation_multiplier", 0.0);
1486
+
1487
+ lprelax.setIterationLimit(5 * mipsolver.mipdata_->avgrootlpiters);
1488
+
1489
+ while (!lprelax.getFractionalIntegers().empty()) {
1490
+ const auto& lpsol = lprelax.getLpSolver().getSolution().col_value;
1491
+ roundedsol = lprelax.getLpSolver().getSolution().col_value;
1492
+
1493
+ std::vector<HighsInt> referencepoint;
1494
+ referencepoint.reserve(mipsolver.mipdata_->integer_cols.size());
1495
+
1496
+ auto localdom = mipsolver.mipdata_->domain;
1497
+ for (HighsInt i : mipsolver.mipdata_->integer_cols) {
1498
+ assert(mipsolver.isColInteger(i));
1499
+ double intval = std::floor(roundedsol[i] + randgen.real(0.4, 0.6));
1500
+ intval = std::max(intval, localdom.col_lower_[i]);
1501
+ intval = std::min(intval, localdom.col_upper_[i]);
1502
+ roundedsol[i] = intval;
1503
+ referencepoint.push_back((HighsInt)intval);
1504
+ if (!localdom.infeasible()) {
1505
+ localdom.fixCol(i, intval, HighsDomain::Reason::branching());
1506
+ if (localdom.infeasible()) {
1507
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
1508
+ continue;
1509
+ }
1510
+ localdom.propagate();
1511
+ if (localdom.infeasible()) {
1512
+ localdom.conflictAnalysis(mipsolver.mipdata_->conflictPool);
1513
+ continue;
1514
+ }
1515
+ }
1516
+ }
1517
+
1518
+ bool havecycle = !referencepoints.emplace(referencepoint).second;
1519
+ for (HighsInt k = 0; havecycle && k < 2; ++k) {
1520
+ for (HighsInt i = 0; i != 10; ++i) {
1521
+ HighsInt flippos =
1522
+ randgen.integer(mipsolver.mipdata_->integer_cols.size());
1523
+ HighsInt col = mipsolver.mipdata_->integer_cols[flippos];
1524
+ if (roundedsol[col] > lpsol[col])
1525
+ roundedsol[col] = (HighsInt)std::floor(lpsol[col]);
1526
+ else if (roundedsol[col] < lpsol[col])
1527
+ roundedsol[col] = (HighsInt)std::ceil(lpsol[col]);
1528
+ else if (roundedsol[col] < mipsolver.mipdata_->domain.col_upper_[col])
1529
+ roundedsol[col] = mipsolver.mipdata_->domain.col_upper_[col];
1530
+ else
1531
+ roundedsol[col] = mipsolver.mipdata_->domain.col_lower_[col];
1532
+
1533
+ referencepoint[flippos] = (HighsInt)roundedsol[col];
1534
+ }
1535
+ havecycle = !referencepoints.emplace(referencepoint).second;
1536
+ }
1537
+
1538
+ if (havecycle) return;
1539
+
1540
+ if (linesearchRounding(lpsol, roundedsol, kSolutionSourceFeasibilityPump))
1541
+ return;
1542
+
1543
+ if (lprelax.getNumLpIterations() >=
1544
+ 1000 + mipsolver.mipdata_->avgrootlpiters * 5)
1545
+ break;
1546
+
1547
+ for (HighsInt i : mipsolver.mipdata_->integer_cols) {
1548
+ assert(mipsolver.isColInteger(i));
1549
+
1550
+ if (mipsolver.mipdata_->uplocks[i] == 0 ||
1551
+ mipsolver.mipdata_->downlocks[i] == 0)
1552
+ cost[i] = 0.0;
1553
+ else if (lpsol[i] > roundedsol[i] - mipsolver.mipdata_->feastol)
1554
+ cost[i] = -1.0 + randgen.real(-1e-4, 1e-4);
1555
+ else
1556
+ cost[i] = 1.0 + randgen.real(-1e-4, 1e-4);
1557
+ }
1558
+
1559
+ lprelax.getLpSolver().changeColsCost(mask.data(), cost.data());
1560
+ int64_t niters = -lprelax.getNumLpIterations();
1561
+ status = lprelax.resolveLp();
1562
+ niters += lprelax.getNumLpIterations();
1563
+ if (niters == 0) break;
1564
+ lp_iterations += niters;
1565
+ }
1566
+
1567
+ if (lprelax.getFractionalIntegers().empty() &&
1568
+ lprelax.unscaledPrimalFeasible(status))
1569
+ mipsolver.mipdata_->addIncumbent(
1570
+ lprelax.getLpSolver().getSolution().col_value, lprelax.getObjective(),
1571
+ kSolutionSourceFeasibilityPump);
1572
+ }
1573
+
1574
+ void HighsPrimalHeuristics::centralRounding() {
1575
+ if (mipsolver.mipdata_->analyticCenter.size() !=
1576
+ static_cast<size_t>(mipsolver.numCol()))
1577
+ return;
1578
+
1579
+ if (!mipsolver.mipdata_->firstlpsol.empty())
1580
+ linesearchRounding(mipsolver.mipdata_->firstlpsol,
1581
+ mipsolver.mipdata_->analyticCenter,
1582
+ kSolutionSourceCentralRounding);
1583
+ else if (!mipsolver.mipdata_->rootlpsol.empty())
1584
+ linesearchRounding(mipsolver.mipdata_->rootlpsol,
1585
+ mipsolver.mipdata_->analyticCenter,
1586
+ kSolutionSourceCentralRounding);
1587
+ else
1588
+ linesearchRounding(mipsolver.mipdata_->analyticCenter,
1589
+ mipsolver.mipdata_->analyticCenter,
1590
+ kSolutionSourceCentralRounding);
1591
+ }
1592
+
1593
+ #if 0
1594
+ void HighsPrimalHeuristics::clique() {
1595
+ HighsHashTable<HighsInt, double> entries;
1596
+ double offset = 0.0;
1597
+
1598
+ HighsDomain& globaldom = mipsolver.mipdata_->domain;
1599
+ for (HighsInt j = 0; j != mipsolver.numCol(); ++j) {
1600
+ HighsInt col = j;
1601
+ double val = mipsolver.colCost(col);
1602
+ if (val == 0.0) continue;
1603
+
1604
+ if (!globaldom.isBinary(col)) {
1605
+ offset += val * globaldom.col_lower_[col];
1606
+ continue;
1607
+ }
1608
+
1609
+ mipsolver.mipdata_->cliquetable.resolveSubstitution(col, val, offset);
1610
+ entries[col] += val;
1611
+ }
1612
+
1613
+ std::vector<double> profits;
1614
+ std::vector<HighsCliqueTable::CliqueVar> objvars;
1615
+
1616
+ for (const auto& entry : entries) {
1617
+ double objprofit = -entry.value();
1618
+ if (objprofit < 0) {
1619
+ offset += objprofit;
1620
+ profits.push_back(-objprofit);
1621
+ objvars.emplace_back(entry.key(), 0);
1622
+ } else {
1623
+ profits.push_back(objprofit);
1624
+ objvars.emplace_back(entry.key(), 1);
1625
+ }
1626
+ }
1627
+
1628
+ std::vector<double> solution(mipsolver.numCol());
1629
+
1630
+ HighsInt nobjvars = profits.size();
1631
+ for (HighsInt i = 0; i != nobjvars; ++i) solution[objvars[i].col] = objvars[i].val;
1632
+
1633
+ std::vector<std::vector<HighsCliqueTable::CliqueVar>> cliques;
1634
+ double bestviol;
1635
+ HighsInt bestviolpos;
1636
+ HighsInt numcliques;
1637
+
1638
+ cliques = mipsolver.mipdata_->cliquetable.separateCliques(
1639
+ solution, mipsolver.mipdata_->domain, mipsolver.mipdata_->feastol);
1640
+ numcliques = cliques.size();
1641
+ while (numcliques != 0) {
1642
+ bestviol = 0.5;
1643
+ bestviolpos = -1;
1644
+
1645
+ for (HighsInt c = 0; c != numcliques; ++c) {
1646
+ double viol = -1.0;
1647
+ for (HighsCliqueTable::CliqueVar clqvar : cliques[c])
1648
+ viol += clqvar.weight(solution);
1649
+
1650
+ if (viol > bestviolpos) {
1651
+ bestviolpos = c;
1652
+ bestviol = viol;
1653
+ }
1654
+ }
1655
+
1656
+ cliques = mipsolver.mipdata_->cliquetable.separateCliques(
1657
+ solution, mipsolver.mipdata_->domain, mipsolver.mipdata_->feastol);
1658
+ numcliques = cliques.size();
1659
+ }
1660
+ }
1661
+ #endif
1662
+
1663
+ void HighsPrimalHeuristics::flushStatistics() {
1664
+ mipsolver.mipdata_->total_repair_lp += total_repair_lp;
1665
+ mipsolver.mipdata_->total_repair_lp_feasible += total_repair_lp_feasible;
1666
+ mipsolver.mipdata_->total_repair_lp_iterations += total_repair_lp_iterations;
1667
+ total_repair_lp = 0;
1668
+ total_repair_lp_feasible = 0;
1669
+ total_repair_lp_iterations = 0;
1670
+ mipsolver.mipdata_->heuristic_lp_iterations += lp_iterations;
1671
+ mipsolver.mipdata_->total_lp_iterations += lp_iterations;
1672
+ lp_iterations = 0;
1673
+ }