casadi 3.6.5__cp37-none-manylinux2014_x86_64.whl → 3.6.7__cp37-none-manylinux2014_x86_64.whl

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 (429) hide show
  1. casadi/_casadi.so +0 -0
  2. casadi/casadi.py +739 -308
  3. casadi/cbc +0 -0
  4. casadi/clp +0 -0
  5. casadi/cmake/casadi-config-version.cmake +1 -1
  6. casadi/cmake/highs/highs-config.cmake +6 -13
  7. casadi/cmake/highs/highs-targets-release.cmake +13 -13
  8. casadi/cmake/highs/highs-targets.cmake +13 -10
  9. casadi/highs +0 -0
  10. casadi/include/casadi/casadi.i +3 -0
  11. casadi/include/casadi/casadi_c.h +2 -0
  12. casadi/include/casadi/config.h +8 -8
  13. casadi/include/casadi/core/casadi_common.hpp +1 -0
  14. casadi/include/casadi/core/casadi_misc.hpp +52 -0
  15. casadi/include/casadi/core/casadi_types.hpp +3 -2
  16. casadi/include/casadi/core/code_generator.hpp +30 -1
  17. casadi/include/casadi/core/global_options.hpp +2 -0
  18. casadi/include/casadi/core/mx.hpp +18 -3
  19. casadi/include/casadi/core/optistack.hpp +23 -0
  20. casadi/include/casadi/core/runtime/casadi_nlp.hpp +19 -4
  21. casadi/include/casadi/core/runtime/casadi_ocp_block.hpp +55 -0
  22. casadi/include/casadi/core/runtime/casadi_oracle.hpp +44 -0
  23. casadi/include/casadi/core/runtime/casadi_oracle_callback.hpp +39 -0
  24. casadi/include/casadi/core/runtime/casadi_runtime.hpp +4 -1
  25. casadi/include/casadi/core/runtime/casadi_scaled_copy.hpp +31 -0
  26. casadi/include/casadi/core/serializing_stream.hpp +2 -2
  27. casadi/include/casadi/core/sparsity.hpp +7 -0
  28. casadi/include/casadi/doc.i +1513 -1016
  29. casadi/include/casadi/doc_merged.i +965 -719
  30. casadi/include/casadi/mem.h +1 -0
  31. casadi/include/daqp/api.h +46 -0
  32. casadi/include/daqp/auxiliary.h +29 -0
  33. casadi/include/daqp/bnb.h +32 -0
  34. casadi/include/daqp/codegen.h +18 -0
  35. casadi/include/daqp/constants.h +92 -0
  36. casadi/include/daqp/daqp.h +22 -0
  37. casadi/include/daqp/daqp_prox.h +18 -0
  38. casadi/include/daqp/factorization.h +18 -0
  39. casadi/include/daqp/types.h +161 -0
  40. casadi/include/daqp/utils.h +44 -0
  41. casadi/include/fatrop/auxiliary/Common.hpp +34 -0
  42. casadi/include/fatrop/auxiliary/DynamicLib.hpp +34 -0
  43. casadi/include/fatrop/auxiliary/FatropOptions.hpp +68 -0
  44. casadi/include/fatrop/auxiliary/FatropVector.hpp +143 -0
  45. casadi/include/fatrop/auxiliary/LinearAlgebra.hpp +88 -0
  46. casadi/include/fatrop/auxiliary/VectorUtils.hpp +54 -0
  47. casadi/include/fatrop/blasfeo_wrapper/LinearAlgebraBlasfeo.hpp +493 -0
  48. casadi/include/fatrop/fatrop.hpp +39 -0
  49. casadi/include/fatrop/function_evaluation/CasadiCodegen.hpp +104 -0
  50. casadi/include/fatrop/function_evaluation/FunctionEvaluation.hpp +60 -0
  51. casadi/include/fatrop/json/json.h +946 -0
  52. casadi/include/fatrop/ocp/CasadiCApiUserdataWrap.hpp +87 -0
  53. casadi/include/fatrop/ocp/DuInfEvaluator.hpp +38 -0
  54. casadi/include/fatrop/ocp/FatropOCP.hpp +161 -0
  55. casadi/include/fatrop/ocp/FatropOCPBuilder.hpp +52 -0
  56. casadi/include/fatrop/ocp/FatropOCPResto.hpp +299 -0
  57. casadi/include/fatrop/ocp/OCP.hpp +82 -0
  58. casadi/include/fatrop/ocp/OCPAbstract.hpp +254 -0
  59. casadi/include/fatrop/ocp/OCPAdapter.hpp +197 -0
  60. casadi/include/fatrop/ocp/OCPCInterface.h +289 -0
  61. casadi/include/fatrop/ocp/OCPDims.hpp +60 -0
  62. casadi/include/fatrop/ocp/OCPInitializer.hpp +41 -0
  63. casadi/include/fatrop/ocp/OCPKKT.hpp +69 -0
  64. casadi/include/fatrop/ocp/OCPLSRiccati.hpp +198 -0
  65. casadi/include/fatrop/ocp/OCPLSScaler.hpp +66 -0
  66. casadi/include/fatrop/ocp/OCPLinearSolver.hpp +75 -0
  67. casadi/include/fatrop/ocp/OCPNoScaling.hpp +42 -0
  68. casadi/include/fatrop/ocp/OCPScalingMethod.hpp +42 -0
  69. casadi/include/fatrop/ocp/StageOCP.hpp +592 -0
  70. casadi/include/fatrop/ocp/StageOCPApplication.hpp +242 -0
  71. casadi/include/fatrop/ocp/StageOCPExpressions.hpp +182 -0
  72. casadi/include/fatrop/ocp/UStageEvalAbstract.hpp +168 -0
  73. casadi/include/fatrop/ocp/UStageOCPImpl.hpp +152 -0
  74. casadi/include/fatrop/quasi_newton/bfgs.hpp +159 -0
  75. casadi/include/fatrop/solver/AlgBuilder.hpp +76 -0
  76. casadi/include/fatrop/solver/AlgStrategy.hpp +33 -0
  77. casadi/include/fatrop/solver/FatropAlg.hpp +121 -0
  78. casadi/include/fatrop/solver/FatropData.hpp +188 -0
  79. casadi/include/fatrop/solver/FatropOptions.hpp +95 -0
  80. casadi/include/fatrop/solver/FatropPrinter.hpp +65 -0
  81. casadi/include/fatrop/solver/FatropStats.hpp +63 -0
  82. casadi/include/fatrop/solver/Filter.hpp +54 -0
  83. casadi/include/fatrop/solver/IterationData.hpp +56 -0
  84. casadi/include/fatrop/solver/LineSearch.hpp +86 -0
  85. casadi/include/fatrop/solver/NLPL1.hpp +263 -0
  86. casadi/include/fatrop/templates/NLPAlg.hpp +104 -0
  87. casadi/include/highs/HConfig.h +6 -5
  88. casadi/include/highs/Highs.h +93 -23
  89. casadi/include/highs/filereaderlp/def.hpp +19 -0
  90. casadi/include/highs/interfaces/highs_c_api.h +200 -24
  91. casadi/include/highs/io/Filereader.h +1 -1
  92. casadi/include/highs/io/FilereaderEms.h +1 -1
  93. casadi/include/highs/io/FilereaderLp.h +1 -1
  94. casadi/include/highs/io/FilereaderMps.h +1 -1
  95. casadi/include/highs/io/HMPSIO.h +1 -1
  96. casadi/include/highs/io/HMpsFF.h +5 -3
  97. casadi/include/highs/io/HighsIO.h +18 -8
  98. casadi/include/highs/io/LoadOptions.h +1 -1
  99. casadi/include/highs/ipm/IpxSolution.h +35 -0
  100. casadi/include/highs/ipm/IpxWrapper.h +1 -1
  101. casadi/include/highs/ipm/basiclu/basiclu.h +161 -0
  102. casadi/include/highs/ipm/basiclu/basiclu_factorize.h +247 -0
  103. casadi/include/highs/ipm/basiclu/basiclu_get_factors.h +108 -0
  104. casadi/include/highs/ipm/basiclu/basiclu_initialize.h +119 -0
  105. casadi/include/highs/ipm/basiclu/basiclu_obj_factorize.h +34 -0
  106. casadi/include/highs/ipm/basiclu/basiclu_obj_free.h +19 -0
  107. casadi/include/highs/ipm/basiclu/basiclu_obj_get_factors.h +34 -0
  108. casadi/include/highs/ipm/basiclu/basiclu_obj_initialize.h +46 -0
  109. casadi/include/highs/ipm/basiclu/basiclu_obj_solve_dense.h +29 -0
  110. casadi/include/highs/ipm/basiclu/basiclu_obj_solve_for_update.h +42 -0
  111. casadi/include/highs/ipm/basiclu/basiclu_obj_solve_sparse.h +32 -0
  112. casadi/include/highs/ipm/basiclu/basiclu_obj_update.h +31 -0
  113. casadi/include/highs/ipm/basiclu/basiclu_object.h +30 -0
  114. casadi/include/highs/ipm/basiclu/basiclu_solve_dense.h +75 -0
  115. casadi/include/highs/ipm/basiclu/basiclu_solve_for_update.h +169 -0
  116. casadi/include/highs/ipm/basiclu/basiclu_solve_sparse.h +112 -0
  117. casadi/include/highs/ipm/basiclu/basiclu_update.h +125 -0
  118. casadi/include/highs/ipm/basiclu/lu_def.h +39 -0
  119. casadi/include/highs/ipm/basiclu/lu_file.h +21 -0
  120. casadi/include/highs/ipm/basiclu/lu_internal.h +220 -0
  121. casadi/include/highs/ipm/basiclu/lu_list.h +168 -0
  122. casadi/include/highs/ipm/ipx/basiclu_kernel.h +20 -0
  123. casadi/include/highs/ipm/ipx/basiclu_wrapper.h +47 -0
  124. casadi/include/highs/ipm/ipx/basis.h +351 -0
  125. casadi/include/highs/ipm/ipx/conjugate_residuals.h +74 -0
  126. casadi/include/highs/ipm/ipx/control.h +163 -0
  127. casadi/include/highs/ipm/ipx/crossover.h +157 -0
  128. casadi/include/highs/ipm/ipx/diagonal_precond.h +45 -0
  129. casadi/include/highs/ipm/ipx/forrest_tomlin.h +102 -0
  130. casadi/include/highs/ipm/ipx/guess_basis.h +21 -0
  131. casadi/include/highs/ipm/ipx/indexed_vector.h +113 -0
  132. casadi/include/highs/ipm/ipx/info.h +27 -0
  133. casadi/include/highs/ipm/ipx/ipm.h +94 -0
  134. casadi/include/highs/ipm/ipx/ipx_c.h +47 -0
  135. casadi/include/highs/ipm/ipx/ipx_config.h +9 -0
  136. casadi/include/highs/ipm/ipx/ipx_info.h +111 -0
  137. casadi/include/highs/ipm/ipx/ipx_internal.h +88 -0
  138. casadi/include/highs/ipm/ipx/ipx_parameters.h +75 -0
  139. casadi/include/highs/ipm/ipx/ipx_status.h +57 -0
  140. casadi/include/highs/ipm/ipx/iterate.h +328 -0
  141. casadi/include/highs/ipm/ipx/kkt_solver.h +70 -0
  142. casadi/include/highs/ipm/ipx/kkt_solver_basis.h +66 -0
  143. casadi/include/highs/ipm/ipx/kkt_solver_diag.h +48 -0
  144. casadi/include/highs/ipm/ipx/linear_operator.h +26 -0
  145. casadi/include/highs/ipm/ipx/lp_solver.h +201 -0
  146. casadi/include/highs/ipm/ipx/lu_factorization.h +79 -0
  147. casadi/include/highs/ipm/ipx/lu_update.h +129 -0
  148. casadi/include/highs/ipm/ipx/maxvolume.h +54 -0
  149. casadi/include/highs/ipm/ipx/model.h +409 -0
  150. casadi/include/highs/ipm/ipx/multistream.h +52 -0
  151. casadi/include/highs/ipm/ipx/normal_matrix.h +44 -0
  152. casadi/include/highs/ipm/ipx/power_method.h +44 -0
  153. casadi/include/highs/ipm/ipx/sparse_matrix.h +195 -0
  154. casadi/include/highs/ipm/ipx/sparse_utils.h +58 -0
  155. casadi/include/highs/ipm/ipx/splitted_normal_matrix.h +63 -0
  156. casadi/include/highs/ipm/ipx/starting_basis.h +39 -0
  157. casadi/include/highs/ipm/ipx/symbolic_invert.h +29 -0
  158. casadi/include/highs/ipm/ipx/timer.h +24 -0
  159. casadi/include/highs/ipm/ipx/utils.h +39 -0
  160. casadi/include/highs/lp_data/HConst.h +20 -10
  161. casadi/include/highs/lp_data/HStruct.h +23 -1
  162. casadi/include/highs/lp_data/HighsAnalysis.h +1 -1
  163. casadi/include/highs/lp_data/HighsCallback.h +10 -3
  164. casadi/include/highs/lp_data/HighsCallbackStruct.h +31 -5
  165. casadi/include/highs/lp_data/HighsDebug.h +1 -1
  166. casadi/include/highs/lp_data/HighsInfo.h +20 -2
  167. casadi/include/highs/lp_data/HighsInfoDebug.h +1 -1
  168. casadi/include/highs/lp_data/HighsLp.h +17 -1
  169. casadi/include/highs/lp_data/HighsLpSolverObject.h +1 -1
  170. casadi/include/highs/lp_data/HighsLpUtils.h +19 -19
  171. casadi/include/highs/lp_data/HighsModelUtils.h +1 -1
  172. casadi/include/highs/lp_data/HighsOptions.h +237 -10
  173. casadi/include/highs/lp_data/HighsRanging.h +1 -1
  174. casadi/include/highs/lp_data/HighsRuntimeOptions.h +2 -2
  175. casadi/include/highs/lp_data/HighsSolution.h +2 -2
  176. casadi/include/highs/lp_data/HighsSolutionDebug.h +1 -1
  177. casadi/include/highs/lp_data/HighsSolve.h +3 -1
  178. casadi/include/highs/lp_data/HighsStatus.h +1 -1
  179. casadi/include/highs/mip/HighsCliqueTable.h +4 -4
  180. casadi/include/highs/mip/HighsConflictPool.h +1 -1
  181. casadi/include/highs/mip/HighsCutGeneration.h +1 -1
  182. casadi/include/highs/mip/HighsCutPool.h +2 -2
  183. casadi/include/highs/mip/HighsDebugSol.h +22 -29
  184. casadi/include/highs/mip/HighsDomain.h +10 -2
  185. casadi/include/highs/mip/HighsDomainChange.h +1 -1
  186. casadi/include/highs/mip/HighsDynamicRowMatrix.h +5 -3
  187. casadi/include/highs/mip/HighsGFkSolve.h +3 -3
  188. casadi/include/highs/mip/HighsImplications.h +3 -3
  189. casadi/include/highs/mip/HighsLpAggregator.h +1 -1
  190. casadi/include/highs/mip/HighsLpRelaxation.h +6 -1
  191. casadi/include/highs/mip/HighsMipSolver.h +4 -2
  192. casadi/include/highs/mip/HighsMipSolverData.h +47 -4
  193. casadi/include/highs/mip/HighsModkSeparator.h +2 -2
  194. casadi/include/highs/mip/HighsNodeQueue.h +5 -3
  195. casadi/include/highs/mip/HighsObjectiveFunction.h +1 -1
  196. casadi/include/highs/mip/HighsPathSeparator.h +2 -2
  197. casadi/include/highs/mip/HighsPrimalHeuristics.h +1 -1
  198. casadi/include/highs/mip/HighsPseudocost.h +35 -23
  199. casadi/include/highs/mip/HighsRedcostFixing.h +1 -1
  200. casadi/include/highs/mip/HighsSearch.h +2 -1
  201. casadi/include/highs/mip/HighsSeparation.h +1 -1
  202. casadi/include/highs/mip/HighsSeparator.h +1 -1
  203. casadi/include/highs/mip/HighsTableauSeparator.h +1 -1
  204. casadi/include/highs/mip/HighsTransformedLp.h +1 -1
  205. casadi/include/highs/model/HighsHessian.h +5 -0
  206. casadi/include/highs/model/HighsHessianUtils.h +2 -0
  207. casadi/include/highs/model/HighsModel.h +10 -1
  208. casadi/include/highs/parallel/HighsMutex.h +2 -1
  209. casadi/include/highs/parallel/HighsParallel.h +7 -2
  210. casadi/include/highs/parallel/HighsTask.h +1 -2
  211. casadi/include/highs/pdlp/CupdlpWrapper.h +93 -0
  212. casadi/include/highs/pdlp/cupdlp/cupdlp_cs.h +41 -0
  213. casadi/include/highs/pdlp/cupdlp/cupdlp_defs.h +423 -0
  214. casadi/include/highs/pdlp/cupdlp/cupdlp_linalg.h +183 -0
  215. casadi/include/highs/pdlp/cupdlp/cupdlp_proj.h +19 -0
  216. casadi/include/highs/pdlp/cupdlp/cupdlp_restart.h +31 -0
  217. casadi/include/highs/pdlp/cupdlp/cupdlp_scaling_cuda.h +28 -0
  218. casadi/include/highs/pdlp/cupdlp/cupdlp_solver.h +98 -0
  219. casadi/include/highs/pdlp/cupdlp/cupdlp_step.h +33 -0
  220. casadi/include/highs/pdlp/cupdlp/cupdlp_utils.c +1726 -0
  221. casadi/include/highs/pdqsort/pdqsort.h +532 -0
  222. casadi/include/highs/presolve/HPresolve.h +27 -14
  223. casadi/include/highs/presolve/HPresolveAnalysis.h +1 -1
  224. casadi/include/highs/presolve/HighsPostsolveStack.h +92 -68
  225. casadi/include/highs/presolve/HighsSymmetry.h +6 -5
  226. casadi/include/highs/presolve/ICrash.h +8 -2
  227. casadi/include/highs/presolve/ICrashUtil.h +1 -1
  228. casadi/include/highs/presolve/ICrashX.h +1 -1
  229. casadi/include/highs/presolve/PresolveComponent.h +1 -1
  230. casadi/include/highs/qpsolver/a_asm.hpp +23 -12
  231. casadi/include/highs/qpsolver/a_quass.hpp +8 -1
  232. casadi/include/highs/qpsolver/basis.hpp +150 -0
  233. casadi/include/highs/qpsolver/crashsolution.hpp +12 -0
  234. casadi/include/highs/qpsolver/dantzigpricing.hpp +72 -0
  235. casadi/include/highs/qpsolver/devexpricing.hpp +99 -0
  236. casadi/include/highs/qpsolver/eventhandler.hpp +23 -0
  237. casadi/include/highs/qpsolver/factor.hpp +400 -0
  238. casadi/include/highs/qpsolver/feasibility_bounded.hpp +105 -0
  239. casadi/include/highs/qpsolver/feasibility_highs.hpp +270 -0
  240. casadi/include/highs/qpsolver/gradient.hpp +39 -0
  241. casadi/include/highs/qpsolver/instance.hpp +63 -0
  242. casadi/include/highs/qpsolver/matrix.hpp +335 -0
  243. casadi/include/highs/qpsolver/pricing.hpp +15 -0
  244. casadi/include/highs/qpsolver/qpconst.hpp +27 -0
  245. casadi/include/highs/qpsolver/{vector.hpp → qpvector.hpp} +25 -25
  246. casadi/include/highs/qpsolver/quass.hpp +1 -1
  247. casadi/include/highs/qpsolver/ratiotest.hpp +19 -0
  248. casadi/include/highs/qpsolver/runtime.hpp +38 -0
  249. casadi/include/highs/qpsolver/settings.hpp +57 -0
  250. casadi/include/highs/qpsolver/snippets.hpp +29 -0
  251. casadi/include/highs/qpsolver/statistics.hpp +23 -0
  252. casadi/include/highs/qpsolver/steepestedgepricing.hpp +167 -0
  253. casadi/include/highs/simplex/HApp.h +1 -1
  254. casadi/include/highs/simplex/HEkk.h +52 -18
  255. casadi/include/highs/simplex/HEkkDual.h +1 -1
  256. casadi/include/highs/simplex/HEkkDualRHS.h +6 -7
  257. casadi/include/highs/simplex/HEkkDualRow.h +2 -2
  258. casadi/include/highs/simplex/HEkkPrimal.h +6 -1
  259. casadi/include/highs/simplex/HSimplex.h +1 -3
  260. casadi/include/highs/simplex/HSimplexDebug.h +1 -1
  261. casadi/include/highs/simplex/HSimplexNla.h +1 -1
  262. casadi/include/highs/simplex/HSimplexReport.h +1 -1
  263. casadi/include/highs/simplex/HighsSimplexAnalysis.h +228 -100
  264. casadi/include/highs/simplex/SimplexConst.h +1 -1
  265. casadi/include/highs/simplex/SimplexStruct.h +2 -2
  266. casadi/include/highs/simplex/SimplexTimer.h +1 -1
  267. casadi/include/highs/test/DevKkt.h +1 -1
  268. casadi/include/highs/test/KktCh2.h +1 -1
  269. casadi/include/highs/util/FactorTimer.h +1 -1
  270. casadi/include/highs/util/HFactor.h +35 -6
  271. casadi/include/highs/util/HFactorConst.h +1 -1
  272. casadi/include/highs/util/HFactorDebug.h +1 -1
  273. casadi/include/highs/util/HSet.h +1 -1
  274. casadi/include/highs/util/HVector.h +1 -1
  275. casadi/include/highs/util/HVectorBase.h +1 -1
  276. casadi/include/highs/util/HighsCDouble.h +3 -3
  277. casadi/include/highs/util/HighsComponent.h +1 -1
  278. casadi/include/highs/util/HighsDataStack.h +4 -4
  279. casadi/include/highs/util/HighsDisjointSets.h +1 -1
  280. casadi/include/highs/util/HighsHash.h +28 -21
  281. casadi/include/highs/util/HighsHashTree.h +63 -63
  282. casadi/include/highs/util/HighsInt.h +1 -1
  283. casadi/include/highs/util/HighsIntegers.h +8 -9
  284. casadi/include/highs/util/HighsLinearSumBounds.h +1 -1
  285. casadi/include/highs/util/HighsMatrixPic.h +1 -1
  286. casadi/include/highs/util/HighsMatrixSlice.h +9 -6
  287. casadi/include/highs/util/HighsMatrixUtils.h +1 -1
  288. casadi/include/highs/util/HighsMemoryAllocation.h +55 -0
  289. casadi/include/highs/util/HighsRandom.h +27 -15
  290. casadi/include/highs/util/HighsRbTree.h +2 -2
  291. casadi/include/highs/util/HighsSort.h +7 -7
  292. casadi/include/highs/util/HighsSparseMatrix.h +5 -2
  293. casadi/include/highs/util/HighsSparseVectorSum.h +2 -2
  294. casadi/include/highs/util/HighsSplay.h +1 -1
  295. casadi/include/highs/util/HighsTimer.h +18 -9
  296. casadi/include/highs/util/HighsUtils.h +15 -8
  297. casadi/include/highs/util/stringutil.h +9 -4
  298. casadi/include/highs/zstr/strict_fstream.hpp +237 -0
  299. casadi/include/highs/zstr/zstr.hpp +472 -0
  300. casadi/include/highs_export.h +42 -0
  301. casadi/include/licenses/daqp-external/LICENSE +21 -0
  302. casadi/include/licenses/fatrop-external/LICENSE.txt +165 -0
  303. casadi/include/licenses/fatrop-external/external/blasfeo/LICENSE.txt +26 -0
  304. casadi/include/licenses/fatrop-external/external/pybind11/LICENSE +29 -0
  305. casadi/include/licenses/highs-external/{LICENSE → LICENSE.txt} +1 -1
  306. casadi/include/osqp/constants.h +2 -3
  307. casadi/include/osqp/version.h +9 -0
  308. casadi/include/sleqp/defs.h +2 -2
  309. casadi/lib64/libtinyxml2.a +0 -0
  310. casadi/libCbcSolver.so +0 -0
  311. casadi/libCbcSolver.so.3 +0 -0
  312. casadi/libCbcSolver.so.3.10.11 +0 -0
  313. casadi/libClpSolver.so +0 -0
  314. casadi/libClpSolver.so.1 +0 -0
  315. casadi/libClpSolver.so.1.14.9 +0 -0
  316. casadi/libbonmin.so +0 -0
  317. casadi/libbonmin.so.4 +0 -0
  318. casadi/libbonmin.so.4.8.9 +0 -0
  319. casadi/libcasadi.so +0 -0
  320. casadi/libcasadi.so.3.7 +0 -0
  321. casadi/libcasadi_conic_cbc.so +0 -0
  322. casadi/libcasadi_conic_cbc.so.3.7 +0 -0
  323. casadi/libcasadi_conic_clp.so +0 -0
  324. casadi/libcasadi_conic_clp.so.3.7 +0 -0
  325. casadi/libcasadi_conic_cplex.so +0 -0
  326. casadi/libcasadi_conic_cplex.so.3.7 +0 -0
  327. casadi/libcasadi_conic_daqp.so +0 -0
  328. casadi/libcasadi_conic_daqp.so.3.7 +0 -0
  329. casadi/libcasadi_conic_fatrop.so +0 -0
  330. casadi/libcasadi_conic_fatrop.so.3.7 +0 -0
  331. casadi/libcasadi_conic_gurobi.so +0 -0
  332. casadi/libcasadi_conic_gurobi.so.3.7 +0 -0
  333. casadi/libcasadi_conic_highs.so +0 -0
  334. casadi/libcasadi_conic_highs.so.3.7 +0 -0
  335. casadi/libcasadi_conic_hpipm.so +0 -0
  336. casadi/libcasadi_conic_hpipm.so.3.7 +0 -0
  337. casadi/libcasadi_conic_ipqp.so +0 -0
  338. casadi/libcasadi_conic_ipqp.so.3.7 +0 -0
  339. casadi/libcasadi_conic_nlpsol.so +0 -0
  340. casadi/libcasadi_conic_nlpsol.so.3.7 +0 -0
  341. casadi/libcasadi_conic_osqp.so +0 -0
  342. casadi/libcasadi_conic_osqp.so.3.7 +0 -0
  343. casadi/libcasadi_conic_proxqp.so +0 -0
  344. casadi/libcasadi_conic_proxqp.so.3.7 +0 -0
  345. casadi/libcasadi_conic_qpoases.so +0 -0
  346. casadi/libcasadi_conic_qpoases.so.3.7 +0 -0
  347. casadi/libcasadi_conic_qrqp.so +0 -0
  348. casadi/libcasadi_conic_qrqp.so.3.7 +0 -0
  349. casadi/libcasadi_conic_superscs.so +0 -0
  350. casadi/libcasadi_conic_superscs.so.3.7 +0 -0
  351. casadi/libcasadi_integrator_collocation.so +0 -0
  352. casadi/libcasadi_integrator_collocation.so.3.7 +0 -0
  353. casadi/libcasadi_integrator_cvodes.so +0 -0
  354. casadi/libcasadi_integrator_cvodes.so.3.7 +0 -0
  355. casadi/libcasadi_integrator_idas.so +0 -0
  356. casadi/libcasadi_integrator_idas.so.3.7 +0 -0
  357. casadi/libcasadi_integrator_rk.so +0 -0
  358. casadi/libcasadi_integrator_rk.so.3.7 +0 -0
  359. casadi/libcasadi_nlpsol_alpaqa.so +0 -0
  360. casadi/libcasadi_nlpsol_alpaqa.so.3.7 +0 -0
  361. casadi/libcasadi_nlpsol_ampl.so +0 -0
  362. casadi/libcasadi_nlpsol_ampl.so.3.7 +0 -0
  363. casadi/libcasadi_nlpsol_blocksqp.so +0 -0
  364. casadi/libcasadi_nlpsol_blocksqp.so.3.7 +0 -0
  365. casadi/libcasadi_nlpsol_bonmin.so +0 -0
  366. casadi/libcasadi_nlpsol_bonmin.so.3.7 +0 -0
  367. casadi/libcasadi_nlpsol_fatrop.so +0 -0
  368. casadi/libcasadi_nlpsol_fatrop.so.3.7 +0 -0
  369. casadi/libcasadi_nlpsol_feasiblesqpmethod.so +0 -0
  370. casadi/libcasadi_nlpsol_feasiblesqpmethod.so.3.7 +0 -0
  371. casadi/libcasadi_nlpsol_ipopt.so +0 -0
  372. casadi/libcasadi_nlpsol_ipopt.so.3.7 +0 -0
  373. casadi/libcasadi_nlpsol_knitro.so +0 -0
  374. casadi/libcasadi_nlpsol_knitro.so.3.7 +0 -0
  375. casadi/libcasadi_nlpsol_madnlp.so +0 -0
  376. casadi/libcasadi_nlpsol_madnlp.so.3.7 +0 -0
  377. casadi/libcasadi_nlpsol_qrsqp.so +0 -0
  378. casadi/libcasadi_nlpsol_qrsqp.so.3.7 +0 -0
  379. casadi/libcasadi_nlpsol_scpgen.so +0 -0
  380. casadi/libcasadi_nlpsol_scpgen.so.3.7 +0 -0
  381. casadi/libcasadi_nlpsol_sleqp.so +0 -0
  382. casadi/libcasadi_nlpsol_sleqp.so.3.7 +0 -0
  383. casadi/libcasadi_nlpsol_snopt.so +0 -0
  384. casadi/libcasadi_nlpsol_snopt.so.3.7 +0 -0
  385. casadi/libcasadi_nlpsol_sqpmethod.so +0 -0
  386. casadi/libcasadi_nlpsol_sqpmethod.so.3.7 +0 -0
  387. casadi/libcasadi_nlpsol_worhp.so +0 -0
  388. casadi/libcasadi_nlpsol_worhp.so.3.7 +0 -0
  389. casadi/libcasadi_rootfinder_fast_newton.so +0 -0
  390. casadi/libcasadi_rootfinder_fast_newton.so.3.7 +0 -0
  391. casadi/libcasadi_rootfinder_kinsol.so +0 -0
  392. casadi/libcasadi_rootfinder_kinsol.so.3.7 +0 -0
  393. casadi/libcasadi_rootfinder_newton.so +0 -0
  394. casadi/libcasadi_rootfinder_newton.so.3.7 +0 -0
  395. casadi/libcasadi_rootfinder_nlpsol.so +0 -0
  396. casadi/libcasadi_rootfinder_nlpsol.so.3.7 +0 -0
  397. casadi/libcasadi_sundials_common.so +0 -0
  398. casadi/libcasadi_sundials_common.so.3.7 +0 -0
  399. casadi/libcoinmetis.la +1 -1
  400. casadi/libcoinmetis.so +0 -0
  401. casadi/libcoinmetis.so.2 +0 -0
  402. casadi/libcoinmetis.so.2.0.0 +0 -0
  403. casadi/libdaqp.so +0 -0
  404. casadi/libdaqpstat.a +0 -0
  405. casadi/libfatrop.so +0 -0
  406. casadi/libhighs.so +0 -0
  407. casadi/libhighs.so.1 +0 -0
  408. casadi/libhighs.so.1.7.2 +0 -0
  409. casadi/libindirect.a +0 -0
  410. casadi/liblinsys.a +0 -0
  411. casadi/libmatlab_ipc.so +0 -0
  412. casadi/libosqp.a +0 -0
  413. casadi/libosqp.so +0 -0
  414. casadi/libqdldl.a +0 -0
  415. casadi/libsleqp.so +0 -0
  416. casadi/libsleqp.so.1.0.1 +0 -0
  417. casadi/libspral.a +0 -0
  418. casadi/libsuperscs.a +0 -0
  419. casadi/pkgconfig/casadi.pc +1 -1
  420. casadi/pkgconfig/highs.pc +1 -1
  421. casadi/tools/__init__.py +4 -0
  422. casadi/tools/bounds.py +3 -3
  423. {casadi-3.6.5.dist-info → casadi-3.6.7.dist-info}/METADATA +2 -2
  424. {casadi-3.6.5.dist-info → casadi-3.6.7.dist-info}/RECORD +425 -255
  425. casadi/include/highs/fortran/highs_fortran_api.mod +0 -0
  426. casadi/libFortranHighs.so +0 -0
  427. casadi/libhighs.so.1.6 +0 -0
  428. casadi/libhighs.so.1.6.0 +0 -0
  429. {casadi-3.6.5.dist-info → casadi-3.6.7.dist-info}/WHEEL +0 -0
