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,1650 @@
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
+ /**@file lp_data/HighsUtils.cpp
9
+ * @brief Class-independent utilities for HiGHS
10
+ */
11
+
12
+ #include "lp_data/HighsModelUtils.h"
13
+
14
+ #include <algorithm>
15
+ #include <cfloat>
16
+ #include <map>
17
+ #include <sstream>
18
+ #include <vector>
19
+
20
+ #include "lp_data/HighsSolution.h"
21
+ #include "util/stringutil.h"
22
+
23
+ void analyseModelBounds(const HighsLogOptions& log_options, const char* message,
24
+ HighsInt numBd, const std::vector<double>& lower,
25
+ const std::vector<double>& upper) {
26
+ if (numBd == 0) return;
27
+ HighsInt numFr = 0;
28
+ HighsInt numLb = 0;
29
+ HighsInt numUb = 0;
30
+ HighsInt numBx = 0;
31
+ HighsInt numFx = 0;
32
+ for (HighsInt ix = 0; ix < numBd; ix++) {
33
+ if (highs_isInfinity(-lower[ix])) {
34
+ // Infinite lower bound
35
+ if (highs_isInfinity(upper[ix])) {
36
+ // Infinite lower bound and infinite upper bound: Fr
37
+ numFr++;
38
+ } else {
39
+ // Infinite lower bound and finite upper bound: Ub
40
+ numUb++;
41
+ }
42
+ } else {
43
+ // Finite lower bound
44
+ if (highs_isInfinity(upper[ix])) {
45
+ // Finite lower bound and infinite upper bound: Lb
46
+ numLb++;
47
+ } else {
48
+ // Finite lower bound and finite upper bound:
49
+ if (lower[ix] < upper[ix]) {
50
+ // Distinct finite bounds: Bx
51
+ numBx++;
52
+ } else {
53
+ // Equal finite bounds: Fx
54
+ numFx++;
55
+ }
56
+ }
57
+ }
58
+ }
59
+ highsLogDev(log_options, HighsLogType::kInfo,
60
+ "Analysing %" HIGHSINT_FORMAT " %s bounds\n", numBd, message);
61
+ if (numFr > 0)
62
+ highsLogDev(log_options, HighsLogType::kInfo,
63
+ " Free: %7" HIGHSINT_FORMAT " (%3" HIGHSINT_FORMAT "%%)\n",
64
+ numFr, (100 * numFr) / numBd);
65
+ if (numLb > 0)
66
+ highsLogDev(log_options, HighsLogType::kInfo,
67
+ " LB: %7" HIGHSINT_FORMAT " (%3" HIGHSINT_FORMAT "%%)\n",
68
+ numLb, (100 * numLb) / numBd);
69
+ if (numUb > 0)
70
+ highsLogDev(log_options, HighsLogType::kInfo,
71
+ " UB: %7" HIGHSINT_FORMAT " (%3" HIGHSINT_FORMAT "%%)\n",
72
+ numUb, (100 * numUb) / numBd);
73
+ if (numBx > 0)
74
+ highsLogDev(log_options, HighsLogType::kInfo,
75
+ " Boxed: %7" HIGHSINT_FORMAT " (%3" HIGHSINT_FORMAT "%%)\n",
76
+ numBx, (100 * numBx) / numBd);
77
+ if (numFx > 0)
78
+ highsLogDev(log_options, HighsLogType::kInfo,
79
+ " Fixed: %7" HIGHSINT_FORMAT " (%3" HIGHSINT_FORMAT "%%)\n",
80
+ numFx, (100 * numFx) / numBd);
81
+ highsLogDev(log_options, HighsLogType::kInfo,
82
+ "grep_CharMl,%s,Free,LB,UB,Boxed,Fixed\n", message);
83
+ highsLogDev(log_options, HighsLogType::kInfo,
84
+ "grep_CharMl,%" HIGHSINT_FORMAT ",%" HIGHSINT_FORMAT
85
+ ",%" HIGHSINT_FORMAT ",%" HIGHSINT_FORMAT ",%" HIGHSINT_FORMAT
86
+ ",%" HIGHSINT_FORMAT "\n",
87
+ numBd, numFr, numLb, numUb, numBx, numFx);
88
+ }
89
+
90
+ std::string statusToString(const HighsBasisStatus status, const double lower,
91
+ const double upper) {
92
+ switch (status) {
93
+ case HighsBasisStatus::kLower:
94
+ if (lower == upper) {
95
+ return "FX";
96
+ } else {
97
+ return "LB";
98
+ }
99
+ break;
100
+ case HighsBasisStatus::kBasic:
101
+ return "BS";
102
+ break;
103
+ case HighsBasisStatus::kUpper:
104
+ if (lower == upper) {
105
+ return "FX";
106
+ } else {
107
+ return "UB";
108
+ }
109
+ break;
110
+ case HighsBasisStatus::kZero:
111
+ return "FR";
112
+ break;
113
+ case HighsBasisStatus::kNonbasic:
114
+ return "NB";
115
+ break;
116
+ }
117
+ return "";
118
+ }
119
+
120
+ std::string typeToString(const HighsVarType type) {
121
+ switch (type) {
122
+ case HighsVarType::kContinuous:
123
+ return "Continuous";
124
+ case HighsVarType::kInteger:
125
+ return "Integer ";
126
+ case HighsVarType::kSemiContinuous:
127
+ return "Semi-conts";
128
+ case HighsVarType::kSemiInteger:
129
+ return "Semi-int ";
130
+ case HighsVarType::kImplicitInteger:
131
+ return "ImpliedInt";
132
+ }
133
+ return "";
134
+ }
135
+
136
+ void writeModelBoundSolution(
137
+ FILE* file, const HighsLogOptions& log_options, const bool columns,
138
+ const HighsInt dim, const std::vector<double>& lower,
139
+ const std::vector<double>& upper, const std::vector<std::string>& names,
140
+ const bool have_primal, const std::vector<double>& primal,
141
+ const bool have_dual, const std::vector<double>& dual,
142
+ const bool have_basis, const std::vector<HighsBasisStatus>& status,
143
+ const HighsVarType* integrality) {
144
+ assert(names.size() == static_cast<size_t>(dim));
145
+ if (have_primal) assert(primal.size() == static_cast<size_t>(dim));
146
+ if (have_dual) assert(dual.size() == static_cast<size_t>(dim));
147
+ if (have_basis) assert(status.size() == static_cast<size_t>(dim));
148
+ const bool have_integrality = integrality != NULL;
149
+ std::stringstream ss;
150
+ std::string s = columns ? "Columns\n" : "Rows\n";
151
+ highsFprintfString(file, log_options, s);
152
+ ss.str(std::string());
153
+ ss << " Index Status Lower Upper Primal Dual";
154
+ if (have_integrality) ss << " Type ";
155
+ ss << " Name\n";
156
+ highsFprintfString(file, log_options, ss.str());
157
+ for (HighsInt ix = 0; ix < dim; ix++) {
158
+ ss.str(std::string());
159
+ std::string var_status_string =
160
+ have_basis ? statusToString(status[ix], lower[ix], upper[ix]) : "";
161
+ ss << highsFormatToString("%9" HIGHSINT_FORMAT " %4s %12g %12g", ix,
162
+ var_status_string.c_str(), lower[ix], upper[ix]);
163
+ if (have_primal) {
164
+ ss << highsFormatToString(" %12g", primal[ix]);
165
+ } else {
166
+ ss << " ";
167
+ }
168
+ if (have_dual) {
169
+ ss << highsFormatToString(" %12g", dual[ix]);
170
+ } else {
171
+ ss << " ";
172
+ }
173
+ if (have_integrality)
174
+ ss << highsFormatToString(" %s", typeToString(integrality[ix]).c_str());
175
+ ss << highsFormatToString(" %-s\n", names[ix].c_str());
176
+ highsFprintfString(file, log_options, ss.str());
177
+ }
178
+ }
179
+
180
+ void writeModelObjective(FILE* file, const HighsLogOptions& log_options,
181
+ const HighsModel& model,
182
+ const std::vector<double>& primal_solution) {
183
+ HighsCDouble objective_value =
184
+ model.lp_.objectiveCDoubleValue(primal_solution);
185
+ objective_value += model.hessian_.objectiveCDoubleValue(primal_solution);
186
+ writeObjectiveValue(file, log_options, (double)objective_value);
187
+ }
188
+
189
+ void writeLpObjective(FILE* file, const HighsLogOptions& log_options,
190
+ const HighsLp& lp,
191
+ const std::vector<double>& primal_solution) {
192
+ HighsCDouble objective_value = lp.objectiveCDoubleValue(primal_solution);
193
+ writeObjectiveValue(file, log_options, (double)objective_value);
194
+ }
195
+
196
+ void writeObjectiveValue(FILE* file, const HighsLogOptions& log_options,
197
+ const double objective_value) {
198
+ auto objStr = highsDoubleToString(objective_value,
199
+ kHighsSolutionValueToStringTolerance);
200
+ std::string s = highsFormatToString("Objective %s\n", objStr.data());
201
+ highsFprintfString(file, log_options, s);
202
+ }
203
+
204
+ void writePrimalSolution(FILE* file, const HighsLogOptions& log_options,
205
+ const HighsLp& lp,
206
+ const std::vector<double>& primal_solution,
207
+ const bool sparse) {
208
+ // Use when writing out the solution file (when names can be assumed
209
+ // to exist) and the improving solution in the MIP solver (when
210
+ // names cannot be assumed to exist)
211
+ HighsInt num_nonzero_primal_value = 0;
212
+ const bool have_col_names = lp.col_names_.size() > 0;
213
+ if (have_col_names)
214
+ assert(lp.col_names_.size() == static_cast<size_t>(lp.num_col_));
215
+ if (sparse) {
216
+ // Determine the number of nonzero primal solution values
217
+ for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++)
218
+ if (primal_solution[iCol]) num_nonzero_primal_value++;
219
+ }
220
+ // Indicate the number of column values to be written out, depending
221
+ // on whether format is sparse: either lp.num_col_ if not sparse, or
222
+ // the negation of the number of nonzero values, if sparse
223
+
224
+ std::stringstream ss;
225
+ ss.str(std::string());
226
+ HighsInt num_col_field = sparse ? -num_nonzero_primal_value : lp.num_col_;
227
+ ss << highsFormatToString("# Columns %d\n", int(num_col_field));
228
+ highsFprintfString(file, log_options, ss.str());
229
+ for (HighsInt ix = 0; ix < lp.num_col_; ix++) {
230
+ if (sparse && !primal_solution[ix]) continue;
231
+ auto valStr = highsDoubleToString(primal_solution[ix],
232
+ kHighsSolutionValueToStringTolerance);
233
+ // Don't invent names locallty: if none exist, then indicate this
234
+ // - so that the (sparse) solution line format remains "name value
235
+ // (index)"
236
+ const std::string name = have_col_names ? lp.col_names_[ix] : "NoName";
237
+ ss.str(std::string());
238
+ ss << highsFormatToString("%-s %s", name.c_str(), valStr.data());
239
+ if (sparse) ss << highsFormatToString(" %d", int(ix));
240
+ ss << "\n";
241
+ highsFprintfString(file, log_options, ss.str());
242
+ }
243
+ fflush(file);
244
+ }
245
+
246
+ void writeModelSolution(FILE* file, const HighsLogOptions& log_options,
247
+ const HighsModel& model, const HighsSolution& solution,
248
+ const HighsInfo& info, const bool sparse) {
249
+ const HighsLp& lp = model.lp_;
250
+ const bool have_primal = solution.value_valid;
251
+ const bool have_dual = solution.dual_valid;
252
+ assert(lp.col_names_.size() == static_cast<size_t>(lp.num_col_));
253
+ assert(lp.row_names_.size() == static_cast<size_t>(lp.num_row_));
254
+ if (have_primal) {
255
+ assert((int)solution.col_value.size() >= lp.num_col_);
256
+ assert((int)solution.row_value.size() >= lp.num_row_);
257
+ assert(info.primal_solution_status != kSolutionStatusNone);
258
+ }
259
+ if (have_dual) {
260
+ assert((int)solution.col_dual.size() >= lp.num_col_);
261
+ assert((int)solution.row_dual.size() >= lp.num_row_);
262
+ assert(info.dual_solution_status != kSolutionStatusNone);
263
+ }
264
+ std::stringstream ss;
265
+ highsFprintfString(file, log_options, "\n# Primal solution values\n");
266
+ if (!have_primal || info.primal_solution_status == kSolutionStatusNone) {
267
+ highsFprintfString(file, log_options, "None\n");
268
+ } else {
269
+ if (info.primal_solution_status == kSolutionStatusFeasible) {
270
+ highsFprintfString(file, log_options, "Feasible\n");
271
+ } else {
272
+ assert(info.primal_solution_status == kSolutionStatusInfeasible);
273
+ highsFprintfString(file, log_options, "Infeasible\n");
274
+ }
275
+ writeModelObjective(file, log_options, model, solution.col_value);
276
+ writePrimalSolution(file, log_options, model.lp_, solution.col_value,
277
+ sparse);
278
+ if (sparse) return;
279
+ ss.str(std::string());
280
+ ss << highsFormatToString("# Rows %" HIGHSINT_FORMAT "\n", lp.num_row_);
281
+ highsFprintfString(file, log_options, ss.str());
282
+ for (HighsInt ix = 0; ix < lp.num_row_; ix++) {
283
+ auto valStr = highsDoubleToString(solution.row_value[ix],
284
+ kHighsSolutionValueToStringTolerance);
285
+ ss.str(std::string());
286
+ ss << highsFormatToString("%-s %s\n", lp.row_names_[ix].c_str(),
287
+ valStr.data());
288
+ highsFprintfString(file, log_options, ss.str());
289
+ }
290
+ }
291
+ highsFprintfString(file, log_options, "\n# Dual solution values\n");
292
+ if (!have_dual || info.dual_solution_status == kSolutionStatusNone) {
293
+ highsFprintfString(file, log_options, "None\n");
294
+ } else {
295
+ if (info.dual_solution_status == kSolutionStatusFeasible) {
296
+ highsFprintfString(file, log_options, "Feasible\n");
297
+ } else {
298
+ assert(info.dual_solution_status == kSolutionStatusInfeasible);
299
+ highsFprintfString(file, log_options, "Infeasible\n");
300
+ }
301
+ ss.str(std::string());
302
+ ss << highsFormatToString("# Columns %" HIGHSINT_FORMAT "\n", lp.num_col_);
303
+ highsFprintfString(file, log_options, ss.str());
304
+ for (HighsInt ix = 0; ix < lp.num_col_; ix++) {
305
+ auto valStr = highsDoubleToString(solution.col_dual[ix],
306
+ kHighsSolutionValueToStringTolerance);
307
+ ss.str(std::string());
308
+ ss << highsFormatToString("%-s %s\n", lp.col_names_[ix].c_str(),
309
+ valStr.data());
310
+ highsFprintfString(file, log_options, ss.str());
311
+ }
312
+ ss.str(std::string());
313
+ ss << highsFormatToString("# Rows %" HIGHSINT_FORMAT "\n", lp.num_row_);
314
+ highsFprintfString(file, log_options, ss.str());
315
+ for (HighsInt ix = 0; ix < lp.num_row_; ix++) {
316
+ auto valStr = highsDoubleToString(solution.row_dual[ix],
317
+ kHighsSolutionValueToStringTolerance);
318
+ ss.str(std::string());
319
+ ss << highsFormatToString("%-s %s\n", lp.row_names_[ix].c_str(),
320
+ valStr.data());
321
+ highsFprintfString(file, log_options, ss.str());
322
+ }
323
+ }
324
+ }
325
+
326
+ bool replaceSpacesByUnderscores(std::string& name) {
327
+ // Find the first occurrence of the substring
328
+ const std::string replace_word = " ";
329
+ const std::string replace_by = "_";
330
+ size_t pos = name.find(replace_word);
331
+ const bool found_space = pos != std::string::npos;
332
+ const std::string from_name = name;
333
+
334
+ // Iterate through the string and replace all
335
+ // occurrences
336
+ while (pos != string::npos) {
337
+ // Replace the substring with the specified string
338
+ name.replace(pos, replace_word.size(), replace_by);
339
+
340
+ // Find the next occurrence of the substring
341
+ pos = name.find(replace_word, pos + replace_by.size());
342
+ }
343
+ return found_space;
344
+ }
345
+
346
+ bool hasNamesWithSpaces(const HighsLogOptions& log_options, const HighsLp& lp) {
347
+ if (hasNamesWithSpaces(log_options, true, lp.col_names_)) return true;
348
+ return hasNamesWithSpaces(log_options, false, lp.row_names_);
349
+ }
350
+
351
+ bool hasNamesWithSpaces(const HighsLogOptions& log_options, const bool col,
352
+ const std::vector<std::string>& names) {
353
+ HighsInt num_names_with_spaces = 0;
354
+ HighsInt num_name = names.size();
355
+ for (HighsInt ix = 0; ix < num_name; ix++)
356
+ if (names[ix].find(" ") != std::string::npos) num_names_with_spaces++;
357
+ if (num_names_with_spaces)
358
+ highsLogDev(log_options, HighsLogType::kInfo,
359
+ "There are %d %s names with spaces\n",
360
+ HighsInt(num_names_with_spaces), col ? "column" : "row");
361
+ return num_names_with_spaces > 0;
362
+ }
363
+
364
+ bool hasIllegalNameForLpFile(const std::vector<std::string>& names) {
365
+ HighsInt num_name = names.size();
366
+ for (HighsInt ix = 0; ix < num_name; ix++) {
367
+ const std::string name = names[ix];
368
+ const std::string first_character = name.substr(0, 1);
369
+ if (name.find_first_not_of(kLegalLpFileColRowNameChar) != std::string::npos)
370
+ return true;
371
+ if (first_character.find_first_not_of(kLegalLpFileColRowNameFirstChar) !=
372
+ std::string::npos)
373
+ return true;
374
+ }
375
+ return false;
376
+ }
377
+
378
+ HighsInt maxNameLength(const HighsLp& lp) {
379
+ return std::max(maxNameLength(lp.col_names_), maxNameLength(lp.row_names_));
380
+ }
381
+
382
+ HighsInt maxNameLength(const std::vector<std::string>& names) {
383
+ HighsInt num_name = names.size();
384
+ HighsInt max_name_length = 0;
385
+ for (HighsInt ix = 0; ix < num_name; ix++)
386
+ max_name_length = std::max(HighsInt(names[ix].length()), max_name_length);
387
+ return max_name_length;
388
+ }
389
+
390
+ HighsStatus normaliseNames(const HighsLogOptions& log_options, HighsLp& lp,
391
+ HighsFileType type) {
392
+ HighsStatus call_status =
393
+ normaliseNames(log_options, true, lp.num_col_, lp.col_name_prefix_,
394
+ lp.col_name_suffix_, lp.col_names_, lp.col_hash_, type);
395
+ assert(call_status != HighsStatus::kError);
396
+ // Retain call_status in case normaliseNames for rows returns
397
+ // HighsStatus::kOk
398
+ HighsStatus return_status = call_status;
399
+ call_status =
400
+ normaliseNames(log_options, false, lp.num_row_, lp.row_name_prefix_,
401
+ lp.row_name_suffix_, lp.row_names_, lp.row_hash_, type);
402
+ assert(call_status != HighsStatus::kError);
403
+ if (call_status != HighsStatus::kOk) return call_status;
404
+ return return_status;
405
+ }
406
+
407
+ HighsStatus normaliseNames(const HighsLogOptions& log_options, bool column,
408
+ HighsInt num_name_required, std::string& name_prefix,
409
+ HighsInt& name_suffix,
410
+ std::vector<std::string>& names,
411
+ HighsNameHash& name_hash, HighsFileType type) {
412
+ // First look for there being no names
413
+ HighsInt max_name_length = maxNameLength(names);
414
+ // Keep track of whether the names are invalid
415
+ bool invalid_names = max_name_length == 0;
416
+ names.resize(num_name_required);
417
+ HighsInt num_blank = 0;
418
+ HighsInt num_names_with_spaces = 0;
419
+ const HighsInt from_name_suffix = name_suffix;
420
+ if (!invalid_names) {
421
+ invalid_names =
422
+ type == HighsFileType::kLp && hasIllegalNameForLpFile(names);
423
+ if (!invalid_names) {
424
+ for (HighsInt ix = 0; ix < num_name_required; ix++) {
425
+ if (HighsInt(names[ix].length()) == 0) {
426
+ // Name is blank, so create one
427
+ num_blank++;
428
+ name_prefix =
429
+ column ? kHighsUniqueColNamePrefix : kHighsUniquerowNamePrefix;
430
+ names[ix] = name_prefix + std::to_string(name_suffix++);
431
+ } else if (type == HighsFileType::kMps) {
432
+ // For MPS files, replace spaces in names by an underscore
433
+ if (replaceSpacesByUnderscores(names[ix])) num_names_with_spaces++;
434
+ }
435
+ }
436
+ }
437
+ }
438
+ // Possibly check for duplicates
439
+ invalid_names = invalid_names || name_hash.hasDuplicate(names);
440
+ name_hash.name2index.clear();
441
+ if (!invalid_names) {
442
+ // Names are valid
443
+ if (num_blank || num_names_with_spaces) {
444
+ // Report on any modifications
445
+ if (num_blank) {
446
+ highsLogUser(
447
+ log_options, HighsLogType::kWarning,
448
+ "Replaced %d blank %-6s name%s by one%s with prefix \"%s\", "
449
+ "beginning with suffix %d\n",
450
+ int(num_blank), column ? "column" : "row",
451
+ num_blank == 1 ? "" : "s", num_blank == 1 ? "" : "s",
452
+ name_prefix.c_str(), int(from_name_suffix));
453
+ }
454
+ if (num_names_with_spaces) {
455
+ highsLogUser(log_options, HighsLogType::kWarning,
456
+ "Replaced spaces in %d %-6s name%s by underscores\n",
457
+ int(num_names_with_spaces), column ? "column" : "row",
458
+ num_names_with_spaces == 1 ? "" : "s");
459
+ }
460
+ return HighsStatus::kWarning;
461
+ } else {
462
+ // Return OK!
463
+ return HighsStatus::kOk;
464
+ }
465
+ }
466
+ assert(invalid_names);
467
+ // Names are not valid, so create them using minimal prefix, and
468
+ // suffix starting from zero
469
+ name_prefix =
470
+ column ? kHighsMinimalColNamePrefix : kHighsMinimalrowNamePrefix;
471
+ name_suffix = 0;
472
+ assert(names.size() == static_cast<size_t>(num_name_required));
473
+ highsLogUser(log_options, HighsLogType::kWarning,
474
+ "%s names are not present, or contain %sduplicates: using "
475
+ "names with prefix \"%s\", beginning with suffix %d\n",
476
+ column ? "Column" : "Row ",
477
+ type == HighsFileType::kLp ? "invalid characters or " : "",
478
+ name_prefix.c_str(), int(name_suffix));
479
+ for (HighsInt ix = 0; ix < num_name_required; ix++)
480
+ names[ix] = name_prefix + std::to_string(name_suffix++);
481
+ return HighsStatus::kWarning;
482
+ }
483
+
484
+ HighsFileType getFileType(const std::string filename) {
485
+ std::string lower_case_extension = getFilenameExt(filename);
486
+ tolower(lower_case_extension);
487
+ if (lower_case_extension.compare("mps") == 0) {
488
+ return HighsFileType::kMps;
489
+ } else if (lower_case_extension.compare("lp") == 0) {
490
+ return HighsFileType::kLp;
491
+ }
492
+ return HighsFileType::kMinimal;
493
+ }
494
+
495
+ void writeSolutionFile(FILE* file, const HighsOptions& options,
496
+ const HighsModel& model, const HighsBasis& basis,
497
+ const HighsSolution& solution, const HighsInfo& info,
498
+ const HighsModelStatus model_status,
499
+ const HighsInt style) {
500
+ const bool have_primal = solution.value_valid;
501
+ const bool have_dual = solution.dual_valid;
502
+ const bool have_basis = basis.valid;
503
+ const HighsLp& lp = model.lp_;
504
+ const HighsLogOptions& log_options = options.log_options;
505
+ assert(lp.col_names_.size() == static_cast<size_t>(lp.num_col_));
506
+ assert(lp.row_names_.size() == static_cast<size_t>(lp.num_row_));
507
+ if (style == kSolutionStyleOldRaw) {
508
+ writeOldRawSolution(file, log_options, lp, basis, solution);
509
+ } else if (style == kSolutionStylePretty) {
510
+ const HighsVarType* integrality =
511
+ lp.integrality_.size() > 0 ? lp.integrality_.data() : nullptr;
512
+ writeModelBoundSolution(file, log_options, true, lp.num_col_, lp.col_lower_,
513
+ lp.col_upper_, lp.col_names_, have_primal,
514
+ solution.col_value, have_dual, solution.col_dual,
515
+ have_basis, basis.col_status, integrality);
516
+ writeModelBoundSolution(file, log_options, false, lp.num_row_,
517
+ lp.row_lower_, lp.row_upper_, lp.row_names_,
518
+ have_primal, solution.row_value, have_dual,
519
+ solution.row_dual, have_basis, basis.row_status);
520
+ highsFprintfString(file, log_options, "\n");
521
+ std::stringstream ss;
522
+ ss.str(std::string());
523
+ ss << highsFormatToString("Model status: %s\n",
524
+ utilModelStatusToString(model_status).c_str());
525
+ highsFprintfString(file, log_options, ss.str());
526
+ auto objStr = highsDoubleToString((double)info.objective_function_value,
527
+ kHighsSolutionValueToStringTolerance);
528
+ highsFprintfString(file, log_options, "\n");
529
+ ss.str(std::string());
530
+ ss << highsFormatToString("Objective value: %s\n", objStr.data());
531
+ highsFprintfString(file, log_options, ss.str());
532
+ } else if (style == kSolutionStyleGlpsolRaw ||
533
+ style == kSolutionStyleGlpsolPretty) {
534
+ const bool raw = style == kSolutionStyleGlpsolRaw;
535
+ writeGlpsolSolution(file, options, model, basis, solution, model_status,
536
+ info, raw);
537
+ } else {
538
+ // Standard raw solution file, possibly sparse => only nonzero primal values
539
+ const bool sparse = style == kSolutionStyleSparse;
540
+ assert(style == kSolutionStyleRaw || sparse);
541
+ highsFprintfString(file, log_options, "Model status\n");
542
+ std::stringstream ss;
543
+ ss.str(std::string());
544
+ ss << highsFormatToString("%s\n",
545
+ utilModelStatusToString(model_status).c_str());
546
+ highsFprintfString(file, log_options, ss.str());
547
+ writeModelSolution(file, log_options, model, solution, info, sparse);
548
+ }
549
+ }
550
+
551
+ void writeGlpsolCostRow(FILE* file, const HighsLogOptions& log_options,
552
+ const bool raw, const bool is_mip,
553
+ const HighsInt row_id,
554
+ const std::string& objective_name,
555
+ const double objective_function_value) {
556
+ std::stringstream ss;
557
+ ss.str(std::string());
558
+ if (raw) {
559
+ double double_value = objective_function_value;
560
+ auto double_string = highsDoubleToString(
561
+ double_value, kGlpsolSolutionValueToStringTolerance);
562
+ // Last term of 0 for dual should (also) be blank when not MIP
563
+ ss << highsFormatToString("i %d %s%s%s\n", (int)row_id, is_mip ? "" : "b ",
564
+ double_string.data(), is_mip ? "" : " 0");
565
+ } else {
566
+ ss << highsFormatToString("%6d ", (int)row_id);
567
+ if (objective_name.length() <= 12) {
568
+ ss << highsFormatToString("%-12s ", objective_name.c_str());
569
+ } else {
570
+ ss << highsFormatToString("%s\n%20s", objective_name.c_str(), "");
571
+ }
572
+ if (is_mip) {
573
+ ss << highsFormatToString(" ");
574
+ } else {
575
+ ss << highsFormatToString("B ");
576
+ }
577
+ ss << highsFormatToString("%13.6g %13s %13s \n", objective_function_value,
578
+ "", "");
579
+ }
580
+ highsFprintfString(file, log_options, ss.str());
581
+ }
582
+
583
+ void writeGlpsolSolution(FILE* file, const HighsOptions& options,
584
+ const HighsModel& model, const HighsBasis& basis,
585
+ const HighsSolution& solution,
586
+ const HighsModelStatus model_status,
587
+ const HighsInfo& info, const bool raw) {
588
+ const bool have_value = solution.value_valid;
589
+ const bool have_dual = solution.dual_valid;
590
+ const bool have_basis = basis.valid;
591
+ const double kGlpsolHighQuality = 1e-9;
592
+ const double kGlpsolMediumQuality = 1e-6;
593
+ const double kGlpsolLowQuality = 1e-3;
594
+ const double kGlpsolPrintAsZero = 1e-9;
595
+ const HighsLp& lp = model.lp_;
596
+ const HighsLogOptions& log_options = options.log_options;
597
+ assert(lp.col_names_.size() == static_cast<size_t>(lp.num_col_));
598
+ assert(lp.row_names_.size() == static_cast<size_t>(lp.num_row_));
599
+ // Determine number of nonzeros including the objective function
600
+ // and, hence, determine whether there is an objective function
601
+ HighsInt num_nz = lp.a_matrix_.numNz();
602
+ for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++)
603
+ if (lp.col_cost_[iCol]) num_nz++;
604
+ const bool empty_cost_row = num_nz == lp.a_matrix_.numNz();
605
+ const bool has_objective = !empty_cost_row || model.hessian_.dim_;
606
+ // Writes the solution using the GLPK raw style (defined in
607
+ // api/wrsol.c) or pretty style (defined in api/prsol.c)
608
+ //
609
+ // When writing out the row information (and hence the number of
610
+ // rows and nonzeros), the case of the cost row is tricky
611
+ // (particularly if it's empty) if HiGHS is to be able to reproduce
612
+ // the (inconsistent) behaviour of Glpsol.
613
+ //
614
+ // If Glpsol is run from a .mod file then the cost row is reported
615
+ // unless there is no objective [minimize/maximize "objname"]
616
+ // statement in the .mod file. In this case, the N-row in the MPS
617
+ // file is called "R0000000" and referred to below as being artificial.
618
+ //
619
+ // However, the position of a defined cost row depends on where the
620
+ // objective appears in the .mod file. If Glpsol is run from a .mod
621
+ // file, and reads a .sol file, it must be in the right format.
622
+ //
623
+ // HiGHS can't read ..mod files, so works from an MPS or LP file
624
+ // generated by glpsol.
625
+ //
626
+ // An MPS file generated by glpsol will have the cost row in the
627
+ // same position as it was in the .mod file
628
+ //
629
+ // An LP file generated by glpsol will have the objective defined
630
+ // first, so the desired position of the cost row in the .sol file
631
+ // is unavailable. The only option with this route is to define the
632
+ // cost row location "by hand" using glpsol_cost_row_location
633
+ //
634
+ // If Glpsol is run from an LP or MPS file then the cost row is not
635
+ // reported. This behaviour is defined by setting
636
+ // glpsol_cost_row_location = -1;
637
+ //
638
+ // This inconsistent behaviour means that it must be possible to
639
+ // tell HiGHS to suppress the cost row
640
+ //
641
+ const HighsInt cost_row_option = options.glpsol_cost_row_location;
642
+ // Define cost_row_location
643
+ //
644
+ // It is indexed from 1 so that it matches the index printed on that
645
+ // row...
646
+ //
647
+ // ... hence a location of zero means that the cost row isn't
648
+ // reported
649
+ HighsInt cost_row_location = 0;
650
+ std::string artificial_cost_row_name = "R0000000";
651
+ const bool artificial_cost_row =
652
+ lp.objective_name_ == artificial_cost_row_name;
653
+ if (artificial_cost_row)
654
+ highsLogUser(options.log_options, HighsLogType::kWarning,
655
+ "The cost row name of \"%s\" is assumed to be artificial and "
656
+ "will not be reported in the Glpsol solution file\n",
657
+ lp.objective_name_.c_str());
658
+
659
+ if (cost_row_option <= kGlpsolCostRowLocationLast ||
660
+ cost_row_option > lp.num_row_) {
661
+ // Place the cost row last
662
+ cost_row_location = lp.num_row_ + 1;
663
+ } else if (cost_row_option == kGlpsolCostRowLocationNone) {
664
+ // Don't report the cost row
665
+ assert(cost_row_location == 0);
666
+ } else if (cost_row_option == kGlpsolCostRowLocationNoneIfEmpty) {
667
+ // This option allows the cost row to be omitted if it's empty.
668
+ if (empty_cost_row && artificial_cost_row) {
669
+ // The cost row is empty and artificial, so don't report it
670
+ assert(cost_row_location == 0);
671
+ } else {
672
+ // Place the cost row according to lp.cost_row_location_
673
+ if (lp.cost_row_location_ >= 0) {
674
+ // The cost row location is known from the MPS file. NB To
675
+ // index from zero whenever possible, lp.cost_row_location_ =
676
+ // 0 if the cost row came first
677
+ assert(lp.cost_row_location_ <= lp.num_row_);
678
+ cost_row_location = lp.cost_row_location_ + 1;
679
+ } else {
680
+ // The location isn't known from an MPS file, so place it
681
+ // last, giving a warning
682
+ cost_row_location = lp.num_row_ + 1;
683
+ highsLogUser(
684
+ options.log_options, HighsLogType::kWarning,
685
+ "The cost row for the Glpsol solution file is reported last since "
686
+ "there is no indication of where it should be\n");
687
+ }
688
+ }
689
+ } else {
690
+ // Place the cost row according to the option value
691
+ cost_row_location = cost_row_option;
692
+ }
693
+ assert(0 <= cost_row_location && cost_row_location <= lp.num_row_ + 1);
694
+ // Despite being written in C, GLPSOL indexes rows (columns) from
695
+ // 1..m (1..n) with - bizarrely! - m being one more than the number
696
+ // of constraints if the cost vector is reported.
697
+ const HighsInt num_row = lp.num_row_;
698
+ const HighsInt num_col = lp.num_col_;
699
+ // There's one more row and more nonzeros if the cost row is
700
+ // reported
701
+ const HighsInt delta_num_row = cost_row_location > 0;
702
+ const HighsInt glpsol_num_row = num_row + delta_num_row;
703
+ // If the cost row isn't reported, then the number of nonzeros is
704
+ // just the number in the constraint matrix
705
+ if (cost_row_location <= 0) num_nz = lp.a_matrix_.numNz();
706
+ // Record the discrete nature of the model
707
+ HighsInt num_integer = 0;
708
+ HighsInt num_binary = 0;
709
+ bool is_mip = false;
710
+ if ((HighsInt)lp.integrality_.size() == lp.num_col_) {
711
+ for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++) {
712
+ if (lp.integrality_[iCol] != HighsVarType::kContinuous) {
713
+ is_mip = true;
714
+ num_integer++;
715
+ if (lp.col_lower_[iCol] == 0 && lp.col_upper_[iCol] == 1) num_binary++;
716
+ }
717
+ }
718
+ }
719
+ // Raw and pretty are the initially the same, but for the "c "
720
+ // prefix to raw lines
721
+ std::string line_prefix = "";
722
+ if (raw) line_prefix = "c ";
723
+ highsFprintfString(file, log_options,
724
+ highsFormatToString("%s%-12s%s\n", line_prefix.c_str(),
725
+ "Problem:", lp.model_name_.c_str()));
726
+ highsFprintfString(file, log_options,
727
+ highsFormatToString("%s%-12s%d\n", line_prefix.c_str(),
728
+ "Rows:", (int)glpsol_num_row));
729
+ std::stringstream ss;
730
+ ss.str(std::string());
731
+ ss << highsFormatToString("%s%-12s%d", line_prefix.c_str(),
732
+ "Columns:", (int)num_col);
733
+ if (!raw && is_mip)
734
+ ss << highsFormatToString(" (%d integer, %d binary)", (int)num_integer,
735
+ (int)num_binary);
736
+ ss << highsFormatToString("\n");
737
+ highsFprintfString(file, log_options, ss.str());
738
+ highsFprintfString(file, log_options,
739
+ highsFormatToString("%s%-12s%d\n", line_prefix.c_str(),
740
+ "Non-zeros:", (int)num_nz));
741
+ // Use model_status to define the GLPK model_status_text and
742
+ // solution_status_char, where the former is used to specify the
743
+ // model status. GLPK uses a single character to specify the
744
+ // solution status, and for LPs this is deduced from the primal and
745
+ // dual solution status. However, for MIPs, it is defined according
746
+ // to the model status, so only set solution_status_char for MIPs
747
+ std::string model_status_text = "???";
748
+ std::string solution_status_char = "?";
749
+ switch (model_status) {
750
+ case HighsModelStatus::kOptimal:
751
+ if (is_mip) {
752
+ model_status_text = "INTEGER OPTIMAL";
753
+ solution_status_char = "o";
754
+ } else {
755
+ model_status_text = "OPTIMAL";
756
+ }
757
+ break;
758
+ case HighsModelStatus::kInfeasible:
759
+ if (is_mip) {
760
+ model_status_text = "INTEGER EMPTY";
761
+ solution_status_char = "n";
762
+ } else {
763
+ model_status_text = "INFEASIBLE (FINAL)";
764
+ }
765
+ break;
766
+ case HighsModelStatus::kUnbounded:
767
+ // No apparent case in wrmip.c
768
+ model_status_text = "UNBOUNDED";
769
+ if (is_mip) solution_status_char = "u";
770
+ break;
771
+ default:
772
+ if (info.primal_solution_status == kSolutionStatusFeasible) {
773
+ if (is_mip) {
774
+ model_status_text = "INTEGER NON-OPTIMAL";
775
+ solution_status_char = "f";
776
+ } else {
777
+ model_status_text = "FEASIBLE";
778
+ }
779
+ } else {
780
+ model_status_text = "UNDEFINED";
781
+ if (is_mip) solution_status_char = "u";
782
+ }
783
+ break;
784
+ }
785
+ assert(model_status_text != "???");
786
+ if (is_mip) assert(solution_status_char != "?");
787
+ highsFprintfString(file, log_options,
788
+ highsFormatToString("%s%-12s%s\n", line_prefix.c_str(),
789
+ "Status:", model_status_text.c_str()));
790
+ // If info is not valid, then cannot write more
791
+ if (!info.valid) return;
792
+ // Now write out the numerical information
793
+ //
794
+ // Determine the objective name to write out
795
+ std::string objective_name = lp.objective_name_;
796
+ // There are row names to be written out, so there must be a
797
+ // non-trivial objective name
798
+ assert(lp.objective_name_ != "");
799
+ const bool has_objective_name = lp.objective_name_ != "";
800
+ highsFprintfString(
801
+ file, log_options,
802
+ highsFormatToString(
803
+ "%s%-12s%s%.10g (%s)\n", line_prefix.c_str(), "Objective:",
804
+ !(has_objective && has_objective_name)
805
+ ? ""
806
+ : (objective_name + " = ").c_str(),
807
+ has_objective ? info.objective_function_value : 0,
808
+ lp.sense_ == ObjSense::kMinimize ? "MINimum" : "MAXimum"));
809
+ // No space after "c" on blank line!
810
+ if (raw) line_prefix = "c";
811
+ highsFprintfString(file, log_options,
812
+ highsFormatToString("%s\n", line_prefix.c_str()));
813
+ // Detailed lines are rather different
814
+ if (raw) {
815
+ ss.str(std::string());
816
+ ss << highsFormatToString("s %s %d %d ", is_mip ? "mip" : "bas",
817
+ (int)glpsol_num_row, (int)num_col);
818
+ if (is_mip) {
819
+ ss << highsFormatToString("%s", solution_status_char.c_str());
820
+ } else {
821
+ if (info.primal_solution_status == kSolutionStatusNone) {
822
+ ss << highsFormatToString("u");
823
+ } else if (info.primal_solution_status == kSolutionStatusInfeasible) {
824
+ ss << highsFormatToString("i");
825
+ } else if (info.primal_solution_status == kSolutionStatusFeasible) {
826
+ ss << highsFormatToString("f");
827
+ } else {
828
+ ss << highsFormatToString("?");
829
+ }
830
+ ss << highsFormatToString(" ");
831
+ if (info.dual_solution_status == kSolutionStatusNone) {
832
+ ss << highsFormatToString("u");
833
+ } else if (info.dual_solution_status == kSolutionStatusInfeasible) {
834
+ ss << highsFormatToString("i");
835
+ } else if (info.dual_solution_status == kSolutionStatusFeasible) {
836
+ ss << highsFormatToString("f");
837
+ } else {
838
+ ss << highsFormatToString("?");
839
+ }
840
+ }
841
+ double double_value = has_objective ? info.objective_function_value : 0;
842
+ auto double_string =
843
+ highsDoubleToString(double_value, kHighsSolutionValueToStringTolerance);
844
+ ss << highsFormatToString(" %s\n", double_string.data());
845
+ highsFprintfString(file, log_options, ss.str());
846
+ }
847
+ // GLPK puts out i 1 b 0 0 etc if there's no primal point, but
848
+ // that's meaningless at best, so HiGHS returns in that case
849
+ if (!have_value) return;
850
+ if (!raw) {
851
+ ss.str(std::string());
852
+ ss << highsFormatToString(
853
+ " No. Row name %s Activity Lower bound "
854
+ " Upper bound",
855
+ have_basis ? "St" : " ");
856
+ if (have_dual) ss << highsFormatToString(" Marginal");
857
+ ss << highsFormatToString("\n");
858
+ highsFprintfString(file, log_options, ss.str());
859
+ ss.str(std::string());
860
+ ss << highsFormatToString(
861
+ "------ ------------ %s ------------- ------------- "
862
+ "-------------",
863
+ have_basis ? "--" : " ");
864
+ if (have_dual) ss << highsFormatToString(" -------------");
865
+ ss << highsFormatToString("\n");
866
+ highsFprintfString(file, log_options, ss.str());
867
+ }
868
+
869
+ HighsInt row_id = 0;
870
+ for (HighsInt iRow = 0; iRow < lp.num_row_; iRow++) {
871
+ row_id++;
872
+ if (row_id == cost_row_location) {
873
+ writeGlpsolCostRow(file, log_options, raw, is_mip, row_id, objective_name,
874
+ info.objective_function_value);
875
+ row_id++;
876
+ }
877
+ ss.str(std::string());
878
+ if (raw) {
879
+ ss << highsFormatToString("i %d ", (int)row_id);
880
+ if (is_mip) {
881
+ // Complete the line if for a MIP
882
+ double double_value = have_value ? solution.row_value[iRow] : 0;
883
+ auto double_string = highsDoubleToString(
884
+ double_value, kHighsSolutionValueToStringTolerance);
885
+ ss << highsFormatToString("%s\n", double_string.data());
886
+ highsFprintfString(file, log_options, ss.str());
887
+ continue;
888
+ }
889
+ } else {
890
+ ss << highsFormatToString("%6d ", (int)row_id);
891
+ std::string row_name = lp.row_names_[iRow];
892
+ if (row_name.length() <= 12) {
893
+ ss << highsFormatToString("%-12s ", row_name.c_str());
894
+ } else {
895
+ ss << highsFormatToString("%s\n", row_name.c_str());
896
+ highsFprintfString(file, log_options, ss.str());
897
+ ss.str(std::string());
898
+ ss << " ";
899
+ }
900
+ }
901
+ const double lower = lp.row_lower_[iRow];
902
+ const double upper = lp.row_upper_[iRow];
903
+ const double value = have_value ? solution.row_value[iRow] : 0;
904
+ const double dual = have_dual ? solution.row_dual[iRow] : 0;
905
+ std::string status_text = " ";
906
+ std::string status_char = "";
907
+ if (have_basis) {
908
+ switch (basis.row_status[iRow]) {
909
+ case HighsBasisStatus::kBasic:
910
+ status_text = "B ";
911
+ status_char = "b";
912
+ break;
913
+ case HighsBasisStatus::kLower:
914
+ status_text = lower == upper ? "NS" : "NL";
915
+ status_char = lower == upper ? "s" : "l";
916
+ break;
917
+ case HighsBasisStatus::kUpper:
918
+ status_text = lower == upper ? "NS" : "NU";
919
+ status_char = lower == upper ? "s" : "u";
920
+ break;
921
+ case HighsBasisStatus::kZero:
922
+ status_text = "NF";
923
+ status_char = "f";
924
+ break;
925
+ default:
926
+ status_text = "??";
927
+ status_char = "?";
928
+ break;
929
+ }
930
+ }
931
+ if (raw) {
932
+ ss << highsFormatToString("%s ", status_char.c_str());
933
+ double double_value = have_value ? solution.row_value[iRow] : 0;
934
+ auto double_string = highsDoubleToString(
935
+ double_value, kHighsSolutionValueToStringTolerance);
936
+ ss << highsFormatToString("%s ", double_string.data());
937
+ } else {
938
+ ss << highsFormatToString("%s ", status_text.c_str());
939
+ ss << highsFormatToString(
940
+ "%13.6g ", fabs(value) <= kGlpsolPrintAsZero ? 0.0 : value);
941
+ if (lower > -kHighsInf)
942
+ ss << highsFormatToString("%13.6g ", lower);
943
+ else
944
+ ss << highsFormatToString("%13s ", "");
945
+ if (lower != upper && upper < kHighsInf)
946
+ ss << highsFormatToString("%13.6g ", upper);
947
+ else
948
+ ss << highsFormatToString("%13s ", lower == upper ? "=" : "");
949
+ }
950
+ if (have_dual) {
951
+ if (raw) {
952
+ double double_value = solution.row_dual[iRow];
953
+ auto double_string = highsDoubleToString(
954
+ double_value, kHighsSolutionValueToStringTolerance);
955
+ ss << highsFormatToString("%s", double_string.data());
956
+ } else {
957
+ // If the row is known to be basic, don't print the dual
958
+ // value. If there's no basis, row cannot be known to be basic
959
+ bool not_basic = have_basis;
960
+ if (have_basis)
961
+ not_basic = basis.row_status[iRow] != HighsBasisStatus::kBasic;
962
+ if (not_basic) {
963
+ if (fabs(dual) <= kGlpsolPrintAsZero)
964
+ ss << highsFormatToString("%13s", "< eps");
965
+ else
966
+ ss << highsFormatToString("%13.6g ", dual);
967
+ }
968
+ }
969
+ }
970
+ ss << highsFormatToString("\n");
971
+ highsFprintfString(file, log_options, ss.str());
972
+ }
973
+
974
+ if (cost_row_location == lp.num_row_ + 1) {
975
+ row_id++;
976
+ writeGlpsolCostRow(file, log_options, raw, is_mip, row_id, objective_name,
977
+ info.objective_function_value);
978
+ }
979
+ if (!raw) highsFprintfString(file, log_options, "\n");
980
+
981
+ if (!raw) {
982
+ ss.str(std::string());
983
+ ss << highsFormatToString(
984
+ " No. Column name %s Activity Lower bound "
985
+ " Upper bound",
986
+ have_basis ? "St" : " ");
987
+ if (have_dual) ss << highsFormatToString(" Marginal");
988
+ ss << highsFormatToString("\n");
989
+ highsFprintfString(file, log_options, ss.str());
990
+ ss.str(std::string());
991
+ ss << highsFormatToString(
992
+ "------ ------------ %s ------------- ------------- "
993
+ "-------------",
994
+ have_basis ? "--" : " ");
995
+ if (have_dual) ss << highsFormatToString(" -------------");
996
+ ss << highsFormatToString("\n");
997
+ highsFprintfString(file, log_options, ss.str());
998
+ }
999
+
1000
+ if (raw) line_prefix = "j ";
1001
+ for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++) {
1002
+ ss.str(std::string());
1003
+ if (raw) {
1004
+ ss << highsFormatToString("%s%d ", line_prefix.c_str(), (int)(iCol + 1));
1005
+ if (is_mip) {
1006
+ double double_value = have_value ? solution.col_value[iCol] : 0;
1007
+ auto double_string = highsDoubleToString(
1008
+ double_value, kHighsSolutionValueToStringTolerance);
1009
+ ss << highsFormatToString("%s\n", double_string.data());
1010
+ highsFprintfString(file, log_options, ss.str());
1011
+ continue;
1012
+ }
1013
+ } else {
1014
+ ss << highsFormatToString("%6d ", (int)(iCol + 1));
1015
+ std::string col_name = lp.col_names_[iCol];
1016
+ if (col_name.length() <= 12) {
1017
+ ss << highsFormatToString("%-12s ", col_name.c_str());
1018
+ } else {
1019
+ ss << highsFormatToString("%s\n", col_name.c_str());
1020
+ highsFprintfString(file, log_options, ss.str());
1021
+ ss.str(std::string());
1022
+ ss << " ";
1023
+ }
1024
+ }
1025
+ const double lower = lp.col_lower_[iCol];
1026
+ const double upper = lp.col_upper_[iCol];
1027
+ const double value = have_value ? solution.col_value[iCol] : 0;
1028
+ const double dual = have_dual ? solution.col_dual[iCol] : 0;
1029
+ std::string status_text = " ";
1030
+ std::string status_char = "";
1031
+ if (have_basis) {
1032
+ switch (basis.col_status[iCol]) {
1033
+ case HighsBasisStatus::kBasic:
1034
+ status_text = "B ";
1035
+ status_char = "b";
1036
+ break;
1037
+ case HighsBasisStatus::kLower:
1038
+ status_text = lower == upper ? "NS" : "NL";
1039
+ status_char = lower == upper ? "s" : "l";
1040
+ break;
1041
+ case HighsBasisStatus::kUpper:
1042
+ status_text = lower == upper ? "NS" : "NU";
1043
+ status_char = lower == upper ? "s" : "u";
1044
+ break;
1045
+ case HighsBasisStatus::kZero:
1046
+ status_text = "NF";
1047
+ status_char = "f";
1048
+ break;
1049
+ default:
1050
+ status_text = "??";
1051
+ status_char = "?";
1052
+ break;
1053
+ }
1054
+ } else if (is_mip) {
1055
+ if (lp.integrality_[iCol] != HighsVarType::kContinuous)
1056
+ status_text = "* ";
1057
+ }
1058
+ if (raw) {
1059
+ ss << highsFormatToString("%s ", status_char.c_str());
1060
+ double double_value = have_value ? solution.col_value[iCol] : 0;
1061
+ auto double_string = highsDoubleToString(
1062
+ double_value, kHighsSolutionValueToStringTolerance);
1063
+ ss << highsFormatToString("%s ", double_string.data());
1064
+ } else {
1065
+ ss << highsFormatToString("%s ", status_text.c_str());
1066
+ ss << highsFormatToString(
1067
+ "%13.6g ", fabs(value) <= kGlpsolPrintAsZero ? 0.0 : value);
1068
+ if (lower > -kHighsInf)
1069
+ ss << highsFormatToString("%13.6g ", lower);
1070
+ else
1071
+ ss << highsFormatToString("%13s ", "");
1072
+ if (lower != upper && upper < kHighsInf)
1073
+ ss << highsFormatToString("%13.6g ", upper);
1074
+ else
1075
+ ss << highsFormatToString("%13s ", lower == upper ? "=" : "");
1076
+ }
1077
+ if (have_dual) {
1078
+ if (raw) {
1079
+ double double_value = solution.col_dual[iCol];
1080
+ auto double_string = highsDoubleToString(
1081
+ double_value, kHighsSolutionValueToStringTolerance);
1082
+ ss << highsFormatToString("%s", double_string.data());
1083
+ } else {
1084
+ // If the column is known to be basic, don't print the dual
1085
+ // value. If there's no basis, column cannot be known to be
1086
+ // basic
1087
+ bool not_basic = have_basis;
1088
+ if (have_basis)
1089
+ not_basic = basis.col_status[iCol] != HighsBasisStatus::kBasic;
1090
+ if (not_basic) {
1091
+ if (fabs(dual) <= kGlpsolPrintAsZero)
1092
+ ss << highsFormatToString("%13s", "< eps");
1093
+ else
1094
+ ss << highsFormatToString("%13.6g ", dual);
1095
+ }
1096
+ }
1097
+ }
1098
+ ss << highsFormatToString("\n");
1099
+ highsFprintfString(file, log_options, ss.str());
1100
+ }
1101
+ if (raw) {
1102
+ highsFprintfString(file, log_options, "e o f\n");
1103
+ return;
1104
+ }
1105
+ HighsPrimalDualErrors errors;
1106
+ HighsInfo local_info;
1107
+ HighsInt absolute_error_index;
1108
+ double absolute_error_value;
1109
+ HighsInt relative_error_index;
1110
+ double relative_error_value;
1111
+ getKktFailures(options, model, solution, basis, local_info, errors, true);
1112
+ highsFprintfString(file, log_options, "\n");
1113
+ if (is_mip) {
1114
+ highsFprintfString(file, log_options, "Integer feasibility conditions:\n");
1115
+ } else {
1116
+ highsFprintfString(file, log_options,
1117
+ "Karush-Kuhn-Tucker optimality conditions:\n");
1118
+ }
1119
+ highsFprintfString(file, log_options, "\n");
1120
+ // Primal residual
1121
+ absolute_error_value = errors.glpsol_max_primal_residual.absolute_value;
1122
+ absolute_error_index = errors.glpsol_max_primal_residual.absolute_index + 1;
1123
+ relative_error_value = errors.glpsol_max_primal_residual.relative_value;
1124
+ relative_error_index = errors.glpsol_max_primal_residual.relative_index + 1;
1125
+ if (!absolute_error_value) absolute_error_index = 0;
1126
+ if (!relative_error_value) relative_error_index = 0;
1127
+ ss.str(std::string());
1128
+ ss << highsFormatToString(
1129
+ "KKT.PE: max.abs.err = %.2e on row %d\n", absolute_error_value,
1130
+ absolute_error_index == 0 ? 0 : (int)absolute_error_index);
1131
+ highsFprintfString(file, log_options, ss.str());
1132
+ ss.str(std::string());
1133
+ ss << highsFormatToString(
1134
+ " max.rel.err = %.2e on row %d\n", relative_error_value,
1135
+ absolute_error_index == 0 ? 0 : (int)relative_error_index);
1136
+ highsFprintfString(file, log_options, ss.str());
1137
+ ss.str(std::string());
1138
+ ss << highsFormatToString(
1139
+ "%8s%s\n", "",
1140
+ relative_error_value <= kGlpsolHighQuality ? "High quality"
1141
+ : relative_error_value <= kGlpsolMediumQuality ? "Medium quality"
1142
+ : relative_error_value <= kGlpsolLowQuality ? "Low quality"
1143
+ : "PRIMAL SOLUTION IS WRONG");
1144
+ ss << "\n";
1145
+ highsFprintfString(file, log_options, ss.str());
1146
+
1147
+ // Primal infeasibility
1148
+ absolute_error_value = errors.glpsol_max_primal_infeasibility.absolute_value;
1149
+ absolute_error_index =
1150
+ errors.glpsol_max_primal_infeasibility.absolute_index + 1;
1151
+ relative_error_value = errors.glpsol_max_primal_infeasibility.relative_value;
1152
+ relative_error_index =
1153
+ errors.glpsol_max_primal_infeasibility.relative_index + 1;
1154
+ if (!absolute_error_value) absolute_error_index = 0;
1155
+ if (!relative_error_value) relative_error_index = 0;
1156
+ bool on_col = absolute_error_index > 0 && absolute_error_index <= lp.num_col_;
1157
+ ss.str(std::string());
1158
+ ss << highsFormatToString("KKT.PB: max.abs.err = %.2e on %s %d\n",
1159
+ absolute_error_value, on_col ? "column" : "row",
1160
+ absolute_error_index <= lp.num_col_
1161
+ ? (int)absolute_error_index
1162
+ : (int)(absolute_error_index - lp.num_col_));
1163
+ highsFprintfString(file, log_options, ss.str());
1164
+ on_col = relative_error_index > 0 && relative_error_index <= lp.num_col_;
1165
+ ss.str(std::string());
1166
+ ss << highsFormatToString(" max.rel.err = %.2e on %s %d\n",
1167
+ relative_error_value, on_col ? "column" : "row",
1168
+ relative_error_index <= lp.num_col_
1169
+ ? (int)relative_error_index
1170
+ : (int)(relative_error_index - lp.num_col_));
1171
+ highsFprintfString(file, log_options, ss.str());
1172
+ ss.str(std::string());
1173
+ ss << highsFormatToString(
1174
+ "%8s%s\n", "",
1175
+ relative_error_value <= kGlpsolHighQuality ? "High quality"
1176
+ : relative_error_value <= kGlpsolMediumQuality ? "Medium quality"
1177
+ : relative_error_value <= kGlpsolLowQuality
1178
+ ? "Low quality"
1179
+ : "PRIMAL SOLUTION IS INFEASIBLE");
1180
+ ss << "\n";
1181
+ highsFprintfString(file, log_options, ss.str());
1182
+
1183
+ if (have_dual) {
1184
+ // Dual residual
1185
+ absolute_error_value = errors.glpsol_max_dual_residual.absolute_value;
1186
+ absolute_error_index = errors.glpsol_max_dual_residual.absolute_index + 1;
1187
+ relative_error_value = errors.glpsol_max_dual_residual.relative_value;
1188
+ relative_error_index = errors.glpsol_max_dual_residual.relative_index + 1;
1189
+ if (!absolute_error_value) absolute_error_index = 0;
1190
+ if (!relative_error_value) relative_error_index = 0;
1191
+ ss.str(std::string());
1192
+ ss << highsFormatToString("KKT.DE: max.abs.err = %.2e on column %d\n",
1193
+ absolute_error_value, (int)absolute_error_index);
1194
+ ss << highsFormatToString(" max.rel.err = %.2e on column %d\n",
1195
+ relative_error_value, (int)relative_error_index);
1196
+ ss << highsFormatToString(
1197
+ "%8s%s\n", "",
1198
+ relative_error_value <= kGlpsolHighQuality ? "High quality"
1199
+ : relative_error_value <= kGlpsolMediumQuality ? "Medium quality"
1200
+ : relative_error_value <= kGlpsolLowQuality ? "Low quality"
1201
+ : "DUAL SOLUTION IS WRONG");
1202
+ ss << "\n";
1203
+ highsFprintfString(file, log_options, ss.str());
1204
+
1205
+ // Dual infeasibility
1206
+ absolute_error_value = errors.glpsol_max_dual_infeasibility.absolute_value;
1207
+ absolute_error_index =
1208
+ errors.glpsol_max_dual_infeasibility.absolute_index + 1;
1209
+ relative_error_value = errors.glpsol_max_dual_infeasibility.relative_value;
1210
+ relative_error_index =
1211
+ errors.glpsol_max_dual_infeasibility.relative_index + 1;
1212
+ if (!absolute_error_value) absolute_error_index = 0;
1213
+ if (!relative_error_value) relative_error_index = 0;
1214
+ bool on_col =
1215
+ absolute_error_index > 0 && absolute_error_index <= lp.num_col_;
1216
+ ss.str(std::string());
1217
+ ss << highsFormatToString("KKT.DB: max.abs.err = %.2e on %s %d\n",
1218
+ absolute_error_value, on_col ? "column" : "row",
1219
+ absolute_error_index <= lp.num_col_
1220
+ ? (int)absolute_error_index
1221
+ : (int)(absolute_error_index - lp.num_col_));
1222
+ highsFprintfString(file, log_options, ss.str());
1223
+ on_col = relative_error_index > 0 && relative_error_index <= lp.num_col_;
1224
+ ss.str(std::string());
1225
+ ss << highsFormatToString(" max.rel.err = %.2e on %s %d\n",
1226
+ relative_error_value, on_col ? "column" : "row",
1227
+ relative_error_index <= lp.num_col_
1228
+ ? (int)relative_error_index
1229
+ : (int)(relative_error_index - lp.num_col_));
1230
+ highsFprintfString(file, log_options, ss.str());
1231
+ ss.str(std::string());
1232
+ ss << highsFormatToString(
1233
+ "%8s%s\n", "",
1234
+ relative_error_value <= kGlpsolHighQuality ? "High quality"
1235
+ : relative_error_value <= kGlpsolMediumQuality ? "Medium quality"
1236
+ : relative_error_value <= kGlpsolLowQuality
1237
+ ? "Low quality"
1238
+ : "DUAL SOLUTION IS INFEASIBLE");
1239
+ ss << "\n";
1240
+ highsFprintfString(file, log_options, ss.str());
1241
+ }
1242
+ highsFprintfString(file, log_options, "End of output\n");
1243
+ }
1244
+
1245
+ void writeOldRawSolution(FILE* file, const HighsLogOptions& log_options,
1246
+ const HighsLp& lp, const HighsBasis& basis,
1247
+ const HighsSolution& solution) {
1248
+ const bool have_value = solution.value_valid;
1249
+ const bool have_dual = solution.dual_valid;
1250
+ const bool have_basis = basis.valid;
1251
+ vector<double> use_col_value;
1252
+ vector<double> use_row_value;
1253
+ vector<double> use_col_dual;
1254
+ vector<double> use_row_dual;
1255
+ vector<HighsBasisStatus> use_col_status;
1256
+ vector<HighsBasisStatus> use_row_status;
1257
+ if (have_value) {
1258
+ use_col_value = solution.col_value;
1259
+ use_row_value = solution.row_value;
1260
+ }
1261
+ if (have_dual) {
1262
+ use_col_dual = solution.col_dual;
1263
+ use_row_dual = solution.row_dual;
1264
+ }
1265
+ if (have_basis) {
1266
+ use_col_status = basis.col_status;
1267
+ use_row_status = basis.row_status;
1268
+ }
1269
+ if (!have_value && !have_dual && !have_basis) return;
1270
+ highsFprintfString(
1271
+ file, log_options,
1272
+ highsFormatToString(
1273
+ "%" HIGHSINT_FORMAT " %" HIGHSINT_FORMAT
1274
+ " : Number of columns and rows for primal or dual solution "
1275
+ "or basis\n",
1276
+ lp.num_col_, lp.num_row_));
1277
+ std::stringstream ss;
1278
+ ss.str(std::string());
1279
+ if (have_value) {
1280
+ ss << highsFormatToString("T");
1281
+ } else {
1282
+ ss << highsFormatToString("F");
1283
+ }
1284
+ ss << highsFormatToString(" Primal solution\n");
1285
+ highsFprintfString(file, log_options, ss.str());
1286
+ ss.str(std::string());
1287
+ if (have_dual) {
1288
+ ss << highsFormatToString("T");
1289
+ } else {
1290
+ ss << highsFormatToString("F");
1291
+ }
1292
+ ss << highsFormatToString(" Dual solution\n");
1293
+ highsFprintfString(file, log_options, ss.str());
1294
+ ss.str(std::string());
1295
+ if (have_basis) {
1296
+ ss << highsFormatToString("T");
1297
+ } else {
1298
+ ss << highsFormatToString("F");
1299
+ }
1300
+ ss << highsFormatToString(" Basis\n");
1301
+ highsFprintfString(file, log_options, ss.str());
1302
+ highsFprintfString(file, log_options, "Columns\n");
1303
+ for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++) {
1304
+ ss.str(std::string());
1305
+ if (have_value) ss << highsFormatToString("%.15g ", use_col_value[iCol]);
1306
+ if (have_dual) ss << highsFormatToString("%.15g ", use_col_dual[iCol]);
1307
+ if (have_basis)
1308
+ ss << highsFormatToString("%" HIGHSINT_FORMAT "",
1309
+ (HighsInt)use_col_status[iCol]);
1310
+ ss << highsFormatToString("\n");
1311
+ highsFprintfString(file, log_options, ss.str());
1312
+ }
1313
+ highsFprintfString(file, log_options, "Rows\n");
1314
+ for (HighsInt iRow = 0; iRow < lp.num_row_; iRow++) {
1315
+ ss.str(std::string());
1316
+ if (have_value) ss << highsFormatToString("%.15g ", use_row_value[iRow]);
1317
+ if (have_dual) ss << highsFormatToString("%.15g ", use_row_dual[iRow]);
1318
+ if (have_basis)
1319
+ ss << highsFormatToString("%" HIGHSINT_FORMAT "",
1320
+ (HighsInt)use_row_status[iRow]);
1321
+ ss << highsFormatToString("\n");
1322
+ highsFprintfString(file, log_options, ss.str());
1323
+ }
1324
+ }
1325
+
1326
+ HighsBasisStatus checkedVarHighsNonbasicStatus(
1327
+ const HighsBasisStatus ideal_status, const double lower,
1328
+ const double upper) {
1329
+ HighsBasisStatus checked_status;
1330
+ if (ideal_status == HighsBasisStatus::kLower ||
1331
+ ideal_status == HighsBasisStatus::kZero) {
1332
+ // Looking to give status LOWER or ZERO
1333
+ if (highs_isInfinity(-lower)) {
1334
+ // Lower bound is infinite
1335
+ if (highs_isInfinity(upper)) {
1336
+ // Upper bound is infinite
1337
+ checked_status = HighsBasisStatus::kZero;
1338
+ } else {
1339
+ // Upper bound is finite
1340
+ checked_status = HighsBasisStatus::kUpper;
1341
+ }
1342
+ } else {
1343
+ checked_status = HighsBasisStatus::kLower;
1344
+ }
1345
+ } else {
1346
+ // Looking to give status UPPER
1347
+ if (highs_isInfinity(upper)) {
1348
+ // Upper bound is infinite
1349
+ if (highs_isInfinity(-lower)) {
1350
+ // Lower bound is infinite
1351
+ checked_status = HighsBasisStatus::kZero;
1352
+ } else {
1353
+ // Upper bound is finite
1354
+ checked_status = HighsBasisStatus::kLower;
1355
+ }
1356
+ } else {
1357
+ checked_status = HighsBasisStatus::kUpper;
1358
+ }
1359
+ }
1360
+ return checked_status;
1361
+ }
1362
+
1363
+ // Return a string representation of SolutionStatus
1364
+ std::string utilSolutionStatusToString(const HighsInt solution_status) {
1365
+ switch (solution_status) {
1366
+ case kSolutionStatusNone:
1367
+ return "None";
1368
+ break;
1369
+ case kSolutionStatusInfeasible:
1370
+ return "Infeasible";
1371
+ break;
1372
+ case kSolutionStatusFeasible:
1373
+ return "Feasible";
1374
+ break;
1375
+ default:
1376
+ assert(1 == 0);
1377
+ return "Unrecognised solution status";
1378
+ }
1379
+ }
1380
+
1381
+ // Return a string representation of HighsBasisStatus
1382
+ std::string utilBasisStatusToString(const HighsBasisStatus basis_status) {
1383
+ switch (basis_status) {
1384
+ case HighsBasisStatus::kLower:
1385
+ return "At lower/fixed bound";
1386
+ break;
1387
+ case HighsBasisStatus::kBasic:
1388
+ return "Basic";
1389
+ break;
1390
+ case HighsBasisStatus::kUpper:
1391
+ return "At upper bound";
1392
+ break;
1393
+ case HighsBasisStatus::kZero:
1394
+ return "Free at zero";
1395
+ break;
1396
+ case HighsBasisStatus::kNonbasic:
1397
+ return "Nonbasic";
1398
+ break;
1399
+ default:
1400
+ assert(1 == 0);
1401
+ return "Unrecognised solution status";
1402
+ }
1403
+ }
1404
+
1405
+ // Return a string representation of basis validity
1406
+ std::string utilBasisValidityToString(const HighsInt basis_validity) {
1407
+ if (basis_validity) {
1408
+ return "Valid";
1409
+ } else {
1410
+ return "Not valid";
1411
+ }
1412
+ }
1413
+
1414
+ // Return a string representation of HighsModelStatus.
1415
+ std::string utilModelStatusToString(const HighsModelStatus model_status) {
1416
+ switch (model_status) {
1417
+ case HighsModelStatus::kNotset:
1418
+ return "Not Set";
1419
+ break;
1420
+ case HighsModelStatus::kLoadError:
1421
+ return "Load error";
1422
+ break;
1423
+ case HighsModelStatus::kModelError:
1424
+ return "Model error";
1425
+ break;
1426
+ case HighsModelStatus::kPresolveError:
1427
+ return "Presolve error";
1428
+ break;
1429
+ case HighsModelStatus::kSolveError:
1430
+ return "Solve error";
1431
+ break;
1432
+ case HighsModelStatus::kPostsolveError:
1433
+ return "Postsolve error";
1434
+ break;
1435
+ case HighsModelStatus::kModelEmpty:
1436
+ return "Empty";
1437
+ break;
1438
+ case HighsModelStatus::kMemoryLimit:
1439
+ return "Memory limit reached";
1440
+ break;
1441
+ case HighsModelStatus::kOptimal:
1442
+ return "Optimal";
1443
+ break;
1444
+ case HighsModelStatus::kInfeasible:
1445
+ return "Infeasible";
1446
+ break;
1447
+ case HighsModelStatus::kUnboundedOrInfeasible:
1448
+ return "Primal infeasible or unbounded";
1449
+ break;
1450
+ case HighsModelStatus::kUnbounded:
1451
+ return "Unbounded";
1452
+ break;
1453
+ case HighsModelStatus::kObjectiveBound:
1454
+ return "Bound on objective reached";
1455
+ break;
1456
+ case HighsModelStatus::kObjectiveTarget:
1457
+ return "Target for objective reached";
1458
+ break;
1459
+ case HighsModelStatus::kTimeLimit:
1460
+ return "Time limit reached";
1461
+ break;
1462
+ case HighsModelStatus::kIterationLimit:
1463
+ return "Iteration limit reached";
1464
+ break;
1465
+ case HighsModelStatus::kSolutionLimit:
1466
+ return "Solution limit reached";
1467
+ break;
1468
+ case HighsModelStatus::kInterrupt:
1469
+ return "Interrupted by user";
1470
+ break;
1471
+ case HighsModelStatus::kHighsInterrupt:
1472
+ return "Interrupted by HiGHS";
1473
+ break;
1474
+ case HighsModelStatus::kUnknown:
1475
+ return "Unknown";
1476
+ break;
1477
+ default:
1478
+ assert(1 == 0);
1479
+ return "Unrecognised HiGHS model status";
1480
+ }
1481
+ }
1482
+
1483
+ std::string utilPresolveRuleTypeToString(const HighsInt rule_type) {
1484
+ if (rule_type == kPresolveRuleEmptyRow) {
1485
+ return "Empty row";
1486
+ } else if (rule_type == kPresolveRuleSingletonRow) {
1487
+ return "Singleton row";
1488
+ } else if (rule_type == kPresolveRuleRedundantRow) {
1489
+ return "Redundant row";
1490
+ } else if (rule_type == kPresolveRuleEmptyCol) {
1491
+ return "Empty column";
1492
+ } else if (rule_type == kPresolveRuleFixedCol) {
1493
+ return "Fixed column";
1494
+ } else if (rule_type == kPresolveRuleDominatedCol) {
1495
+ return "Dominated col";
1496
+ } else if (rule_type == kPresolveRuleForcingRow) {
1497
+ return "Forcing row";
1498
+ } else if (rule_type == kPresolveRuleForcingCol) {
1499
+ return "Forcing col";
1500
+ } else if (rule_type == kPresolveRuleFreeColSubstitution) {
1501
+ return "Free col substitution";
1502
+ } else if (rule_type == kPresolveRuleDoubletonEquation) {
1503
+ return "Doubleton equation";
1504
+ } else if (rule_type == kPresolveRuleDependentEquations) {
1505
+ return "Dependent equations";
1506
+ } else if (rule_type == kPresolveRuleDependentFreeCols) {
1507
+ return "Dependent free columns";
1508
+ } else if (rule_type == kPresolveRuleAggregator) {
1509
+ return "Aggregator";
1510
+ } else if (rule_type == kPresolveRuleParallelRowsAndCols) {
1511
+ return "Parallel rows and columns";
1512
+ } else if (rule_type == kPresolveRuleSparsify) {
1513
+ return "Sparsify";
1514
+ } else if (rule_type == kPresolveRuleProbing) {
1515
+ return "Probing";
1516
+ } else if (rule_type == kPresolveRuleEnumeration) {
1517
+ return "Enumeration";
1518
+ }
1519
+ assert(1 == 0);
1520
+ return "????";
1521
+ }
1522
+
1523
+ // Deduce the HighsStatus value corresponding to a HighsModelStatus value.
1524
+ HighsStatus highsStatusFromHighsModelStatus(HighsModelStatus model_status) {
1525
+ switch (model_status) {
1526
+ case HighsModelStatus::kNotset:
1527
+ return HighsStatus::kError;
1528
+ case HighsModelStatus::kLoadError:
1529
+ return HighsStatus::kError;
1530
+ case HighsModelStatus::kModelError:
1531
+ return HighsStatus::kError;
1532
+ case HighsModelStatus::kPresolveError:
1533
+ return HighsStatus::kError;
1534
+ case HighsModelStatus::kSolveError:
1535
+ return HighsStatus::kError;
1536
+ case HighsModelStatus::kPostsolveError:
1537
+ return HighsStatus::kError;
1538
+ case HighsModelStatus::kMemoryLimit:
1539
+ return HighsStatus::kError;
1540
+ case HighsModelStatus::kModelEmpty:
1541
+ return HighsStatus::kOk;
1542
+ case HighsModelStatus::kOptimal:
1543
+ return HighsStatus::kOk;
1544
+ case HighsModelStatus::kInfeasible:
1545
+ return HighsStatus::kOk;
1546
+ case HighsModelStatus::kUnboundedOrInfeasible:
1547
+ return HighsStatus::kOk;
1548
+ case HighsModelStatus::kUnbounded:
1549
+ return HighsStatus::kOk;
1550
+ case HighsModelStatus::kObjectiveBound:
1551
+ return HighsStatus::kOk;
1552
+ case HighsModelStatus::kObjectiveTarget:
1553
+ return HighsStatus::kOk;
1554
+ case HighsModelStatus::kTimeLimit:
1555
+ return HighsStatus::kWarning;
1556
+ case HighsModelStatus::kIterationLimit:
1557
+ return HighsStatus::kWarning;
1558
+ case HighsModelStatus::kSolutionLimit:
1559
+ return HighsStatus::kWarning;
1560
+ case HighsModelStatus::kInterrupt:
1561
+ return HighsStatus::kWarning;
1562
+ case HighsModelStatus::kHighsInterrupt:
1563
+ return HighsStatus::kWarning;
1564
+ case HighsModelStatus::kUnknown:
1565
+ return HighsStatus::kWarning;
1566
+ default:
1567
+ return HighsStatus::kError;
1568
+ }
1569
+ }
1570
+
1571
+ std::string findModelObjectiveName(const HighsLp* lp,
1572
+ const HighsHessian* hessian) {
1573
+ // Return any non-trivial current objective name
1574
+ if (lp->objective_name_ != "") return lp->objective_name_;
1575
+
1576
+ std::string objective_name = "";
1577
+ // Determine whether there is a nonzero cost vector
1578
+ bool has_objective = false;
1579
+ for (HighsInt iCol = 0; iCol < lp->num_col_; iCol++) {
1580
+ if (lp->col_cost_[iCol]) {
1581
+ has_objective = true;
1582
+ break;
1583
+ }
1584
+ }
1585
+ if (!has_objective && hessian) {
1586
+ // Zero cost vector, so only chance of an objective comes from any
1587
+ // Hessian
1588
+ has_objective = (hessian->dim_ != 0);
1589
+ }
1590
+ HighsInt pass = 0;
1591
+ for (;;) {
1592
+ // Loop until a valid name is found. Vanishingly unlikely to have
1593
+ // to pass more than once, since check for objective name
1594
+ // duplicating a row name is very unlikely to fail
1595
+ //
1596
+ // So set up an appropriate name (stem)
1597
+ if (has_objective) {
1598
+ objective_name = "Obj";
1599
+ } else {
1600
+ objective_name = "NoObj";
1601
+ }
1602
+ // If there are no row names, then the objective name is certainly
1603
+ // OK
1604
+ if (lp->row_names_.size() == 0) break;
1605
+ if (pass != 0) objective_name += pass;
1606
+ // Ensure that the objective name doesn't clash with any row names
1607
+ bool ok_objective_name = true;
1608
+ for (HighsInt iRow = 0; iRow < lp->num_row_; iRow++) {
1609
+ std::string trimmed_name = lp->row_names_[iRow];
1610
+ trimmed_name = trim(trimmed_name);
1611
+ if (objective_name == trimmed_name) {
1612
+ ok_objective_name = false;
1613
+ break;
1614
+ }
1615
+ }
1616
+ if (ok_objective_name) break;
1617
+ pass++;
1618
+ }
1619
+ assert(objective_name != "");
1620
+ return objective_name;
1621
+ }
1622
+
1623
+ /*
1624
+ void print_map(std::string comment, const std::map<std::string, HighsInt>& m)
1625
+ {
1626
+ std::cout << comment;
1627
+
1628
+ for (const auto& n : m)
1629
+ std::cout << n.first << " = " << n.second << "; ";
1630
+ std::cout << '\n';
1631
+ }
1632
+ */
1633
+
1634
+ /*
1635
+ bool repeatedNames(const std::vector<std::string> name) {
1636
+ const HighsInt num_name = name.size();
1637
+ // With no names, cannot have any repeated
1638
+ if (num_name == 0) return false;
1639
+ std::map<std::string, HighsInt> name_map;
1640
+ for (HighsInt ix = 0; ix < num_name; ix++) {
1641
+ auto search = name_map.find(name[ix]);
1642
+ if (search != name_map.end()) return true;
1643
+ // printf("Search for %s yields %d\n", name[ix].c_str(),
1644
+ // int(search->second));
1645
+ name_map.insert({name[ix], ix});
1646
+ // print_map("Map\n", name_map);
1647
+ }
1648
+ return false;
1649
+ }
1650
+ */