lpsolver 0.1.0 → 0.2.1

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 +104 -26
  4. data/ext/lpsolver/Makefile +269 -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 +35 -7
  1160. data/lib/lpsolver/native.so +0 -0
  1161. data/lib/lpsolver/native_model.rb +261 -0
  1162. data/lib/lpsolver/solution.rb +93 -8
  1163. data/lib/lpsolver/version.rb +1 -1
  1164. data/lpsolver.gemspec +4 -1
  1165. metadata +1176 -4
@@ -0,0 +1,1850 @@
1
+ //
2
+ // Created by chuwen on 23-11-26.
3
+ //
4
+
5
+ #include "pdlp/cupdlp/cupdlp_utils.h"
6
+
7
+ #include <limits.h>
8
+ #include <stdio.h>
9
+
10
+ #include <time.h>
11
+
12
+ #include "pdlp/cupdlp/cupdlp_cs.h"
13
+ #include "pdlp/cupdlp/cupdlp_linalg.h"
14
+ #include "pdlp/cupdlp/glbopts.h"
15
+
16
+ #ifndef CUPDLP_CPU
17
+
18
+ #include "cuda/cupdlp_cudalinalg.cuh"
19
+
20
+ #endif
21
+
22
+ void dense_clear(CUPDLPdense *dense) {
23
+ if (dense) {
24
+ if (dense->data) {
25
+ cupdlp_free(dense->data);
26
+ }
27
+ cupdlp_free(dense);
28
+ }
29
+ }
30
+
31
+ cupdlp_int csc_clear(CUPDLPcsc *csc) {
32
+ if (csc) {
33
+ #ifndef CUPDLP_CPU
34
+ if (csc->cuda_csc != NULL) {
35
+ CHECK_CUSPARSE(cusparseDestroySpMat(csc->cuda_csc))
36
+ }
37
+ #endif
38
+ if (csc->colMatBeg) {
39
+ CUPDLP_FREE_VEC(csc->colMatBeg);
40
+ }
41
+ if (csc->colMatIdx) {
42
+ CUPDLP_FREE_VEC(csc->colMatIdx);
43
+ }
44
+ if (csc->colMatElem) {
45
+ CUPDLP_FREE_VEC(csc->colMatElem);
46
+ }
47
+ cupdlp_free(csc);
48
+ }
49
+ return 0;
50
+ }
51
+
52
+ cupdlp_int csc_clear_host(CUPDLPcsc *csc) {
53
+ if (csc) {
54
+ if (csc->colMatBeg) {
55
+ cupdlp_free(csc->colMatBeg);
56
+ }
57
+ if (csc->colMatIdx) {
58
+ cupdlp_free(csc->colMatIdx);
59
+ }
60
+ if (csc->colMatElem) {
61
+ cupdlp_free(csc->colMatElem);
62
+ }
63
+ cupdlp_free(csc);
64
+ }
65
+ return 0;
66
+ }
67
+
68
+ cupdlp_int csr_clear(CUPDLPcsr *csr) {
69
+ if (csr) {
70
+ #ifndef CUPDLP_CPU
71
+ if (csr->cuda_csr != NULL) {
72
+ CHECK_CUSPARSE(cusparseDestroySpMat(csr->cuda_csr))
73
+ }
74
+ #endif
75
+ if (csr->rowMatBeg) {
76
+ CUPDLP_FREE_VEC(csr->rowMatBeg);
77
+ }
78
+ if (csr->rowMatIdx) {
79
+ CUPDLP_FREE_VEC(csr->rowMatIdx);
80
+ }
81
+ if (csr->rowMatElem) {
82
+ CUPDLP_FREE_VEC(csr->rowMatElem);
83
+ }
84
+ cupdlp_free(csr);
85
+ }
86
+ return 0;
87
+ }
88
+
89
+ void data_clear(CUPDLPdata *data) {
90
+ if (data) {
91
+ switch (data->matrix_format) {
92
+ case DENSE:
93
+ dense_clear(data->dense_matrix);
94
+ break;
95
+ case CSR:
96
+ csr_clear(data->csr_matrix);
97
+ break;
98
+ case CSC:
99
+ csc_clear(data->csc_matrix);
100
+ break;
101
+ case CSR_CSC:
102
+ csr_clear(data->csr_matrix);
103
+ csc_clear(data->csc_matrix);
104
+ break;
105
+ }
106
+ cupdlp_free(data);
107
+ }
108
+ }
109
+
110
+ void problem_clear(CUPDLPproblem *problem) {
111
+ if (problem) {
112
+ if (problem->data) {
113
+ data_clear(problem->data);
114
+ }
115
+ // if (problem->colMatBeg) {
116
+ // cupdlp_free(problem->colMatBeg);
117
+ // }
118
+ // if (problem->colMatIdx) {
119
+ // cupdlp_free(problem->colMatIdx);
120
+ // }
121
+ // if (problem->colMatElem) {
122
+ // cupdlp_free(problem->colMatElem);
123
+ // }
124
+ // if (problem->rowMatBeg) {
125
+ // cupdlp_free(problem->rowMatBeg);
126
+ // }
127
+ // if (problem->rowMatIdx) {
128
+ // cupdlp_free(problem->rowMatIdx);
129
+ // }
130
+ // if (problem->rowMatElem) {
131
+ // cupdlp_free(problem->rowMatElem);
132
+ // }
133
+ if (problem->lower) {
134
+ CUPDLP_FREE_VEC(problem->lower);
135
+ }
136
+ if (problem->upper) {
137
+ CUPDLP_FREE_VEC(problem->upper);
138
+ }
139
+ if (problem->cost) {
140
+ CUPDLP_FREE_VEC(problem->cost);
141
+ }
142
+ if (problem->rhs) {
143
+ CUPDLP_FREE_VEC(problem->rhs);
144
+ }
145
+ if (problem->hasLower) {
146
+ CUPDLP_FREE_VEC(problem->hasLower);
147
+ }
148
+ if (problem->hasUpper) {
149
+ CUPDLP_FREE_VEC(problem->hasUpper);
150
+ }
151
+ cupdlp_free(problem);
152
+ }
153
+ }
154
+
155
+ void settings_clear(CUPDLPsettings *settings) {
156
+ if (settings) {
157
+ cupdlp_free(settings);
158
+ }
159
+ }
160
+
161
+ cupdlp_int vec_clear(CUPDLPvec *vec) {
162
+ if (vec) {
163
+ if (vec->data) {
164
+ CUPDLP_FREE_VEC(vec->data);
165
+ }
166
+ #ifndef CUPDLP_CPU
167
+ CHECK_CUSPARSE(cusparseDestroyDnVec(vec->cuda_vec))
168
+ #endif
169
+ cupdlp_free(vec);
170
+ }
171
+
172
+ return 0;
173
+ }
174
+
175
+ void iterates_clear(CUPDLPiterates *iterates) {
176
+ if (iterates) {
177
+ if (iterates->x[0]) {
178
+ // CUPDLP_FREE_VEC(iterates->x[0]);
179
+ vec_clear(iterates->x[0]);
180
+ }
181
+ if (iterates->x[1]) {
182
+ // CUPDLP_FREE_VEC(iterates->x[1]);
183
+ vec_clear(iterates->x[1]);
184
+ }
185
+ if (iterates->y[0]) {
186
+ // CUPDLP_FREE_VEC(iterates->y[0]);
187
+ vec_clear(iterates->y[0]);
188
+ }
189
+ if (iterates->y[1]) {
190
+ // CUPDLP_FREE_VEC(iterates->y[1]);
191
+ vec_clear(iterates->y[1]);
192
+ }
193
+ if (iterates->xSum) {
194
+ CUPDLP_FREE_VEC(iterates->xSum);
195
+ }
196
+ if (iterates->ySum) {
197
+ CUPDLP_FREE_VEC(iterates->ySum);
198
+ }
199
+ if (iterates->xAverage) {
200
+ // CUPDLP_FREE_VEC(iterates->xAverage);
201
+ vec_clear(iterates->xAverage);
202
+ }
203
+ if (iterates->yAverage) {
204
+ // CUPDLP_FREE_VEC(iterates->yAverage);
205
+ vec_clear(iterates->yAverage);
206
+ }
207
+ if (iterates->xLastRestart) {
208
+ CUPDLP_FREE_VEC(iterates->xLastRestart);
209
+ }
210
+ if (iterates->yLastRestart) {
211
+ CUPDLP_FREE_VEC(iterates->yLastRestart);
212
+ }
213
+ if (iterates->ax[0]) {
214
+ // CUPDLP_FREE_VEC(iterates->ax[0]);
215
+ vec_clear(iterates->ax[0]);
216
+ }
217
+ if (iterates->ax[1]) {
218
+ // CUPDLP_FREE_VEC(iterates->ax[1]);
219
+ vec_clear(iterates->ax[1]);
220
+ }
221
+ if (iterates->axAverage) {
222
+ // CUPDLP_FREE_VEC(iterates->axAverage);
223
+ vec_clear(iterates->axAverage);
224
+ }
225
+ if (iterates->aty[0]) {
226
+ // CUPDLP_FREE_VEC(iterates->aty[0]);
227
+ vec_clear(iterates->aty[0]);
228
+ }
229
+ if (iterates->aty[1]) {
230
+ // CUPDLP_FREE_VEC(iterates->aty[1]);
231
+ vec_clear(iterates->aty[1]);
232
+ }
233
+ if (iterates->atyAverage) {
234
+ // CUPDLP_FREE_VEC(iterates->atyAverage);
235
+ vec_clear(iterates->atyAverage);
236
+ }
237
+ cupdlp_free(iterates);
238
+ }
239
+ }
240
+
241
+ void resobj_clear(CUPDLPresobj *resobj) {
242
+ if (resobj) {
243
+ if (resobj->primalResidual) {
244
+ CUPDLP_FREE_VEC(resobj->primalResidual);
245
+ }
246
+ if (resobj->dualResidual) {
247
+ CUPDLP_FREE_VEC(resobj->dualResidual);
248
+ }
249
+ if (resobj->primalResidualAverage) {
250
+ CUPDLP_FREE_VEC(resobj->primalResidualAverage);
251
+ }
252
+ if (resobj->dualResidualAverage) {
253
+ CUPDLP_FREE_VEC(resobj->dualResidualAverage);
254
+ }
255
+ if (resobj->dSlackPos) {
256
+ CUPDLP_FREE_VEC(resobj->dSlackPos);
257
+ }
258
+ if (resobj->dSlackNeg) {
259
+ CUPDLP_FREE_VEC(resobj->dSlackNeg);
260
+ }
261
+ if (resobj->dSlackPosAverage) {
262
+ CUPDLP_FREE_VEC(resobj->dSlackPosAverage);
263
+ }
264
+ if (resobj->dSlackNegAverage) {
265
+ CUPDLP_FREE_VEC(resobj->dSlackNegAverage);
266
+ }
267
+ if (resobj->dLowerFiltered) {
268
+ CUPDLP_FREE_VEC(resobj->dLowerFiltered);
269
+ }
270
+ if (resobj->dUpperFiltered) {
271
+ CUPDLP_FREE_VEC(resobj->dUpperFiltered);
272
+ }
273
+ if (resobj->primalInfeasRay) {
274
+ CUPDLP_FREE_VEC(resobj->primalInfeasRay);
275
+ }
276
+ if (resobj->primalInfeasConstr) {
277
+ CUPDLP_FREE_VEC(resobj->primalInfeasConstr);
278
+ }
279
+ if (resobj->primalInfeasBound) {
280
+ CUPDLP_FREE_VEC(resobj->primalInfeasBound);
281
+ }
282
+ if (resobj->dualInfeasRay) {
283
+ CUPDLP_FREE_VEC(resobj->dualInfeasRay);
284
+ }
285
+ if (resobj->dualInfeasLbRay) {
286
+ CUPDLP_FREE_VEC(resobj->dualInfeasLbRay);
287
+ }
288
+ if (resobj->dualInfeasUbRay) {
289
+ CUPDLP_FREE_VEC(resobj->dualInfeasUbRay);
290
+ }
291
+ if (resobj->dualInfeasConstr) {
292
+ CUPDLP_FREE_VEC(resobj->dualInfeasConstr);
293
+ }
294
+ // if (resobj->dualInfeasBound) {
295
+ // CUPDLP_FREE_VEC(resobj->dualInfeasBound);
296
+ // }
297
+ cupdlp_free(resobj);
298
+ }
299
+ }
300
+
301
+ void stepsize_clear(CUPDLPstepsize *stepsize) {
302
+ if (stepsize) {
303
+ cupdlp_free(stepsize);
304
+ }
305
+ }
306
+
307
+ void timers_clear(int log_level, CUPDLPtimers *timers) {
308
+ #ifndef CUPDLP_CPU
309
+ if (log_level > 1)
310
+ cupdlp_printf("%20s %e\n\n", "Free Device memory", timers->FreeDeviceMemTime);
311
+ #endif
312
+
313
+
314
+ if (timers) {
315
+ cupdlp_free(timers);
316
+ }
317
+ }
318
+
319
+ void scaling_clear(CUPDLPscaling *scaling) {
320
+ if (scaling) {
321
+ if (scaling->colScale) {
322
+ cupdlp_free(scaling->colScale);
323
+ }
324
+ if (scaling->rowScale) {
325
+ cupdlp_free(scaling->rowScale);
326
+ }
327
+ cupdlp_free(scaling);
328
+ }
329
+ }
330
+
331
+ cupdlp_int PDHG_Clear(CUPDLPwork *w) {
332
+ CUPDLPproblem *problem = w->problem;
333
+ CUPDLPsettings *settings = w->settings;
334
+ CUPDLPiterates *iterates = w->iterates;
335
+ CUPDLPresobj *resobj = w->resobj;
336
+ CUPDLPstepsize *stepsize = w->stepsize;
337
+ CUPDLPtimers *timers = w->timers;
338
+ CUPDLPscaling *scaling = w->scaling;
339
+
340
+
341
+ cupdlp_float begin = getTimeStamp();
342
+ #ifndef CUPDLP_CPU
343
+
344
+ // CUDAmv *MV = w->MV;
345
+ // if (MV)
346
+ // {
347
+ // cupdlp_float begin = getTimeStamp();
348
+ // cuda_free_mv(MV);
349
+ // timers->FreeDeviceMemTime += getTimeStamp() - begin;
350
+ // }
351
+ CHECK_CUBLAS(cublasDestroy(w->cublashandle))
352
+ CHECK_CUSPARSE(cusparseDestroy(w->cusparsehandle))
353
+ CHECK_CUDA(cudaFree(w->dBuffer_csc_ATy))
354
+ CHECK_CUDA(cudaFree(w->dBuffer_csr_Ax))
355
+ if (w->buffer2) CUPDLP_FREE_VEC(w->buffer2);
356
+ if (w->buffer3) CUPDLP_FREE_VEC(w->buffer3);
357
+ #endif
358
+ if (w->colScale) CUPDLP_FREE_VEC(w->colScale);
359
+ if (w->rowScale) CUPDLP_FREE_VEC(w->rowScale);
360
+
361
+ if (w->buffer) {
362
+ // CUPDLP_FREE_VEC(w->buffer);
363
+ vec_clear(w->buffer);
364
+ }
365
+
366
+ if (w->buffer2 != NULL) {
367
+ // CUPDLP_FREE_VEC(w->buffer);
368
+ free(w->buffer2);
369
+ }
370
+
371
+ if (w->buffer3) {
372
+ // CUPDLP_FREE_VEC(w->buffer);
373
+ free(w->buffer3);
374
+ }
375
+
376
+ if (problem) {
377
+ // problem_clear(problem);
378
+ problem = cupdlp_NULL;
379
+ }
380
+
381
+ if (iterates) {
382
+ iterates_clear(iterates);
383
+ }
384
+
385
+ if (resobj) {
386
+ resobj_clear(resobj);
387
+ }
388
+
389
+ #ifndef CUPDLP_CPU
390
+ timers->FreeDeviceMemTime += getTimeStamp() - begin;
391
+ #endif
392
+
393
+ // Call timers_clear, before clearing settings
394
+ if (timers) {
395
+ timers_clear(settings->nLogLevel, timers);
396
+ }
397
+ if (settings) {
398
+ settings_clear(settings);
399
+ }
400
+ if (stepsize) {
401
+ stepsize_clear(stepsize);
402
+ }
403
+ if (scaling) {
404
+ // scaling_clear(scaling);
405
+ // if (scaling->colScale) {
406
+ // cupdlp_free(scaling->colScale);
407
+ // }
408
+ // if (scaling->rowScale) {
409
+ // cupdlp_free(scaling->rowScale);
410
+ // }
411
+ // cupdlp_free(scaling);
412
+ scaling = cupdlp_NULL;
413
+ }
414
+ cupdlp_free(w);
415
+
416
+ return 0;
417
+ }
418
+
419
+ void PDHG_PrintPDHGParam(CUPDLPwork *w) {
420
+ if (w->settings->nLogLevel < 2) return;
421
+ CUPDLPsettings *settings = w->settings;
422
+ CUPDLPstepsize *stepsize = w->stepsize;
423
+ CUPDLPresobj *resobj = w->resobj;
424
+ CUPDLPiterates *iterates = w->iterates;
425
+ CUPDLPscaling *scaling = w->scaling;
426
+ CUPDLPtimers *timers = w->timers;
427
+
428
+ cupdlp_printf("\n");
429
+
430
+ cupdlp_printf("\n");
431
+ cupdlp_printf("--------------------------------------------------\n");
432
+ cupdlp_printf("CUPDHG Parameters:\n");
433
+ cupdlp_printf("--------------------------------------------------\n");
434
+ cupdlp_printf("\n");
435
+
436
+ cupdlp_printf(" nIterLim: %d\n", settings->nIterLim);
437
+ cupdlp_printf(" dTimeLim (sec): %.2f\n", settings->dTimeLim);
438
+ cupdlp_printf(" ifScaling: %d\n", settings->ifScaling);
439
+ // cupdlp_printf(" iScalingMethod: %d\n", settings->iScalingMethod);)
440
+ cupdlp_printf(" ifRuizScaling: %d\n", scaling->ifRuizScaling);
441
+ cupdlp_printf(" ifL2Scaling: %d\n", scaling->ifL2Scaling);
442
+ cupdlp_printf(" ifPcScaling: %d\n", scaling->ifPcScaling);
443
+ cupdlp_printf(" eLineSearchMethod: %d\n", stepsize->eLineSearchMethod);
444
+ // cupdlp_printf(" dScalingLimit: %.4e\n", settings->dScalingLimit);
445
+ cupdlp_printf(" dPrimalTol: %.4e\n", settings->dPrimalTol);
446
+ cupdlp_printf(" dDualTol: %.4e\n", settings->dDualTol);
447
+ cupdlp_printf(" dGapTol: %.4e\n", settings->dGapTol);
448
+ cupdlp_printf(" dFeasTol: %.4e\n", resobj->dFeasTol);
449
+ cupdlp_printf(" eRestartMethod: %d\n", settings->eRestartMethod);
450
+ cupdlp_printf(" nLogLevel: %d\n", settings->nLogLevel);
451
+ cupdlp_printf(" nLogInterval: %d\n", settings->nLogInterval);
452
+ cupdlp_printf("\n");
453
+ cupdlp_printf("--------------------------------------------------\n");
454
+ cupdlp_printf("\n");
455
+ }
456
+
457
+ void PDHG_PrintHugeCUPDHG(void) {
458
+ cupdlp_printf("\n");
459
+ cupdlp_printf(" ____ _ _ ____ ____ _ ____\n");
460
+ cupdlp_printf(" / ___| | | | _ \\| _ \\| | | _ \\\n");
461
+ cupdlp_printf("| | | | | | |_) | | | | | | |_) |\n");
462
+ cupdlp_printf("| |___| |_| | __/| |_| | |___| __/\n");
463
+ cupdlp_printf(" \\____|\\___/|_| |____/|_____|_|\n");
464
+ cupdlp_printf("\n");
465
+ }
466
+
467
+ void PDHG_PrintUserParamHelper(void) {
468
+ PDHG_PrintHugeCUPDHG();
469
+
470
+ cupdlp_printf("CUPDHG User Parameters:\n");
471
+ cupdlp_printf("\n");
472
+
473
+ cupdlp_printf(" -h: print this helper\n");
474
+ cupdlp_printf("\n");
475
+
476
+ cupdlp_printf(" -nIterLim: maximum iteration number\n");
477
+ cupdlp_printf(" type: int\n");
478
+ cupdlp_printf(" default: INT_MAX\n");
479
+ cupdlp_printf(" range: >= 0\n");
480
+ cupdlp_printf("\n");
481
+
482
+ cupdlp_printf(" -ifScaling: whether to use scaling\n");
483
+ cupdlp_printf(" type: bool\n");
484
+ cupdlp_printf(" default: true\n");
485
+ cupdlp_printf(" range: true or false\n");
486
+ cupdlp_printf("\n");
487
+
488
+ cupdlp_printf(" -eLineSearchMethod: which line search method to use\n");
489
+ cupdlp_printf(
490
+ " 0-Fixed, 1-Malitsky (not support), "
491
+ "2-Adaptive\n");
492
+ cupdlp_printf(" type: int\n");
493
+ cupdlp_printf(" default: 2\n");
494
+ cupdlp_printf(" range: 0 to 2\n");
495
+ cupdlp_printf("\n");
496
+
497
+ cupdlp_printf(" -dPrimalTol: primal tolerance\n");
498
+ cupdlp_printf(" type: double\n");
499
+ cupdlp_printf(" default: 1e-4\n");
500
+ cupdlp_printf(" range: >= 0\n");
501
+ cupdlp_printf("\n");
502
+
503
+ cupdlp_printf(" -dDualTol: dual tolerance\n");
504
+ cupdlp_printf(" type: double\n");
505
+ cupdlp_printf(" default: 1e-4\n");
506
+ cupdlp_printf(" range: >= 0\n");
507
+ cupdlp_printf("\n");
508
+
509
+ cupdlp_printf(" -dGapTol: gap tolerance\n");
510
+ cupdlp_printf(" type: double\n");
511
+ cupdlp_printf(" default: 1e-4\n");
512
+ cupdlp_printf(" range: >= 0\n");
513
+ cupdlp_printf("\n");
514
+
515
+ cupdlp_printf(" -dFeasTol: feasibility tolerance\n");
516
+ cupdlp_printf(" type: double\n");
517
+ cupdlp_printf(" default: 1e-8\n");
518
+ cupdlp_printf(" range: >= 0\n");
519
+ cupdlp_printf("\n");
520
+
521
+ cupdlp_printf(" -dTimeLim: time limit (in seconds)\n");
522
+ cupdlp_printf(" type: double\n");
523
+ cupdlp_printf(" default: 3600\n");
524
+ cupdlp_printf(" range: >= 0\n");
525
+ cupdlp_printf("\n");
526
+
527
+ cupdlp_printf(" -eRestartMethod: which restart method to use\n");
528
+ cupdlp_printf(" 0-None, 1-KKTversion\n");
529
+ cupdlp_printf(" type: int\n");
530
+ cupdlp_printf(" default: 1\n");
531
+ cupdlp_printf(" range: 0 to 1\n");
532
+ cupdlp_printf("\n");
533
+
534
+ cupdlp_printf(" -ifRuizScaling: whether to use Ruiz scaling\n");
535
+ cupdlp_printf(" type: bool\n");
536
+ cupdlp_printf(" default: true\n");
537
+ cupdlp_printf(" range: true or false\n");
538
+ cupdlp_printf("\n");
539
+
540
+ cupdlp_printf(" -ifL2Scaling: whether to use L2 scaling\n");
541
+ cupdlp_printf(" type: bool\n");
542
+ cupdlp_printf(" default: false\n");
543
+ cupdlp_printf(" range: true or false\n");
544
+ cupdlp_printf("\n");
545
+
546
+ cupdlp_printf(" -ifPcScaling: whether to use Pock-Chambolle scaling\n");
547
+ cupdlp_printf(" type: bool\n");
548
+ cupdlp_printf(" default: true\n");
549
+ cupdlp_printf(" range: true or false\n");
550
+ cupdlp_printf("\n");
551
+
552
+ // cupdlp_printf(
553
+ // " -ifPre: whether to use HiGHS presolver (and thus postsolver)\n");
554
+ // cupdlp_printf(" type: bool\n");
555
+ // cupdlp_printf(" default: true\n");
556
+ // cupdlp_printf(" range: true or false\n");
557
+ // cupdlp_printf("\n");
558
+ }
559
+
560
+ cupdlp_retcode getUserParam(int argc, char **argv,
561
+ cupdlp_bool *ifChangeIntParam, cupdlp_int *intParam,
562
+ cupdlp_bool *ifChangeFloatParam,
563
+ cupdlp_float *floatParam) {
564
+ cupdlp_retcode retcode = RETCODE_OK;
565
+
566
+ // set ifChangeIntParam and ifChangeFloatParam to false
567
+ for (cupdlp_int i = 0; i < N_INT_USER_PARAM; ++i) {
568
+ ifChangeIntParam[i] = false;
569
+ }
570
+
571
+ for (cupdlp_int i = 0; i < N_FLOAT_USER_PARAM; ++i) {
572
+ ifChangeFloatParam[i] = false;
573
+ }
574
+
575
+ // parse command line arguments
576
+ for (cupdlp_int i = 0; i < argc - 1; ++i) {
577
+ if (strcmp(argv[i], "-h") == 0) {
578
+ PDHG_PrintUserParamHelper();
579
+
580
+ retcode = RETCODE_FAILED;
581
+ goto exit_cleanup;
582
+ }
583
+
584
+ if (strcmp(argv[i], "-nIterLim") == 0) {
585
+ ifChangeIntParam[N_ITER_LIM] = true;
586
+ intParam[N_ITER_LIM] = atoi(argv[i + 1]);
587
+ } else if (strcmp(argv[i], "-ifScaling") == 0) {
588
+ ifChangeIntParam[IF_SCALING] = true;
589
+ intParam[IF_SCALING] = atoi(argv[i + 1]);
590
+ } else if (strcmp(argv[i], "-iScalingMethod") == 0) {
591
+ ifChangeIntParam[I_SCALING_METHOD] = true;
592
+ intParam[I_SCALING_METHOD] = atoi(argv[i + 1]);
593
+ } else if (strcmp(argv[i], "-eLineSearchMethod") == 0) {
594
+ ifChangeIntParam[E_LINE_SEARCH_METHOD] = true;
595
+ intParam[E_LINE_SEARCH_METHOD] = atoi(argv[i + 1]);
596
+ } else if (strcmp(argv[i], "-dScalingLimit") == 0) {
597
+ ifChangeFloatParam[D_SCALING_LIMIT] = true;
598
+ floatParam[D_SCALING_LIMIT] = atof(argv[i + 1]);
599
+ } else if (strcmp(argv[i], "-dPrimalTol") == 0) {
600
+ ifChangeFloatParam[D_PRIMAL_TOL] = true;
601
+ floatParam[D_PRIMAL_TOL] = atof(argv[i + 1]);
602
+ } else if (strcmp(argv[i], "-dDualTol") == 0) {
603
+ ifChangeFloatParam[D_DUAL_TOL] = true;
604
+ floatParam[D_DUAL_TOL] = atof(argv[i + 1]);
605
+ } else if (strcmp(argv[i], "-dGapTol") == 0) {
606
+ ifChangeFloatParam[D_GAP_TOL] = true;
607
+ floatParam[D_GAP_TOL] = atof(argv[i + 1]);
608
+ } else if (strcmp(argv[i], "-dFeasTol") == 0) {
609
+ ifChangeFloatParam[D_FEAS_TOL] = true;
610
+ floatParam[D_FEAS_TOL] = atof(argv[i + 1]);
611
+ } else if (strcmp(argv[i], "-dTimeLim") == 0) {
612
+ ifChangeFloatParam[D_TIME_LIM] = true;
613
+ floatParam[D_TIME_LIM] = atof(argv[i + 1]);
614
+ } else if (strcmp(argv[i], "-eRestartMethod") == 0) {
615
+ ifChangeIntParam[E_RESTART_METHOD] = true;
616
+ intParam[E_RESTART_METHOD] = atoi(argv[i + 1]);
617
+ } else if (strcmp(argv[i], "-ifRuizScaling") == 0) {
618
+ ifChangeIntParam[IF_RUIZ_SCALING] = true;
619
+ intParam[IF_RUIZ_SCALING] = atoi(argv[i + 1]);
620
+ } else if (strcmp(argv[i], "-ifL2Scaling") == 0) {
621
+ ifChangeIntParam[IF_L2_SCALING] = true;
622
+ intParam[IF_L2_SCALING] = atoi(argv[i + 1]);
623
+ } else if (strcmp(argv[i], "-ifPcScaling") == 0) {
624
+ ifChangeIntParam[IF_PC_SCALING] = true;
625
+ intParam[IF_PC_SCALING] = atoi(argv[i + 1]);
626
+ } else if (strcmp(argv[i], "-nLogLevel") == 0) {
627
+ ifChangeIntParam[N_LOG_LEVEL] = true;
628
+ intParam[N_LOG_LEVEL] = atoi(argv[i + 1]);
629
+ } else if (strcmp(argv[i], "-nLogInt") == 0) {
630
+ ifChangeIntParam[N_LOG_INTERVAL] = true;
631
+ intParam[N_LOG_INTERVAL] = atoi(argv[i + 1]);
632
+ } else if (strcmp(argv[i], "-ifPre") == 0) {
633
+ ifChangeIntParam[IF_PRESOLVE] = true;
634
+ intParam[IF_PRESOLVE] = atoi(argv[i + 1]);
635
+ }
636
+ }
637
+
638
+ // if (argc>0) {
639
+ // if (strcmp(argv[argc - 1], "-h") == 0) {
640
+ // PDHG_PrintUserParamHelper();
641
+
642
+ // retcode = RETCODE_FAILED;
643
+ // goto exit_cleanup;
644
+ // }
645
+ // }
646
+
647
+ exit_cleanup:
648
+ return retcode;
649
+ }
650
+
651
+ cupdlp_retcode settings_SetUserParam(CUPDLPsettings *settings,
652
+ cupdlp_bool *ifChangeIntParam,
653
+ cupdlp_int *intParam,
654
+ cupdlp_bool *ifChangeFloatParam,
655
+ cupdlp_float *floatParam) {
656
+ cupdlp_retcode retcode = RETCODE_OK;
657
+
658
+ if (ifChangeIntParam[N_ITER_LIM]) {
659
+ settings->nIterLim = intParam[N_ITER_LIM];
660
+ }
661
+
662
+ if (ifChangeIntParam[N_LOG_LEVEL]) {
663
+ settings->nLogLevel = intParam[N_LOG_LEVEL];
664
+ }
665
+
666
+ if (ifChangeIntParam[N_LOG_INTERVAL]) {
667
+ settings->nLogInterval = intParam[N_LOG_INTERVAL];
668
+ }
669
+
670
+ if (ifChangeIntParam[IF_SCALING]) {
671
+ settings->ifScaling = intParam[IF_SCALING];
672
+ }
673
+
674
+ if (ifChangeIntParam[I_SCALING_METHOD]) {
675
+ settings->iScalingMethod = intParam[I_SCALING_METHOD];
676
+ }
677
+
678
+ if (ifChangeFloatParam[D_SCALING_LIMIT]) {
679
+ settings->dScalingLimit = floatParam[D_SCALING_LIMIT];
680
+ }
681
+
682
+ if (ifChangeFloatParam[D_PRIMAL_TOL]) {
683
+ settings->dPrimalTol = floatParam[D_PRIMAL_TOL];
684
+ }
685
+
686
+ if (ifChangeFloatParam[D_DUAL_TOL]) {
687
+ settings->dDualTol = floatParam[D_DUAL_TOL];
688
+ }
689
+
690
+ if (ifChangeFloatParam[D_GAP_TOL]) {
691
+ settings->dGapTol = floatParam[D_GAP_TOL];
692
+ }
693
+
694
+ if (ifChangeFloatParam[D_TIME_LIM]) {
695
+ settings->dTimeLim = floatParam[D_TIME_LIM];
696
+ }
697
+
698
+ if (ifChangeIntParam[E_RESTART_METHOD]) {
699
+ settings->eRestartMethod = intParam[E_RESTART_METHOD];
700
+ }
701
+
702
+ exit_cleanup:
703
+ return retcode;
704
+ }
705
+
706
+ cupdlp_retcode resobj_SetUserParam(CUPDLPresobj *resobj,
707
+ cupdlp_bool *ifChangeIntParam,
708
+ cupdlp_int *intParam,
709
+ cupdlp_bool *ifChangeFloatParam,
710
+ cupdlp_float *floatParam) {
711
+ cupdlp_retcode retcode = RETCODE_OK;
712
+
713
+ if (ifChangeFloatParam[D_FEAS_TOL]) {
714
+ resobj->dFeasTol = floatParam[D_FEAS_TOL];
715
+ }
716
+
717
+ exit_cleanup:
718
+ return retcode;
719
+ }
720
+
721
+ cupdlp_retcode iterates_SetUserParam(CUPDLPiterates *iterates,
722
+ cupdlp_bool *ifChangeIntParam,
723
+ cupdlp_int *intParam,
724
+ cupdlp_bool *ifChangeFloatParam,
725
+ cupdlp_float *floatParam) {
726
+ cupdlp_retcode retcode = RETCODE_OK;
727
+
728
+ exit_cleanup:
729
+ return retcode;
730
+ }
731
+
732
+ cupdlp_retcode stepsize_SetUserParam(CUPDLPstepsize *stepsize,
733
+ cupdlp_bool *ifChangeIntParam,
734
+ cupdlp_int *intParam,
735
+ cupdlp_bool *ifChangeFloatParam,
736
+ cupdlp_float *floatParam) {
737
+ cupdlp_retcode retcode = RETCODE_OK;
738
+
739
+ if (ifChangeIntParam[E_LINE_SEARCH_METHOD]) {
740
+ stepsize->eLineSearchMethod = intParam[E_LINE_SEARCH_METHOD];
741
+ }
742
+
743
+ exit_cleanup:
744
+ return retcode;
745
+ }
746
+
747
+ cupdlp_retcode scaling_SetUserParam(CUPDLPscaling *scaling,
748
+ cupdlp_bool *ifChangeIntParam,
749
+ cupdlp_int *intParam,
750
+ cupdlp_bool *ifChangeFloatParam,
751
+ cupdlp_float *floatParam) {
752
+ cupdlp_retcode retcode = RETCODE_OK;
753
+
754
+ if (ifChangeIntParam[IF_RUIZ_SCALING]) {
755
+ scaling->ifRuizScaling = intParam[IF_RUIZ_SCALING];
756
+ }
757
+
758
+ if (ifChangeIntParam[IF_L2_SCALING]) {
759
+ scaling->ifL2Scaling = intParam[IF_L2_SCALING];
760
+ }
761
+
762
+ if (ifChangeIntParam[IF_PC_SCALING]) {
763
+ scaling->ifPcScaling = intParam[IF_PC_SCALING];
764
+ }
765
+
766
+ exit_cleanup:
767
+ return retcode;
768
+ }
769
+
770
+ cupdlp_retcode timers_SetUserParam(CUPDLPtimers *timers,
771
+ cupdlp_bool *ifChangeIntParam,
772
+ cupdlp_int *intParam,
773
+ cupdlp_bool *ifChangeFloatParam,
774
+ cupdlp_float *floatParam) {
775
+ cupdlp_retcode retcode = RETCODE_OK;
776
+
777
+ exit_cleanup:
778
+ return retcode;
779
+ }
780
+
781
+ cupdlp_retcode PDHG_SetUserParam(CUPDLPwork *w, cupdlp_bool *ifChangeIntParam,
782
+ cupdlp_int *intParam,
783
+ cupdlp_bool *ifChangeFloatParam,
784
+ cupdlp_float *floatParam) {
785
+ cupdlp_retcode retcode = RETCODE_OK;
786
+
787
+ CUPDLPsettings *settings = w->settings;
788
+ CUPDLPstepsize *stepsize = w->stepsize;
789
+ CUPDLPresobj *resobj = w->resobj;
790
+ CUPDLPiterates *iterates = w->iterates;
791
+ CUPDLPscaling *scaling = w->scaling;
792
+ CUPDLPtimers *timers = w->timers;
793
+
794
+ CUPDLP_CALL(settings_SetUserParam(settings, ifChangeIntParam, intParam,
795
+ ifChangeFloatParam, floatParam));
796
+ CUPDLP_CALL(stepsize_SetUserParam(stepsize, ifChangeIntParam, intParam,
797
+ ifChangeFloatParam, floatParam));
798
+ CUPDLP_CALL(resobj_SetUserParam(resobj, ifChangeIntParam, intParam,
799
+ ifChangeFloatParam, floatParam));
800
+ CUPDLP_CALL(iterates_SetUserParam(iterates, ifChangeIntParam, intParam,
801
+ ifChangeFloatParam, floatParam));
802
+ CUPDLP_CALL(scaling_SetUserParam(scaling, ifChangeIntParam, intParam,
803
+ ifChangeFloatParam, floatParam));
804
+ CUPDLP_CALL(timers_SetUserParam(timers, ifChangeIntParam, intParam,
805
+ ifChangeFloatParam, floatParam));
806
+
807
+ PDHG_PrintPDHGParam(w);
808
+
809
+ exit_cleanup:
810
+ return retcode;
811
+ }
812
+
813
+ cupdlp_retcode settings_Alloc(CUPDLPsettings *settings) {
814
+ cupdlp_retcode retcode = RETCODE_OK;
815
+ // settings->nIterLim = INFINITY;
816
+ settings->nIterLim = INT_MAX; // INFINITY cause bug on MacOS
817
+ settings->nLogLevel = 2; // Ensures that, by default, cuPDLP-C printing is unchanged
818
+ settings->nLogInterval = 100;
819
+ // settings->dTimeLim = INFINITY;
820
+ settings->dTimeLim = 3600;
821
+ settings->ifScaling = true;
822
+ settings->iScalingMethod = 3; // no use
823
+ settings->dScalingLimit = 5; // no use
824
+ settings->eRestartMethod = PDHG_GPU_RESTART;
825
+
826
+ // termination criteria
827
+ settings->dPrimalTol = 1e-4;
828
+ settings->dDualTol = 1e-4;
829
+ settings->dGapTol = 1e-4;
830
+
831
+ return retcode;
832
+ }
833
+
834
+ cupdlp_retcode resobj_Alloc(CUPDLPresobj *resobj, CUPDLPproblem *problem,
835
+ cupdlp_int ncols, cupdlp_int nrows) {
836
+ cupdlp_retcode retcode = RETCODE_OK;
837
+
838
+ #if !defined(CUPDLP_CPU) && USE_KERNELS
839
+ resobj->primalResidual = NULL;
840
+ resobj->dualResidual = NULL;
841
+ resobj->primalResidualAverage = NULL;
842
+ resobj->dualResidualAverage = NULL;
843
+ #else
844
+
845
+ cupdlp_init_zero_vec_double(resobj->primalResidual, nrows);
846
+ cupdlp_init_zero_vec_double(resobj->dualResidual, ncols);
847
+ cupdlp_init_zero_vec_double(resobj->primalResidualAverage, nrows);
848
+ cupdlp_init_zero_vec_double(resobj->dualResidualAverage, ncols);
849
+
850
+ #endif
851
+
852
+ cupdlp_init_zero_vec_double(resobj->dSlackPos, ncols);
853
+ cupdlp_init_zero_vec_double(resobj->dSlackNeg, ncols);
854
+ cupdlp_init_zero_vec_double(resobj->dSlackPosAverage, ncols);
855
+ cupdlp_init_zero_vec_double(resobj->dSlackNegAverage, ncols);
856
+ cupdlp_init_zero_vec_double(resobj->dLowerFiltered, ncols);
857
+ cupdlp_init_zero_vec_double(resobj->dUpperFiltered, ncols);
858
+
859
+ #if !defined(CUPDLP_CPU) && USE_KERNELS
860
+ resobj->primalInfeasRay = NULL;
861
+ resobj->primalInfeasConstr = NULL;
862
+ resobj->primalInfeasBound = NULL;
863
+ resobj->dualInfeasRay = NULL;
864
+ resobj->dualInfeasLbRay = NULL;
865
+ resobj->dualInfeasUbRay = NULL;
866
+ #else
867
+
868
+ cupdlp_init_zero_vec_double(resobj->primalInfeasRay, ncols);
869
+ cupdlp_init_zero_vec_double(resobj->primalInfeasConstr, nrows);
870
+ cupdlp_init_zero_vec_double(resobj->primalInfeasBound, ncols);
871
+ cupdlp_init_zero_vec_double(resobj->dualInfeasRay, nrows);
872
+ cupdlp_init_zero_vec_double(resobj->dualInfeasLbRay, ncols);
873
+ cupdlp_init_zero_vec_double(resobj->dualInfeasUbRay, ncols);
874
+ #endif
875
+
876
+
877
+ #if !defined(CUPDLP_CPU) && USE_KERNELS
878
+ resobj->dualInfeasConstr = NULL;
879
+ #else
880
+ cupdlp_init_zero_vec_double(resobj->dualInfeasConstr, ncols);
881
+ #endif
882
+
883
+ // CUPDLP_INIT_DOUBLE_ZERO_VEC(resobj->dualInfeasBound, nrows);
884
+
885
+ cupdlp_filterlb(resobj->dLowerFiltered, problem->lower, -INFINITY, ncols);
886
+ cupdlp_filterub(resobj->dUpperFiltered, problem->upper, +INFINITY, ncols);
887
+
888
+ // initialization
889
+ resobj->dFeasTol = 1e-8;
890
+ resobj->dPrimalObj = 0.0;
891
+ resobj->dDualObj = 0.0;
892
+ resobj->dDualityGap = 0.0;
893
+ resobj->dComplementarity = 0.0;
894
+ resobj->dPrimalFeas = 0.0;
895
+ resobj->dDualFeas = 0.0;
896
+ resobj->dRelObjGap = 0.0;
897
+ resobj->dPrimalObjAverage = 0.0;
898
+ resobj->dDualObjAverage = 0.0;
899
+ resobj->dDualityGapAverage = 0.0;
900
+ resobj->dComplementarityAverage = 0.0;
901
+ resobj->dPrimalFeasAverage = 0.0;
902
+ resobj->dDualFeasAverage = 0.0;
903
+ resobj->dRelObjGapAverage = 0.0;
904
+ resobj->dPrimalFeasLastRestart = 0.0;
905
+ resobj->dDualFeasLastRestart = 0.0;
906
+ resobj->dDualityGapLastRestart = 0.0;
907
+ resobj->dPrimalFeasLastCandidate = 0.0;
908
+ resobj->dDualFeasLastCandidate = 0.0;
909
+ resobj->dDualityGapLastCandidate = 0.0;
910
+
911
+ resobj->primalCode = FEASIBLE;
912
+ resobj->dualCode = FEASIBLE;
913
+ resobj->termInfeasIterate = LAST_ITERATE;
914
+ resobj->dPrimalInfeasObj = 0.0;
915
+ resobj->dDualInfeasObj = 0.0;
916
+ resobj->dPrimalInfeasRes = 1.0;
917
+ resobj->dDualInfeasRes = 1.0;
918
+ resobj->dPrimalInfeasObjAverage = 0.0;
919
+ resobj->dDualInfeasObjAverage = 0.0;
920
+ resobj->dPrimalInfeasResAverage = 1.0;
921
+ resobj->dDualInfeasResAverage = 1.0;
922
+
923
+ resobj->termCode = TIMELIMIT_OR_ITERLIMIT;
924
+ resobj->termIterate = LAST_ITERATE;
925
+
926
+ // todo, pass work
927
+ // cupdlp_twoNorm(problem->cost, ncols, &resobj->dNormCost);
928
+ // twoNorm(problem->rhs, nrows);
929
+
930
+ exit_cleanup:
931
+ return retcode;
932
+ }
933
+
934
+ cupdlp_retcode iterates_Alloc(CUPDLPiterates *iterates, cupdlp_int ncols,
935
+ cupdlp_int nrows) {
936
+ cupdlp_retcode retcode = RETCODE_OK;
937
+
938
+ iterates->nCols = ncols;
939
+ iterates->nRows = nrows;
940
+
941
+ cupdlp_init_zero_vec_double(iterates->xSum, ncols);
942
+ cupdlp_init_zero_vec_double(iterates->ySum, nrows);
943
+ cupdlp_init_zero_vec_double(iterates->xLastRestart, ncols);
944
+ cupdlp_init_zero_vec_double(iterates->yLastRestart, nrows);
945
+
946
+ CUPDLP_INIT_CUPDLP_VEC(iterates->x[0], 1);
947
+ CUPDLP_INIT_CUPDLP_VEC(iterates->x[1], 1);
948
+ CUPDLP_INIT_CUPDLP_VEC(iterates->xAverage, 1);
949
+ CUPDLP_INIT_CUPDLP_VEC(iterates->y[0], 1);
950
+ CUPDLP_INIT_CUPDLP_VEC(iterates->y[1], 1);
951
+ CUPDLP_INIT_CUPDLP_VEC(iterates->yAverage, 1);
952
+ CUPDLP_INIT_CUPDLP_VEC(iterates->ax[0], 1);
953
+ CUPDLP_INIT_CUPDLP_VEC(iterates->ax[1], 1);
954
+ CUPDLP_INIT_CUPDLP_VEC(iterates->axAverage, 1);
955
+ CUPDLP_INIT_CUPDLP_VEC(iterates->aty[0], 1);
956
+ CUPDLP_INIT_CUPDLP_VEC(iterates->aty[1], 1);
957
+ CUPDLP_INIT_CUPDLP_VEC(iterates->atyAverage, 1);
958
+
959
+ CUPDLP_CALL(vec_Alloc(iterates->x[0], ncols));
960
+ CUPDLP_CALL(vec_Alloc(iterates->x[1], ncols));
961
+ CUPDLP_CALL(vec_Alloc(iterates->xAverage, ncols));
962
+ CUPDLP_CALL(vec_Alloc(iterates->y[0], nrows));
963
+ CUPDLP_CALL(vec_Alloc(iterates->y[1], nrows));
964
+ CUPDLP_CALL(vec_Alloc(iterates->yAverage, nrows));
965
+ CUPDLP_CALL(vec_Alloc(iterates->ax[0], nrows));
966
+ CUPDLP_CALL(vec_Alloc(iterates->ax[1], nrows));
967
+ CUPDLP_CALL(vec_Alloc(iterates->axAverage, nrows));
968
+ CUPDLP_CALL(vec_Alloc(iterates->aty[0], ncols));
969
+ CUPDLP_CALL(vec_Alloc(iterates->aty[1], ncols));
970
+ CUPDLP_CALL(vec_Alloc(iterates->atyAverage, ncols));
971
+
972
+ // initialization
973
+ iterates->iLastRestartIter = 0;
974
+ iterates->dLastRestartDualityGap = 0.0;
975
+ iterates->dLastRestartBeta = 0.0;
976
+
977
+ exit_cleanup:
978
+ return retcode;
979
+ }
980
+
981
+ cupdlp_retcode stepsize_Alloc(CUPDLPstepsize *stepsize) {
982
+ cupdlp_retcode retcode = RETCODE_OK;
983
+
984
+ stepsize->eLineSearchMethod = PDHG_ADAPTIVE_LINESEARCH;
985
+
986
+ // initialization
987
+ stepsize->nStepSizeIter = 0;
988
+ stepsize->dPrimalStep = 0.0;
989
+ stepsize->dDualStep = 0.0;
990
+ stepsize->dSumPrimalStep = 0.0;
991
+ stepsize->dSumDualStep = 0.0;
992
+ stepsize->dBeta = 0.0;
993
+ stepsize->dTheta = 0.0;
994
+
995
+ exit_cleanup:
996
+ return retcode;
997
+ }
998
+
999
+ cupdlp_retcode timers_Alloc(CUPDLPtimers *timers) {
1000
+ cupdlp_retcode retcode = RETCODE_OK;
1001
+
1002
+ timers->nIter = 0;
1003
+ timers->dSolvingTime = 0.0;
1004
+ timers->dSolvingBeg = 0.0;
1005
+ timers->dScalingTime = 0.0;
1006
+ timers->dPresolveTime = 0.0;
1007
+
1008
+ #if PDHG_USE_TIMERS
1009
+ timers->dAtyTime = 0.0;
1010
+ timers->dAxTime = 0.0;
1011
+ timers->dComputeResidualsTime = 0.0;
1012
+ timers->dUpdateIterateTime = 0.0;
1013
+ timers->nAtyCalls = 0;
1014
+ timers->nAxCalls = 0;
1015
+ timers->nComputeResidualsCalls = 0;
1016
+ timers->nUpdateIterateCalls = 0;
1017
+ #endif
1018
+ #ifndef CUPDLP_CPU
1019
+ // GPU timers
1020
+ timers->AllocMem_CopyMatToDeviceTime = 0.0;
1021
+ timers->CopyVecToDeviceTime = 0.0;
1022
+ timers->DeviceMatVecProdTime = 0.0;
1023
+ timers->CopyVecToHostTime = 0.0;
1024
+ timers->FreeDeviceMemTime = 0.0;
1025
+ timers->CudaPrepareTime = 0.0;
1026
+ #endif
1027
+
1028
+ exit_cleanup:
1029
+ return retcode;
1030
+ }
1031
+
1032
+ cupdlp_retcode vec_Alloc(CUPDLPvec *vec, cupdlp_int n) {
1033
+ cupdlp_retcode retcode = RETCODE_OK;
1034
+ cupdlp_init_zero_vec_double(vec->data, n);
1035
+ vec->len = n;
1036
+ #ifndef CUPDLP_CPU
1037
+ CHECK_CUSPARSE(
1038
+ cusparseCreateDnVec(&vec->cuda_vec, n, vec->data, CudaComputeType))
1039
+ #endif
1040
+
1041
+ exit_cleanup:
1042
+ return retcode;
1043
+ }
1044
+
1045
+ cupdlp_retcode PDHG_Alloc(CUPDLPwork *w) {
1046
+ cupdlp_retcode retcode = RETCODE_OK;
1047
+
1048
+ CUPDLP_INIT_SETTINGS(w->settings, 1);
1049
+ CUPDLP_INIT_RESOBJ(w->resobj, 1);
1050
+ CUPDLP_INIT_ITERATES(w->iterates, 1);
1051
+ CUPDLP_INIT_STEPSIZE(w->stepsize, 1);
1052
+
1053
+ CUPDLP_INIT_TIMERS(w->timers, 1);
1054
+ CUPDLP_CALL(timers_Alloc(w->timers));
1055
+
1056
+ cupdlp_float begin = getTimeStamp();
1057
+ // buffer
1058
+ CUPDLP_INIT_CUPDLP_VEC(w->buffer, 1);
1059
+ CUPDLP_CALL(vec_Alloc(w->buffer, w->problem->data->nRows));
1060
+
1061
+
1062
+ cupdlp_init_zero_vec_double(w->buffer2,
1063
+ MAX(2048, MAX(w->problem->data->nCols, w->problem->data->nRows)));
1064
+ #if defined(CUPDLP_CPU) || !(USE_KERNELS) || (CUPDLP_DUMP_LINESEARCH_STATS && CUPDLP_DEBUG)
1065
+ cupdlp_init_zero_vec_double(w->buffer3,
1066
+ MAX(2048, MAX(w->problem->data->nCols, w->problem->data->nRows)));
1067
+ #else
1068
+ w->buffer3 = NULL;
1069
+ #endif
1070
+
1071
+ // for scaling
1072
+ cupdlp_init_zero_vec_double(w->colScale, w->problem->data->nCols);
1073
+ cupdlp_init_zero_vec_double(w->rowScale, w->problem->data->nRows);
1074
+
1075
+ CUPDLP_CALL(settings_Alloc(w->settings));
1076
+ CUPDLP_CALL(resobj_Alloc(w->resobj, w->problem, w->problem->data->nCols,
1077
+ w->problem->data->nRows));
1078
+ CUPDLP_CALL(iterates_Alloc(w->iterates, w->problem->data->nCols,
1079
+ w->problem->data->nRows));
1080
+ CUPDLP_CALL(stepsize_Alloc(w->stepsize));
1081
+
1082
+ #ifndef CUPDLP_CPU
1083
+ // CHECK_CUSPARSE(cusparseCreate(&w->cusparsehandle));
1084
+ // CHECK_CUBLAS(cublasCreate(&w->cublashandle));
1085
+ CUPDLP_CALL(cuda_alloc_MVbuffer(
1086
+ // w->problem->data->matrix_format,
1087
+ w->cusparsehandle, w->problem->data->csc_matrix->cuda_csc,
1088
+ w->iterates->x[0]->cuda_vec, w->iterates->ax[0]->cuda_vec,
1089
+ w->problem->data->csr_matrix->cuda_csr, w->iterates->y[0]->cuda_vec,
1090
+ w->iterates->aty[0]->cuda_vec, &w->dBuffer_csc_ATy, &w->dBuffer_csr_Ax))
1091
+ w->timers->AllocMem_CopyMatToDeviceTime += getTimeStamp() - begin;
1092
+ #endif
1093
+
1094
+ exit_cleanup:
1095
+ return retcode;
1096
+ }
1097
+
1098
+ cupdlp_retcode PDHG_Create(CUPDLPwork **ww, CUPDLPproblem *lp,
1099
+ CUPDLPscaling *scaling) {
1100
+ cupdlp_retcode retcode = RETCODE_OK;
1101
+ CUPDLP_INIT_ZERO_CUPDLP_WORK(*ww, 1);
1102
+
1103
+ CUPDLPwork *w = *ww;
1104
+ w->problem = lp;
1105
+ w->scaling = scaling;
1106
+
1107
+ exit_cleanup:
1108
+ return retcode;
1109
+ }
1110
+
1111
+ void PDHG_Destroy(CUPDLPwork **w) {
1112
+ if (w && *w) {
1113
+ PDHG_Clear(*w);
1114
+ }
1115
+ }
1116
+
1117
+ void PDHG_Init_Data(CUPDLPwork *work) {}
1118
+
1119
+ // double my_clock(void) {
1120
+
1121
+ // #ifdef CUPDLP_TIMER
1122
+
1123
+ // #if defined(_WIN32) || defined(_WIN64)
1124
+ // return (double)clock() / CLOCKS_PER_SEC;
1125
+ // #else
1126
+ // struct timeval t;
1127
+ // gettimeofday(&t, NULL);
1128
+ // return (1e-06 * t.tv_usec + t.tv_sec);
1129
+ // #endif
1130
+
1131
+ // #else
1132
+ // return 0;
1133
+ // #endif
1134
+
1135
+ // }
1136
+
1137
+
1138
+ double my_clock(void) {
1139
+ #ifdef CUPDLP_TIMER
1140
+ // struct timeval t;
1141
+ // clock_gettime(&t, NULL);
1142
+ // gettimeofday(&t, NULL);
1143
+ double timeee = 0;
1144
+
1145
+ #ifndef WIN32
1146
+ timeee = time(NULL);
1147
+ #else
1148
+ timeee = clock();
1149
+ #endif
1150
+
1151
+ return timeee;
1152
+ // return (1e-06 * t.tv_usec + t.tv_sec);
1153
+ #else
1154
+ return 0;
1155
+ #endif
1156
+ }
1157
+
1158
+ double getTimeStamp(void) { return my_clock(); }
1159
+
1160
+ void dense_copy(CUPDLPdense *dst, CUPDLPdense *src) {
1161
+ dst->nRows = src->nRows;
1162
+ dst->nCols = src->nCols;
1163
+ cupdlp_copy(dst->data, src->data, cupdlp_float, src->nRows * src->nCols);
1164
+
1165
+ return;
1166
+ }
1167
+
1168
+ void csr_copy(CUPDLPcsr *dst, CUPDLPcsr *src) {
1169
+ dst->nRows = src->nRows;
1170
+ dst->nCols = src->nCols;
1171
+ dst->nMatElem = src->nMatElem;
1172
+ cupdlp_copy(dst->rowMatBeg, src->rowMatBeg, cupdlp_int, src->nRows + 1);
1173
+ cupdlp_copy(dst->rowMatIdx, src->rowMatIdx, cupdlp_int, src->nMatElem);
1174
+ cupdlp_copy(dst->rowMatElem, src->rowMatElem, cupdlp_float, src->nMatElem);
1175
+
1176
+ return;
1177
+ }
1178
+
1179
+ cupdlp_int csc_copy(CUPDLPcsc *dst, CUPDLPcsc *src) {
1180
+ dst->nRows = src->nRows;
1181
+ dst->nCols = src->nCols;
1182
+ dst->nMatElem = src->nMatElem;
1183
+ CUPDLP_COPY_VEC(dst->colMatBeg, src->colMatBeg, cupdlp_int, src->nCols + 1);
1184
+ CUPDLP_COPY_VEC(dst->colMatIdx, src->colMatIdx, cupdlp_int, src->nMatElem);
1185
+ CUPDLP_COPY_VEC(dst->colMatElem, src->colMatElem, cupdlp_float,
1186
+ src->nMatElem);
1187
+
1188
+ #ifndef CUPDLP_CPU
1189
+ // Pointer to GPU csc matrix
1190
+ CHECK_CUSPARSE(cusparseCreateCsc(
1191
+ &dst->cuda_csc, src->nRows, src->nCols, src->nMatElem, dst->colMatBeg,
1192
+ dst->colMatIdx, dst->colMatElem, CUSPARSE_INDEX_32I, CUSPARSE_INDEX_32I,
1193
+ CUSPARSE_INDEX_BASE_ZERO, CudaComputeType));
1194
+ #endif
1195
+
1196
+ return 0;
1197
+ }
1198
+
1199
+ void csr2csc(CUPDLPcsc *csc, CUPDLPcsr *csr) {
1200
+ cupdlp_dcs *cs_csr =
1201
+ cupdlp_dcs_spalloc(csr->nCols, csc->nRows, csc->nMatElem, 1, 0);
1202
+ cupdlp_copy(cs_csr->p, csr->rowMatBeg, cupdlp_int, csr->nRows + 1);
1203
+ cupdlp_copy(cs_csr->i, csr->rowMatIdx, cupdlp_int, csr->nMatElem);
1204
+ cupdlp_copy(cs_csr->x, csr->rowMatElem, cupdlp_float, csr->nMatElem);
1205
+
1206
+ cupdlp_dcs *cs_csc = cupdlp_dcs_transpose(cs_csr, 1);
1207
+ csc->nCols = cs_csc->m;
1208
+ csc->nRows = cs_csc->n;
1209
+ csc->nMatElem = cs_csc->nzmax;
1210
+ cupdlp_copy(csc->colMatBeg, cs_csc->p, cupdlp_int, cs_csc->n + 1);
1211
+ cupdlp_copy(csc->colMatIdx, cs_csc->i, cupdlp_int, cs_csc->nzmax);
1212
+ cupdlp_copy(csc->colMatElem, cs_csc->x, cupdlp_float, cs_csc->nzmax);
1213
+
1214
+ // cupdlp_dcs_free(cs_csc);
1215
+ // cupdlp_dcs_free(cs_csr);
1216
+ cupdlp_dcs_spfree(cs_csc);
1217
+ cupdlp_dcs_spfree(cs_csr);
1218
+
1219
+ return;
1220
+ }
1221
+
1222
+ cupdlp_int csc2csr(CUPDLPcsr *csr, CUPDLPcsc *csc) {
1223
+ // The transpose may need to be done on the GPU
1224
+ // Currently, it is done on the CPU
1225
+
1226
+ cupdlp_dcs *cs_csc =
1227
+ cupdlp_dcs_spalloc(csc->nRows, csc->nCols, csc->nMatElem, 1, 0);
1228
+ cupdlp_copy(cs_csc->p, csc->colMatBeg, cupdlp_int, csc->nCols + 1);
1229
+ cupdlp_copy(cs_csc->i, csc->colMatIdx, cupdlp_int, csc->nMatElem);
1230
+ cupdlp_copy(cs_csc->x, csc->colMatElem, cupdlp_float, csc->nMatElem);
1231
+
1232
+ cupdlp_dcs *cs_csr = cupdlp_dcs_transpose(cs_csc, 1);
1233
+ csr->nCols = cs_csr->m;
1234
+ csr->nRows = cs_csr->n;
1235
+ csr->nMatElem = cs_csr->nzmax;
1236
+ CUPDLP_COPY_VEC(csr->rowMatBeg, cs_csr->p, cupdlp_int, cs_csr->n + 1);
1237
+ CUPDLP_COPY_VEC(csr->rowMatIdx, cs_csr->i, cupdlp_int, cs_csr->nzmax);
1238
+ CUPDLP_COPY_VEC(csr->rowMatElem, cs_csr->x, cupdlp_float, cs_csr->nzmax);
1239
+
1240
+ // cupdlp_dcs_free(cs_csc);
1241
+ // cupdlp_dcs_free(cs_csr);
1242
+ cupdlp_dcs_spfree(cs_csc);
1243
+ cupdlp_dcs_spfree(cs_csr);
1244
+
1245
+ #ifndef CUPDLP_CPU
1246
+ // Pointer to GPU csc matrix
1247
+ CHECK_CUSPARSE(cusparseCreateCsr(
1248
+ &csr->cuda_csr, csr->nRows, csr->nCols, csr->nMatElem, csr->rowMatBeg,
1249
+ csr->rowMatIdx, csr->rowMatElem, CUSPARSE_INDEX_32I, CUSPARSE_INDEX_32I,
1250
+ CUSPARSE_INDEX_BASE_ZERO, CudaComputeType));
1251
+ #endif
1252
+
1253
+ return 0;
1254
+ }
1255
+
1256
+ void dense2csr(CUPDLPcsr *csr, CUPDLPdense *dense) {
1257
+ csr->nRows = dense->nRows;
1258
+ csr->nCols = dense->nCols;
1259
+
1260
+ cupdlp_int nnz = 0;
1261
+ cupdlp_int iCol = 0;
1262
+ cupdlp_int iRow = 0;
1263
+ csr->rowMatBeg[0] = 0;
1264
+ for (iRow = 0; iRow < csr->nRows; ++iRow) {
1265
+ for (iCol = 0; iCol < csr->nCols; ++iCol) {
1266
+ if (dense->data[iCol * csr->nRows + iRow] != 0) {
1267
+ csr->rowMatIdx[nnz] = iCol;
1268
+ csr->rowMatElem[nnz] = dense->data[iCol * csr->nRows + iRow];
1269
+ ++nnz;
1270
+ }
1271
+ }
1272
+ csr->rowMatBeg[iRow + 1] = nnz;
1273
+ }
1274
+ csr->nMatElem = nnz;
1275
+
1276
+ return;
1277
+ }
1278
+
1279
+ void dense2csc(CUPDLPcsc *csc, CUPDLPdense *dense) {
1280
+ csc->nRows = dense->nRows;
1281
+ csc->nCols = dense->nCols;
1282
+
1283
+ cupdlp_int nnz = 0;
1284
+ cupdlp_int iCol = 0;
1285
+ cupdlp_int iRow = 0;
1286
+ csc->colMatBeg[0] = 0;
1287
+ for (iCol = 0; iCol < csc->nCols; ++iCol) {
1288
+ for (iRow = 0; iRow < csc->nRows; ++iRow) {
1289
+ if (dense->data[iCol * csc->nRows + iRow] != 0) {
1290
+ csc->colMatIdx[nnz] = iRow;
1291
+ csc->colMatElem[nnz] = dense->data[iCol * csc->nRows + iRow];
1292
+ ++nnz;
1293
+ }
1294
+ }
1295
+ csc->colMatBeg[iCol + 1] = nnz;
1296
+ }
1297
+
1298
+ csc->nMatElem = nnz;
1299
+
1300
+ return;
1301
+ }
1302
+
1303
+ void csr2dense(CUPDLPdense *dense, CUPDLPcsr *csr) {
1304
+ dense->nRows = csr->nRows;
1305
+ dense->nCols = csr->nCols;
1306
+
1307
+ cupdlp_int iRow = 0;
1308
+ cupdlp_int iCol = 0;
1309
+ cupdlp_int iMatElem = 0;
1310
+ for (iRow = 0; iRow < dense->nRows; ++iRow)
1311
+ for (iCol = 0; iCol < dense->nCols; ++iCol) {
1312
+ if (iCol == csr->rowMatIdx[iMatElem]) {
1313
+ dense->data[iRow * dense->nCols + iCol] = csr->rowMatElem[iMatElem];
1314
+ ++iMatElem;
1315
+ } else {
1316
+ dense->data[iRow * dense->nCols + iCol] = 0;
1317
+ }
1318
+ }
1319
+
1320
+ return;
1321
+ }
1322
+
1323
+ void csc2dense(CUPDLPdense *dense, CUPDLPcsc *csc) {
1324
+ dense->nRows = csc->nRows;
1325
+ dense->nCols = csc->nCols;
1326
+
1327
+ cupdlp_int iRow = 0;
1328
+ cupdlp_int iCol = 0;
1329
+ cupdlp_int iMatElem = 0;
1330
+ for (iCol = 0; iCol < dense->nCols; ++iCol)
1331
+ for (iRow = 0; iRow < dense->nRows; ++iRow) {
1332
+ if (iRow == csc->colMatIdx[iMatElem]) {
1333
+ dense->data[iRow * dense->nCols + iCol] = csc->colMatElem[iMatElem];
1334
+ ++iMatElem;
1335
+ } else {
1336
+ dense->data[iRow * dense->nCols + iCol] = 0;
1337
+ }
1338
+ }
1339
+
1340
+ return;
1341
+ }
1342
+
1343
+ cupdlp_retcode dense_create(CUPDLPdense **dense) {
1344
+ cupdlp_retcode retcode = RETCODE_OK;
1345
+ CUPDLP_INIT_DENSE_MATRIX(*dense, 1);
1346
+
1347
+ exit_cleanup:
1348
+ return retcode;
1349
+ }
1350
+
1351
+ cupdlp_retcode csr_create(CUPDLPcsr **csr) {
1352
+ cupdlp_retcode retcode = RETCODE_OK;
1353
+ CUPDLP_INIT_CSR_MATRIX(*csr, 1);
1354
+
1355
+ exit_cleanup:
1356
+ return retcode;
1357
+ }
1358
+
1359
+ cupdlp_retcode csc_create(CUPDLPcsc **csc) {
1360
+ cupdlp_retcode retcode = RETCODE_OK;
1361
+
1362
+ CUPDLP_INIT_CSC_MATRIX(*csc, 1);
1363
+
1364
+ exit_cleanup:
1365
+ return retcode;
1366
+ }
1367
+
1368
+ cupdlp_retcode dense_alloc_matrix(CUPDLPdense *dense, cupdlp_int nRows,
1369
+ cupdlp_int nCols, void *src,
1370
+ CUPDLP_MATRIX_FORMAT src_matrix_format) {
1371
+ cupdlp_retcode retcode = RETCODE_OK;
1372
+ cupdlp_init_zero_vec_double(dense->data, nRows * nCols);
1373
+
1374
+ switch (src_matrix_format) {
1375
+ case DENSE:
1376
+ dense_copy(dense, (CUPDLPdense *)src);
1377
+ break;
1378
+ case CSR:
1379
+ csr2dense(dense, (CUPDLPcsr *)src);
1380
+ break;
1381
+ case CSC:
1382
+ csc2dense(dense, (CUPDLPcsc *)src);
1383
+ break;
1384
+ default:
1385
+ break;
1386
+ }
1387
+ exit_cleanup:
1388
+ return retcode;
1389
+ }
1390
+
1391
+ cupdlp_retcode csr_alloc_matrix(CUPDLPcsr *csr, cupdlp_int nRows,
1392
+ cupdlp_int nCols, void *src,
1393
+ CUPDLP_MATRIX_FORMAT src_matrix_format) {
1394
+ cupdlp_retcode retcode = RETCODE_OK;
1395
+ cupdlp_int nnz = 0;
1396
+ switch (src_matrix_format) {
1397
+ case DENSE:
1398
+ nnz = nRows * nCols;
1399
+ break;
1400
+ case CSR:
1401
+ nnz = ((CUPDLPcsr *)src)->nMatElem;
1402
+ break;
1403
+ case CSC:
1404
+ nnz = ((CUPDLPcsc *)src)->nMatElem;
1405
+ break;
1406
+ default:
1407
+ break;
1408
+ }
1409
+ // todo make sure this is right
1410
+ cupdlp_init_zero_vec_int(csr->rowMatBeg, nRows + 1);
1411
+ cupdlp_init_zero_vec_int(csr->rowMatIdx, nnz);
1412
+ cupdlp_init_zero_vec_double(csr->rowMatElem, nnz);
1413
+
1414
+ switch (src_matrix_format) {
1415
+ case DENSE:
1416
+ dense2csr(csr, (CUPDLPdense *)src);
1417
+ break;
1418
+ case CSR:
1419
+ csr_copy(csr, (CUPDLPcsr *)src);
1420
+ break;
1421
+ case CSC:
1422
+ csc2csr(csr, (CUPDLPcsc *)src);
1423
+ break;
1424
+ default:
1425
+ break;
1426
+ }
1427
+ exit_cleanup:
1428
+ return retcode;
1429
+ }
1430
+
1431
+ cupdlp_retcode csc_alloc_matrix(CUPDLPcsc *csc, cupdlp_int nRows,
1432
+ cupdlp_int nCols, void *src,
1433
+ CUPDLP_MATRIX_FORMAT src_matrix_format) {
1434
+ cupdlp_retcode retcode = RETCODE_OK;
1435
+ cupdlp_int nnz = 0;
1436
+ switch (src_matrix_format) {
1437
+ case DENSE:
1438
+ nnz = nRows * nCols;
1439
+ break;
1440
+ case CSR:
1441
+ nnz = ((CUPDLPcsr *)src)->nMatElem;
1442
+ break;
1443
+ case CSC:
1444
+ nnz = ((CUPDLPcsc *)src)->nMatElem;
1445
+ break;
1446
+ default:
1447
+ break;
1448
+ }
1449
+
1450
+ cupdlp_init_zero_vec_int(csc->colMatBeg, nCols + 1);
1451
+ cupdlp_init_zero_vec_int(csc->colMatIdx, nnz);
1452
+ cupdlp_init_zero_vec_double(csc->colMatElem, nnz);
1453
+
1454
+ switch (src_matrix_format) {
1455
+ case DENSE:
1456
+ dense2csc(csc, (CUPDLPdense *)src);
1457
+ break;
1458
+ case CSR:
1459
+ csr2csc(csc, (CUPDLPcsr *)src);
1460
+ break;
1461
+ case CSC:
1462
+ csc_copy(csc, (CUPDLPcsc *)src);
1463
+ break;
1464
+ default:
1465
+ break;
1466
+ }
1467
+ exit_cleanup:
1468
+ return retcode;
1469
+ }
1470
+
1471
+ cupdlp_retcode dense_alloc(CUPDLPdense *dense, cupdlp_int nRows,
1472
+ cupdlp_int nCols, cupdlp_float *val) {
1473
+ cupdlp_retcode retcode = RETCODE_OK;
1474
+ dense->nRows = nRows;
1475
+ dense->nCols = nCols;
1476
+ dense->data = cupdlp_NULL;
1477
+ cupdlp_init_zero_vec_double(dense->data, nRows * nCols);
1478
+
1479
+ CUPDLP_COPY_VEC(dense->data, val, cupdlp_float, nRows * nCols);
1480
+ exit_cleanup:
1481
+ return retcode;
1482
+ }
1483
+
1484
+ cupdlp_retcode csr_alloc(CUPDLPcsr *csr, cupdlp_int nRows, cupdlp_int nCols,
1485
+ cupdlp_int nnz, cupdlp_int *row_ptr,
1486
+ cupdlp_int *col_ind, cupdlp_float *val) {
1487
+ cupdlp_retcode retcode = RETCODE_OK;
1488
+ csr->nRows = nRows;
1489
+ csr->nCols = nCols;
1490
+ csr->nMatElem = nnz;
1491
+ csr->rowMatBeg = cupdlp_NULL;
1492
+ csr->rowMatIdx = cupdlp_NULL;
1493
+ csr->rowMatElem = cupdlp_NULL;
1494
+
1495
+ cupdlp_init_zero_vec_int(csr->rowMatBeg, nRows + 1);
1496
+ cupdlp_init_zero_vec_int(csr->rowMatIdx, nnz);
1497
+ cupdlp_init_zero_vec_double(csr->rowMatElem, nnz);
1498
+
1499
+ CUPDLP_COPY_VEC(csr->rowMatBeg, row_ptr, cupdlp_int, nRows + 1);
1500
+ CUPDLP_COPY_VEC(csr->rowMatIdx, col_ind, cupdlp_int, nnz);
1501
+ CUPDLP_COPY_VEC(csr->rowMatElem, val, cupdlp_float, nnz);
1502
+ exit_cleanup:
1503
+ return retcode;
1504
+ }
1505
+
1506
+ cupdlp_retcode csc_alloc(CUPDLPcsc *csc, cupdlp_int nRows, cupdlp_int nCols,
1507
+ cupdlp_int nnz, cupdlp_int *col_ptr,
1508
+ cupdlp_int *row_ind, cupdlp_float *val) {
1509
+ cupdlp_retcode retcode = RETCODE_OK;
1510
+ csc->nRows = nRows;
1511
+ csc->nCols = nCols;
1512
+ csc->nMatElem = nnz;
1513
+ csc->colMatBeg = cupdlp_NULL;
1514
+ csc->colMatIdx = cupdlp_NULL;
1515
+ csc->colMatElem = cupdlp_NULL;
1516
+ cupdlp_init_zero_vec_int(csc->colMatBeg, nCols + 1);
1517
+ cupdlp_init_zero_vec_int(csc->colMatIdx, nnz);
1518
+ cupdlp_init_zero_vec_double(csc->colMatElem, nnz);
1519
+
1520
+ CUPDLP_COPY_VEC(csc->colMatBeg, col_ptr, cupdlp_int, nCols + 1);
1521
+ CUPDLP_COPY_VEC(csc->colMatIdx, row_ind, cupdlp_int, nnz);
1522
+ CUPDLP_COPY_VEC(csc->colMatElem, val, cupdlp_float, nnz);
1523
+ exit_cleanup:
1524
+ return retcode;
1525
+ }
1526
+
1527
+ void vecPrint(const char *s, const cupdlp_float *a, cupdlp_int n) {
1528
+ cupdlp_printf("%s: ", s);
1529
+ for (cupdlp_int i = 0; i < n; ++i) {
1530
+ cupdlp_printf("%.3f ", a[i]);
1531
+ }
1532
+ cupdlp_printf("\n");
1533
+ }
1534
+
1535
+ void vecIntPrint(const char *s, const cupdlp_int *a, cupdlp_int n) {
1536
+ cupdlp_printf("%s: ", s);
1537
+ for (cupdlp_int i = 0; i < n; ++i) {
1538
+ cupdlp_printf("%d ", a[i]);
1539
+ }
1540
+ cupdlp_printf("\n");
1541
+ }
1542
+
1543
+ void PDHG_Dump_Stats(CUPDLPwork *w) {
1544
+ cupdlp_int nCols = w->iterates->nCols;
1545
+ cupdlp_int nRows = w->iterates->nRows;
1546
+ CUPDLPiterates *iterates = w->iterates;
1547
+ CUPDLPstepsize *stepsize = w->stepsize;
1548
+
1549
+ cupdlp_printf("------------------------------------------------\n");
1550
+ cupdlp_printf("Iteration % 3d\n", w->timers->nIter);
1551
+ #if CUPDLP_DUMP_ITERATES
1552
+ cupdlp_int iter = w->timers->nIter;
1553
+ CUPDLPvec *x = iterates->x[iter % 2];
1554
+ CUPDLPvec *y = iterates->y[iter % 2];
1555
+ CUPDLPvec *aty = iterates->aty[iter % 2];
1556
+
1557
+ vecPrint("x", x->data, nCols);
1558
+ vecPrint("y", y->data, nRows);
1559
+ vecPrint("xSum", iterates->xSum, nCols);
1560
+ vecPrint("ySum", iterates->ySum, nRows);
1561
+ vecPrint("Ax ", ax->data, nRows);
1562
+ vecPrint("A'y", aty->data, nCols);
1563
+ vecPrint("xLastRestart", iterates->xLastRestart, nCols);
1564
+ vecPrint("yLastRestart", iterates->yLastRestart, nRows);
1565
+ #endif
1566
+ cupdlp_printf(
1567
+ "PrimalStep: %e, SumPrimalStep: %e, DualStep: %e, SumDualStep: %e\n",
1568
+ stepsize->dPrimalStep, stepsize->dSumPrimalStep, stepsize->dDualStep,
1569
+ stepsize->dSumDualStep);
1570
+ cupdlp_printf("Stepsize: %e, Primal weight: %e Ratio: %e\n",
1571
+ sqrt(stepsize->dPrimalStep * stepsize->dDualStep),
1572
+ sqrt(stepsize->dBeta), stepsize->dTheta);
1573
+ }
1574
+
1575
+ void csrPrintDense(const char *s, CUPDLPcsr *csr) {
1576
+ cupdlp_printf("------------------------------------------------\n");
1577
+ cupdlp_printf("%s:\n", s);
1578
+ cupdlp_int deltaCol = 0;
1579
+ for (cupdlp_int iRow = 0; iRow < csr->nRows; ++iRow) {
1580
+ for (cupdlp_int iElem = csr->rowMatBeg[iRow];
1581
+ iElem < csr->rowMatBeg[iRow + 1]; ++iElem) {
1582
+ if (iElem == csr->rowMatBeg[iRow])
1583
+ deltaCol = csr->rowMatIdx[iElem];
1584
+ else
1585
+ deltaCol = csr->rowMatIdx[iElem] - csr->rowMatIdx[iElem - 1] - 1;
1586
+ for (cupdlp_int i = 0; i < deltaCol; ++i) {
1587
+ cupdlp_printf(" ");
1588
+ }
1589
+ cupdlp_printf("%6.3f ", csr->rowMatElem[iElem]);
1590
+ }
1591
+ cupdlp_printf("\n");
1592
+ }
1593
+ cupdlp_printf("------------------------------------------------\n");
1594
+ }
1595
+
1596
+ void cscPrintDense(const char *s, CUPDLPcsc *csc) {
1597
+ cupdlp_printf("------------------------------------------------\n");
1598
+ cupdlp_printf("%s (Trans):\n", s);
1599
+ cupdlp_int deltaRow = 0;
1600
+ for (cupdlp_int iCol = 0; iCol < csc->nCols; ++iCol) {
1601
+ for (cupdlp_int iElem = csc->colMatBeg[iCol];
1602
+ iElem < csc->colMatBeg[iCol + 1]; ++iElem) {
1603
+ if (iElem == csc->colMatBeg[iCol])
1604
+ deltaRow = csc->colMatIdx[iElem];
1605
+ else
1606
+ deltaRow = csc->colMatIdx[iElem] - csc->colMatIdx[iElem - 1] - 1;
1607
+ for (cupdlp_int i = 0; i < deltaRow; ++i) {
1608
+ cupdlp_printf(" ");
1609
+ }
1610
+ cupdlp_printf("%6.3f ", csc->colMatElem[iElem]);
1611
+ }
1612
+ cupdlp_printf("\n");
1613
+ }
1614
+ cupdlp_printf("------------------------------------------------\n");
1615
+ }
1616
+
1617
+ #ifndef CUPDLP_OUTPUT_NAMES
1618
+ const char *termCodeNames[] = {"OPTIMAL",
1619
+ "INFEASIBLE",
1620
+ "UNBOUNDED",
1621
+ "INFEASIBLE_OR_UNBOUNDED",
1622
+ "TIMELIMIT_OR_ITERLIMIT",
1623
+ "FEASIBLE"};
1624
+ const char *termIterateNames[] = {
1625
+ "LAST_ITERATE",
1626
+ "AVERAGE_ITERATE",
1627
+ };
1628
+ #endif
1629
+
1630
+ void writeJson(const char *fout, CUPDLPwork *work) {
1631
+ FILE *fptr;
1632
+
1633
+ cupdlp_printf("--------------------------------\n");
1634
+ cupdlp_printf("--- saving to %s\n", fout);
1635
+ cupdlp_printf("--------------------------------\n");
1636
+ // Open a file in writing mode
1637
+ fptr = fopen(fout, "w");
1638
+
1639
+ fprintf(fptr, "{");
1640
+
1641
+ // solver
1642
+ fprintf(fptr, "\"solver\":\"%s\",", "cuPDLP-C");
1643
+
1644
+ // timers
1645
+ fprintf(fptr, "\"nIter\":%d,", work->timers->nIter);
1646
+ fprintf(fptr, "\"nAtyCalls\":%d,", work->timers->nAtyCalls);
1647
+ fprintf(fptr, "\"nAxCalls\":%d,", work->timers->nAxCalls);
1648
+ fprintf(fptr, "\"dSolvingBeg\":%f,", work->timers->dSolvingBeg);
1649
+ fprintf(fptr, "\"dSolvingTime\":%f,", work->timers->dSolvingTime);
1650
+ fprintf(fptr, "\"dPresolveTime\":%f,", work->timers->dPresolveTime);
1651
+ fprintf(fptr, "\"dScalingTime\":%f,", work->timers->dScalingTime);
1652
+ #ifndef CUPDLP_CPU
1653
+ fprintf(fptr, "\"AllocMem_CopyMatToDeviceTime\":%f,",
1654
+ work->timers->AllocMem_CopyMatToDeviceTime);
1655
+ fprintf(fptr, "\"CopyVecToDeviceTime\":%f,",
1656
+ work->timers->CopyVecToDeviceTime);
1657
+ fprintf(fptr, "\"CopyVecToHostTime\":%f,", work->timers->CopyVecToHostTime);
1658
+ fprintf(fptr, "\"DeviceMatVecProdTime\":%f,",
1659
+ work->timers->DeviceMatVecProdTime);
1660
+ #endif
1661
+ // residuals
1662
+ fprintf(fptr, "\"dPrimalObj\":%.14f,", work->resobj->dPrimalObj);
1663
+ fprintf(fptr, "\"dDualObj\":%.14f,", work->resobj->dDualObj);
1664
+ fprintf(fptr, "\"dPrimalFeas\":%.14f,", work->resobj->dPrimalFeas);
1665
+ fprintf(fptr, "\"dDualFeas\":%.14f,", work->resobj->dDualFeas);
1666
+ fprintf(fptr, "\"dPrimalObjAverage\":%.14f,",
1667
+ work->resobj->dPrimalObjAverage);
1668
+ fprintf(fptr, "\"dDualObjAverage\":%.14f,", work->resobj->dDualObjAverage);
1669
+ fprintf(fptr, "\"dPrimalFeasAverage\":%.14f,",
1670
+ work->resobj->dPrimalFeasAverage);
1671
+ fprintf(fptr, "\"dDualFeasAverage\":%.14f,", work->resobj->dDualFeasAverage);
1672
+ fprintf(fptr, "\"dDualityGap\":%.14f,", work->resobj->dDualityGap);
1673
+ fprintf(fptr, "\"dDualityGapAverage\":%.14f,",
1674
+ work->resobj->dDualityGapAverage);
1675
+ // fprintf(fptr, "\"dComplementarity\":%.14f,",
1676
+ // work->resobj->dComplementarity); fprintf(fptr,
1677
+ // "\"dComplementarityAverage\":%.14f,",
1678
+ // work->resobj->dComplementarityAverage);
1679
+
1680
+ // todo should this be added to postsolve?
1681
+ // todo, fix dNormCost and this
1682
+ if (work->resobj->termIterate == AVERAGE_ITERATE) {
1683
+ fprintf(fptr, "\"dRelPrimalFeas\":%.14f,",
1684
+ work->resobj->dPrimalFeasAverage / (1.0 + work->scaling->dNormRhs));
1685
+ fprintf(fptr, "\"dRelDualFeas\":%.14f,",
1686
+ work->resobj->dDualFeasAverage / (1.0 + work->scaling->dNormCost));
1687
+ fprintf(fptr, "\"dRelDualityGap\":%.14f,", work->resobj->dRelObjGapAverage);
1688
+ } else {
1689
+ fprintf(fptr, "\"dRelPrimalFeas\":%.14f,",
1690
+ work->resobj->dPrimalFeas / (1.0 + work->scaling->dNormRhs));
1691
+ fprintf(fptr, "\"dRelDualFeas\":%.14f,",
1692
+ work->resobj->dDualFeas / (1.0 + work->scaling->dNormCost));
1693
+ fprintf(fptr, "\"dRelDualityGap\":%.14f,", work->resobj->dRelObjGap);
1694
+ }
1695
+ fprintf(fptr, "\"terminationCode\":\"%s\",",
1696
+ termCodeNames[work->resobj->termCode]);
1697
+ fprintf(fptr, "\"terminationIterate\":\"%s\",",
1698
+ termIterateNames[work->resobj->termIterate]);
1699
+ fprintf(fptr, "\"primalCode\":\"%s\",",
1700
+ termCodeNames[work->resobj->primalCode]);
1701
+ fprintf(fptr, "\"dualCode\":\"%s\",", termCodeNames[work->resobj->dualCode]);
1702
+ fprintf(fptr, "\"terminationInfeasIterate\":\"%s\"",
1703
+ termIterateNames[work->resobj->termInfeasIterate]);
1704
+
1705
+ fprintf(fptr, "}");
1706
+ // Close the file
1707
+ fclose(fptr);
1708
+ }
1709
+
1710
+ void writeSol(const char *fout, cupdlp_int nCols, cupdlp_int nRows,
1711
+ cupdlp_float *col_value, cupdlp_float *col_dual,
1712
+ cupdlp_float *row_value, cupdlp_float *row_dual) {
1713
+ FILE *fptr;
1714
+
1715
+ cupdlp_printf("--------------------------------\n");
1716
+ cupdlp_printf("--- saving sol to %s\n", fout);
1717
+ cupdlp_printf("--------------------------------\n");
1718
+ // Open a file in writing mode
1719
+ fptr = fopen(fout, "w");
1720
+ fprintf(fptr, "{");
1721
+
1722
+ // nCols
1723
+ fprintf(fptr, "\n");
1724
+
1725
+ fprintf(fptr, "\"nCols\": %d", nCols);
1726
+
1727
+ // nRows
1728
+ fprintf(fptr, ",\n");
1729
+
1730
+ fprintf(fptr, "\"nRows\": %d", nRows);
1731
+
1732
+ // col value
1733
+ fprintf(fptr, ",\n");
1734
+
1735
+ fprintf(fptr, "\"col_value\": [");
1736
+ if (col_value && nCols) {
1737
+ for (int i = 0; i < nCols - 1; ++i) {
1738
+ fprintf(fptr, "%.14f,", col_value[i]);
1739
+ }
1740
+ fprintf(fptr, "%.14f", col_value[nCols - 1]);
1741
+ }
1742
+ fprintf(fptr, "]");
1743
+
1744
+ // col dual
1745
+ fprintf(fptr, ",\n");
1746
+ fprintf(fptr, "\"col_dual\": [");
1747
+ if (col_dual && nCols) {
1748
+ for (int i = 0; i < nCols - 1; ++i) {
1749
+ fprintf(fptr, "%.14f,", col_dual[i]);
1750
+ }
1751
+ fprintf(fptr, "%.14f", col_dual[nCols - 1]);
1752
+ }
1753
+ fprintf(fptr, "]");
1754
+
1755
+ // row value
1756
+ fprintf(fptr, ",\n");
1757
+ fprintf(fptr, "\"row_value\": [");
1758
+ if (row_value && nRows) {
1759
+ for (int i = 0; i < nRows - 1; ++i) {
1760
+ fprintf(fptr, "%.14f,", row_value[i]);
1761
+ }
1762
+ fprintf(fptr, "%.14f", row_value[nRows - 1]);
1763
+ }
1764
+ fprintf(fptr, "]");
1765
+
1766
+ // row dual
1767
+ fprintf(fptr, ",\n");
1768
+ fprintf(fptr, "\"row_dual\": [");
1769
+ if (row_dual && nRows) {
1770
+ for (int i = 0; i < nRows - 1; ++i) {
1771
+ fprintf(fptr, "%.14f,", row_dual[i]);
1772
+ }
1773
+ fprintf(fptr, "%.14f", row_dual[nRows - 1]);
1774
+ }
1775
+ fprintf(fptr, "]");
1776
+
1777
+ // end writing
1778
+ fprintf(fptr, "\n");
1779
+ fprintf(fptr, "}");
1780
+
1781
+ // Close the file
1782
+ fclose(fptr);
1783
+ }
1784
+
1785
+ void debugPdlpIterHeaderLog(FILE* file) {
1786
+ if (!file) return;
1787
+ fprintf(file, " Iter ||Ax|| ||Aty|| ||Ax_Avg|| ||Aty_Avg|| ||x_avg|| beta PrimalStep DualStep \n");
1788
+ }
1789
+
1790
+ void debugPdlpDataInitialise(struct DebugPdlpData* debug_pdlp) {
1791
+ debug_pdlp->ax_norm = 0;
1792
+ debug_pdlp->aty_norm = 0;
1793
+ debug_pdlp->ax_average_norm = 0;
1794
+ debug_pdlp->aty_average_norm = 0;
1795
+ debug_pdlp->x_average_norm = 0;
1796
+ }
1797
+
1798
+ void debugPdlpIterLog(FILE* file, const int iter_num, const struct DebugPdlpData* debug_pdlp, const double beta, const double primal_step, const double dual_step) {
1799
+ if (!file) return;
1800
+ fprintf(file, "%6d %16.12g %16.12g %16.12g %16.12g %16.12g %16.12g %16.12g %16.12g\n",
1801
+ iter_num,
1802
+ debug_pdlp->ax_norm,
1803
+ debug_pdlp->aty_norm,
1804
+ debug_pdlp->ax_average_norm,
1805
+ debug_pdlp->aty_average_norm,
1806
+ debug_pdlp->x_average_norm,
1807
+ beta,
1808
+ primal_step,
1809
+ dual_step);
1810
+ }
1811
+
1812
+ void debugPdlpFeasOptLog(FILE* file,
1813
+ const int iter_num,
1814
+ const double primal_obj, const double dual_obj,
1815
+ const double gap, const double primal_feas, const double dual_feas,
1816
+ const char* type) {
1817
+ if (!file) return;
1818
+ fprintf(file,
1819
+ "%6d Feasibility-optimality %s\n"
1820
+ " primal_obj = %16.12g\n"
1821
+ " dual_obj = %16.12g\n"
1822
+ " gap = %16.12g\n"
1823
+ " primal_feas = %16.12g\n"
1824
+ " dual_feas = %16.12g\n",
1825
+ iter_num, type, primal_obj, dual_obj, gap, primal_feas, dual_feas);
1826
+ }
1827
+
1828
+ void debugPdlpRestartLog(FILE* file, const int iter_num, const double current_score, const double average_score) {
1829
+ if (!file) return;
1830
+ fprintf(file, "Restart at iter %6d: Current Score = %.6g, Average Score = %.6g\n", iter_num, current_score, average_score);
1831
+ }
1832
+
1833
+ void debugPdlpRestarScoretLog(FILE* file, const double weight_squared, const double primal_feas,
1834
+ const double dual_feas, const double obj_gap) {
1835
+ if (!file) return;
1836
+ fprintf(file, "Restart Score: Weight^2 = %.6g, Primal Feas = %.6g, Dual Feas = %.6g, Obj Gap = %.6g\n",
1837
+ weight_squared, primal_feas, dual_feas, obj_gap);
1838
+ }
1839
+
1840
+ void debugPdlpFinalSolutionLog(FILE* file, const double* x, int nCols, const double* y, int nRows) {
1841
+ if (!file) return;
1842
+ fprintf(file,"Primal solution (x):\n");
1843
+ for (int i = 0; i < nCols; ++i) {
1844
+ fprintf(file, "x[%d]=%g\n", i, x[i]);
1845
+ }
1846
+ fprintf(file, "Dual solution (y):\n");
1847
+ for (int i = 0; i < nRows; ++i) {
1848
+ fprintf(file, "y[%d]=%g\n", i, y[i]);
1849
+ }
1850
+ }