@@ -0,0 +1,270 @@
1
+ #ifndef __SRC_LIB_FEASIBILITYHIGHS_HPP__
2
+ #define __SRC_LIB_FEASIBILITYHIGHS_HPP__
3
+
4
+ #include "Highs.h"
5
+ #include "qpsolver/a_asm.hpp"
6
+ #include "qpsolver/crashsolution.hpp"
7
+
8
+ static void computeStartingPointHighs(Instance& instance,
9
+ Settings& settings,
10
+ Statistics& stats,
11
+ QpModelStatus& modelstatus,
12
+ QpHotstartInformation& result,
13
+ HighsModelStatus& highs_model_status,
14
+ HighsBasis& highs_basis,
15
+ HighsSolution& highs_solution,
16
+ HighsTimer& timer) {
17
+ bool have_starting_point = false;
18
+ const bool debug_report = false;
19
+ if (highs_solution.value_valid) {
20
+ // #1350 add primal_feasibility_tolerance to settings
21
+ const double primal_feasibility_tolerance = settings.lambda_zero_threshold;
22
+
23
+ HighsInt num_var_infeasibilities = 0;
24
+ double max_var_infeasibility = 0;
25
+ double sum_var_infeasibilities = 0;
26
+ HighsInt num_con_infeasibilities = 0;
27
+ double max_con_infeasibility = 0;
28
+ double sum_con_infeasibilities = 0;
29
+ double max_con_residual = 0;
30
+ double sum_con_residuals = 0;
31
+
32
+ assessQpPrimalFeasibility(instance, primal_feasibility_tolerance,
33
+ highs_solution.col_value, highs_solution.row_value,
34
+ num_var_infeasibilities, max_var_infeasibility, sum_var_infeasibilities,
35
+ num_con_infeasibilities, max_con_infeasibility, sum_con_infeasibilities,
36
+ max_con_residual, sum_con_residuals);
37
+
38
+ if (debug_report) printf("computeStartingPointHighs highs_solution has (num / max / sum) "
39
+ "var (%d / %g / %g) and "
40
+ "con (%d / %g / %g) infeasibilities "
41
+ "with (max = %g; sum = %g) residuals\n",
42
+ int(num_var_infeasibilities), max_var_infeasibility, sum_var_infeasibilities,
43
+ int(num_con_infeasibilities), max_con_infeasibility, sum_con_infeasibilities,
44
+ max_con_residual, sum_con_residuals);
45
+ have_starting_point =
46
+ num_var_infeasibilities == 0 &&
47
+ num_con_infeasibilities == 0 &&
48
+ highs_basis.valid;
49
+ }
50
+ // compute initial feasible point
51
+ HighsBasis use_basis;
52
+ HighsSolution use_solution;
53
+ if (have_starting_point) {
54
+ use_basis = highs_basis;
55
+ use_solution = highs_solution;
56
+ } else {
57
+ Highs highs;
58
+
59
+ // set HiGHS to be silent
60
+ highs.setOptionValue("output_flag", false);
61
+
62
+ highs.setOptionValue("presolve", "on");
63
+
64
+ highs.setOptionValue("time_limit", settings.time_limit -
65
+ timer.readRunHighsClock());
66
+
67
+ HighsLp lp;
68
+ lp.a_matrix_.index_ = instance.A.mat.index;
69
+ lp.a_matrix_.start_ = instance.A.mat.start;
70
+ lp.a_matrix_.value_ = instance.A.mat.value;
71
+ lp.a_matrix_.format_ = MatrixFormat::kColwise;
72
+ lp.col_cost_.assign(instance.num_var, 0.0);
73
+ // lp.col_cost_ = runtime.instance.c.value;
74
+ lp.col_lower_ = instance.var_lo;
75
+ lp.col_upper_ = instance.var_up;
76
+ lp.row_lower_ = instance.con_lo;
77
+ lp.row_upper_ = instance.con_up;
78
+ lp.num_col_ = instance.num_var;
79
+ lp.num_row_ = instance.num_con;
80
+
81
+ // create artificial bounds for free variables: false by default
82
+ assert(!settings.phase1boundfreevars);
83
+ if (settings.phase1boundfreevars) {
84
+ for (HighsInt i=0; i<instance.num_var; i++) {
85
+ if (isfreevar(instance, i)) {
86
+ lp.col_lower_[i] = -1E5;
87
+ lp.col_upper_[i] = 1E5;
88
+ }
89
+ }
90
+ }
91
+
92
+ highs.passModel(lp);
93
+ // Make free variables basic: false by default
94
+ assert(!settings.phase1movefreevarsbasic);
95
+ if (settings.phase1movefreevarsbasic) {
96
+ HighsBasis basis;
97
+ basis.alien = true; // Set true when basis is instantiated
98
+ for (HighsInt i = 0; i < instance.num_con; i++) {
99
+ basis.row_status.push_back(HighsBasisStatus::kNonbasic);
100
+ }
101
+
102
+ for (HighsInt i = 0; i < instance.num_var; i++) {
103
+ // make free variables basic
104
+ if (instance.var_lo[i] == -kHighsInf &&
105
+ instance.var_up[i] == kHighsInf) {
106
+ // free variable
107
+ basis.col_status.push_back(HighsBasisStatus::kBasic);
108
+ } else {
109
+ basis.col_status.push_back(HighsBasisStatus::kNonbasic);
110
+ }
111
+ }
112
+
113
+ highs.setBasis(basis);
114
+
115
+ highs.setOptionValue("simplex_strategy", kSimplexStrategyPrimal);
116
+ }
117
+
118
+ HighsStatus status = highs.run();
119
+ if (status != HighsStatus::kOk) {
120
+ modelstatus = QpModelStatus::kError;
121
+ return;
122
+ }
123
+
124
+ stats.phase1_iterations = highs.getInfo().simplex_iteration_count;
125
+
126
+ HighsModelStatus phase1stat = highs.getModelStatus();
127
+ if (phase1stat == HighsModelStatus::kInfeasible) {
128
+ modelstatus = QpModelStatus::kInfeasible;
129
+ return;
130
+ }
131
+
132
+ use_basis = highs.getBasis();
133
+ use_solution = highs.getSolution();
134
+ }
135
+
136
+ HighsInt num_small_x0 = 0;
137
+ HighsInt num_small_ra = 0;
138
+ const double zero_activity_tolerance = have_starting_point ? 0 : 1e-4;
139
+ QpVector x0(instance.num_var);
140
+ QpVector ra(instance.num_con);
141
+ for (HighsInt i = 0; i < x0.dim; i++) {
142
+ if (fabs(use_solution.col_value[i]) > zero_activity_tolerance) {
143
+ x0.value[i] = use_solution.col_value[i];
144
+ x0.index[x0.num_nz++] = i;
145
+ } else if (fabs(use_solution.col_value[i]) > 0) {
146
+ num_small_x0++;
147
+ }
148
+ }
149
+
150
+ for (HighsInt i = 0; i < ra.dim; i++) {
151
+ if (fabs(use_solution.row_value[i]) > zero_activity_tolerance) {
152
+ ra.value[i] = use_solution.row_value[i];
153
+ ra.index[ra.num_nz++] = i;
154
+ } else if (fabs(use_solution.row_value[i]) > 0) {
155
+ num_small_ra++;
156
+ }
157
+ }
158
+ if (debug_report && num_small_x0+num_small_ra)
159
+ printf("feasibility_highs has %d small col values and %d small row values\n",
160
+ int(num_small_x0), int(num_small_ra));
161
+ std::vector<HighsInt> initial_active;
162
+ std::vector<HighsInt> initial_inactive;
163
+ std::vector<BasisStatus> initial_status;
164
+
165
+ const HighsInt num_highs_basis_status = HighsInt(HighsBasisStatus::kNonbasic)+1;
166
+ std::vector<HighsInt> debug_row_status_count;
167
+ debug_row_status_count.assign(num_highs_basis_status, 0);
168
+ for (HighsInt i = 0; i < HighsInt(use_basis.row_status.size()); i++) {
169
+ HighsBasisStatus status = use_basis.row_status[i];
170
+ debug_row_status_count[HighsInt(status)]++;
171
+ if (status == HighsBasisStatus::kLower) {
172
+ initial_active.push_back(i);
173
+ initial_status.push_back(BasisStatus::kActiveAtLower);
174
+ } else if (status == HighsBasisStatus::kUpper) {
175
+ initial_active.push_back(i);
176
+ initial_status.push_back(BasisStatus::kActiveAtUpper);
177
+ } else if (status == HighsBasisStatus::kZero) {
178
+ // Shouldn't happen, since free rows are basic in a logical
179
+ // basis and remain basic, or are removed by presolve and
180
+ // restored as basic in postsolve
181
+ assert(111==222);
182
+ // That said, a free row that is nonbasic in the Highs basis
183
+ // must be counted as inactive in the QP basis for accounting
184
+ // purposes
185
+ initial_inactive.push_back(i);
186
+ } else if (status != HighsBasisStatus::kBasic) {
187
+ assert(status == HighsBasisStatus::kNonbasic);
188
+ // Surely an error, but not a problem before, since simplex
189
+ // solver cannot return a HighsBasisStatus::kNonbasic
190
+ // variable. Does matter now, since a saved QP basis will
191
+ // generally have such variables.
192
+ //
193
+ // initial_inactive.push_back(instance.num_con + i);
194
+ //
195
+ // A HighsBasisStatus::kNonbasic variable corresponds one-to-one
196
+ // with being inactive in the QP basis
197
+ initial_inactive.push_back(i);
198
+ } else {
199
+ assert(status == HighsBasisStatus::kBasic);
200
+ }
201
+ }
202
+
203
+ std::vector<HighsInt> debug_col_status_count;
204
+ debug_col_status_count.assign(num_highs_basis_status, 0);
205
+ for (HighsInt i = 0; i < HighsInt(use_basis.col_status.size()); i++) {
206
+ HighsBasisStatus status = use_basis.col_status[i];
207
+ debug_col_status_count[HighsInt(status)]++;
208
+ if (status == HighsBasisStatus::kLower) {
209
+ if (isfreevar(instance, i)) {
210
+ initial_inactive.push_back(instance.num_con + i);
211
+ } else {
212
+ initial_active.push_back(instance.num_con + i);
213
+ initial_status.push_back(BasisStatus::kActiveAtLower);
214
+ }
215
+
216
+ } else if (status == HighsBasisStatus::kUpper) {
217
+ if (isfreevar(instance, i)) {
218
+ initial_inactive.push_back(instance.num_con + i);
219
+ } else {
220
+ initial_active.push_back(instance.num_con + i);
221
+ initial_status.push_back(BasisStatus::kActiveAtUpper);
222
+ }
223
+
224
+ } else if (status == HighsBasisStatus::kZero) {
225
+ initial_inactive.push_back(instance.num_con + i);
226
+ } else if (status != HighsBasisStatus::kBasic) {
227
+ assert(status == HighsBasisStatus::kNonbasic);
228
+ initial_inactive.push_back(instance.num_con + i);
229
+ } else {
230
+ assert(status == HighsBasisStatus::kBasic);
231
+ }
232
+ }
233
+
234
+ if (debug_report) {
235
+ printf("QP solver initial basis: (Lo / Bs / Up / Ze / Nb) for cols (");
236
+ for (HighsInt k = 0; k < num_highs_basis_status; k++)
237
+ printf("%s%d", k==0 ? "" : " / ", int(debug_col_status_count[k]));
238
+ printf(") and rows (");
239
+ for (HighsInt k = 0; k < num_highs_basis_status; k++)
240
+ printf("%s%d", k==0 ? "" : " / ", int(debug_row_status_count[k]));
241
+ printf(")\n");
242
+ }
243
+
244
+ assert((HighsInt)(initial_active.size() + initial_inactive.size()) ==
245
+ instance.num_var);
246
+
247
+ if (!have_starting_point) {
248
+ // When starting from a feasible basis, there will generally be
249
+ // inactive variables in the basis that aren't free
250
+ for (HighsInt ia : initial_inactive) {
251
+ if (ia < instance.num_con) {
252
+ // printf("free row %d\n", (int)ia);
253
+ assert(instance.con_lo[ia] == -kHighsInf);
254
+ assert(instance.con_up[ia] == kHighsInf);
255
+ } else {
256
+ // printf("free col %d\n", (int)ia);
257
+ assert(instance.var_lo[ia - instance.num_con] == -kHighsInf);
258
+ assert(instance.var_up[ia - instance.num_con] == kHighsInf);
259
+ }
260
+ }
261
+ }
262
+
263
+ result.status = initial_status;
264
+ result.active = initial_active;
265
+ result.inactive = initial_inactive;
266
+ result.primal = x0;
267
+ result.rowact = ra;
268
+ }
269
+
270
+ #endif
@@ -0,0 +1,39 @@
1
+ #ifndef __SRC_LIB_GRADIENT_HPP__
2
+ #define __SRC_LIB_GRADIENT_HPP__
3
+
4
+ #include "runtime.hpp"
5
+ #include "qpvector.hpp"
6
+
7
+ class Gradient {
8
+ Runtime& runtime;
9
+
10
+ QpVector gradient;
11
+ bool uptodate;
12
+ HighsInt numupdates = 0;
13
+
14
+ public:
15
+ Gradient(Runtime& rt)
16
+ : runtime(rt), gradient(QpVector(rt.instance.num_var)), uptodate(false) {}
17
+
18
+ void recompute() {
19
+ runtime.instance.Q.vec_mat(runtime.primal, gradient);
20
+ gradient += runtime.instance.c;
21
+ uptodate = true;
22
+ numupdates = 0;
23
+ }
24
+
25
+ QpVector& getGradient() {
26
+ if (!uptodate ||
27
+ numupdates >= runtime.settings.gradientrecomputefrequency) {
28
+ recompute();
29
+ }
30
+ return gradient;
31
+ }
32
+
33
+ void update(QpVector& buffer_Qp, double stepsize) {
34
+ gradient.saxpy(stepsize, buffer_Qp);
35
+ numupdates++;
36
+ }
37
+ };
38
+
39
+ #endif
@@ -0,0 +1,63 @@
1
+ #ifndef __SRC_LIB_INSTANCE_HPP__
2
+ #define __SRC_LIB_INSTANCE_HPP__
3
+
4
+ #include <vector>
5
+
6
+ #include "matrix.hpp"
7
+ #include "qpvector.hpp"
8
+
9
+ struct SumNum {
10
+ double sum = 0.0;
11
+ HighsInt num = 0;
12
+ };
13
+
14
+ struct Instance {
15
+ HighsInt sense = 1; // Minimization
16
+ HighsInt num_var = 0;
17
+ HighsInt num_con = 0;
18
+ double offset = 0;
19
+ QpVector c;
20
+ Matrix Q;
21
+ std::vector<double> con_lo;
22
+ std::vector<double> con_up;
23
+ Matrix A;
24
+ std::vector<double> var_lo;
25
+ std::vector<double> var_up;
26
+
27
+ Instance(HighsInt nv = 0, HighsInt nc = 0)
28
+ : num_var(nv),
29
+ num_con(nc),
30
+ c(QpVector(nv)),
31
+ Q(Matrix(nv, nv)),
32
+ A(Matrix(nc, nv)) {}
33
+
34
+ double objval(const QpVector& x) {
35
+ return c * x + 0.5 * (Q.vec_mat(x) * x) + offset;
36
+ }
37
+
38
+ SumNum sumnumprimalinfeasibilities(const QpVector& x,
39
+ const QpVector& rowactivity) {
40
+ SumNum res;
41
+ for (HighsInt row = 0; row < num_con; row++) {
42
+ if (rowactivity.value[row] < con_lo[row]) {
43
+ res.sum += (con_lo[row] - rowactivity.value[row]);
44
+ res.num++;
45
+ } else if (rowactivity.value[row] > con_up[row]) {
46
+ res.sum += (rowactivity.value[row] - con_up[row]);
47
+ res.num++;
48
+ }
49
+ }
50
+ for (HighsInt var = 0; var < num_var; var++) {
51
+ if (x.value[var] < var_lo[var]) {
52
+ res.sum += (var_lo[var] - x.value[var]);
53
+ res.num++;
54
+ } else if (x.value[var] > var_up[var]) {
55
+ res.sum += (x.value[var] - var_up[var]);
56
+ res.num++;
57
+ }
58
+ }
59
+ return res;
60
+ }
61
+ };
62
+
63
+ #endif
@@ -0,0 +1,335 @@
1
+ #ifndef __SRC_LIB_MATRIX_HPP__
2
+ #define __SRC_LIB_MATRIX_HPP__
3
+
4
+ #include <cassert>
5
+ #include <vector>
6
+
7
+ #include "qpvector.hpp"
8
+
9
+ struct MatrixBase {
10
+ HighsInt num_row;
11
+ HighsInt num_col;
12
+ std::vector<HighsInt> start;
13
+ std::vector<HighsInt> index;
14
+ std::vector<double> value;
15
+
16
+ QpVector& mat_vec(const QpVector& other, QpVector& target) const {
17
+ return mat_vec_seq(other, target);
18
+ }
19
+
20
+ QpVector& mat_vec_seq(const QpVector& other, QpVector& target) const {
21
+ target.reset();
22
+ for (HighsInt i = 0; i < other.num_nz; i++) {
23
+ HighsInt col = other.index[i];
24
+ for (HighsInt idx = start[col]; idx < start[col + 1]; idx++) {
25
+ HighsInt row = index[idx];
26
+ target.value[row] += value[idx] * other.value[col];
27
+ }
28
+ }
29
+ target.resparsify();
30
+ return target;
31
+ }
32
+
33
+ QpVector mat_vec(const QpVector& other) {
34
+ QpVector result(num_row);
35
+ mat_vec(other, result);
36
+ return result;
37
+ }
38
+
39
+ QpVector vec_mat(HighsInt* idx, double* val, HighsInt nnz) {
40
+ QpVector result(num_col);
41
+ for (HighsInt i = 0; i < num_col; i++) {
42
+ double dot = 0.0;
43
+ // HighsInt idx_other = 0;
44
+ // HighsInt idx_this = start[i];
45
+ // while (idx_this < start[i+1] && idx_other < nnz) {
46
+ // if (idx[idx_other] == index[idx_this]) {
47
+ // dot += val[idx_other] * value[idx_this];
48
+ // } else if (idx[idx_other] < index[idx_this]) {
49
+ // idx_other++;
50
+ // } else {
51
+ // idx_this++;
52
+ // }
53
+ // }
54
+
55
+ for (HighsInt j = start[i]; j < start[i + 1]; j++) {
56
+ // does the vector have an entry for index index[j]?
57
+ double other_value = 0.0;
58
+ for (HighsInt k = 0; k < nnz; k++) {
59
+ if (idx[k] == index[j]) {
60
+ other_value = val[k];
61
+ break;
62
+ }
63
+ }
64
+
65
+ dot += other_value * value[j];
66
+ }
67
+
68
+ if (dot != 0.0) {
69
+ result.value[i] = dot;
70
+ result.index[result.num_nz] = i;
71
+ result.num_nz++;
72
+ }
73
+ }
74
+ return result;
75
+ }
76
+
77
+ QpVector& vec_mat(const QpVector& other, QpVector& target) const {
78
+ return vec_mat_1(other, target);
79
+ }
80
+
81
+ QpVector& vec_mat_1(const QpVector& other, QpVector& target) const {
82
+ target.reset();
83
+ for (HighsInt col = 0; col < num_col; col++) {
84
+ double dot = 0.0;
85
+ for (HighsInt j = start[col]; j < start[col + 1]; j++) {
86
+ dot += other.value[index[j]] * value[j];
87
+ }
88
+ target.value[col] = dot;
89
+ }
90
+
91
+ target.resparsify();
92
+ return target;
93
+ }
94
+
95
+ QpVector vec_mat(const QpVector& other) const {
96
+ QpVector result(num_col);
97
+
98
+ return vec_mat(other, result);
99
+ }
100
+
101
+ // computes this * mat, where "this" is a tranposed matrix
102
+ MatrixBase tran_mat_(const MatrixBase& other) {
103
+ MatrixBase res;
104
+ res.num_row = num_col;
105
+ res.num_col = other.num_col;
106
+
107
+ res.start.push_back(0);
108
+ QpVector buffer_col(other.num_row);
109
+ QpVector buffer_col_res(num_col);
110
+ for (HighsInt r = 0; r < other.num_col; r++) {
111
+ other.extractcol(r, buffer_col);
112
+
113
+ vec_mat(buffer_col, buffer_col_res);
114
+ for (HighsInt i = 0; i < buffer_col_res.num_nz; i++) {
115
+ res.index.push_back(buffer_col_res.index[i]);
116
+ res.value.push_back(buffer_col_res.value[buffer_col_res.index[i]]);
117
+ }
118
+ res.start.push_back(res.start[r] + buffer_col_res.num_nz);
119
+ }
120
+
121
+ return res;
122
+ }
123
+
124
+ QpVector& extractcol(HighsInt col, QpVector& target) const {
125
+ assert(target.dim == num_row);
126
+ target.reset();
127
+
128
+ if (col >= num_col) {
129
+ target.index[0] = col - num_col;
130
+ target.value[col - num_col] = 1.0;
131
+ target.num_nz = 1;
132
+ } else {
133
+ for (HighsInt i = 0; i < start[col + 1] - start[col]; i++) {
134
+ target.index[i] = index[start[col] + i];
135
+ target.value[target.index[i]] = value[start[col] + i];
136
+ }
137
+ target.num_nz = start[col + 1] - start[col];
138
+ }
139
+
140
+ return target;
141
+ }
142
+
143
+ QpVector extractcol(HighsInt col) const {
144
+ QpVector res(num_row);
145
+
146
+ return extractcol(col, res);
147
+ }
148
+ };
149
+
150
+ struct Matrix {
151
+ private:
152
+ MatrixBase tran;
153
+ bool has_transpose = false;
154
+
155
+ void transpose() {
156
+ if (!has_transpose) {
157
+ std::vector<std::vector<HighsInt>> row_indices(mat.num_row);
158
+ std::vector<std::vector<double>> row_values(mat.num_row);
159
+
160
+ for (HighsInt col = 0; col < mat.num_col; col++) {
161
+ for (HighsInt entry = mat.start[col]; entry < mat.start[col + 1];
162
+ entry++) {
163
+ HighsInt row = mat.index[entry];
164
+ double val = mat.value[entry];
165
+ row_indices[row].push_back(col);
166
+ row_values[row].push_back(val);
167
+ }
168
+ }
169
+ tran.start.clear();
170
+ tran.index.clear();
171
+ tran.value.clear();
172
+ tran.start.reserve(mat.num_row + 1);
173
+ tran.index.reserve(mat.index.size());
174
+ tran.value.reserve(mat.value.size());
175
+
176
+ tran.start.push_back(0);
177
+ for (HighsInt row = 0; row < mat.num_row; row++) {
178
+ tran.index.insert(tran.index.end(), row_indices[row].begin(),
179
+ row_indices[row].end());
180
+ tran.value.insert(tran.value.end(), row_values[row].begin(),
181
+ row_values[row].end());
182
+
183
+ tran.start.push_back(tran.start[row] + row_indices[row].size());
184
+ }
185
+
186
+ tran.num_col = mat.num_row;
187
+ tran.num_row = mat.num_col;
188
+ }
189
+ }
190
+
191
+ public:
192
+ MatrixBase mat;
193
+
194
+ Matrix(HighsInt nr, HighsInt nc) {
195
+ mat.num_row = nr;
196
+ mat.num_col = nc;
197
+ };
198
+
199
+ Matrix(const MatrixBase& m, bool needstran) {
200
+ mat = m;
201
+ // if (needstran) {
202
+ // transpose();
203
+ // }
204
+ }
205
+
206
+ void append(const QpVector& vec) {
207
+ if (mat.num_col == 0 && mat.start.size() == 0) {
208
+ mat.start.push_back(0);
209
+ }
210
+ for (HighsInt i = 0; i < vec.num_nz; i++) {
211
+ mat.index.push_back(vec.index[i]);
212
+ mat.value.push_back(vec.value[vec.index[i]]);
213
+ }
214
+ mat.start.push_back(mat.start[mat.num_col] + vec.num_nz);
215
+ mat.num_col++;
216
+ has_transpose = false;
217
+ }
218
+
219
+ void append(HighsInt* idx, double* val, HighsInt nnz) {
220
+ if (mat.num_col == 0 && mat.start.size() == 0) {
221
+ mat.start.push_back(0);
222
+ }
223
+ for (HighsInt i = 0; i < nnz; i++) {
224
+ mat.index.push_back(idx[i]);
225
+ mat.value.push_back(val[i]);
226
+ }
227
+ mat.start.push_back(mat.start[mat.num_col] + nnz);
228
+ mat.num_col++;
229
+ has_transpose = false;
230
+ }
231
+
232
+ void append(HighsInt num_nz, HighsInt* index, double* value) {
233
+ if (mat.num_col == 0 && mat.start.size() == 0) {
234
+ mat.start.push_back(0);
235
+ }
236
+ for (HighsInt i = 0; i < num_nz; i++) {
237
+ mat.index.push_back(index[i]);
238
+ mat.value.push_back(value[i]);
239
+ }
240
+ mat.start.push_back(mat.start[mat.num_col] + num_nz);
241
+ mat.num_col++;
242
+ has_transpose = false;
243
+ }
244
+
245
+ void dropcol(HighsInt col) {
246
+ assert(col < mat.num_col);
247
+ has_transpose = false;
248
+
249
+ mat.index.erase(mat.index.begin() + mat.start[col],
250
+ mat.index.begin() + mat.start[col + 1]);
251
+ mat.value.erase(mat.value.begin() + mat.start[col],
252
+ mat.value.begin() + mat.start[col + 1]);
253
+
254
+ HighsInt num_elements_in_col = mat.start[col + 1] - mat.start[col];
255
+ for (; col < mat.num_col; col++) {
256
+ mat.start[col] = mat.start[col + 1] - num_elements_in_col;
257
+ }
258
+ mat.start.pop_back();
259
+ mat.num_col--;
260
+ }
261
+
262
+ MatrixBase& t() {
263
+ if (!has_transpose) {
264
+ transpose();
265
+ has_transpose = true;
266
+ }
267
+ return tran;
268
+ }
269
+
270
+ Matrix mat_mat(Matrix& other) {
271
+ Matrix res(mat.num_row, 0);
272
+
273
+ QpVector buffer(other.mat.num_row);
274
+ QpVector buffer2(mat.num_col);
275
+ for (HighsInt col = 0; col < other.mat.num_col; col++) {
276
+ res.append(vec_mat(other.mat.extractcol(col, buffer), buffer2));
277
+ }
278
+
279
+ return res;
280
+ }
281
+
282
+ Matrix tran_mat(Matrix& other) {
283
+ Matrix res(mat.num_col, 0);
284
+
285
+ QpVector buffer(other.mat.num_row);
286
+ QpVector buffer2(mat.num_row);
287
+ for (HighsInt col = 0; col < other.mat.num_col; col++) {
288
+ res.append(mat_vec(other.mat.extractcol(col, buffer), buffer2));
289
+ }
290
+ return res;
291
+ }
292
+
293
+ QpVector& mat_vec(const QpVector& other, QpVector& target) {
294
+ return mat.mat_vec(other, target);
295
+ }
296
+
297
+ QpVector mat_vec(const QpVector& other) { return mat.mat_vec(other); }
298
+
299
+ QpVector vec_mat(const QpVector& other) const { return mat.vec_mat(other); }
300
+
301
+ QpVector& vec_mat(const QpVector& other, QpVector& target) const {
302
+ return mat.vec_mat(other, target);
303
+ }
304
+
305
+ QpVector vec_mat(HighsInt* index, double* value, HighsInt num_nz) {
306
+ return mat.vec_mat(index, value, num_nz);
307
+ }
308
+
309
+ void report(std::string name = "") const {
310
+ if (name != "") {
311
+ printf("%s:", name.c_str());
312
+ }
313
+ printf("[%" HIGHSINT_FORMAT " x %" HIGHSINT_FORMAT "]\n", mat.num_row,
314
+ mat.num_col);
315
+ printf("start: ");
316
+ for (HighsInt i : mat.start) {
317
+ printf("%" HIGHSINT_FORMAT " ", i);
318
+ }
319
+ printf("\n");
320
+
321
+ printf("index: ");
322
+ for (HighsInt i : mat.index) {
323
+ printf("%" HIGHSINT_FORMAT " ", i);
324
+ }
325
+ printf("\n");
326
+
327
+ printf("value: ");
328
+ for (double d : mat.value) {
329
+ printf("%lf ", d);
330
+ }
331
+ printf("\n");
332
+ }
333
+ };
334
+
335
+ #endif