lpsolver 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +70 -26
- data/ext/lpsolver/Makefile +273 -0
- data/ext/lpsolver/ext.c +353 -0
- data/ext/lpsolver/ext.o +0 -0
- data/ext/lpsolver/extconf.rb +79 -0
- data/ext/lpsolver/native.so +0 -0
- data/ext/lpsolver-highs/AUTHORS +7 -0
- data/ext/lpsolver-highs/BUILD.bazel +243 -0
- data/ext/lpsolver-highs/CITATION.cff +29 -0
- data/ext/lpsolver-highs/CMakeCache.txt +406 -0
- data/ext/lpsolver-highs/CMakeFiles/3.31.4/CMakeCCompiler.cmake +81 -0
- data/ext/lpsolver-highs/CMakeFiles/3.31.4/CMakeCXXCompiler.cmake +101 -0
- data/ext/lpsolver-highs/CMakeFiles/3.31.4/CMakeDetermineCompilerABI_C.bin +0 -0
- data/ext/lpsolver-highs/CMakeFiles/3.31.4/CMakeDetermineCompilerABI_CXX.bin +0 -0
- data/ext/lpsolver-highs/CMakeFiles/3.31.4/CMakeSystem.cmake +15 -0
- data/ext/lpsolver-highs/CMakeFiles/3.31.4/CompilerIdC/CMakeCCompilerId.c +904 -0
- data/ext/lpsolver-highs/CMakeFiles/3.31.4/CompilerIdC/a.out +0 -0
- data/ext/lpsolver-highs/CMakeFiles/3.31.4/CompilerIdCXX/CMakeCXXCompilerId.cpp +919 -0
- data/ext/lpsolver-highs/CMakeFiles/3.31.4/CompilerIdCXX/a.out +0 -0
- data/ext/lpsolver-highs/CMakeFiles/CMakeConfigureLog.yaml +576 -0
- data/ext/lpsolver-highs/CMakeFiles/cmake.check_cache +1 -0
- data/ext/lpsolver-highs/CMakeLists.txt +983 -0
- data/ext/lpsolver-highs/CODE_OF_CONDUCT.md +128 -0
- data/ext/lpsolver-highs/CONTRIBUTING.md +31 -0
- data/ext/lpsolver-highs/FEATURES.md +61 -0
- data/ext/lpsolver-highs/LICENSE.txt +21 -0
- data/ext/lpsolver-highs/MODULE.bazel +38 -0
- data/ext/lpsolver-highs/README.md +281 -0
- data/ext/lpsolver-highs/THIRD_PARTY_NOTICES.md +78 -0
- data/ext/lpsolver-highs/Version.txt +4 -0
- data/ext/lpsolver-highs/WORKSPACE +33 -0
- data/ext/lpsolver-highs/app/CMakeLists.txt +110 -0
- data/ext/lpsolver-highs/app/HighsRuntimeOptions.h +292 -0
- data/ext/lpsolver-highs/app/RunHighs.cpp +147 -0
- data/ext/lpsolver-highs/app/highs_webdemo_shell.html +73 -0
- data/ext/lpsolver-highs/build/bin/highs +0 -0
- data/ext/lpsolver-highs/build/include/highs/HConfig.h +22 -0
- data/ext/lpsolver-highs/build/include/highs/Highs.h +1812 -0
- data/ext/lpsolver-highs/build/include/highs/interfaces/highs_c_api.h +2651 -0
- data/ext/lpsolver-highs/build/include/highs/io/Filereader.h +45 -0
- data/ext/lpsolver-highs/build/include/highs/io/FilereaderLp.h +49 -0
- data/ext/lpsolver-highs/build/include/highs/io/FilereaderMps.h +27 -0
- data/ext/lpsolver-highs/build/include/highs/io/HMPSIO.h +78 -0
- data/ext/lpsolver-highs/build/include/highs/io/HMpsFF.h +245 -0
- data/ext/lpsolver-highs/build/include/highs/io/HighsIO.h +118 -0
- data/ext/lpsolver-highs/build/include/highs/io/LoadOptions.h +24 -0
- data/ext/lpsolver-highs/build/include/highs/io/filereaderlp/builder.hpp +25 -0
- data/ext/lpsolver-highs/build/include/highs/io/filereaderlp/def.hpp +19 -0
- data/ext/lpsolver-highs/build/include/highs/io/filereaderlp/model.hpp +68 -0
- data/ext/lpsolver-highs/build/include/highs/io/filereaderlp/reader.hpp +10 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/IpxSolution.h +32 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/IpxWrapper.h +106 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu.h +161 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_factorize.h +247 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_get_factors.h +108 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_initialize.h +119 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_factorize.h +34 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_free.h +19 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_get_factors.h +34 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_initialize.h +46 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_solve_dense.h +29 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_solve_for_update.h +42 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_solve_sparse.h +32 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_obj_update.h +31 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_object.h +30 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_solve_dense.h +75 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_solve_for_update.h +169 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_solve_sparse.h +112 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/basiclu_update.h +125 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/lu_def.h +39 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/lu_file.h +21 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/lu_internal.h +220 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/basiclu/lu_list.h +173 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/basiclu_kernel.h +20 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/basiclu_wrapper.h +47 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/basis.h +350 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/conjugate_residuals.h +74 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/control.h +167 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/crossover.h +157 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/diagonal_precond.h +45 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/forrest_tomlin.h +102 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/guess_basis.h +21 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/indexed_vector.h +113 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/info.h +27 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipm.h +94 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_c.h +47 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_config.h +9 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_info.h +111 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_internal.h +89 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_parameters.h +76 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/ipx_status.h +57 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/iterate.h +331 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/kkt_solver.h +70 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/kkt_solver_basis.h +66 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/kkt_solver_diag.h +48 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/linear_operator.h +26 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/lp_solver.h +204 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/lu_factorization.h +79 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/lu_update.h +129 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/maxvolume.h +54 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/model.h +413 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/multistream.h +52 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/normal_matrix.h +44 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/power_method.h +44 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/sparse_matrix.h +195 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/sparse_utils.h +58 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/splitted_normal_matrix.h +63 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/starting_basis.h +39 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/symbolic_invert.h +29 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/timer.h +25 -0
- data/ext/lpsolver-highs/build/include/highs/ipm/ipx/utils.h +37 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HConst.h +430 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HStruct.h +213 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsAnalysis.h +23 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsCallback.h +104 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsCallbackStruct.h +70 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsDebug.h +34 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsIis.h +139 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsInfo.h +421 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsInfoDebug.h +27 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsLp.h +97 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsLpSolverObject.h +47 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsLpUtils.h +330 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsModelUtils.h +129 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsOptions.h +1715 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsRanging.h +43 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsSolution.h +179 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsSolutionDebug.h +87 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsSolve.h +29 -0
- data/ext/lpsolver-highs/build/include/highs/lp_data/HighsStatus.h +29 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsCliqueTable.h +329 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsConflictPool.h +109 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsCutGeneration.h +108 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsCutPool.h +168 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsDebugSol.h +133 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsDomain.h +657 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsDomainChange.h +48 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsDynamicRowMatrix.h +104 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsGFkSolve.h +439 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsImplications.h +194 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsLpAggregator.h +50 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsLpRelaxation.h +361 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsMipAnalysis.h +71 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsMipSolver.h +159 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsMipSolverData.h +313 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsModkSeparator.h +60 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsNodeQueue.h +312 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsObjectiveFunction.h +71 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsPathSeparator.h +39 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsPrimalHeuristics.h +75 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsPseudocost.h +366 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsRedcostFixing.h +42 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsSearch.h +241 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsSeparation.h +41 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsSeparator.h +60 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsTableauSeparator.h +34 -0
- data/ext/lpsolver-highs/build/include/highs/mip/HighsTransformedLp.h +63 -0
- data/ext/lpsolver-highs/build/include/highs/mip/MipTimer.h +544 -0
- data/ext/lpsolver-highs/build/include/highs/mip/feasibilityjump.hh +800 -0
- data/ext/lpsolver-highs/build/include/highs/model/HighsHessian.h +54 -0
- data/ext/lpsolver-highs/build/include/highs/model/HighsHessianUtils.h +47 -0
- data/ext/lpsolver-highs/build/include/highs/model/HighsModel.h +42 -0
- data/ext/lpsolver-highs/build/include/highs/parallel/HighsBinarySemaphore.h +108 -0
- data/ext/lpsolver-highs/build/include/highs/parallel/HighsCacheAlign.h +82 -0
- data/ext/lpsolver-highs/build/include/highs/parallel/HighsCombinable.h +116 -0
- data/ext/lpsolver-highs/build/include/highs/parallel/HighsMutex.h +124 -0
- data/ext/lpsolver-highs/build/include/highs/parallel/HighsParallel.h +128 -0
- data/ext/lpsolver-highs/build/include/highs/parallel/HighsRaceTimer.h +38 -0
- data/ext/lpsolver-highs/build/include/highs/parallel/HighsSchedulerConstants.h +19 -0
- data/ext/lpsolver-highs/build/include/highs/parallel/HighsSpinMutex.h +48 -0
- data/ext/lpsolver-highs/build/include/highs/parallel/HighsSplitDeque.h +606 -0
- data/ext/lpsolver-highs/build/include/highs/parallel/HighsTask.h +170 -0
- data/ext/lpsolver-highs/build/include/highs/parallel/HighsTaskExecutor.h +217 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/CupdlpWrapper.h +108 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/HiPdlpTimer.h +155 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/HiPdlpWrapper.h +26 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_cs.h +40 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_defs.h +447 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_linalg.h +189 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_proj.h +19 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_restart.h +31 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_scaling.h +26 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_solver.h +105 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_step.h +37 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/cupdlp/cupdlp_utils.c +1850 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/defs.hpp +222 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/linalg.hpp +61 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/logger.hpp +80 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/pdhg.hpp +358 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/restart.hpp +96 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/scaling.hpp +74 -0
- data/ext/lpsolver-highs/build/include/highs/pdlp/hipdlp/solver_results.hpp +65 -0
- data/ext/lpsolver-highs/build/include/highs/pdqsort/pdqsort.h +532 -0
- data/ext/lpsolver-highs/build/include/highs/presolve/HPresolve.h +505 -0
- data/ext/lpsolver-highs/build/include/highs/presolve/HPresolveAnalysis.h +52 -0
- data/ext/lpsolver-highs/build/include/highs/presolve/HighsPostsolveStack.h +943 -0
- data/ext/lpsolver-highs/build/include/highs/presolve/HighsSymmetry.h +284 -0
- data/ext/lpsolver-highs/build/include/highs/presolve/ICrash.h +124 -0
- data/ext/lpsolver-highs/build/include/highs/presolve/ICrashUtil.h +62 -0
- data/ext/lpsolver-highs/build/include/highs/presolve/ICrashX.h +23 -0
- data/ext/lpsolver-highs/build/include/highs/presolve/PresolveComponent.h +90 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/a_asm.hpp +77 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/a_quass.hpp +22 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/basis.hpp +159 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/crashsolution.hpp +20 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/dantzigpricing.hpp +80 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/devexpricing.hpp +108 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/eventhandler.hpp +30 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/factor.hpp +408 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/feasibility_bounded.hpp +114 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/feasibility_highs.hpp +301 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/gradient.hpp +46 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/instance.hpp +70 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/matrix.hpp +342 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/perturbation.hpp +15 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/pricing.hpp +22 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/qpconst.hpp +34 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/qpvector.hpp +242 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/quass.hpp +27 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/ratiotest.hpp +26 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/runtime.hpp +45 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/scaling.hpp +15 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/settings.hpp +84 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/snippets.hpp +36 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/statistics.hpp +30 -0
- data/ext/lpsolver-highs/build/include/highs/qpsolver/steepestedgepricing.hpp +173 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/HApp.h +550 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/HEkk.h +419 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/HEkkDual.h +513 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/HEkkDualRHS.h +134 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/HEkkDualRow.h +201 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/HEkkPrimal.h +191 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/HSimplex.h +42 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/HSimplexDebug.h +48 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/HSimplexNla.h +158 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/HSimplexReport.h +21 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/HighsSimplexAnalysis.h +500 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/SimplexConst.h +273 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/SimplexStruct.h +263 -0
- data/ext/lpsolver-highs/build/include/highs/simplex/SimplexTimer.h +414 -0
- data/ext/lpsolver-highs/build/include/highs/test_kkt/DevKkt.h +143 -0
- data/ext/lpsolver-highs/build/include/highs/test_kkt/KktCh2.h +79 -0
- data/ext/lpsolver-highs/build/include/highs/util/FactorTimer.h +199 -0
- data/ext/lpsolver-highs/build/include/highs/util/HFactor.h +587 -0
- data/ext/lpsolver-highs/build/include/highs/util/HFactorConst.h +81 -0
- data/ext/lpsolver-highs/build/include/highs/util/HFactorDebug.h +55 -0
- data/ext/lpsolver-highs/build/include/highs/util/HSet.h +89 -0
- data/ext/lpsolver-highs/build/include/highs/util/HVector.h +22 -0
- data/ext/lpsolver-highs/build/include/highs/util/HVectorBase.h +102 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsCDouble.h +323 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsComponent.h +53 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsDataStack.h +83 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsDisjointSets.h +107 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsHash.h +1274 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsHashTree.h +1461 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsInt.h +36 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsIntegers.h +212 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsLinearSumBounds.h +203 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsMatrixPic.h +37 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsMatrixSlice.h +561 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsMatrixUtils.h +57 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsMemoryAllocation.h +63 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsRandom.h +242 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsRbTree.h +452 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsSort.h +131 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsSparseMatrix.h +151 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsSparseVectorSum.h +95 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsSplay.h +135 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsTimer.h +385 -0
- data/ext/lpsolver-highs/build/include/highs/util/HighsUtils.h +272 -0
- data/ext/lpsolver-highs/build/include/highs/util/stringutil.h +46 -0
- data/ext/lpsolver-highs/build/include/highs/zstr/strict_fstream.hpp +237 -0
- data/ext/lpsolver-highs/build/include/highs/zstr/zstr.hpp +473 -0
- data/ext/lpsolver-highs/build/include/highs_export.h +43 -0
- data/ext/lpsolver-highs/build/lib/cmake/highs/highs-config-version.cmake +65 -0
- data/ext/lpsolver-highs/build/lib/cmake/highs/highs-config.cmake +36 -0
- data/ext/lpsolver-highs/build/lib/cmake/highs/highs-targets-release.cmake +19 -0
- data/ext/lpsolver-highs/build/lib/cmake/highs/highs-targets.cmake +111 -0
- data/ext/lpsolver-highs/build/lib/libhighs.a +0 -0
- data/ext/lpsolver-highs/build/lib/pkgconfig/highs.pc +12 -0
- data/ext/lpsolver-highs/build/share/doc/HIGHS/AUTHORS +7 -0
- data/ext/lpsolver-highs/build/share/doc/HIGHS/CITATION.cff +29 -0
- data/ext/lpsolver-highs/build/share/doc/HIGHS/CODE_OF_CONDUCT.md +128 -0
- data/ext/lpsolver-highs/build/share/doc/HIGHS/CONTRIBUTING.md +31 -0
- data/ext/lpsolver-highs/build/share/doc/HIGHS/FEATURES.md +61 -0
- data/ext/lpsolver-highs/build/share/doc/HIGHS/LICENSE.txt +21 -0
- data/ext/lpsolver-highs/build/share/doc/HIGHS/README.md +281 -0
- data/ext/lpsolver-highs/build_webdemo.sh +46 -0
- data/ext/lpsolver-highs/check/Avgas.cpp +245 -0
- data/ext/lpsolver-highs/check/Avgas.h +44 -0
- data/ext/lpsolver-highs/check/CMakeLists.txt +573 -0
- data/ext/lpsolver-highs/check/HCheckConfig.h.bazel.in +6 -0
- data/ext/lpsolver-highs/check/HCheckConfig.h.in +12 -0
- data/ext/lpsolver-highs/check/HCheckConfig.h.meson.in +6 -0
- data/ext/lpsolver-highs/check/SpecialLps.h +405 -0
- data/ext/lpsolver-highs/check/TestAlienBasis.cpp +720 -0
- data/ext/lpsolver-highs/check/TestBasis.cpp +359 -0
- data/ext/lpsolver-highs/check/TestBasisSolves.cpp +669 -0
- data/ext/lpsolver-highs/check/TestCAPI.c +2513 -0
- data/ext/lpsolver-highs/check/TestCallbacks.cpp +608 -0
- data/ext/lpsolver-highs/check/TestCheckSolution.cpp +740 -0
- data/ext/lpsolver-highs/check/TestCrossover.cpp +111 -0
- data/ext/lpsolver-highs/check/TestDualize.cpp +172 -0
- data/ext/lpsolver-highs/check/TestEkk.cpp +100 -0
- data/ext/lpsolver-highs/check/TestFactor.cpp +389 -0
- data/ext/lpsolver-highs/check/TestFilereader.cpp +568 -0
- data/ext/lpsolver-highs/check/TestFortranAPI.f90 +65 -0
- data/ext/lpsolver-highs/check/TestHSet.cpp +80 -0
- data/ext/lpsolver-highs/check/TestHighsCDouble.cpp +109 -0
- data/ext/lpsolver-highs/check/TestHighsGFkSolve.cpp +102 -0
- data/ext/lpsolver-highs/check/TestHighsHash.cpp +126 -0
- data/ext/lpsolver-highs/check/TestHighsHessian.cpp +329 -0
- data/ext/lpsolver-highs/check/TestHighsIntegers.cpp +42 -0
- data/ext/lpsolver-highs/check/TestHighsModel.cpp +134 -0
- data/ext/lpsolver-highs/check/TestHighsParallel.cpp +277 -0
- data/ext/lpsolver-highs/check/TestHighsRbTree.cpp +109 -0
- data/ext/lpsolver-highs/check/TestHighsSparseMatrix.cpp +126 -0
- data/ext/lpsolver-highs/check/TestHighsVersion.cpp +61 -0
- data/ext/lpsolver-highs/check/TestHipo.cpp +122 -0
- data/ext/lpsolver-highs/check/TestICrash.cpp +46 -0
- data/ext/lpsolver-highs/check/TestIO.cpp +163 -0
- data/ext/lpsolver-highs/check/TestIis.cpp +1063 -0
- data/ext/lpsolver-highs/check/TestInfo.cpp +116 -0
- data/ext/lpsolver-highs/check/TestIpm.cpp +226 -0
- data/ext/lpsolver-highs/check/TestIpx.cpp +96 -0
- data/ext/lpsolver-highs/check/TestLPFileFormat.cpp +22 -0
- data/ext/lpsolver-highs/check/TestLogging.cpp +69 -0
- data/ext/lpsolver-highs/check/TestLpModification.cpp +2497 -0
- data/ext/lpsolver-highs/check/TestLpOrientation.cpp +121 -0
- data/ext/lpsolver-highs/check/TestLpSolvers.cpp +555 -0
- data/ext/lpsolver-highs/check/TestLpValidation.cpp +689 -0
- data/ext/lpsolver-highs/check/TestMain.cpp +6 -0
- data/ext/lpsolver-highs/check/TestMipSolver.cpp +1406 -0
- data/ext/lpsolver-highs/check/TestModelProperties.cpp +143 -0
- data/ext/lpsolver-highs/check/TestMultiObjective.cpp +198 -0
- data/ext/lpsolver-highs/check/TestNames.cpp +187 -0
- data/ext/lpsolver-highs/check/TestOptions.cpp +544 -0
- data/ext/lpsolver-highs/check/TestPdlp.cpp +327 -0
- data/ext/lpsolver-highs/check/TestPdlpHi.cpp +40 -0
- data/ext/lpsolver-highs/check/TestPresolve.cpp +912 -0
- data/ext/lpsolver-highs/check/TestQpSolver.cpp +1345 -0
- data/ext/lpsolver-highs/check/TestRanging.cpp +558 -0
- data/ext/lpsolver-highs/check/TestRays.cpp +1010 -0
- data/ext/lpsolver-highs/check/TestSemiVariables.cpp +329 -0
- data/ext/lpsolver-highs/check/TestSetup.cpp +12 -0
- data/ext/lpsolver-highs/check/TestSort.cpp +247 -0
- data/ext/lpsolver-highs/check/TestSpecialLps.cpp +775 -0
- data/ext/lpsolver-highs/check/TestThrow.cpp +83 -0
- data/ext/lpsolver-highs/check/TestTspSolver.cpp +19 -0
- data/ext/lpsolver-highs/check/TestUserScale.cpp +444 -0
- data/ext/lpsolver-highs/check/cublas_example.cpp +76 -0
- data/ext/lpsolver-highs/check/cublas_gpu_start.cpp +88 -0
- data/ext/lpsolver-highs/check/hipo_test_option_files/hipo_options_0 +1 -0
- data/ext/lpsolver-highs/check/instances/1448.lp +1 -0
- data/ext/lpsolver-highs/check/instances/1449a.lp +1 -0
- data/ext/lpsolver-highs/check/instances/1449b.lp +1 -0
- data/ext/lpsolver-highs/check/instances/1451.lp +8 -0
- data/ext/lpsolver-highs/check/instances/2122.lp +1822 -0
- data/ext/lpsolver-highs/check/instances/2171.mps +717 -0
- data/ext/lpsolver-highs/check/instances/25fv47.mps +6919 -0
- data/ext/lpsolver-highs/check/instances/2821-duplicate.mps +31 -0
- data/ext/lpsolver-highs/check/instances/2821-qmatrix.mps +31 -0
- data/ext/lpsolver-highs/check/instances/2821-quadobj.mps +29 -0
- data/ext/lpsolver-highs/check/instances/2821-summation.mps +30 -0
- data/ext/lpsolver-highs/check/instances/2821.mps +29 -0
- data/ext/lpsolver-highs/check/instances/2894.mps +89 -0
- data/ext/lpsolver-highs/check/instances/80bau3b.mps +23732 -0
- data/ext/lpsolver-highs/check/instances/WithInf.set +3 -0
- data/ext/lpsolver-highs/check/instances/adlittle.mps +335 -0
- data/ext/lpsolver-highs/check/instances/afiro.mps +83 -0
- data/ext/lpsolver-highs/check/instances/avgas.mps +51 -0
- data/ext/lpsolver-highs/check/instances/bell5.mps +384 -0
- data/ext/lpsolver-highs/check/instances/bgetam.mps +2112 -0
- data/ext/lpsolver-highs/check/instances/blending.mps +13 -0
- data/ext/lpsolver-highs/check/instances/box1.mps +1085 -0
- data/ext/lpsolver-highs/check/instances/chip.mps +13 -0
- data/ext/lpsolver-highs/check/instances/comment.mps +23 -0
- data/ext/lpsolver-highs/check/instances/cplex1.mps +9674 -0
- data/ext/lpsolver-highs/check/instances/dD2e.mps +10 -0
- data/ext/lpsolver-highs/check/instances/dcmulti.mps +2310 -0
- data/ext/lpsolver-highs/check/instances/e226.mps +1733 -0
- data/ext/lpsolver-highs/check/instances/egout-ac.mps +473 -0
- data/ext/lpsolver-highs/check/instances/egout.mps +403 -0
- data/ext/lpsolver-highs/check/instances/etamacro.mps +2084 -0
- data/ext/lpsolver-highs/check/instances/ex72a.mps +849 -0
- data/ext/lpsolver-highs/check/instances/fixed-binary.lp +11 -0
- data/ext/lpsolver-highs/check/instances/flugpl.mps +111 -0
- data/ext/lpsolver-highs/check/instances/flugpl_illegal_integer.sol +24 -0
- data/ext/lpsolver-highs/check/instances/flugpl_integer.sol +25 -0
- data/ext/lpsolver-highs/check/instances/forest6.mps +261 -0
- data/ext/lpsolver-highs/check/instances/galenet.mps +34 -0
- data/ext/lpsolver-highs/check/instances/gams10am.mps +478 -0
- data/ext/lpsolver-highs/check/instances/garbage.ems +3 -0
- data/ext/lpsolver-highs/check/instances/garbage.lp +3 -0
- data/ext/lpsolver-highs/check/instances/garbage.mps +3 -0
- data/ext/lpsolver-highs/check/instances/gas11.mps +2924 -0
- data/ext/lpsolver-highs/check/instances/gesa2.mps +5459 -0
- data/ext/lpsolver-highs/check/instances/greenbea.mps +19215 -0
- data/ext/lpsolver-highs/check/instances/gt2.mps +534 -0
- data/ext/lpsolver-highs/check/instances/infeasible-mip0.mps +140 -0
- data/ext/lpsolver-highs/check/instances/infeasible-mip1.mps +371 -0
- data/ext/lpsolver-highs/check/instances/israel.mps +1490 -0
- data/ext/lpsolver-highs/check/instances/issue-2095.mps +836 -0
- data/ext/lpsolver-highs/check/instances/issue-2173.mps +3331 -0
- data/ext/lpsolver-highs/check/instances/issue-2204.mps +143 -0
- data/ext/lpsolver-highs/check/instances/issue-2290.mps +158 -0
- data/ext/lpsolver-highs/check/instances/issue-2388.lp +76 -0
- data/ext/lpsolver-highs/check/instances/issue-2402.mps +435 -0
- data/ext/lpsolver-highs/check/instances/issue-2446.mps +9154 -0
- data/ext/lpsolver-highs/check/instances/issue-2585.lp +16 -0
- data/ext/lpsolver-highs/check/instances/issue-2874-3.mps +97 -0
- data/ext/lpsolver-highs/check/instances/klein1.mps +422 -0
- data/ext/lpsolver-highs/check/instances/lseu.mps +371 -0
- data/ext/lpsolver-highs/check/instances/model.xyz +1 -0
- data/ext/lpsolver-highs/check/instances/nan0.mps +13 -0
- data/ext/lpsolver-highs/check/instances/nan1.mps +13 -0
- data/ext/lpsolver-highs/check/instances/nan2.mps +13 -0
- data/ext/lpsolver-highs/check/instances/no-newline-eof.lp +5 -0
- data/ext/lpsolver-highs/check/instances/p01.mps +909 -0
- data/ext/lpsolver-highs/check/instances/p0548.mps +1992 -0
- data/ext/lpsolver-highs/check/instances/primal1.mps +3909 -0
- data/ext/lpsolver-highs/check/instances/qap04.mps +606 -0
- data/ext/lpsolver-highs/check/instances/qcqp.lp +8 -0
- data/ext/lpsolver-highs/check/instances/qjh.lp +9 -0
- data/ext/lpsolver-highs/check/instances/qjh.mps +18 -0
- data/ext/lpsolver-highs/check/instances/qjh_qmatrix.mps +19 -0
- data/ext/lpsolver-highs/check/instances/qjh_quadobj.mps +18 -0
- data/ext/lpsolver-highs/check/instances/qjh_quadobj_qmatrix.mps +25 -0
- data/ext/lpsolver-highs/check/instances/qjh_uncon.lp +10 -0
- data/ext/lpsolver-highs/check/instances/qjh_uncon.mps +17 -0
- data/ext/lpsolver-highs/check/instances/qpinfeasible.lp +8 -0
- data/ext/lpsolver-highs/check/instances/qptestnw.lp +7 -0
- data/ext/lpsolver-highs/check/instances/qpunbounded.lp +5 -0
- data/ext/lpsolver-highs/check/instances/refinery.mps +1882 -0
- data/ext/lpsolver-highs/check/instances/rgn.mps +559 -0
- data/ext/lpsolver-highs/check/instances/scrs8.mps +2717 -0
- data/ext/lpsolver-highs/check/instances/sctest.mps +66 -0
- data/ext/lpsolver-highs/check/instances/semi-continuous.lp +13 -0
- data/ext/lpsolver-highs/check/instances/semi-continuous.mps +24 -0
- data/ext/lpsolver-highs/check/instances/semi-integer.lp +15 -0
- data/ext/lpsolver-highs/check/instances/semi-integer.mps +22 -0
- data/ext/lpsolver-highs/check/instances/shell.mps +4039 -0
- data/ext/lpsolver-highs/check/instances/silly-names.mps +14 -0
- data/ext/lpsolver-highs/check/instances/small_mip.mps +87 -0
- data/ext/lpsolver-highs/check/instances/smalllp.mps +21 -0
- data/ext/lpsolver-highs/check/instances/sp150x300d.mps +1983 -0
- data/ext/lpsolver-highs/check/instances/stair.mps +2499 -0
- data/ext/lpsolver-highs/check/instances/standata.mps +2317 -0
- data/ext/lpsolver-highs/check/instances/standgub.mps +2428 -0
- data/ext/lpsolver-highs/check/instances/standmps.mps +2695 -0
- data/ext/lpsolver-highs/check/instances/test.mps +53 -0
- data/ext/lpsolver-highs/check/instances/vol1.mps +1895 -0
- data/ext/lpsolver-highs/check/instances/warnings.mps +68 -0
- data/ext/lpsolver-highs/check/instances/woodinfe.mps +216 -0
- data/ext/lpsolver-highs/check/matrix_multiplication.hpp +49 -0
- data/ext/lpsolver-highs/check/meson.build +92 -0
- data/ext/lpsolver-highs/check/pythontest.py +11 -0
- data/ext/lpsolver-highs/check/sample_options_file +8 -0
- data/ext/lpsolver-highs/cmake/CheckAtomic.cmake +74 -0
- data/ext/lpsolver-highs/cmake/FindCUDAConf.cmake +44 -0
- data/ext/lpsolver-highs/cmake/FindHipoDeps.cmake +351 -0
- data/ext/lpsolver-highs/cmake/README.md +243 -0
- data/ext/lpsolver-highs/cmake/cpp-highs.cmake +243 -0
- data/ext/lpsolver-highs/cmake/dotnet.cmake +94 -0
- data/ext/lpsolver-highs/cmake/highs-config.cmake.in +22 -0
- data/ext/lpsolver-highs/cmake/python-highs.cmake +74 -0
- data/ext/lpsolver-highs/cmake/set-version.cmake +26 -0
- data/ext/lpsolver-highs/cmake/sources-python.cmake +461 -0
- data/ext/lpsolver-highs/cmake/sources.cmake +618 -0
- data/ext/lpsolver-highs/docs/HiGHS_CopyrightHeader.pl +78 -0
- data/ext/lpsolver-highs/docs/HiGHS_CopyrightHeaderUpdateAll +32 -0
- data/ext/lpsolver-highs/docs/Project.toml +7 -0
- data/ext/lpsolver-highs/docs/README.md +27 -0
- data/ext/lpsolver-highs/docs/c_api_gen/HConfig.h +1 -0
- data/ext/lpsolver-highs/docs/c_api_gen/build.jl +48 -0
- data/ext/lpsolver-highs/docs/make.jl +115 -0
- data/ext/lpsolver-highs/docs/src/assets/logo.png +0 -0
- data/ext/lpsolver-highs/docs/src/callbacks.md +171 -0
- data/ext/lpsolver-highs/docs/src/executable.md +88 -0
- data/ext/lpsolver-highs/docs/src/guide/advanced.md +66 -0
- data/ext/lpsolver-highs/docs/src/guide/basic.md +116 -0
- data/ext/lpsolver-highs/docs/src/guide/further.md +193 -0
- data/ext/lpsolver-highs/docs/src/guide/gpu.md +58 -0
- data/ext/lpsolver-highs/docs/src/guide/index.md +18 -0
- data/ext/lpsolver-highs/docs/src/guide/kkt.md +219 -0
- data/ext/lpsolver-highs/docs/src/guide/numerics.md +55 -0
- data/ext/lpsolver-highs/docs/src/index.md +86 -0
- data/ext/lpsolver-highs/docs/src/installation.md +130 -0
- data/ext/lpsolver-highs/docs/src/interfaces/c_api.md +6 -0
- data/ext/lpsolver-highs/docs/src/interfaces/cpp/examples.md +1 -0
- data/ext/lpsolver-highs/docs/src/interfaces/cpp/index.md +29 -0
- data/ext/lpsolver-highs/docs/src/interfaces/cpp/library.md +107 -0
- data/ext/lpsolver-highs/docs/src/interfaces/csharp.md +55 -0
- data/ext/lpsolver-highs/docs/src/interfaces/fortran.md +11 -0
- data/ext/lpsolver-highs/docs/src/interfaces/julia/index.md +130 -0
- data/ext/lpsolver-highs/docs/src/interfaces/other.md +41 -0
- data/ext/lpsolver-highs/docs/src/interfaces/python/example-py.md +275 -0
- data/ext/lpsolver-highs/docs/src/interfaces/python/index.md +91 -0
- data/ext/lpsolver-highs/docs/src/interfaces/python/model-py.md +90 -0
- data/ext/lpsolver-highs/docs/src/options/definitions.md +529 -0
- data/ext/lpsolver-highs/docs/src/options/intro.md +46 -0
- data/ext/lpsolver-highs/docs/src/parallel.md +88 -0
- data/ext/lpsolver-highs/docs/src/solvers.md +168 -0
- data/ext/lpsolver-highs/docs/src/structures/classes/HighsHessian.md +9 -0
- data/ext/lpsolver-highs/docs/src/structures/classes/HighsIis.md +16 -0
- data/ext/lpsolver-highs/docs/src/structures/classes/HighsLp.md +19 -0
- data/ext/lpsolver-highs/docs/src/structures/classes/HighsModel.md +6 -0
- data/ext/lpsolver-highs/docs/src/structures/classes/HighsSparseMatrix.md +10 -0
- data/ext/lpsolver-highs/docs/src/structures/classes/index.md +11 -0
- data/ext/lpsolver-highs/docs/src/structures/enums.md +114 -0
- data/ext/lpsolver-highs/docs/src/structures/index.md +12 -0
- data/ext/lpsolver-highs/docs/src/structures/structs/HighsBasis.md +8 -0
- data/ext/lpsolver-highs/docs/src/structures/structs/HighsInfo.md +148 -0
- data/ext/lpsolver-highs/docs/src/structures/structs/HighsLinearObjective.md +11 -0
- data/ext/lpsolver-highs/docs/src/structures/structs/HighsSolution.md +10 -0
- data/ext/lpsolver-highs/docs/src/structures/structs/index.md +10 -0
- data/ext/lpsolver-highs/docs/src/terminology.md +163 -0
- data/ext/lpsolver-highs/examples/CMakeLists.txt +26 -0
- data/ext/lpsolver-highs/examples/Docs.py +104 -0
- data/ext/lpsolver-highs/examples/branch-and-price.py +465 -0
- data/ext/lpsolver-highs/examples/call_highs_from_c.c +685 -0
- data/ext/lpsolver-highs/examples/call_highs_from_c_minimal.c +659 -0
- data/ext/lpsolver-highs/examples/call_highs_from_cpp.cpp +178 -0
- data/ext/lpsolver-highs/examples/call_highs_from_csharp.cs +83 -0
- data/ext/lpsolver-highs/examples/call_highs_from_fortran.f90 +579 -0
- data/ext/lpsolver-highs/examples/call_highs_from_python.py +448 -0
- data/ext/lpsolver-highs/examples/call_highs_from_python_highspy.py +71 -0
- data/ext/lpsolver-highs/examples/call_highs_from_python_mps.py +59 -0
- data/ext/lpsolver-highs/examples/callback_gap.py +71 -0
- data/ext/lpsolver-highs/examples/chip.py +43 -0
- data/ext/lpsolver-highs/examples/chip0.py +29 -0
- data/ext/lpsolver-highs/examples/distillation.py +77 -0
- data/ext/lpsolver-highs/examples/knapsack.py +43 -0
- data/ext/lpsolver-highs/examples/minimal.py +11 -0
- data/ext/lpsolver-highs/examples/multi_objective.py +139 -0
- data/ext/lpsolver-highs/examples/multiple_objective.py +120 -0
- data/ext/lpsolver-highs/examples/network_flow.py +37 -0
- data/ext/lpsolver-highs/examples/nqueens.py +29 -0
- data/ext/lpsolver-highs/examples/plot_highs_log.py +134 -0
- data/ext/lpsolver-highs/extern/CLI11.hpp +11546 -0
- data/ext/lpsolver-highs/extern/LICENCE_1_0.txt +23 -0
- data/ext/lpsolver-highs/extern/amd/License.txt +35 -0
- data/ext/lpsolver-highs/extern/amd/SuiteSparse_config.c +54 -0
- data/ext/lpsolver-highs/extern/amd/SuiteSparse_config.h +56 -0
- data/ext/lpsolver-highs/extern/amd/amd.h +357 -0
- data/ext/lpsolver-highs/extern/amd/amd_1.c +172 -0
- data/ext/lpsolver-highs/extern/amd/amd_2.c +1761 -0
- data/ext/lpsolver-highs/extern/amd/amd_aat.c +179 -0
- data/ext/lpsolver-highs/extern/amd/amd_control.c +65 -0
- data/ext/lpsolver-highs/extern/amd/amd_defaults.c +37 -0
- data/ext/lpsolver-highs/extern/amd/amd_info.c +120 -0
- data/ext/lpsolver-highs/extern/amd/amd_internal.h +137 -0
- data/ext/lpsolver-highs/extern/amd/amd_order.c +195 -0
- data/ext/lpsolver-highs/extern/amd/amd_post_tree.c +105 -0
- data/ext/lpsolver-highs/extern/amd/amd_postorder.c +140 -0
- data/ext/lpsolver-highs/extern/amd/amd_preprocess.c +107 -0
- data/ext/lpsolver-highs/extern/amd/amd_valid.c +93 -0
- data/ext/lpsolver-highs/extern/amd/changes.txt +8 -0
- data/ext/lpsolver-highs/extern/catch.hpp +18861 -0
- data/ext/lpsolver-highs/extern/metis/Changes.txt +31 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/GKlib.h +62 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/error.c +21 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_arch.h +64 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_defs.h +19 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_macros.h +50 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_mkblas.h +51 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_mkmemory.h +80 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_mkpqueue.h +329 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_mkrandom.h +89 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_mksort.h +271 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_ms_inttypes.h +41 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_ms_stat.h +22 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_ms_stdint.h +41 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_proto.h +50 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_struct.h +66 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/gk_types.h +15 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/mcore.c +176 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/memory.c +23 -0
- data/ext/lpsolver-highs/extern/metis/GKlib/random.c +37 -0
- data/ext/lpsolver-highs/extern/metis/LICENSE.txt +18 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/auxapi.c +27 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/balance.c +491 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/bucketsort.c +44 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/coarsen.c +895 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/compress.c +231 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/contig.c +83 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/defs.h +39 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/fm.c +527 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/gklib.c +55 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/gklib_defs.h +33 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/graph.c +268 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/initpart.c +385 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/macros.h +59 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/mcutil.c +162 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/metislib.h +35 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/mmd.c +598 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/ometis.c +661 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/options.c +260 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/proto.h +172 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/refine.c +99 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/separator.c +57 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/sfm.c +581 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/srefine.c +152 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/stdheaders.h +29 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/struct.h +117 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/util.c +59 -0
- data/ext/lpsolver-highs/extern/metis/libmetis/wspace.c +91 -0
- data/ext/lpsolver-highs/extern/metis/metis.h +271 -0
- data/ext/lpsolver-highs/extern/pdqsort/license.txt +16 -0
- data/ext/lpsolver-highs/extern/pdqsort/pdqsort.h +532 -0
- data/ext/lpsolver-highs/extern/rcm/LICENSE +19 -0
- data/ext/lpsolver-highs/extern/rcm/rcm.cpp +873 -0
- data/ext/lpsolver-highs/extern/rcm/rcm.h +22 -0
- data/ext/lpsolver-highs/extern/zstr/LICENSE +21 -0
- data/ext/lpsolver-highs/extern/zstr/strict_fstream.hpp +237 -0
- data/ext/lpsolver-highs/extern/zstr/zstr.hpp +473 -0
- data/ext/lpsolver-highs/flake.lock +61 -0
- data/ext/lpsolver-highs/flake.nix +73 -0
- data/ext/lpsolver-highs/highs/CMakeLists.txt +499 -0
- data/ext/lpsolver-highs/highs/HConfig.h.bazel.in +25 -0
- data/ext/lpsolver-highs/highs/HConfig.h.in +22 -0
- data/ext/lpsolver-highs/highs/HConfig.h.meson.in +17 -0
- data/ext/lpsolver-highs/highs/Highs.h +1812 -0
- data/ext/lpsolver-highs/highs/HighsRun.md +143 -0
- data/ext/lpsolver-highs/highs/highs_bindings.cpp +1826 -0
- data/ext/lpsolver-highs/highs/highspy/__init__.py +93 -0
- data/ext/lpsolver-highs/highs/highspy/__init__.pyi +91 -0
- data/ext/lpsolver-highs/highs/highspy/_core/__init__.pyi +1058 -0
- data/ext/lpsolver-highs/highs/highspy/_core/cb.pyi +118 -0
- data/ext/lpsolver-highs/highs/highspy/_core/simplex_constants.pyi +472 -0
- data/ext/lpsolver-highs/highs/highspy/highs.py +2430 -0
- data/ext/lpsolver-highs/highs/interfaces/highs_c_api.cpp +1812 -0
- data/ext/lpsolver-highs/highs/interfaces/highs_c_api.h +2651 -0
- data/ext/lpsolver-highs/highs/interfaces/highs_csharp_api.cs +1142 -0
- data/ext/lpsolver-highs/highs/interfaces/highs_fortran_api.f90 +873 -0
- data/ext/lpsolver-highs/highs/io/Filereader.cpp +87 -0
- data/ext/lpsolver-highs/highs/io/Filereader.h +45 -0
- data/ext/lpsolver-highs/highs/io/FilereaderLp.cpp +539 -0
- data/ext/lpsolver-highs/highs/io/FilereaderLp.h +49 -0
- data/ext/lpsolver-highs/highs/io/FilereaderMps.cpp +86 -0
- data/ext/lpsolver-highs/highs/io/FilereaderMps.h +27 -0
- data/ext/lpsolver-highs/highs/io/HMPSIO.cpp +1001 -0
- data/ext/lpsolver-highs/highs/io/HMPSIO.h +78 -0
- data/ext/lpsolver-highs/highs/io/HMpsFF.cpp +2113 -0
- data/ext/lpsolver-highs/highs/io/HMpsFF.h +245 -0
- data/ext/lpsolver-highs/highs/io/HighsIO.cpp +371 -0
- data/ext/lpsolver-highs/highs/io/HighsIO.h +118 -0
- data/ext/lpsolver-highs/highs/io/LoadOptions.cpp +60 -0
- data/ext/lpsolver-highs/highs/io/LoadOptions.h +24 -0
- data/ext/lpsolver-highs/highs/io/filereaderlp/LICENSE +19 -0
- data/ext/lpsolver-highs/highs/io/filereaderlp/builder.hpp +25 -0
- data/ext/lpsolver-highs/highs/io/filereaderlp/def.hpp +19 -0
- data/ext/lpsolver-highs/highs/io/filereaderlp/model.hpp +68 -0
- data/ext/lpsolver-highs/highs/io/filereaderlp/reader.cpp +1375 -0
- data/ext/lpsolver-highs/highs/io/filereaderlp/reader.hpp +10 -0
- data/ext/lpsolver-highs/highs/ipm/IpxSolution.h +32 -0
- data/ext/lpsolver-highs/highs/ipm/IpxWrapper.cpp +1526 -0
- data/ext/lpsolver-highs/highs/ipm/IpxWrapper.h +106 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu.h +161 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_factorize.c +132 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_factorize.h +247 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_get_factors.c +148 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_get_factors.h +108 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_initialize.c +24 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_initialize.h +119 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_factorize.h +34 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_free.h +19 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_get_factors.h +34 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_initialize.h +46 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_solve_dense.h +29 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_solve_for_update.h +42 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_solve_sparse.h +32 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_obj_update.h +31 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_object.c +325 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_object.h +30 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_dense.c +46 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_dense.h +75 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_for_update.c +79 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_for_update.h +169 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_sparse.c +63 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_solve_sparse.h +112 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_update.c +44 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/basiclu_update.h +125 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_build_factors.c +441 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_condest.c +124 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_def.h +39 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_dfs.c +141 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_factorize_bump.c +56 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_file.c +184 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_file.h +21 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_garbage_perm.c +53 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_initialize.c +56 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_internal.c +352 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_internal.h +220 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_list.h +173 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_markowitz.c +188 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_matrix_norm.c +51 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_pivot.c +1247 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_residual_test.c +155 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_setup_bump.c +198 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_singletons.c +511 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_solve_dense.c +129 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_solve_for_update.c +360 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_solve_sparse.c +284 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_solve_symbolic.c +48 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_solve_triangular.c +140 -0
- data/ext/lpsolver-highs/highs/ipm/basiclu/lu_update.c +908 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/Auxiliary.cpp +301 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/Auxiliary.h +104 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/IntConfig.h +27 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/KrylovMethods.cpp +193 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/KrylovMethods.h +30 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/Log.cpp +60 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/Log.h +62 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/OrderingPrint.h +10 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/VectorOperations.cpp +117 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/VectorOperations.h +59 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/auxiliary/mycblas.h +85 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Analyse.cpp +1367 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Analyse.h +122 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/CallAndTimeBlas.cpp +114 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/CallAndTimeBlas.h +46 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/CliqueStack.cpp +82 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/CliqueStack.h +83 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DataCollector.cpp +326 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DataCollector.h +86 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DenseFact.h +48 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DenseFactHybrid.cpp +279 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DenseFactKernel.cpp +284 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DgemmParallel.cpp +38 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/DgemmParallel.h +32 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/FactorHiGHS.cpp +57 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/FactorHiGHS.h +112 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/FactorHiGHSSettings.h +63 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Factorise.cpp +405 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Factorise.h +85 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/FormatHandler.cpp +46 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/FormatHandler.h +95 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/HybridHybridFormatHandler.cpp +238 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/HybridHybridFormatHandler.h +31 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/HybridSolveHandler.cpp +272 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/HybridSolveHandler.h +26 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/KrylovMethodsIpm.cpp +83 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/KrylovMethodsIpm.h +45 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Numeric.cpp +54 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Numeric.h +46 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/ReturnValues.h +19 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/SolveHandler.cpp +10 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/SolveHandler.h +48 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Swaps.cpp +70 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Swaps.h +19 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Symbolic.cpp +101 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Symbolic.h +220 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/factorhighs/Timing.h +114 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Control.cpp +38 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Control.h +41 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/FactorHiGHSSolver.cpp +887 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/FactorHiGHSSolver.h +92 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Info.h +58 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/IpmData.cpp +8 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/IpmData.h +37 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Iterate.cpp +640 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Iterate.h +172 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/LinearSolver.h +81 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/LogHighs.cpp +71 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/LogHighs.h +33 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Model.cpp +403 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Model.h +136 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Options.h +35 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Parameters.h +63 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/PreProcess.cpp +646 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/PreProcess.h +94 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Refine.cpp +214 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Solver.cpp +1346 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Solver.h +338 -0
- data/ext/lpsolver-highs/highs/ipm/hipo/ipm/Status.h +88 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/basiclu_kernel.cc +71 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/basiclu_kernel.h +20 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/basiclu_wrapper.cc +299 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/basiclu_wrapper.h +47 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/basis.cc +966 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/basis.h +350 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/conjugate_residuals.cc +217 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/conjugate_residuals.h +74 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/control.cc +151 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/control.h +167 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/crossover.cc +479 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/crossover.h +157 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/diagonal_precond.cc +70 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/diagonal_precond.h +45 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/forrest_tomlin.cc +360 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/forrest_tomlin.h +102 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/guess_basis.cc +233 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/guess_basis.h +21 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/indexed_vector.cc +30 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/indexed_vector.h +113 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/info.cc +124 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/info.h +27 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/ipm.cc +897 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/ipm.h +94 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/ipx_c.cc +83 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/ipx_c.h +47 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/ipx_config.h +9 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/ipx_info.h +111 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/ipx_internal.h +89 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/ipx_parameters.h +76 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/ipx_status.h +57 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/iterate.cc +683 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/iterate.h +331 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver.cc +23 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver.h +70 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver_basis.cc +387 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver_basis.h +66 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver_diag.cc +120 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/kkt_solver_diag.h +48 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/linear_operator.cc +10 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/linear_operator.h +26 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/lp_solver.cc +686 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/lp_solver.h +204 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/lu_factorization.cc +131 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/lu_factorization.h +79 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/lu_update.cc +62 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/lu_update.h +129 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/maxvolume.cc +337 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/maxvolume.h +54 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/model.cc +1528 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/model.h +413 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/multistream.h +52 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/normal_matrix.cc +126 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/normal_matrix.h +44 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/power_method.h +44 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/sparse_matrix.cc +382 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/sparse_matrix.h +195 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/sparse_utils.cc +92 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/sparse_utils.h +58 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/splitted_normal_matrix.cc +117 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/splitted_normal_matrix.h +63 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/starting_basis.cc +182 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/starting_basis.h +39 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/symbolic_invert.cc +183 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/symbolic_invert.h +29 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/timer.cc +16 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/timer.h +25 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/utils.cc +95 -0
- data/ext/lpsolver-highs/highs/ipm/ipx/utils.h +37 -0
- data/ext/lpsolver-highs/highs/lp_data/HConst.h +430 -0
- data/ext/lpsolver-highs/highs/lp_data/HStruct.h +213 -0
- data/ext/lpsolver-highs/highs/lp_data/Highs.cpp +4949 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsAnalysis.h +23 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsCallback.cpp +323 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsCallback.h +104 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsCallbackStruct.h +70 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsDebug.cpp +54 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsDebug.h +34 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsDeprecated.cpp +181 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsIis.cpp +1290 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsIis.h +139 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsInfo.cpp +426 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsInfo.h +421 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsInfoDebug.cpp +175 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsInfoDebug.h +27 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsInterface.cpp +4344 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsLp.cpp +564 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsLp.h +97 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsLpSolverObject.h +47 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsLpUtils.cpp +3794 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsLpUtils.h +330 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsModelUtils.cpp +1650 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsModelUtils.h +129 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsOptions.cpp +1176 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsOptions.h +1715 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsRanging.cpp +733 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsRanging.h +43 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsSolution.cpp +2194 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsSolution.h +179 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsSolutionDebug.cpp +490 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsSolutionDebug.h +87 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsSolve.cpp +747 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsSolve.h +29 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsStatus.cpp +48 -0
- data/ext/lpsolver-highs/highs/lp_data/HighsStatus.h +29 -0
- data/ext/lpsolver-highs/highs/lp_data/Iis.md +113 -0
- data/ext/lpsolver-highs/highs/meson.build +433 -0
- data/ext/lpsolver-highs/highs/mip/HighsCliqueTable.cpp +2236 -0
- data/ext/lpsolver-highs/highs/mip/HighsCliqueTable.h +329 -0
- data/ext/lpsolver-highs/highs/mip/HighsConflictPool.cpp +201 -0
- data/ext/lpsolver-highs/highs/mip/HighsConflictPool.h +109 -0
- data/ext/lpsolver-highs/highs/mip/HighsCutGeneration.cpp +1491 -0
- data/ext/lpsolver-highs/highs/mip/HighsCutGeneration.h +108 -0
- data/ext/lpsolver-highs/highs/mip/HighsCutPool.cpp +526 -0
- data/ext/lpsolver-highs/highs/mip/HighsCutPool.h +168 -0
- data/ext/lpsolver-highs/highs/mip/HighsDebugSol.cpp +313 -0
- data/ext/lpsolver-highs/highs/mip/HighsDebugSol.h +133 -0
- data/ext/lpsolver-highs/highs/mip/HighsDomain.cpp +3861 -0
- data/ext/lpsolver-highs/highs/mip/HighsDomain.h +657 -0
- data/ext/lpsolver-highs/highs/mip/HighsDomainChange.h +48 -0
- data/ext/lpsolver-highs/highs/mip/HighsDynamicRowMatrix.cpp +199 -0
- data/ext/lpsolver-highs/highs/mip/HighsDynamicRowMatrix.h +104 -0
- data/ext/lpsolver-highs/highs/mip/HighsFeasibilityJump.cpp +139 -0
- data/ext/lpsolver-highs/highs/mip/HighsGFkSolve.cpp +106 -0
- data/ext/lpsolver-highs/highs/mip/HighsGFkSolve.h +439 -0
- data/ext/lpsolver-highs/highs/mip/HighsImplications.cpp +915 -0
- data/ext/lpsolver-highs/highs/mip/HighsImplications.h +194 -0
- data/ext/lpsolver-highs/highs/mip/HighsLpAggregator.cpp +56 -0
- data/ext/lpsolver-highs/highs/mip/HighsLpAggregator.h +50 -0
- data/ext/lpsolver-highs/highs/mip/HighsLpRelaxation.cpp +1609 -0
- data/ext/lpsolver-highs/highs/mip/HighsLpRelaxation.h +361 -0
- data/ext/lpsolver-highs/highs/mip/HighsMipAnalysis.cpp +313 -0
- data/ext/lpsolver-highs/highs/mip/HighsMipAnalysis.h +71 -0
- data/ext/lpsolver-highs/highs/mip/HighsMipSolver.cpp +1002 -0
- data/ext/lpsolver-highs/highs/mip/HighsMipSolver.h +159 -0
- data/ext/lpsolver-highs/highs/mip/HighsMipSolverData.cpp +2936 -0
- data/ext/lpsolver-highs/highs/mip/HighsMipSolverData.h +313 -0
- data/ext/lpsolver-highs/highs/mip/HighsModkSeparator.cpp +267 -0
- data/ext/lpsolver-highs/highs/mip/HighsModkSeparator.h +60 -0
- data/ext/lpsolver-highs/highs/mip/HighsNodeQueue.cpp +443 -0
- data/ext/lpsolver-highs/highs/mip/HighsNodeQueue.h +312 -0
- data/ext/lpsolver-highs/highs/mip/HighsObjectiveFunction.cpp +124 -0
- data/ext/lpsolver-highs/highs/mip/HighsObjectiveFunction.h +71 -0
- data/ext/lpsolver-highs/highs/mip/HighsPathSeparator.cpp +549 -0
- data/ext/lpsolver-highs/highs/mip/HighsPathSeparator.h +39 -0
- data/ext/lpsolver-highs/highs/mip/HighsPrimalHeuristics.cpp +1673 -0
- data/ext/lpsolver-highs/highs/mip/HighsPrimalHeuristics.h +75 -0
- data/ext/lpsolver-highs/highs/mip/HighsPseudocost.cpp +129 -0
- data/ext/lpsolver-highs/highs/mip/HighsPseudocost.h +366 -0
- data/ext/lpsolver-highs/highs/mip/HighsRedcostFixing.cpp +316 -0
- data/ext/lpsolver-highs/highs/mip/HighsRedcostFixing.h +42 -0
- data/ext/lpsolver-highs/highs/mip/HighsSearch.cpp +1881 -0
- data/ext/lpsolver-highs/highs/mip/HighsSearch.h +241 -0
- data/ext/lpsolver-highs/highs/mip/HighsSeparation.cpp +186 -0
- data/ext/lpsolver-highs/highs/mip/HighsSeparation.h +41 -0
- data/ext/lpsolver-highs/highs/mip/HighsSeparator.cpp +39 -0
- data/ext/lpsolver-highs/highs/mip/HighsSeparator.h +60 -0
- data/ext/lpsolver-highs/highs/mip/HighsTableauSeparator.cpp +244 -0
- data/ext/lpsolver-highs/highs/mip/HighsTableauSeparator.h +34 -0
- data/ext/lpsolver-highs/highs/mip/HighsTransformedLp.cpp +563 -0
- data/ext/lpsolver-highs/highs/mip/HighsTransformedLp.h +63 -0
- data/ext/lpsolver-highs/highs/mip/MipTimer.h +544 -0
- data/ext/lpsolver-highs/highs/mip/feasibilityjump.hh +800 -0
- data/ext/lpsolver-highs/highs/model/HighsHessian.cpp +263 -0
- data/ext/lpsolver-highs/highs/model/HighsHessian.h +54 -0
- data/ext/lpsolver-highs/highs/model/HighsHessianUtils.cpp +584 -0
- data/ext/lpsolver-highs/highs/model/HighsHessianUtils.h +47 -0
- data/ext/lpsolver-highs/highs/model/HighsModel.cpp +46 -0
- data/ext/lpsolver-highs/highs/model/HighsModel.h +42 -0
- data/ext/lpsolver-highs/highs/parallel/HighsBinarySemaphore.h +108 -0
- data/ext/lpsolver-highs/highs/parallel/HighsCacheAlign.h +82 -0
- data/ext/lpsolver-highs/highs/parallel/HighsCombinable.h +116 -0
- data/ext/lpsolver-highs/highs/parallel/HighsMutex.h +124 -0
- data/ext/lpsolver-highs/highs/parallel/HighsParallel.h +128 -0
- data/ext/lpsolver-highs/highs/parallel/HighsRaceTimer.h +38 -0
- data/ext/lpsolver-highs/highs/parallel/HighsSchedulerConstants.h +19 -0
- data/ext/lpsolver-highs/highs/parallel/HighsSpinMutex.h +48 -0
- data/ext/lpsolver-highs/highs/parallel/HighsSplitDeque.h +606 -0
- data/ext/lpsolver-highs/highs/parallel/HighsTask.h +170 -0
- data/ext/lpsolver-highs/highs/parallel/HighsTaskExecutor.cpp +43 -0
- data/ext/lpsolver-highs/highs/parallel/HighsTaskExecutor.h +217 -0
- data/ext/lpsolver-highs/highs/pdlp/CupdlpWrapper.cpp +848 -0
- data/ext/lpsolver-highs/highs/pdlp/CupdlpWrapper.h +108 -0
- data/ext/lpsolver-highs/highs/pdlp/HiPdlpTimer.h +155 -0
- data/ext/lpsolver-highs/highs/pdlp/HiPdlpWrapper.cpp +141 -0
- data/ext/lpsolver-highs/highs/pdlp/HiPdlpWrapper.h +26 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/Diff +12 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/Meld +7 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/Merge +2 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/README.md +95 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/CMakeLists.txt +58 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/cupdlp_cuda_kernels.cu +338 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/cupdlp_cuda_kernels.cuh +319 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/cupdlp_cudalinalg.cu +386 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/cupdlp_cudalinalg.cuh +149 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/test_cublas.c +154 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cuda/test_cuda_linalg.c +79 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp.h +16 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_cs.c +214 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_cs.h +40 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_defs.h +447 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_linalg.c +802 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_linalg.h +189 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_proj.c +148 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_proj.h +19 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_restart.c +124 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_restart.h +31 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_scaling.c +425 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_scaling.h +26 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_solver.c +1498 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_solver.h +105 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_step.c +478 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_step.h +37 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_utils.c +1850 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/cupdlp_utils.h +212 -0
- data/ext/lpsolver-highs/highs/pdlp/cupdlp/glbopts.h +342 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/defs.hpp +222 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/linalg.cc +231 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/linalg.hpp +61 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/logger.cc +225 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/logger.hpp +80 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/pdhg.cc +2798 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/pdhg.cu +497 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/pdhg.hpp +358 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/pdhg_kernels.hpp +77 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/pdlp_gpu_debug.hpp +62 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/restart.cc +132 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/restart.hpp +96 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/scaling.cc +307 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/scaling.hpp +74 -0
- data/ext/lpsolver-highs/highs/pdlp/hipdlp/solver_results.hpp +65 -0
- data/ext/lpsolver-highs/highs/presolve/HPresolve.cpp +8511 -0
- data/ext/lpsolver-highs/highs/presolve/HPresolve.h +505 -0
- data/ext/lpsolver-highs/highs/presolve/HPresolveAnalysis.cpp +239 -0
- data/ext/lpsolver-highs/highs/presolve/HPresolveAnalysis.h +52 -0
- data/ext/lpsolver-highs/highs/presolve/HighsPostsolveStack.cpp +1368 -0
- data/ext/lpsolver-highs/highs/presolve/HighsPostsolveStack.h +943 -0
- data/ext/lpsolver-highs/highs/presolve/HighsSymmetry.cpp +1921 -0
- data/ext/lpsolver-highs/highs/presolve/HighsSymmetry.h +284 -0
- data/ext/lpsolver-highs/highs/presolve/ICrash.cpp +474 -0
- data/ext/lpsolver-highs/highs/presolve/ICrash.h +124 -0
- data/ext/lpsolver-highs/highs/presolve/ICrashUtil.cpp +267 -0
- data/ext/lpsolver-highs/highs/presolve/ICrashUtil.h +62 -0
- data/ext/lpsolver-highs/highs/presolve/ICrashX.cpp +173 -0
- data/ext/lpsolver-highs/highs/presolve/ICrashX.h +23 -0
- data/ext/lpsolver-highs/highs/presolve/PresolveComponent.cpp +45 -0
- data/ext/lpsolver-highs/highs/presolve/PresolveComponent.h +90 -0
- data/ext/lpsolver-highs/highs/qpsolver/README.md +185 -0
- data/ext/lpsolver-highs/highs/qpsolver/a_asm.cpp +139 -0
- data/ext/lpsolver-highs/highs/qpsolver/a_asm.hpp +77 -0
- data/ext/lpsolver-highs/highs/qpsolver/a_quass.cpp +194 -0
- data/ext/lpsolver-highs/highs/qpsolver/a_quass.hpp +22 -0
- data/ext/lpsolver-highs/highs/qpsolver/basis.cpp +443 -0
- data/ext/lpsolver-highs/highs/qpsolver/basis.hpp +159 -0
- data/ext/lpsolver-highs/highs/qpsolver/crashsolution.hpp +20 -0
- data/ext/lpsolver-highs/highs/qpsolver/dantzigpricing.hpp +80 -0
- data/ext/lpsolver-highs/highs/qpsolver/devexharrispricing.hpp +98 -0
- data/ext/lpsolver-highs/highs/qpsolver/devexpricing.hpp +108 -0
- data/ext/lpsolver-highs/highs/qpsolver/eventhandler.hpp +30 -0
- data/ext/lpsolver-highs/highs/qpsolver/factor.hpp +408 -0
- data/ext/lpsolver-highs/highs/qpsolver/feasibility_bounded.hpp +114 -0
- data/ext/lpsolver-highs/highs/qpsolver/feasibility_highs.hpp +301 -0
- data/ext/lpsolver-highs/highs/qpsolver/gradient.hpp +46 -0
- data/ext/lpsolver-highs/highs/qpsolver/instance.hpp +70 -0
- data/ext/lpsolver-highs/highs/qpsolver/matrix.hpp +342 -0
- data/ext/lpsolver-highs/highs/qpsolver/perturbation.cpp +41 -0
- data/ext/lpsolver-highs/highs/qpsolver/perturbation.hpp +15 -0
- data/ext/lpsolver-highs/highs/qpsolver/pricing.hpp +22 -0
- data/ext/lpsolver-highs/highs/qpsolver/qpconst.hpp +34 -0
- data/ext/lpsolver-highs/highs/qpsolver/qpvector.hpp +242 -0
- data/ext/lpsolver-highs/highs/qpsolver/quass.cpp +551 -0
- data/ext/lpsolver-highs/highs/qpsolver/quass.hpp +27 -0
- data/ext/lpsolver-highs/highs/qpsolver/ratiotest.cpp +146 -0
- data/ext/lpsolver-highs/highs/qpsolver/ratiotest.hpp +26 -0
- data/ext/lpsolver-highs/highs/qpsolver/reducedcosts.hpp +46 -0
- data/ext/lpsolver-highs/highs/qpsolver/reducedgradient.hpp +95 -0
- data/ext/lpsolver-highs/highs/qpsolver/runtime.hpp +45 -0
- data/ext/lpsolver-highs/highs/qpsolver/scaling.cpp +123 -0
- data/ext/lpsolver-highs/highs/qpsolver/scaling.hpp +15 -0
- data/ext/lpsolver-highs/highs/qpsolver/settings.hpp +84 -0
- data/ext/lpsolver-highs/highs/qpsolver/snippets.hpp +36 -0
- data/ext/lpsolver-highs/highs/qpsolver/statistics.hpp +30 -0
- data/ext/lpsolver-highs/highs/qpsolver/steepestedgepricing.hpp +173 -0
- data/ext/lpsolver-highs/highs/simplex/HApp.h +550 -0
- data/ext/lpsolver-highs/highs/simplex/HEkk.cpp +4404 -0
- data/ext/lpsolver-highs/highs/simplex/HEkk.h +419 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkControl.cpp +146 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkDebug.cpp +1722 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkDual.cpp +3003 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkDual.h +513 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkDualMulti.cpp +1020 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkDualRHS.cpp +535 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkDualRHS.h +134 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkDualRow.cpp +697 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkDualRow.h +201 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkInterface.cpp +26 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkPrimal.cpp +2984 -0
- data/ext/lpsolver-highs/highs/simplex/HEkkPrimal.h +191 -0
- data/ext/lpsolver-highs/highs/simplex/HSimplex.cpp +330 -0
- data/ext/lpsolver-highs/highs/simplex/HSimplex.h +42 -0
- data/ext/lpsolver-highs/highs/simplex/HSimplexDebug.cpp +145 -0
- data/ext/lpsolver-highs/highs/simplex/HSimplexDebug.h +48 -0
- data/ext/lpsolver-highs/highs/simplex/HSimplexNla.cpp +517 -0
- data/ext/lpsolver-highs/highs/simplex/HSimplexNla.h +158 -0
- data/ext/lpsolver-highs/highs/simplex/HSimplexNlaDebug.cpp +373 -0
- data/ext/lpsolver-highs/highs/simplex/HSimplexNlaFreeze.cpp +28 -0
- data/ext/lpsolver-highs/highs/simplex/HSimplexNlaProductForm.cpp +113 -0
- data/ext/lpsolver-highs/highs/simplex/HSimplexReport.cpp +77 -0
- data/ext/lpsolver-highs/highs/simplex/HSimplexReport.h +21 -0
- data/ext/lpsolver-highs/highs/simplex/HighsSimplexAnalysis.cpp +1495 -0
- data/ext/lpsolver-highs/highs/simplex/HighsSimplexAnalysis.h +500 -0
- data/ext/lpsolver-highs/highs/simplex/SimplexConst.h +273 -0
- data/ext/lpsolver-highs/highs/simplex/SimplexStruct.h +263 -0
- data/ext/lpsolver-highs/highs/simplex/SimplexTimer.h +414 -0
- data/ext/lpsolver-highs/highs/test_kkt/DevKkt.cpp +469 -0
- data/ext/lpsolver-highs/highs/test_kkt/DevKkt.h +143 -0
- data/ext/lpsolver-highs/highs/test_kkt/KktCh2.cpp +305 -0
- data/ext/lpsolver-highs/highs/test_kkt/KktCh2.h +79 -0
- data/ext/lpsolver-highs/highs/util/FactorTimer.h +199 -0
- data/ext/lpsolver-highs/highs/util/HFactor.cpp +2597 -0
- data/ext/lpsolver-highs/highs/util/HFactor.h +587 -0
- data/ext/lpsolver-highs/highs/util/HFactorConst.h +81 -0
- data/ext/lpsolver-highs/highs/util/HFactorDebug.cpp +231 -0
- data/ext/lpsolver-highs/highs/util/HFactorDebug.h +55 -0
- data/ext/lpsolver-highs/highs/util/HFactorExtend.cpp +229 -0
- data/ext/lpsolver-highs/highs/util/HFactorRefactor.cpp +304 -0
- data/ext/lpsolver-highs/highs/util/HFactorUtils.cpp +122 -0
- data/ext/lpsolver-highs/highs/util/HSet.cpp +197 -0
- data/ext/lpsolver-highs/highs/util/HSet.h +89 -0
- data/ext/lpsolver-highs/highs/util/HVector.h +22 -0
- data/ext/lpsolver-highs/highs/util/HVectorBase.cpp +271 -0
- data/ext/lpsolver-highs/highs/util/HVectorBase.h +102 -0
- data/ext/lpsolver-highs/highs/util/HighsCDouble.h +323 -0
- data/ext/lpsolver-highs/highs/util/HighsComponent.h +53 -0
- data/ext/lpsolver-highs/highs/util/HighsDataStack.h +83 -0
- data/ext/lpsolver-highs/highs/util/HighsDisjointSets.h +107 -0
- data/ext/lpsolver-highs/highs/util/HighsHash.cpp +10 -0
- data/ext/lpsolver-highs/highs/util/HighsHash.h +1274 -0
- data/ext/lpsolver-highs/highs/util/HighsHashTree.h +1461 -0
- data/ext/lpsolver-highs/highs/util/HighsInt.h +36 -0
- data/ext/lpsolver-highs/highs/util/HighsIntegers.h +212 -0
- data/ext/lpsolver-highs/highs/util/HighsLinearSumBounds.cpp +267 -0
- data/ext/lpsolver-highs/highs/util/HighsLinearSumBounds.h +203 -0
- data/ext/lpsolver-highs/highs/util/HighsMatrixPic.cpp +146 -0
- data/ext/lpsolver-highs/highs/util/HighsMatrixPic.h +37 -0
- data/ext/lpsolver-highs/highs/util/HighsMatrixSlice.h +561 -0
- data/ext/lpsolver-highs/highs/util/HighsMatrixUtils.cpp +407 -0
- data/ext/lpsolver-highs/highs/util/HighsMatrixUtils.h +57 -0
- data/ext/lpsolver-highs/highs/util/HighsMemoryAllocation.h +63 -0
- data/ext/lpsolver-highs/highs/util/HighsRandom.h +242 -0
- data/ext/lpsolver-highs/highs/util/HighsRbTree.h +452 -0
- data/ext/lpsolver-highs/highs/util/HighsSort.cpp +364 -0
- data/ext/lpsolver-highs/highs/util/HighsSort.h +131 -0
- data/ext/lpsolver-highs/highs/util/HighsSparseMatrix.cpp +1746 -0
- data/ext/lpsolver-highs/highs/util/HighsSparseMatrix.h +151 -0
- data/ext/lpsolver-highs/highs/util/HighsSparseVectorSum.h +95 -0
- data/ext/lpsolver-highs/highs/util/HighsSplay.h +135 -0
- data/ext/lpsolver-highs/highs/util/HighsTimer.h +385 -0
- data/ext/lpsolver-highs/highs/util/HighsUtils.cpp +1259 -0
- data/ext/lpsolver-highs/highs/util/HighsUtils.h +272 -0
- data/ext/lpsolver-highs/highs/util/stringutil.cpp +131 -0
- data/ext/lpsolver-highs/highs/util/stringutil.h +46 -0
- data/ext/lpsolver-highs/highs.pc.in +12 -0
- data/ext/lpsolver-highs/meson.build +198 -0
- data/ext/lpsolver-highs/meson_options.txt +31 -0
- data/ext/lpsolver-highs/nuget/HiGHS_Logo.png +0 -0
- data/ext/lpsolver-highs/nuget/Highs.csproj +25 -0
- data/ext/lpsolver-highs/nuget/Highs.csproj.in +36 -0
- data/ext/lpsolver-highs/nuget/HowToAlternative.md +77 -0
- data/ext/lpsolver-highs/nuget/README.md +38 -0
- data/ext/lpsolver-highs/nuget/arm-toolchain.cmake +15 -0
- data/ext/lpsolver-highs/nuget/build_linux-arm.sh +13 -0
- data/ext/lpsolver-highs/nuget/build_linux.sh +10 -0
- data/ext/lpsolver-highs/nuget/build_windows.ps1 +27 -0
- data/ext/lpsolver-highs/nuget/generatePackage.ps1 +28 -0
- data/ext/lpsolver-highs/pyproject.toml +221 -0
- data/ext/lpsolver-highs/subprojects/pybind11.wrap +13 -0
- data/ext/lpsolver-highs/tests/test_highspy.py +2310 -0
- data/ext/lpsolver-highs/version.rc.in +50 -0
- data/lib/lpsolver/highs +0 -0
- data/lib/lpsolver/model.rb +28 -4
- data/lib/lpsolver/native.so +0 -0
- data/lib/lpsolver/native_model.rb +261 -0
- data/lib/lpsolver/solution.rb +72 -7
- data/lib/lpsolver/version.rb +1 -1
- data/lpsolver.gemspec +4 -1
- metadata +1176 -4
|
@@ -0,0 +1,1746 @@
|
|
|
1
|
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
2
|
+
/* */
|
|
3
|
+
/* This file is part of the HiGHS linear optimization suite */
|
|
4
|
+
/* */
|
|
5
|
+
/* Available as open-source under the MIT License */
|
|
6
|
+
/* */
|
|
7
|
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
8
|
+
/**@file util/HighsSparseMatrix.cpp
|
|
9
|
+
* @brief
|
|
10
|
+
*/
|
|
11
|
+
#include "util/HighsSparseMatrix.h"
|
|
12
|
+
|
|
13
|
+
#include <algorithm>
|
|
14
|
+
#include <cassert>
|
|
15
|
+
#include <cmath>
|
|
16
|
+
|
|
17
|
+
#include "util/HighsCDouble.h"
|
|
18
|
+
#include "util/HighsMatrixUtils.h"
|
|
19
|
+
#include "util/HighsSort.h"
|
|
20
|
+
#include "util/HighsSparseVectorSum.h"
|
|
21
|
+
|
|
22
|
+
using std::fabs;
|
|
23
|
+
using std::max;
|
|
24
|
+
using std::min;
|
|
25
|
+
using std::swap;
|
|
26
|
+
using std::vector;
|
|
27
|
+
|
|
28
|
+
bool HighsSparseMatrix::operator==(const HighsSparseMatrix& matrix) const {
|
|
29
|
+
bool equal = true;
|
|
30
|
+
equal = this->format_ == matrix.format_ && equal;
|
|
31
|
+
equal = this->num_col_ == matrix.num_col_ && equal;
|
|
32
|
+
equal = this->num_row_ == matrix.num_row_ && equal;
|
|
33
|
+
equal = this->start_ == matrix.start_ && equal;
|
|
34
|
+
equal = this->index_ == matrix.index_ && equal;
|
|
35
|
+
equal = this->value_ == matrix.value_ && equal;
|
|
36
|
+
return equal;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
bool HighsSparseMatrix::equivalent(const HighsSparseMatrix& matrix) const {
|
|
40
|
+
// Use this to test when the matrices may be in opposite format
|
|
41
|
+
if (*this == matrix) return true;
|
|
42
|
+
// Creat a local copy in of matrix in the same format as this and
|
|
43
|
+
// test for it being equal to this
|
|
44
|
+
HighsSparseMatrix lc_matrix = matrix;
|
|
45
|
+
if (this->isColwise()) {
|
|
46
|
+
lc_matrix.ensureColwise();
|
|
47
|
+
} else {
|
|
48
|
+
lc_matrix.ensureRowwise();
|
|
49
|
+
}
|
|
50
|
+
return *this == lc_matrix;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
void HighsSparseMatrix::clear() {
|
|
54
|
+
this->num_col_ = 0;
|
|
55
|
+
this->num_row_ = 0;
|
|
56
|
+
this->start_.clear();
|
|
57
|
+
this->p_end_.clear();
|
|
58
|
+
this->index_.clear();
|
|
59
|
+
this->value_.clear();
|
|
60
|
+
this->format_ = MatrixFormat::kColwise;
|
|
61
|
+
this->start_.assign(1, 0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
void HighsSparseMatrix::exactResize() {
|
|
65
|
+
if (this->isColwise()) {
|
|
66
|
+
this->start_.resize(this->num_col_ + 1);
|
|
67
|
+
} else {
|
|
68
|
+
this->start_.resize(this->num_row_ + 1);
|
|
69
|
+
}
|
|
70
|
+
const HighsInt num_nz = this->isColwise() ? this->start_[this->num_col_]
|
|
71
|
+
: this->start_[this->num_row_];
|
|
72
|
+
if (this->format_ == MatrixFormat::kRowwisePartitioned) {
|
|
73
|
+
this->p_end_.resize(this->num_row_);
|
|
74
|
+
} else {
|
|
75
|
+
assert((int)this->p_end_.size() == 0);
|
|
76
|
+
this->p_end_.clear();
|
|
77
|
+
}
|
|
78
|
+
this->index_.resize(num_nz);
|
|
79
|
+
this->value_.resize(num_nz);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
bool HighsSparseMatrix::isRowwise() const {
|
|
83
|
+
return this->format_ == MatrixFormat::kRowwise ||
|
|
84
|
+
this->format_ == MatrixFormat::kRowwisePartitioned;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
bool HighsSparseMatrix::isColwise() const {
|
|
88
|
+
return this->format_ == MatrixFormat::kColwise;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
HighsInt HighsSparseMatrix::numNz() const {
|
|
92
|
+
assert(this->formatOk());
|
|
93
|
+
if (this->isColwise()) {
|
|
94
|
+
assert((HighsInt)this->start_.size() >= this->num_col_ + 1);
|
|
95
|
+
return this->start_[this->num_col_];
|
|
96
|
+
} else {
|
|
97
|
+
assert((HighsInt)this->start_.size() >= this->num_row_ + 1);
|
|
98
|
+
return this->start_[this->num_row_];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
void HighsSparseMatrix::range(double& min_value, double& max_value) const {
|
|
103
|
+
assert(this->formatOk());
|
|
104
|
+
for (HighsInt iEl = 0; iEl < this->start_[this->num_col_]; iEl++) {
|
|
105
|
+
double value = fabs(this->value_[iEl]);
|
|
106
|
+
min_value = min(min_value, value);
|
|
107
|
+
max_value = max(max_value, value);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
void HighsSparseMatrix::setFormat(const MatrixFormat desired_format) {
|
|
112
|
+
assert(this->formatOk());
|
|
113
|
+
if (desired_format == MatrixFormat::kColwise) {
|
|
114
|
+
this->ensureColwise();
|
|
115
|
+
} else {
|
|
116
|
+
this->ensureRowwise();
|
|
117
|
+
}
|
|
118
|
+
assert(this->format_ == desired_format);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
void HighsSparseMatrix::ensureColwise() {
|
|
122
|
+
assert(this->formatOk());
|
|
123
|
+
if (this->isColwise()) return;
|
|
124
|
+
HighsInt num_col = this->num_col_;
|
|
125
|
+
HighsInt num_row = this->num_row_;
|
|
126
|
+
HighsInt num_nz = this->numNz();
|
|
127
|
+
assert(num_nz >= 0);
|
|
128
|
+
assert((HighsInt)this->index_.size() >= num_nz);
|
|
129
|
+
assert((HighsInt)this->value_.size() >= num_nz);
|
|
130
|
+
if (num_nz == 0) {
|
|
131
|
+
// Empty matrix, so just ensure that there are enough zero starts
|
|
132
|
+
// for the new orientation
|
|
133
|
+
this->start_.assign(num_col + 1, 0);
|
|
134
|
+
this->index_.clear();
|
|
135
|
+
this->value_.clear();
|
|
136
|
+
} else {
|
|
137
|
+
// Matrix is non-empty, so transpose it
|
|
138
|
+
//
|
|
139
|
+
// Take a copy of the current matrix - that is rowwise - so that
|
|
140
|
+
// the current matrix is filled colwise
|
|
141
|
+
std::vector<HighsInt> ARstart = this->start_;
|
|
142
|
+
std::vector<HighsInt> ARindex = this->index_;
|
|
143
|
+
std::vector<double> ARvalue = this->value_;
|
|
144
|
+
this->start_.resize(num_col + 1);
|
|
145
|
+
this->index_.resize(num_nz);
|
|
146
|
+
this->value_.resize(num_nz);
|
|
147
|
+
vector<HighsInt> Alength;
|
|
148
|
+
Alength.assign(num_col, 0);
|
|
149
|
+
for (HighsInt iEl = ARstart[0]; iEl < num_nz; iEl++)
|
|
150
|
+
Alength[ARindex[iEl]]++;
|
|
151
|
+
this->start_[0] = 0;
|
|
152
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++)
|
|
153
|
+
this->start_[iCol + 1] = this->start_[iCol] + Alength[iCol];
|
|
154
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++) {
|
|
155
|
+
for (HighsInt iEl = ARstart[iRow]; iEl < ARstart[iRow + 1]; iEl++) {
|
|
156
|
+
HighsInt iCol = ARindex[iEl];
|
|
157
|
+
HighsInt iCol_el = this->start_[iCol];
|
|
158
|
+
this->index_[iCol_el] = iRow;
|
|
159
|
+
this->value_[iCol_el] = ARvalue[iEl];
|
|
160
|
+
this->start_[iCol]++;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
this->start_[0] = 0;
|
|
164
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++)
|
|
165
|
+
this->start_[iCol + 1] = this->start_[iCol] + Alength[iCol];
|
|
166
|
+
assert(this->start_[num_col] == num_nz);
|
|
167
|
+
}
|
|
168
|
+
this->format_ = MatrixFormat::kColwise;
|
|
169
|
+
assert((HighsInt)this->start_.size() >= num_col + 1);
|
|
170
|
+
num_nz = this->numNz();
|
|
171
|
+
assert(num_nz >= 0);
|
|
172
|
+
assert((HighsInt)this->index_.size() >= num_nz);
|
|
173
|
+
assert((HighsInt)this->value_.size() >= num_nz);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
void HighsSparseMatrix::ensureRowwise() {
|
|
177
|
+
assert(this->formatOk());
|
|
178
|
+
if (this->isRowwise()) return;
|
|
179
|
+
HighsInt num_col = this->num_col_;
|
|
180
|
+
HighsInt num_row = this->num_row_;
|
|
181
|
+
HighsInt num_nz = this->numNz();
|
|
182
|
+
assert(num_nz >= 0);
|
|
183
|
+
assert((HighsInt)this->index_.size() >= num_nz);
|
|
184
|
+
assert((HighsInt)this->value_.size() >= num_nz);
|
|
185
|
+
if (num_nz == 0) {
|
|
186
|
+
// Empty matrix, so just ensure that there are enough zero starts
|
|
187
|
+
// for the new orientation
|
|
188
|
+
this->start_.assign(num_row + 1, 0);
|
|
189
|
+
this->index_.clear();
|
|
190
|
+
this->value_.clear();
|
|
191
|
+
} else {
|
|
192
|
+
// Matrix is non-empty, so transpose it
|
|
193
|
+
//
|
|
194
|
+
// Take a copy of the current matrix - that is colwise - so that
|
|
195
|
+
// the current matrix is filled rowwise
|
|
196
|
+
vector<HighsInt> Astart = this->start_;
|
|
197
|
+
vector<HighsInt> Aindex = this->index_;
|
|
198
|
+
vector<double> Avalue = this->value_;
|
|
199
|
+
this->start_.resize(num_row + 1);
|
|
200
|
+
this->index_.resize(num_nz);
|
|
201
|
+
this->value_.resize(num_nz);
|
|
202
|
+
vector<HighsInt> ARlength;
|
|
203
|
+
ARlength.assign(num_row, 0);
|
|
204
|
+
for (HighsInt iEl = Astart[0]; iEl < num_nz; iEl++) ARlength[Aindex[iEl]]++;
|
|
205
|
+
this->start_[0] = 0;
|
|
206
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++)
|
|
207
|
+
this->start_[iRow + 1] = this->start_[iRow] + ARlength[iRow];
|
|
208
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
209
|
+
for (HighsInt iEl = Astart[iCol]; iEl < Astart[iCol + 1]; iEl++) {
|
|
210
|
+
HighsInt iRow = Aindex[iEl];
|
|
211
|
+
HighsInt iRow_el = this->start_[iRow];
|
|
212
|
+
this->index_[iRow_el] = iCol;
|
|
213
|
+
this->value_[iRow_el] = Avalue[iEl];
|
|
214
|
+
this->start_[iRow]++;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
this->start_[0] = 0;
|
|
218
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++)
|
|
219
|
+
this->start_[iRow + 1] = this->start_[iRow] + ARlength[iRow];
|
|
220
|
+
assert(this->start_[num_row] == num_nz);
|
|
221
|
+
}
|
|
222
|
+
this->format_ = MatrixFormat::kRowwise;
|
|
223
|
+
assert((HighsInt)this->start_.size() >= num_row + 1);
|
|
224
|
+
num_nz = this->numNz();
|
|
225
|
+
assert(num_nz >= 0);
|
|
226
|
+
assert((HighsInt)this->index_.size() >= num_nz);
|
|
227
|
+
assert((HighsInt)this->value_.size() >= num_nz);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
void HighsSparseMatrix::addVec(const HighsInt num_nz, const HighsInt* index,
|
|
231
|
+
const double* value, const double multiple) {
|
|
232
|
+
HighsInt num_vec = 0;
|
|
233
|
+
if (this->isColwise()) {
|
|
234
|
+
num_vec = this->num_col_;
|
|
235
|
+
} else {
|
|
236
|
+
num_vec = this->num_row_;
|
|
237
|
+
}
|
|
238
|
+
assert((int)this->start_.size() == num_vec + 1);
|
|
239
|
+
assert((int)this->index_.size() == this->numNz());
|
|
240
|
+
assert((int)this->value_.size() == this->numNz());
|
|
241
|
+
for (HighsInt iEl = 0; iEl < num_nz; iEl++) {
|
|
242
|
+
this->index_.push_back(index[iEl]);
|
|
243
|
+
this->value_.push_back(multiple * value[iEl]);
|
|
244
|
+
}
|
|
245
|
+
this->start_.push_back(this->start_[num_vec] + num_nz);
|
|
246
|
+
if (this->isColwise()) {
|
|
247
|
+
this->num_col_++;
|
|
248
|
+
} else {
|
|
249
|
+
this->num_row_++;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
void HighsSparseMatrix::addCols(const HighsSparseMatrix new_cols,
|
|
254
|
+
const int8_t* in_partition) {
|
|
255
|
+
assert(new_cols.isColwise());
|
|
256
|
+
const HighsInt num_new_col = new_cols.num_col_;
|
|
257
|
+
const HighsInt num_new_nz = new_cols.numNz();
|
|
258
|
+
const vector<HighsInt>& new_matrix_start = new_cols.start_;
|
|
259
|
+
const vector<HighsInt>& new_matrix_index = new_cols.index_;
|
|
260
|
+
const vector<double>& new_matrix_value = new_cols.value_;
|
|
261
|
+
|
|
262
|
+
assert(this->formatOk());
|
|
263
|
+
// Adding columns to a row-wise partitioned matrix needs the
|
|
264
|
+
// partition information
|
|
265
|
+
const bool partitioned = this->format_ == MatrixFormat::kRowwisePartitioned;
|
|
266
|
+
// Cannot handle the row-wise partitioned case
|
|
267
|
+
assert(!partitioned);
|
|
268
|
+
if (partitioned) {
|
|
269
|
+
// if (in_partition == NULL) { printf("in_partition == NULL\n"); }
|
|
270
|
+
assert(in_partition != NULL);
|
|
271
|
+
}
|
|
272
|
+
assert(num_new_col >= 0);
|
|
273
|
+
assert(num_new_nz >= 0);
|
|
274
|
+
if (num_new_col == 0) {
|
|
275
|
+
// No columns are being added, so check that no nonzeros are being
|
|
276
|
+
// added
|
|
277
|
+
assert(num_new_nz == 0);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
// Adding a positive number of columns to a matrix
|
|
281
|
+
if (num_new_nz) {
|
|
282
|
+
// Nonzeros are being added, so ensure that non-null data are
|
|
283
|
+
// being passed
|
|
284
|
+
assert(!new_matrix_start.empty());
|
|
285
|
+
assert(!new_matrix_index.empty());
|
|
286
|
+
assert(!new_matrix_value.empty());
|
|
287
|
+
}
|
|
288
|
+
HighsInt num_col = this->num_col_;
|
|
289
|
+
HighsInt num_row = this->num_row_;
|
|
290
|
+
HighsInt num_nz = this->numNz();
|
|
291
|
+
// Check that nonzeros aren't being appended to a matrix with no rows
|
|
292
|
+
assert(num_new_nz <= 0 || num_row > 0);
|
|
293
|
+
|
|
294
|
+
// If matrix is currently a standard row-wise matrix and there are
|
|
295
|
+
// more new nonzeros than current nonzeros so flip column-wise
|
|
296
|
+
if (this->format_ == MatrixFormat::kRowwise && num_new_nz > num_nz)
|
|
297
|
+
this->ensureColwise();
|
|
298
|
+
|
|
299
|
+
// Determine the new number of columns and nonzeros in the matrix
|
|
300
|
+
HighsInt new_num_col = num_col + num_new_col;
|
|
301
|
+
HighsInt new_num_nz = num_nz + num_new_nz;
|
|
302
|
+
|
|
303
|
+
if (this->isColwise()) {
|
|
304
|
+
// Matrix is column-wise
|
|
305
|
+
this->start_.resize(new_num_col + 1);
|
|
306
|
+
// Append the starts of the new columns
|
|
307
|
+
if (num_new_nz) {
|
|
308
|
+
// Nontrivial number of nonzeros being added, so use new_matrix_start
|
|
309
|
+
for (HighsInt iNewCol = 0; iNewCol < num_new_col; iNewCol++)
|
|
310
|
+
this->start_[num_col + iNewCol] = num_nz + new_matrix_start[iNewCol];
|
|
311
|
+
} else {
|
|
312
|
+
// No nonzeros being added, so new_matrix_start may be null, but entries
|
|
313
|
+
// of zero are implied.
|
|
314
|
+
for (HighsInt iNewCol = 0; iNewCol < num_new_col; iNewCol++)
|
|
315
|
+
this->start_[num_col + iNewCol] = num_nz;
|
|
316
|
+
}
|
|
317
|
+
this->start_[num_col + num_new_col] = new_num_nz;
|
|
318
|
+
// Update the number of columns
|
|
319
|
+
this->num_col_ += num_new_col;
|
|
320
|
+
// If no nonzeros are being added then there's nothing else to do
|
|
321
|
+
if (num_new_nz <= 0) return;
|
|
322
|
+
// Adding a non-trivial matrix: resize the column-wise matrix arrays
|
|
323
|
+
// accordingly
|
|
324
|
+
this->index_.resize(new_num_nz);
|
|
325
|
+
this->value_.resize(new_num_nz);
|
|
326
|
+
// Copy in the new indices and values
|
|
327
|
+
for (HighsInt iEl = 0; iEl < num_new_nz; iEl++) {
|
|
328
|
+
this->index_[num_nz + iEl] = new_matrix_index[iEl];
|
|
329
|
+
this->value_[num_nz + iEl] = new_matrix_value[iEl];
|
|
330
|
+
}
|
|
331
|
+
} else {
|
|
332
|
+
// Matrix is row-wise
|
|
333
|
+
if (num_new_nz) {
|
|
334
|
+
// Adding a positive number of nonzeros
|
|
335
|
+
this->index_.resize(new_num_nz);
|
|
336
|
+
this->value_.resize(new_num_nz);
|
|
337
|
+
// Determine the row lengths of the new columns being added
|
|
338
|
+
std::vector<HighsInt> new_row_length;
|
|
339
|
+
new_row_length.assign(num_row, 0);
|
|
340
|
+
for (HighsInt iEl = 0; iEl < num_new_nz; iEl++)
|
|
341
|
+
new_row_length[new_matrix_index[iEl]]++;
|
|
342
|
+
// Now shift the indices and values to make space
|
|
343
|
+
HighsInt entry_offset = num_new_nz;
|
|
344
|
+
HighsInt to_original_el = this->start_[num_row];
|
|
345
|
+
this->start_[num_row] = new_num_nz;
|
|
346
|
+
for (HighsInt iRow = num_row - 1; iRow >= 0; iRow--) {
|
|
347
|
+
entry_offset -= new_row_length[iRow];
|
|
348
|
+
HighsInt from_original_el = this->start_[iRow];
|
|
349
|
+
// Can now use this new_row_length to store the start for the
|
|
350
|
+
// new entries
|
|
351
|
+
new_row_length[iRow] = to_original_el + entry_offset;
|
|
352
|
+
for (HighsInt iEl = to_original_el - 1; iEl >= from_original_el;
|
|
353
|
+
iEl--) {
|
|
354
|
+
this->index_[iEl + entry_offset] = this->index_[iEl];
|
|
355
|
+
this->value_[iEl + entry_offset] = this->value_[iEl];
|
|
356
|
+
}
|
|
357
|
+
to_original_el = from_original_el;
|
|
358
|
+
this->start_[iRow] = entry_offset + from_original_el;
|
|
359
|
+
}
|
|
360
|
+
// Now insert the indices and values for the new columns
|
|
361
|
+
for (HighsInt iCol = 0; iCol < num_new_col; iCol++) {
|
|
362
|
+
for (HighsInt iEl = new_matrix_start[iCol];
|
|
363
|
+
iEl < new_matrix_start[iCol + 1]; iEl++) {
|
|
364
|
+
HighsInt iRow = new_matrix_index[iEl];
|
|
365
|
+
this->index_[new_row_length[iRow]] = num_col + iCol;
|
|
366
|
+
this->value_[new_row_length[iRow]] = new_matrix_value[iEl];
|
|
367
|
+
new_row_length[iRow]++;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
// Have to increase the number of columns, even if no nonzeros are being
|
|
372
|
+
// added
|
|
373
|
+
this->num_col_ += num_new_col;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
void HighsSparseMatrix::addRows(const HighsSparseMatrix new_rows,
|
|
378
|
+
const int8_t* in_partition) {
|
|
379
|
+
assert(new_rows.isRowwise());
|
|
380
|
+
const HighsInt num_new_row = new_rows.num_row_;
|
|
381
|
+
const HighsInt num_new_nz = new_rows.numNz();
|
|
382
|
+
const vector<HighsInt>& new_matrix_start = new_rows.start_;
|
|
383
|
+
const vector<HighsInt>& new_matrix_index = new_rows.index_;
|
|
384
|
+
const vector<double>& new_matrix_value = new_rows.value_;
|
|
385
|
+
|
|
386
|
+
assert(this->formatOk());
|
|
387
|
+
// Adding rows to a row-wise partitioned matrix needs the
|
|
388
|
+
// partition information
|
|
389
|
+
const bool partitioned = this->format_ == MatrixFormat::kRowwisePartitioned;
|
|
390
|
+
if (partitioned) {
|
|
391
|
+
assert(1 == 0);
|
|
392
|
+
assert(in_partition != NULL);
|
|
393
|
+
}
|
|
394
|
+
assert(num_new_row >= 0);
|
|
395
|
+
assert(num_new_nz >= 0);
|
|
396
|
+
if (num_new_row == 0) {
|
|
397
|
+
// No rows are being added, so check that no nonzeros are being
|
|
398
|
+
// added
|
|
399
|
+
assert(num_new_nz == 0);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
// Adding a positive number of rows to a matrix
|
|
403
|
+
if (num_new_nz) {
|
|
404
|
+
// Nonzeros are being added, so ensure that non-null data are
|
|
405
|
+
// being passed
|
|
406
|
+
assert(!new_matrix_start.empty());
|
|
407
|
+
assert(!new_matrix_index.empty());
|
|
408
|
+
assert(!new_matrix_value.empty());
|
|
409
|
+
}
|
|
410
|
+
HighsInt num_col = this->num_col_;
|
|
411
|
+
HighsInt num_row = this->num_row_;
|
|
412
|
+
HighsInt num_nz = this->numNz();
|
|
413
|
+
// Check that nonzeros aren't being appended to a matrix with no columns
|
|
414
|
+
assert(num_new_nz <= 0 || num_col > 0);
|
|
415
|
+
|
|
416
|
+
if (this->isColwise()) {
|
|
417
|
+
// Matrix is currently a standard col-wise matrix, so flip
|
|
418
|
+
// row-wise if there are more new nonzeros than current nonzeros
|
|
419
|
+
if (num_new_nz > num_nz) this->ensureRowwise();
|
|
420
|
+
}
|
|
421
|
+
// Determine the new number of rows and nonzeros in the matrix
|
|
422
|
+
HighsInt new_num_nz = num_nz + num_new_nz;
|
|
423
|
+
HighsInt new_num_row = num_row + num_new_row;
|
|
424
|
+
|
|
425
|
+
if (this->isRowwise()) {
|
|
426
|
+
// Matrix is row-wise
|
|
427
|
+
this->start_.resize(new_num_row + 1);
|
|
428
|
+
// Append the starts of the new rows
|
|
429
|
+
if (num_new_nz) {
|
|
430
|
+
// Nontrivial number of nonzeros being added, so use new_matrix_start
|
|
431
|
+
for (HighsInt iNewRow = 0; iNewRow < num_new_row; iNewRow++)
|
|
432
|
+
this->start_[num_row + iNewRow] = num_nz + new_matrix_start[iNewRow];
|
|
433
|
+
} else {
|
|
434
|
+
// No nonzeros being added, so new_matrix_start may be NULL, but entries
|
|
435
|
+
// of zero are implied.
|
|
436
|
+
for (HighsInt iNewRow = 0; iNewRow < num_new_row; iNewRow++)
|
|
437
|
+
this->start_[num_row + iNewRow] = num_nz;
|
|
438
|
+
}
|
|
439
|
+
this->start_[new_num_row] = new_num_nz;
|
|
440
|
+
if (num_new_nz > 0) {
|
|
441
|
+
// Adding a non-trivial matrix: resize the matrix arrays accordingly
|
|
442
|
+
this->index_.resize(new_num_nz);
|
|
443
|
+
this->value_.resize(new_num_nz);
|
|
444
|
+
// Copy in the new indices and values
|
|
445
|
+
if (partitioned) {
|
|
446
|
+
// Insert the entries in the partition
|
|
447
|
+
assert(1 == 0);
|
|
448
|
+
for (HighsInt iNewRow = 0; iNewRow < num_new_row; iNewRow++) {
|
|
449
|
+
HighsInt iRow = num_row + iNewRow;
|
|
450
|
+
for (HighsInt iNewEl = new_matrix_start[iNewRow];
|
|
451
|
+
iNewEl < new_matrix_start[iNewRow + 1]; iNewEl++) {
|
|
452
|
+
HighsInt iCol = new_matrix_index[iNewEl];
|
|
453
|
+
if (in_partition[iCol]) {
|
|
454
|
+
HighsInt iEl = this->start_[iRow];
|
|
455
|
+
this->index_[iEl] = new_matrix_index[iNewEl];
|
|
456
|
+
this->value_[iEl] = new_matrix_value[iNewEl];
|
|
457
|
+
this->start_[iRow]++;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
// Use the incremented starts to initialise p_end, save these
|
|
462
|
+
// values and reset the starts
|
|
463
|
+
vector<HighsInt> save_p_end;
|
|
464
|
+
save_p_end.resize(num_new_row);
|
|
465
|
+
for (HighsInt iNewRow = 0; iNewRow < num_new_row; iNewRow++) {
|
|
466
|
+
HighsInt iRow = num_row + iNewRow;
|
|
467
|
+
this->start_[iRow] = num_nz + new_matrix_start[iNewRow];
|
|
468
|
+
this->p_end_[iRow] = this->start_[iRow];
|
|
469
|
+
save_p_end[iNewRow] = this->p_end_[iRow];
|
|
470
|
+
}
|
|
471
|
+
// Insert the entries not in the partition
|
|
472
|
+
for (HighsInt iNewRow = 0; iNewRow < num_new_row; iNewRow++) {
|
|
473
|
+
HighsInt iRow = num_row + iNewRow;
|
|
474
|
+
for (HighsInt iNewEl = new_matrix_start[iNewRow];
|
|
475
|
+
iNewEl < new_matrix_start[iNewRow + 1]; iNewEl++) {
|
|
476
|
+
HighsInt iCol = new_matrix_index[iNewEl];
|
|
477
|
+
if (!in_partition[iCol]) {
|
|
478
|
+
HighsInt iEl = this->p_end_[iRow];
|
|
479
|
+
this->index_[iEl] = new_matrix_index[iNewEl];
|
|
480
|
+
this->value_[iEl] = new_matrix_value[iNewEl];
|
|
481
|
+
this->p_end_[iRow]++;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
// Reset p_end using the saved values
|
|
486
|
+
for (HighsInt iNewRow = 0; iNewRow < num_new_row; iNewRow++)
|
|
487
|
+
this->p_end_[num_row + iNewRow] = save_p_end[iNewRow];
|
|
488
|
+
} else {
|
|
489
|
+
for (HighsInt iNewEl = 0; iNewEl < num_new_nz; iNewEl++) {
|
|
490
|
+
this->index_[num_nz + iNewEl] = new_matrix_index[iNewEl];
|
|
491
|
+
this->value_[num_nz + iNewEl] = new_matrix_value[iNewEl];
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
} else {
|
|
496
|
+
// Storing the matrix column-wise, so have to insert the new rows
|
|
497
|
+
assert(this->isColwise());
|
|
498
|
+
if (num_new_nz) {
|
|
499
|
+
vector<HighsInt> length;
|
|
500
|
+
length.assign(num_col, 0);
|
|
501
|
+
for (HighsInt iEl = 0; iEl < num_new_nz; iEl++)
|
|
502
|
+
length[new_matrix_index[iEl]]++;
|
|
503
|
+
// Determine the new number of nonzeros and resize the column-wise matrix
|
|
504
|
+
// arrays
|
|
505
|
+
this->index_.resize(new_num_nz);
|
|
506
|
+
this->value_.resize(new_num_nz);
|
|
507
|
+
// Append the new rows
|
|
508
|
+
// Shift the existing columns to make space for the new entries
|
|
509
|
+
HighsInt new_iEl = new_num_nz;
|
|
510
|
+
for (HighsInt iCol = num_col - 1; iCol >= 0; iCol--) {
|
|
511
|
+
HighsInt start_col_plus_1 = new_iEl;
|
|
512
|
+
new_iEl -= length[iCol];
|
|
513
|
+
for (HighsInt iEl = this->start_[iCol + 1] - 1;
|
|
514
|
+
iEl >= this->start_[iCol]; iEl--) {
|
|
515
|
+
new_iEl--;
|
|
516
|
+
this->index_[new_iEl] = this->index_[iEl];
|
|
517
|
+
this->value_[new_iEl] = this->value_[iEl];
|
|
518
|
+
}
|
|
519
|
+
this->start_[iCol + 1] = start_col_plus_1;
|
|
520
|
+
}
|
|
521
|
+
assert(new_iEl == 0);
|
|
522
|
+
// Insert the new entries
|
|
523
|
+
for (HighsInt iNewRow = 0; iNewRow < num_new_row; iNewRow++) {
|
|
524
|
+
HighsInt first_el = new_matrix_start[iNewRow];
|
|
525
|
+
HighsInt last_el =
|
|
526
|
+
(iNewRow < num_new_row - 1 ? new_matrix_start[iNewRow + 1]
|
|
527
|
+
: num_new_nz);
|
|
528
|
+
for (HighsInt iEl = first_el; iEl < last_el; iEl++) {
|
|
529
|
+
HighsInt iCol = new_matrix_index[iEl];
|
|
530
|
+
new_iEl = this->start_[iCol + 1] - length[iCol];
|
|
531
|
+
length[iCol]--;
|
|
532
|
+
this->index_[new_iEl] = num_row + iNewRow;
|
|
533
|
+
this->value_[new_iEl] = new_matrix_value[iEl];
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
// Update the number of rows
|
|
539
|
+
this->num_row_ += num_new_row;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
void HighsSparseMatrix::getCol(const HighsInt iCol, HighsInt& num_nz,
|
|
543
|
+
HighsInt* index, double* value) const {
|
|
544
|
+
assert(iCol >= 0 && iCol < this->num_col_);
|
|
545
|
+
num_nz = 0;
|
|
546
|
+
if (this->isColwise()) {
|
|
547
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
548
|
+
iEl++) {
|
|
549
|
+
index[num_nz] = this->index_[iEl];
|
|
550
|
+
value[num_nz] = this->value_[iEl];
|
|
551
|
+
num_nz++;
|
|
552
|
+
}
|
|
553
|
+
} else {
|
|
554
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
555
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
556
|
+
iEl++) {
|
|
557
|
+
if (this->index_[iEl] == iCol) {
|
|
558
|
+
index[num_nz] = iRow;
|
|
559
|
+
value[num_nz] = this->value_[iEl];
|
|
560
|
+
num_nz++;
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
void HighsSparseMatrix::getRow(const HighsInt iRow, HighsInt& num_nz,
|
|
569
|
+
HighsInt* index, double* value) const {
|
|
570
|
+
assert(iRow >= 0 && iRow < this->num_row_);
|
|
571
|
+
num_nz = 0;
|
|
572
|
+
if (this->isRowwise()) {
|
|
573
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
574
|
+
iEl++) {
|
|
575
|
+
index[num_nz] = this->index_[iEl];
|
|
576
|
+
value[num_nz] = this->value_[iEl];
|
|
577
|
+
num_nz++;
|
|
578
|
+
}
|
|
579
|
+
} else {
|
|
580
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
581
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
582
|
+
iEl++) {
|
|
583
|
+
if (this->index_[iEl] == iRow) {
|
|
584
|
+
index[num_nz] = iCol;
|
|
585
|
+
value[num_nz] = this->value_[iEl];
|
|
586
|
+
num_nz++;
|
|
587
|
+
break;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
void HighsSparseMatrix::deleteCols(
|
|
595
|
+
const HighsIndexCollection& index_collection) {
|
|
596
|
+
assert(this->formatOk());
|
|
597
|
+
// Can't handle rowwise matrices yet
|
|
598
|
+
assert(!this->isRowwise());
|
|
599
|
+
assert(ok(index_collection));
|
|
600
|
+
HighsInt from_k;
|
|
601
|
+
HighsInt to_k;
|
|
602
|
+
limits(index_collection, from_k, to_k);
|
|
603
|
+
if (from_k > to_k) return;
|
|
604
|
+
|
|
605
|
+
HighsInt delete_from_col;
|
|
606
|
+
HighsInt delete_to_col;
|
|
607
|
+
HighsInt keep_from_col;
|
|
608
|
+
HighsInt keep_to_col = -1;
|
|
609
|
+
HighsInt current_set_entry = 0;
|
|
610
|
+
|
|
611
|
+
HighsInt col_dim = this->num_col_;
|
|
612
|
+
HighsInt new_num_col = 0;
|
|
613
|
+
HighsInt new_num_nz = 0;
|
|
614
|
+
for (HighsInt k = from_k; k <= to_k; k++) {
|
|
615
|
+
updateOutInIndex(index_collection, delete_from_col, delete_to_col,
|
|
616
|
+
keep_from_col, keep_to_col, current_set_entry);
|
|
617
|
+
if (k == from_k) {
|
|
618
|
+
// Account for the initial columns being kept
|
|
619
|
+
new_num_col = delete_from_col;
|
|
620
|
+
new_num_nz = this->start_[delete_from_col];
|
|
621
|
+
}
|
|
622
|
+
// Ensure that the starts of the deleted columns are zeroed to
|
|
623
|
+
// avoid redundant start information for columns whose indices
|
|
624
|
+
// aren't used after the deletion takes place. In particular, if
|
|
625
|
+
// all columns are deleted then something must be done to ensure
|
|
626
|
+
// that the matrix isn't magically recreated by increasing the
|
|
627
|
+
// number of columns from zero when there are no rows in the
|
|
628
|
+
// matrix.
|
|
629
|
+
for (HighsInt col = delete_from_col; col <= delete_to_col; col++)
|
|
630
|
+
this->start_[col] = 0;
|
|
631
|
+
// Shift the starts - both in place and value - to account for the
|
|
632
|
+
// columns and nonzeros removed
|
|
633
|
+
const HighsInt keep_from_el = this->start_[keep_from_col];
|
|
634
|
+
for (HighsInt col = keep_from_col; col <= keep_to_col; col++) {
|
|
635
|
+
this->start_[new_num_col] = new_num_nz + this->start_[col] - keep_from_el;
|
|
636
|
+
new_num_col++;
|
|
637
|
+
}
|
|
638
|
+
for (HighsInt el = keep_from_el; el < this->start_[keep_to_col + 1]; el++) {
|
|
639
|
+
this->index_[new_num_nz] = this->index_[el];
|
|
640
|
+
this->value_[new_num_nz] = this->value_[el];
|
|
641
|
+
new_num_nz++;
|
|
642
|
+
}
|
|
643
|
+
if (keep_to_col >= col_dim - 1) break;
|
|
644
|
+
}
|
|
645
|
+
// Ensure that the start of the spurious last column is zeroed so
|
|
646
|
+
// that it doesn't give a positive number of matrix entries if the
|
|
647
|
+
// number of columns in the matrix is increased when there are no
|
|
648
|
+
// rows in the matrix.
|
|
649
|
+
this->start_[this->num_col_] = 0;
|
|
650
|
+
this->start_[new_num_col] = new_num_nz;
|
|
651
|
+
this->start_.resize(new_num_col + 1);
|
|
652
|
+
this->index_.resize(new_num_nz);
|
|
653
|
+
this->value_.resize(new_num_nz);
|
|
654
|
+
// Update the number of columns
|
|
655
|
+
this->num_col_ = new_num_col;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
void HighsSparseMatrix::deleteRows(
|
|
659
|
+
const HighsIndexCollection& index_collection) {
|
|
660
|
+
assert(this->formatOk());
|
|
661
|
+
assert(ok(index_collection));
|
|
662
|
+
HighsInt from_k;
|
|
663
|
+
HighsInt to_k;
|
|
664
|
+
limits(index_collection, from_k, to_k);
|
|
665
|
+
if (from_k > to_k) return;
|
|
666
|
+
|
|
667
|
+
HighsInt delete_from_row;
|
|
668
|
+
HighsInt delete_to_row;
|
|
669
|
+
HighsInt keep_from_row;
|
|
670
|
+
HighsInt row_dim = this->num_row_;
|
|
671
|
+
HighsInt keep_to_row = -1;
|
|
672
|
+
HighsInt current_set_entry = 0;
|
|
673
|
+
|
|
674
|
+
// Set up a row mask to indicate the new row index of kept rows and
|
|
675
|
+
// -1 for deleted rows so that the kept entries in the column-wise
|
|
676
|
+
// matrix can be identified and have their correct row index.
|
|
677
|
+
vector<HighsInt> new_index;
|
|
678
|
+
new_index.resize(this->num_row_);
|
|
679
|
+
HighsInt new_num_row = 0;
|
|
680
|
+
bool mask = index_collection.is_mask_;
|
|
681
|
+
const vector<HighsInt>& row_mask = index_collection.mask_;
|
|
682
|
+
if (!mask) {
|
|
683
|
+
keep_to_row = -1;
|
|
684
|
+
current_set_entry = 0;
|
|
685
|
+
for (HighsInt k = from_k; k <= to_k; k++) {
|
|
686
|
+
updateOutInIndex(index_collection, delete_from_row, delete_to_row,
|
|
687
|
+
keep_from_row, keep_to_row, current_set_entry);
|
|
688
|
+
if (k == from_k) {
|
|
689
|
+
// Account for any initial rows being kept
|
|
690
|
+
for (HighsInt row = 0; row < delete_from_row; row++) {
|
|
691
|
+
new_index[row] = new_num_row;
|
|
692
|
+
new_num_row++;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
for (HighsInt row = delete_from_row; row <= delete_to_row; row++) {
|
|
696
|
+
new_index[row] = -1;
|
|
697
|
+
}
|
|
698
|
+
for (HighsInt row = keep_from_row; row <= keep_to_row; row++) {
|
|
699
|
+
new_index[row] = new_num_row;
|
|
700
|
+
new_num_row++;
|
|
701
|
+
}
|
|
702
|
+
if (keep_to_row >= row_dim - 1) break;
|
|
703
|
+
}
|
|
704
|
+
} else {
|
|
705
|
+
for (HighsInt row = 0; row < this->num_row_; row++) {
|
|
706
|
+
if (row_mask[row]) {
|
|
707
|
+
new_index[row] = -1;
|
|
708
|
+
} else {
|
|
709
|
+
new_index[row] = new_num_row;
|
|
710
|
+
new_num_row++;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
HighsInt new_num_nz = 0;
|
|
715
|
+
for (HighsInt col = 0; col < this->num_col_; col++) {
|
|
716
|
+
HighsInt from_el = this->start_[col];
|
|
717
|
+
this->start_[col] = new_num_nz;
|
|
718
|
+
for (HighsInt el = from_el; el < this->start_[col + 1]; el++) {
|
|
719
|
+
HighsInt row = this->index_[el];
|
|
720
|
+
HighsInt new_row = new_index[row];
|
|
721
|
+
if (new_row >= 0) {
|
|
722
|
+
this->index_[new_num_nz] = new_row;
|
|
723
|
+
this->value_[new_num_nz] = this->value_[el];
|
|
724
|
+
new_num_nz++;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
this->start_[this->num_col_] = new_num_nz;
|
|
729
|
+
this->start_.resize(this->num_col_ + 1);
|
|
730
|
+
this->index_.resize(new_num_nz);
|
|
731
|
+
this->value_.resize(new_num_nz);
|
|
732
|
+
// Update the number of rows
|
|
733
|
+
this->num_row_ = new_num_row;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
HighsStatus HighsSparseMatrix::assessStart(const HighsLogOptions& log_options) {
|
|
737
|
+
// Identify main dimensions
|
|
738
|
+
HighsInt vec_dim;
|
|
739
|
+
HighsInt num_vec;
|
|
740
|
+
if (this->isColwise()) {
|
|
741
|
+
vec_dim = this->num_row_;
|
|
742
|
+
num_vec = this->num_col_;
|
|
743
|
+
} else {
|
|
744
|
+
vec_dim = this->num_col_;
|
|
745
|
+
num_vec = this->num_row_;
|
|
746
|
+
}
|
|
747
|
+
if (this->start_[0]) {
|
|
748
|
+
highsLogUser(log_options, HighsLogType::kError,
|
|
749
|
+
"Matrix start[0] = %d, not 0\n", int(this->start_[0]));
|
|
750
|
+
return HighsStatus::kError;
|
|
751
|
+
}
|
|
752
|
+
HighsInt num_nz = this->numNz();
|
|
753
|
+
for (HighsInt iVec = 1; iVec < num_vec; iVec++) {
|
|
754
|
+
if (this->start_[iVec] < this->start_[iVec - 1]) {
|
|
755
|
+
highsLogUser(log_options, HighsLogType::kError,
|
|
756
|
+
"Matrix start[%d] = %d > %d = start[%d]\n", int(iVec),
|
|
757
|
+
int(this->start_[iVec]), int(this->start_[iVec - 1]),
|
|
758
|
+
int(iVec - 1));
|
|
759
|
+
return HighsStatus::kError;
|
|
760
|
+
}
|
|
761
|
+
if (this->start_[iVec] > num_nz) {
|
|
762
|
+
highsLogUser(log_options, HighsLogType::kError,
|
|
763
|
+
"Matrix start[%d] = %d > %d = number of nonzeros\n",
|
|
764
|
+
int(iVec), int(this->start_[iVec]), int(num_nz));
|
|
765
|
+
return HighsStatus::kError;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
return HighsStatus::kOk;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
HighsStatus HighsSparseMatrix::assessIndexBounds(
|
|
772
|
+
const HighsLogOptions& log_options) {
|
|
773
|
+
// Identify main dimensions
|
|
774
|
+
HighsInt vec_dim;
|
|
775
|
+
HighsInt num_vec;
|
|
776
|
+
if (this->isColwise()) {
|
|
777
|
+
vec_dim = this->num_row_;
|
|
778
|
+
// num_vec = this->num_col_;
|
|
779
|
+
} else {
|
|
780
|
+
vec_dim = this->num_col_;
|
|
781
|
+
// num_vec = this->num_row_;
|
|
782
|
+
}
|
|
783
|
+
HighsInt num_nz = this->numNz();
|
|
784
|
+
for (HighsInt iEl = 1; iEl < num_nz; iEl++) {
|
|
785
|
+
if (this->index_[iEl] < 0 || this->index_[iEl] >= vec_dim) {
|
|
786
|
+
highsLogUser(log_options, HighsLogType::kError,
|
|
787
|
+
"Matrix index[%d] = %d is not in legal range of [0, %d)\n",
|
|
788
|
+
int(iEl), int(this->index_[iEl]), vec_dim);
|
|
789
|
+
return HighsStatus::kError;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
return HighsStatus::kOk;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
HighsStatus HighsSparseMatrix::assess(const HighsLogOptions& log_options,
|
|
796
|
+
const std::string matrix_name,
|
|
797
|
+
const double small_matrix_value,
|
|
798
|
+
const double large_matrix_value) {
|
|
799
|
+
assert(this->formatOk());
|
|
800
|
+
// Identify main dimensions
|
|
801
|
+
HighsInt vec_dim;
|
|
802
|
+
HighsInt num_vec;
|
|
803
|
+
if (this->isColwise()) {
|
|
804
|
+
vec_dim = this->num_row_;
|
|
805
|
+
num_vec = this->num_col_;
|
|
806
|
+
} else {
|
|
807
|
+
vec_dim = this->num_col_;
|
|
808
|
+
num_vec = this->num_row_;
|
|
809
|
+
}
|
|
810
|
+
const bool partitioned = this->format_ == MatrixFormat::kRowwisePartitioned;
|
|
811
|
+
return assessMatrix(log_options, matrix_name, vec_dim, num_vec, partitioned,
|
|
812
|
+
this->start_, this->p_end_, this->index_, this->value_,
|
|
813
|
+
small_matrix_value, large_matrix_value);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
void HighsSparseMatrix::assessSmallValues(const HighsLogOptions& log_options,
|
|
817
|
+
const double small_matrix_value) {
|
|
818
|
+
double min_value = kHighsInf;
|
|
819
|
+
const HighsInt num_values = this->value_.size();
|
|
820
|
+
for (HighsInt iX = 0; iX < num_values; iX++)
|
|
821
|
+
min_value = std::min(std::abs(this->value_[iX]), min_value);
|
|
822
|
+
if (min_value > small_matrix_value) return;
|
|
823
|
+
analyseVectorValues(&log_options, "Small values in matrix", num_values,
|
|
824
|
+
this->value_, false, "");
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
bool HighsSparseMatrix::hasLargeValue(const double large_matrix_value) {
|
|
828
|
+
for (HighsInt iEl = 0; iEl < this->numNz(); iEl++)
|
|
829
|
+
if (std::abs(this->value_[iEl]) >= large_matrix_value) return true;
|
|
830
|
+
return false;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
void HighsSparseMatrix::considerColScaling(
|
|
834
|
+
const HighsInt max_scale_factor_exponent, double* col_scale) {
|
|
835
|
+
const double log2 = log(2.0);
|
|
836
|
+
const double max_allow_scale = pow(2.0, max_scale_factor_exponent);
|
|
837
|
+
const double min_allow_scale = 1 / max_allow_scale;
|
|
838
|
+
|
|
839
|
+
const double min_allow_col_scale = min_allow_scale;
|
|
840
|
+
const double max_allow_col_scale = max_allow_scale;
|
|
841
|
+
|
|
842
|
+
if (this->isColwise()) {
|
|
843
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
844
|
+
double col_max_value = 0;
|
|
845
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
846
|
+
iEl++)
|
|
847
|
+
col_max_value = max(fabs(this->value_[iEl]), col_max_value);
|
|
848
|
+
if (col_max_value) {
|
|
849
|
+
double col_scale_value = 1 / col_max_value;
|
|
850
|
+
// Convert the col scale factor to the nearest power of two, and
|
|
851
|
+
// ensure that it is not excessively large or small
|
|
852
|
+
col_scale_value = pow(2.0, floor(log(col_scale_value) / log2 + 0.5));
|
|
853
|
+
col_scale_value =
|
|
854
|
+
min(max(min_allow_col_scale, col_scale_value), max_allow_col_scale);
|
|
855
|
+
col_scale[iCol] = col_scale_value;
|
|
856
|
+
// Scale the column
|
|
857
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
858
|
+
iEl++)
|
|
859
|
+
this->value_[iEl] *= col_scale[iCol];
|
|
860
|
+
} else {
|
|
861
|
+
// Empty column
|
|
862
|
+
col_scale[iCol] = 1;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
} else {
|
|
866
|
+
assert(1 == 0);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
void HighsSparseMatrix::considerRowScaling(
|
|
871
|
+
const HighsInt max_scale_factor_exponent, double* row_scale) {
|
|
872
|
+
const double log2 = log(2.0);
|
|
873
|
+
const double max_allow_scale = pow(2.0, max_scale_factor_exponent);
|
|
874
|
+
const double min_allow_scale = 1 / max_allow_scale;
|
|
875
|
+
|
|
876
|
+
const double min_allow_row_scale = min_allow_scale;
|
|
877
|
+
const double max_allow_row_scale = max_allow_scale;
|
|
878
|
+
|
|
879
|
+
if (this->isRowwise()) {
|
|
880
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
881
|
+
double row_max_value = 0;
|
|
882
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
883
|
+
iEl++)
|
|
884
|
+
row_max_value = max(fabs(this->value_[iEl]), row_max_value);
|
|
885
|
+
if (row_max_value) {
|
|
886
|
+
double row_scale_value = 1 / row_max_value;
|
|
887
|
+
// Convert the row scale factor to the nearest power of two, and
|
|
888
|
+
// ensure that it is not excessively large or small
|
|
889
|
+
row_scale_value = pow(2.0, floor(log(row_scale_value) / log2 + 0.5));
|
|
890
|
+
row_scale_value =
|
|
891
|
+
min(max(min_allow_row_scale, row_scale_value), max_allow_row_scale);
|
|
892
|
+
row_scale[iRow] = row_scale_value;
|
|
893
|
+
// Scale the row
|
|
894
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
895
|
+
iEl++)
|
|
896
|
+
this->value_[iEl] *= row_scale[iRow];
|
|
897
|
+
} else {
|
|
898
|
+
// Empty row
|
|
899
|
+
row_scale[iRow] = 1;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
} else {
|
|
903
|
+
assert(1 == 0);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
void HighsSparseMatrix::scaleCol(const HighsInt col, const double colScale) {
|
|
908
|
+
assert(this->formatOk());
|
|
909
|
+
assert(col >= 0);
|
|
910
|
+
assert(col < this->num_col_);
|
|
911
|
+
assert(colScale);
|
|
912
|
+
|
|
913
|
+
if (this->isColwise()) {
|
|
914
|
+
for (HighsInt iEl = this->start_[col]; iEl < this->start_[col + 1]; iEl++)
|
|
915
|
+
this->value_[iEl] *= colScale;
|
|
916
|
+
} else {
|
|
917
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
918
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
919
|
+
iEl++) {
|
|
920
|
+
if (this->index_[iEl] == col) this->value_[iEl] *= colScale;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
void HighsSparseMatrix::scaleRow(const HighsInt row, const double rowScale) {
|
|
927
|
+
assert(this->formatOk());
|
|
928
|
+
assert(row >= 0);
|
|
929
|
+
assert(row < this->num_row_);
|
|
930
|
+
assert(rowScale);
|
|
931
|
+
|
|
932
|
+
if (this->isColwise()) {
|
|
933
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
934
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
935
|
+
iEl++) {
|
|
936
|
+
if (this->index_[iEl] == row) this->value_[iEl] *= rowScale;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
} else {
|
|
940
|
+
for (HighsInt iEl = this->start_[row]; iEl < this->start_[row + 1]; iEl++)
|
|
941
|
+
this->value_[iEl] *= rowScale;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
void HighsSparseMatrix::applyScale(const HighsScale& scale) {
|
|
946
|
+
assert(this->formatOk());
|
|
947
|
+
if (this->isColwise()) {
|
|
948
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
949
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
950
|
+
iEl++) {
|
|
951
|
+
HighsInt iRow = this->index_[iEl];
|
|
952
|
+
this->value_[iEl] *= (scale.col[iCol] * scale.row[iRow]);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
} else {
|
|
956
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
957
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
958
|
+
iEl++) {
|
|
959
|
+
HighsInt iCol = this->index_[iEl];
|
|
960
|
+
this->value_[iEl] *= (scale.col[iCol] * scale.row[iRow]);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
void HighsSparseMatrix::applyColScale(const HighsScale& scale) {
|
|
967
|
+
assert(this->formatOk());
|
|
968
|
+
if (this->isColwise()) {
|
|
969
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
970
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
971
|
+
iEl++)
|
|
972
|
+
this->value_[iEl] *= scale.col[iCol];
|
|
973
|
+
}
|
|
974
|
+
} else {
|
|
975
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
976
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
977
|
+
iEl++)
|
|
978
|
+
this->value_[iEl] *= scale.col[this->index_[iEl]];
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
void HighsSparseMatrix::applyRowScale(const HighsScale& scale) {
|
|
984
|
+
assert(this->formatOk());
|
|
985
|
+
if (this->isColwise()) {
|
|
986
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
987
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
988
|
+
iEl++)
|
|
989
|
+
this->value_[iEl] *= scale.row[this->index_[iEl]];
|
|
990
|
+
}
|
|
991
|
+
} else {
|
|
992
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
993
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
994
|
+
iEl++)
|
|
995
|
+
this->value_[iEl] *= scale.row[iRow];
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
void HighsSparseMatrix::unapplyScale(const HighsScale& scale) {
|
|
1001
|
+
assert(this->formatOk());
|
|
1002
|
+
if (this->isColwise()) {
|
|
1003
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
1004
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
1005
|
+
iEl++) {
|
|
1006
|
+
HighsInt iRow = this->index_[iEl];
|
|
1007
|
+
this->value_[iEl] /= (scale.col[iCol] * scale.row[iRow]);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
} else {
|
|
1011
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
1012
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
1013
|
+
iEl++) {
|
|
1014
|
+
HighsInt iCol = this->index_[iEl];
|
|
1015
|
+
this->value_[iEl] /= (scale.col[iCol] * scale.row[iRow]);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
void HighsSparseMatrix::createSlice(const HighsSparseMatrix& matrix,
|
|
1022
|
+
const HighsInt from_col,
|
|
1023
|
+
const HighsInt to_col) {
|
|
1024
|
+
assert(matrix.formatOk());
|
|
1025
|
+
assert(matrix.isColwise());
|
|
1026
|
+
assert(this->formatOk());
|
|
1027
|
+
HighsInt num_row = matrix.num_row_;
|
|
1028
|
+
const vector<HighsInt>& a_start = matrix.start_;
|
|
1029
|
+
const vector<HighsInt>& a_index = matrix.index_;
|
|
1030
|
+
const vector<double>& a_value = matrix.value_;
|
|
1031
|
+
vector<HighsInt>& slice_start = this->start_;
|
|
1032
|
+
vector<HighsInt>& slice_index = this->index_;
|
|
1033
|
+
vector<double>& slice_value = this->value_;
|
|
1034
|
+
HighsInt slice_num_col = to_col + 1 - from_col;
|
|
1035
|
+
HighsInt slice_num_nz = a_start[to_col + 1] - a_start[from_col];
|
|
1036
|
+
slice_start.resize(slice_num_col + 1);
|
|
1037
|
+
slice_index.resize(slice_num_nz);
|
|
1038
|
+
slice_value.resize(slice_num_nz);
|
|
1039
|
+
HighsInt from_col_start = a_start[from_col];
|
|
1040
|
+
for (HighsInt iCol = from_col; iCol < to_col + 1; iCol++)
|
|
1041
|
+
slice_start[iCol - from_col] = a_start[iCol] - from_col_start;
|
|
1042
|
+
slice_start[slice_num_col] = slice_num_nz;
|
|
1043
|
+
for (HighsInt iEl = a_start[from_col]; iEl < a_start[to_col + 1]; iEl++) {
|
|
1044
|
+
slice_index[iEl - from_col_start] = a_index[iEl];
|
|
1045
|
+
slice_value[iEl - from_col_start] = a_value[iEl];
|
|
1046
|
+
}
|
|
1047
|
+
this->num_col_ = slice_num_col;
|
|
1048
|
+
this->num_row_ = num_row;
|
|
1049
|
+
this->format_ = MatrixFormat::kColwise;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
void HighsSparseMatrix::createRowwise(const HighsSparseMatrix& matrix) {
|
|
1053
|
+
assert(matrix.formatOk());
|
|
1054
|
+
assert(matrix.isColwise());
|
|
1055
|
+
assert(this->formatOk());
|
|
1056
|
+
|
|
1057
|
+
HighsInt num_col = matrix.num_col_;
|
|
1058
|
+
HighsInt num_row = matrix.num_row_;
|
|
1059
|
+
HighsInt num_nz = matrix.numNz();
|
|
1060
|
+
const vector<HighsInt>& a_start = matrix.start_;
|
|
1061
|
+
const vector<HighsInt>& a_index = matrix.index_;
|
|
1062
|
+
const vector<double>& a_value = matrix.value_;
|
|
1063
|
+
vector<HighsInt>& ar_start = this->start_;
|
|
1064
|
+
vector<HighsInt>& ar_index = this->index_;
|
|
1065
|
+
vector<double>& ar_value = this->value_;
|
|
1066
|
+
|
|
1067
|
+
// Use ar_end to compute lengths, which are then transformed into
|
|
1068
|
+
// the ends of the inserted entries
|
|
1069
|
+
std::vector<HighsInt> ar_end;
|
|
1070
|
+
ar_start.resize(num_row + 1);
|
|
1071
|
+
ar_end.assign(num_row, 0);
|
|
1072
|
+
// Count the nonzeros in each row
|
|
1073
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
1074
|
+
for (HighsInt iEl = a_start[iCol]; iEl < a_start[iCol + 1]; iEl++) {
|
|
1075
|
+
HighsInt iRow = a_index[iEl];
|
|
1076
|
+
ar_end[iRow]++;
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
// Compute the starts and turn the lengths into ends
|
|
1080
|
+
ar_start[0] = 0;
|
|
1081
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++) {
|
|
1082
|
+
ar_start[iRow + 1] = ar_start[iRow] + ar_end[iRow];
|
|
1083
|
+
ar_end[iRow] = ar_start[iRow];
|
|
1084
|
+
}
|
|
1085
|
+
ar_index.resize(num_nz);
|
|
1086
|
+
ar_value.resize(num_nz);
|
|
1087
|
+
// Insert the entries
|
|
1088
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
1089
|
+
for (HighsInt iEl = a_start[iCol]; iEl < a_start[iCol + 1]; iEl++) {
|
|
1090
|
+
HighsInt iRow = a_index[iEl];
|
|
1091
|
+
HighsInt iToEl = ar_end[iRow]++;
|
|
1092
|
+
ar_index[iToEl] = iCol;
|
|
1093
|
+
ar_value[iToEl] = a_value[iEl];
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
this->format_ = MatrixFormat::kRowwise;
|
|
1097
|
+
this->num_col_ = num_col;
|
|
1098
|
+
this->num_row_ = num_row;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
void HighsSparseMatrix::createColwise(const HighsSparseMatrix& matrix) {
|
|
1102
|
+
assert(matrix.formatOk());
|
|
1103
|
+
assert(matrix.isRowwise());
|
|
1104
|
+
assert(this->formatOk());
|
|
1105
|
+
|
|
1106
|
+
HighsInt num_col = matrix.num_col_;
|
|
1107
|
+
HighsInt num_row = matrix.num_row_;
|
|
1108
|
+
HighsInt num_nz = matrix.numNz();
|
|
1109
|
+
const vector<HighsInt>& ar_start = matrix.start_;
|
|
1110
|
+
const vector<HighsInt>& ar_index = matrix.index_;
|
|
1111
|
+
const vector<double>& ar_value = matrix.value_;
|
|
1112
|
+
vector<HighsInt>& a_start = this->start_;
|
|
1113
|
+
vector<HighsInt>& a_index = this->index_;
|
|
1114
|
+
vector<double>& a_value = this->value_;
|
|
1115
|
+
|
|
1116
|
+
// Use a_end to compute lengths, which are then transformed into
|
|
1117
|
+
// the ends of the inserted entries
|
|
1118
|
+
std::vector<HighsInt> a_end;
|
|
1119
|
+
a_start.resize(num_col + 1);
|
|
1120
|
+
a_end.assign(num_col, 0);
|
|
1121
|
+
// Count the nonzeros in each col
|
|
1122
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++) {
|
|
1123
|
+
for (HighsInt iEl = ar_start[iRow]; iEl < ar_start[iRow + 1]; iEl++) {
|
|
1124
|
+
HighsInt iCol = ar_index[iEl];
|
|
1125
|
+
a_end[iCol]++;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
// Compute the starts and turn the lengths into ends
|
|
1129
|
+
a_start[0] = 0;
|
|
1130
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
1131
|
+
a_start[iCol + 1] = a_start[iCol] + a_end[iCol];
|
|
1132
|
+
a_end[iCol] = a_start[iCol];
|
|
1133
|
+
}
|
|
1134
|
+
a_index.resize(num_nz);
|
|
1135
|
+
a_value.resize(num_nz);
|
|
1136
|
+
// Insert the entries
|
|
1137
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++) {
|
|
1138
|
+
for (HighsInt iEl = ar_start[iRow]; iEl < ar_start[iRow + 1]; iEl++) {
|
|
1139
|
+
HighsInt iCol = ar_index[iEl];
|
|
1140
|
+
HighsInt iToEl = a_end[iCol]++;
|
|
1141
|
+
a_index[iToEl] = iRow;
|
|
1142
|
+
a_value[iToEl] = ar_value[iEl];
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
this->format_ = MatrixFormat::kColwise;
|
|
1146
|
+
this->num_col_ = num_col;
|
|
1147
|
+
this->num_row_ = num_row;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
void HighsSparseMatrix::alphaProductPlusY(const double alpha,
|
|
1151
|
+
const std::vector<double>& x,
|
|
1152
|
+
std::vector<double>& y,
|
|
1153
|
+
const bool transpose) const {
|
|
1154
|
+
assert(x.size() >=
|
|
1155
|
+
static_cast<size_t>(transpose ? this->num_row_ : this->num_col_));
|
|
1156
|
+
assert(y.size() >=
|
|
1157
|
+
static_cast<size_t>(transpose ? this->num_col_ : this->num_row_));
|
|
1158
|
+
if (this->isColwise()) {
|
|
1159
|
+
if (transpose) {
|
|
1160
|
+
for (int iCol = 0; iCol < this->num_col_; iCol++)
|
|
1161
|
+
for (int iEl = this->start_[iCol]; iEl < this->start_[iCol + 1]; iEl++)
|
|
1162
|
+
y[iCol] += alpha * this->value_[iEl] * x[this->index_[iEl]];
|
|
1163
|
+
} else {
|
|
1164
|
+
for (int iCol = 0; iCol < this->num_col_; iCol++)
|
|
1165
|
+
for (int iEl = this->start_[iCol]; iEl < this->start_[iCol + 1]; iEl++)
|
|
1166
|
+
y[this->index_[iEl]] += alpha * this->value_[iEl] * x[iCol];
|
|
1167
|
+
}
|
|
1168
|
+
} else {
|
|
1169
|
+
if (transpose) {
|
|
1170
|
+
for (int iRow = 0; iRow < this->num_row_; iRow++)
|
|
1171
|
+
for (int iEl = this->start_[iRow]; iEl < this->start_[iRow + 1]; iEl++)
|
|
1172
|
+
y[this->index_[iEl]] += alpha * this->value_[iEl] * x[iRow];
|
|
1173
|
+
} else {
|
|
1174
|
+
for (int iRow = 0; iRow < this->num_row_; iRow++)
|
|
1175
|
+
for (int iEl = this->start_[iRow]; iEl < this->start_[iRow + 1]; iEl++)
|
|
1176
|
+
y[iRow] += alpha * this->value_[iEl] * x[this->index_[iEl]];
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
void HighsSparseMatrix::product(vector<double>& result,
|
|
1182
|
+
const vector<double>& row) const {
|
|
1183
|
+
assert(this->formatOk());
|
|
1184
|
+
assert((int)row.size() >= this->num_col_);
|
|
1185
|
+
result.assign(this->num_row_, 0.0);
|
|
1186
|
+
if (this->isColwise()) {
|
|
1187
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
1188
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
1189
|
+
iEl++)
|
|
1190
|
+
result[this->index_[iEl]] += row[iCol] * this->value_[iEl];
|
|
1191
|
+
}
|
|
1192
|
+
} else {
|
|
1193
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
1194
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
1195
|
+
iEl++)
|
|
1196
|
+
result[iRow] += row[this->index_[iEl]] * this->value_[iEl];
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
void HighsSparseMatrix::productTranspose(vector<double>& result,
|
|
1202
|
+
const vector<double>& col) const {
|
|
1203
|
+
assert(this->formatOk());
|
|
1204
|
+
assert((int)col.size() >= this->num_row_);
|
|
1205
|
+
result.assign(this->num_col_, 0.0);
|
|
1206
|
+
if (this->isColwise()) {
|
|
1207
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
1208
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
1209
|
+
iEl++)
|
|
1210
|
+
result[iCol] += col[this->index_[iEl]] * this->value_[iEl];
|
|
1211
|
+
}
|
|
1212
|
+
} else {
|
|
1213
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
1214
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
1215
|
+
iEl++)
|
|
1216
|
+
result[this->index_[iEl]] += col[iRow] * this->value_[iEl];
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
void HighsSparseMatrix::productQuad(vector<double>& result,
|
|
1222
|
+
const vector<double>& row,
|
|
1223
|
+
const HighsInt debug_report) const {
|
|
1224
|
+
assert(this->formatOk());
|
|
1225
|
+
assert((int)row.size() >= this->num_col_);
|
|
1226
|
+
result.assign(this->num_row_, 0.0);
|
|
1227
|
+
if (this->isColwise()) {
|
|
1228
|
+
std::vector<HighsCDouble> value(this->num_row_, 0);
|
|
1229
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
1230
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
1231
|
+
iEl++)
|
|
1232
|
+
value[this->index_[iEl]] += row[iCol] * this->value_[iEl];
|
|
1233
|
+
}
|
|
1234
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++)
|
|
1235
|
+
result[iRow] = double(value[iRow]);
|
|
1236
|
+
} else {
|
|
1237
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
1238
|
+
HighsCDouble value = 0.0;
|
|
1239
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
1240
|
+
iEl++)
|
|
1241
|
+
value += row[this->index_[iEl]] * this->value_[iEl];
|
|
1242
|
+
result[iRow] = double(value);
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
void HighsSparseMatrix::productTransposeQuad(
|
|
1248
|
+
vector<double>& result, const vector<double>& row,
|
|
1249
|
+
const HighsInt debug_report) const {
|
|
1250
|
+
assert(this->formatOk());
|
|
1251
|
+
assert((int)row.size() >= this->num_row_);
|
|
1252
|
+
result.assign(this->num_col_, 0.0);
|
|
1253
|
+
if (this->isColwise()) {
|
|
1254
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
1255
|
+
HighsCDouble value = 0.0;
|
|
1256
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
1257
|
+
iEl++)
|
|
1258
|
+
value += row[this->index_[iEl]] * this->value_[iEl];
|
|
1259
|
+
result[iCol] = double(value);
|
|
1260
|
+
}
|
|
1261
|
+
} else {
|
|
1262
|
+
std::vector<HighsCDouble> value(this->num_col_, 0);
|
|
1263
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
1264
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
1265
|
+
iEl++)
|
|
1266
|
+
value[this->index_[iEl]] += row[iRow] * this->value_[iEl];
|
|
1267
|
+
}
|
|
1268
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++)
|
|
1269
|
+
result[iCol] = double(value[iCol]);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
void HighsSparseMatrix::productTransposeQuad(
|
|
1274
|
+
vector<double>& result_value, vector<HighsInt>& result_index,
|
|
1275
|
+
const HVector& column, const HighsInt debug_report) const {
|
|
1276
|
+
if (debug_report >= kDebugReportAll)
|
|
1277
|
+
printf("\nHighsSparseMatrix::productTranspose:\n");
|
|
1278
|
+
if (this->isColwise()) {
|
|
1279
|
+
result_value.reserve(this->num_col_);
|
|
1280
|
+
result_index.reserve(this->num_col_);
|
|
1281
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
1282
|
+
HighsCDouble value = 0.0;
|
|
1283
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
1284
|
+
iEl++)
|
|
1285
|
+
value += column.array[this->index_[iEl]] * this->value_[iEl];
|
|
1286
|
+
|
|
1287
|
+
if (abs(value) - kHighsTiny > 0.0) {
|
|
1288
|
+
result_value.push_back(double(value));
|
|
1289
|
+
result_index.push_back(iCol);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
} else {
|
|
1293
|
+
HighsSparseVectorSum sum(num_col_);
|
|
1294
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
1295
|
+
double multiplier = column.array[iRow];
|
|
1296
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->start_[iRow + 1];
|
|
1297
|
+
iEl++)
|
|
1298
|
+
sum.add(this->index_[iEl], multiplier * this->value_[iEl]);
|
|
1299
|
+
}
|
|
1300
|
+
if (debug_report >= kDebugReportAll) {
|
|
1301
|
+
HighsSparseVectorSum report_sum(num_col_);
|
|
1302
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
1303
|
+
double multiplier = column.array[iRow];
|
|
1304
|
+
if (debug_report == kDebugReportAll || debug_report == iRow)
|
|
1305
|
+
debugReportRowPrice(iRow, multiplier, this->start_[iRow + 1],
|
|
1306
|
+
report_sum);
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
sum.cleanup([](HighsInt, double x) { return std::abs(x) <= kHighsTiny; });
|
|
1311
|
+
result_index = std::move(sum.nonzeroinds);
|
|
1312
|
+
HighsInt result_num_nz = result_index.size();
|
|
1313
|
+
result_value.reserve(result_num_nz);
|
|
1314
|
+
for (HighsInt i = 0; i < result_num_nz; ++i)
|
|
1315
|
+
result_value.push_back(sum.getValue(result_index[i]));
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
void HighsSparseMatrix::createRowwisePartitioned(
|
|
1320
|
+
const HighsSparseMatrix& matrix, const int8_t* in_partition) {
|
|
1321
|
+
assert(matrix.formatOk());
|
|
1322
|
+
assert(matrix.isColwise());
|
|
1323
|
+
assert(this->formatOk());
|
|
1324
|
+
const bool all_in_partition = in_partition == NULL;
|
|
1325
|
+
|
|
1326
|
+
HighsInt num_col = matrix.num_col_;
|
|
1327
|
+
HighsInt num_row = matrix.num_row_;
|
|
1328
|
+
HighsInt num_nz = matrix.numNz();
|
|
1329
|
+
const vector<HighsInt>& a_start = matrix.start_;
|
|
1330
|
+
const vector<HighsInt>& a_index = matrix.index_;
|
|
1331
|
+
const vector<double>& a_value = matrix.value_;
|
|
1332
|
+
vector<HighsInt>& ar_start = this->start_;
|
|
1333
|
+
vector<HighsInt>& ar_p_end = this->p_end_;
|
|
1334
|
+
vector<HighsInt>& ar_index = this->index_;
|
|
1335
|
+
vector<double>& ar_value = this->value_;
|
|
1336
|
+
|
|
1337
|
+
// Use ar_p_end and ar_end to compute lengths, which are then transformed into
|
|
1338
|
+
// the p_ends and ends of the inserted entries
|
|
1339
|
+
std::vector<HighsInt> ar_end;
|
|
1340
|
+
ar_start.resize(num_row + 1);
|
|
1341
|
+
ar_p_end.assign(num_row, 0);
|
|
1342
|
+
ar_end.assign(num_row, 0);
|
|
1343
|
+
// Count the nonzeros of nonbasic and basic columns in each row
|
|
1344
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
1345
|
+
if (all_in_partition || in_partition[iCol]) {
|
|
1346
|
+
for (HighsInt iEl = a_start[iCol]; iEl < a_start[iCol + 1]; iEl++) {
|
|
1347
|
+
HighsInt iRow = a_index[iEl];
|
|
1348
|
+
ar_p_end[iRow]++;
|
|
1349
|
+
}
|
|
1350
|
+
} else {
|
|
1351
|
+
for (HighsInt iEl = a_start[iCol]; iEl < a_start[iCol + 1]; iEl++) {
|
|
1352
|
+
HighsInt iRow = a_index[iEl];
|
|
1353
|
+
ar_end[iRow]++;
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
// Compute the starts and turn the lengths into ends
|
|
1358
|
+
ar_start[0] = 0;
|
|
1359
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++)
|
|
1360
|
+
ar_start[iRow + 1] = ar_start[iRow] + ar_p_end[iRow] + ar_end[iRow];
|
|
1361
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++) {
|
|
1362
|
+
ar_end[iRow] = ar_start[iRow] + ar_p_end[iRow];
|
|
1363
|
+
ar_p_end[iRow] = ar_start[iRow];
|
|
1364
|
+
}
|
|
1365
|
+
// Insert the entries
|
|
1366
|
+
ar_index.resize(num_nz);
|
|
1367
|
+
ar_value.resize(num_nz);
|
|
1368
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
1369
|
+
if (all_in_partition || in_partition[iCol]) {
|
|
1370
|
+
for (HighsInt iEl = a_start[iCol]; iEl < a_start[iCol + 1]; iEl++) {
|
|
1371
|
+
HighsInt iRow = a_index[iEl];
|
|
1372
|
+
HighsInt iToEl = ar_p_end[iRow]++;
|
|
1373
|
+
ar_index[iToEl] = iCol;
|
|
1374
|
+
ar_value[iToEl] = a_value[iEl];
|
|
1375
|
+
}
|
|
1376
|
+
} else {
|
|
1377
|
+
for (HighsInt iEl = a_start[iCol]; iEl < a_start[iCol + 1]; iEl++) {
|
|
1378
|
+
HighsInt iRow = a_index[iEl];
|
|
1379
|
+
HighsInt iToEl = ar_end[iRow]++;
|
|
1380
|
+
ar_index[iToEl] = iCol;
|
|
1381
|
+
ar_value[iToEl] = a_value[iEl];
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
this->format_ = MatrixFormat::kRowwisePartitioned;
|
|
1386
|
+
this->num_col_ = num_col;
|
|
1387
|
+
this->num_row_ = num_row;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
bool HighsSparseMatrix::debugPartitionOk(const int8_t* in_partition) const {
|
|
1391
|
+
assert(this->format_ == MatrixFormat::kRowwisePartitioned);
|
|
1392
|
+
bool ok = true;
|
|
1393
|
+
for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
|
|
1394
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < this->p_end_[iRow]; iEl++) {
|
|
1395
|
+
if (!in_partition[this->index_[iEl]]) {
|
|
1396
|
+
ok = false;
|
|
1397
|
+
break;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
if (!ok) break;
|
|
1401
|
+
for (HighsInt iEl = this->p_end_[iRow]; iEl < this->start_[iRow + 1];
|
|
1402
|
+
iEl++) {
|
|
1403
|
+
if (in_partition[this->index_[iEl]]) {
|
|
1404
|
+
ok = false;
|
|
1405
|
+
break;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
if (!ok) break;
|
|
1409
|
+
}
|
|
1410
|
+
return ok;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
void HighsSparseMatrix::priceByColumn(const bool quad_precision,
|
|
1414
|
+
HVector& result, const HVector& column,
|
|
1415
|
+
const HighsInt debug_report) const {
|
|
1416
|
+
assert(this->isColwise());
|
|
1417
|
+
if (debug_report >= kDebugReportAll)
|
|
1418
|
+
printf("\nHighsSparseMatrix::priceByColumn:\n");
|
|
1419
|
+
result.count = 0;
|
|
1420
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
1421
|
+
double value = 0;
|
|
1422
|
+
if (quad_precision) {
|
|
1423
|
+
HighsCDouble quad_value = 0.0;
|
|
1424
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
1425
|
+
iEl++)
|
|
1426
|
+
quad_value += column.array[this->index_[iEl]] * this->value_[iEl];
|
|
1427
|
+
value = (double)quad_value;
|
|
1428
|
+
} else {
|
|
1429
|
+
for (HighsInt iEl = this->start_[iCol]; iEl < this->start_[iCol + 1];
|
|
1430
|
+
iEl++)
|
|
1431
|
+
value += column.array[this->index_[iEl]] * this->value_[iEl];
|
|
1432
|
+
}
|
|
1433
|
+
if (fabs(value) > kHighsTiny) {
|
|
1434
|
+
result.array[iCol] = value;
|
|
1435
|
+
result.index[result.count++] = iCol;
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
void HighsSparseMatrix::priceByRow(const bool quad_precision, HVector& result,
|
|
1441
|
+
const HVector& column,
|
|
1442
|
+
const HighsInt debug_report) const {
|
|
1443
|
+
assert(this->isRowwise());
|
|
1444
|
+
if (debug_report >= kDebugReportAll)
|
|
1445
|
+
printf("\nHighsSparseMatrix::priceByRow:\n");
|
|
1446
|
+
// Vanilla hyper-sparse row-wise PRICE. Set up parameters so that
|
|
1447
|
+
// priceByRowWithSwitch runs as vanilla hyper-sparse PRICE
|
|
1448
|
+
// Expected density always forces hyper-sparse PRICE
|
|
1449
|
+
const double expected_density = -kHighsInf;
|
|
1450
|
+
// Always start from first index of column
|
|
1451
|
+
HighsInt from_index = 0;
|
|
1452
|
+
// Never switch to standard row-wise PRICE
|
|
1453
|
+
const double switch_density = kHighsInf;
|
|
1454
|
+
this->priceByRowWithSwitch(quad_precision, result, column, expected_density,
|
|
1455
|
+
from_index, switch_density);
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
void HighsSparseMatrix::priceByRowWithSwitch(
|
|
1459
|
+
const bool quad_precision, HVector& result, const HVector& column,
|
|
1460
|
+
const double expected_density, const HighsInt from_index,
|
|
1461
|
+
const double switch_density, const HighsInt debug_report) const {
|
|
1462
|
+
assert(this->isRowwise());
|
|
1463
|
+
HighsSparseVectorSum sum;
|
|
1464
|
+
// todo @Julian: Setting up the sparse vector sum is equivalent to calling
|
|
1465
|
+
// HVector::setup() I think there should instead be overloads where the result
|
|
1466
|
+
// vector is of type HVectorQuad for the future and not the boolean parameter
|
|
1467
|
+
// quad_precision. Then the buffer can be maintained similar to row_ap.
|
|
1468
|
+
if (quad_precision) sum.setDimension(num_col_);
|
|
1469
|
+
if (debug_report >= kDebugReportAll)
|
|
1470
|
+
printf("\nHighsSparseMatrix::priceByRowWithSwitch\n");
|
|
1471
|
+
// (Continue) hyper-sparse row-wise PRICE with possible switches to
|
|
1472
|
+
// standard row-wise PRICE either immediately based on historical
|
|
1473
|
+
// density or during hyper-sparse PRICE if there is too much fill-in
|
|
1474
|
+
HighsInt next_index = from_index;
|
|
1475
|
+
// Possibly don't perform hyper-sparse PRICE based on historical density
|
|
1476
|
+
//
|
|
1477
|
+
// Ensure that result was set up for this number of columns, and
|
|
1478
|
+
// that result.index is still of correct size
|
|
1479
|
+
assert(HighsInt(result.size) == this->num_col_);
|
|
1480
|
+
assert(HighsInt(result.index.size()) == this->num_col_);
|
|
1481
|
+
if (expected_density <= kHyperPriceDensity) {
|
|
1482
|
+
double inv_num_col = 1.0 / this->num_col_;
|
|
1483
|
+
for (HighsInt ix = next_index; ix < column.count; ix++) {
|
|
1484
|
+
HighsInt iRow = column.index[ix];
|
|
1485
|
+
// Determine whether p_end_ or the next start_ ends the loop
|
|
1486
|
+
HighsInt to_iEl;
|
|
1487
|
+
if (this->format_ == MatrixFormat::kRowwisePartitioned) {
|
|
1488
|
+
to_iEl = this->p_end_[iRow];
|
|
1489
|
+
} else {
|
|
1490
|
+
to_iEl = this->start_[iRow + 1];
|
|
1491
|
+
}
|
|
1492
|
+
// Possibly switch to standard row-wise price
|
|
1493
|
+
HighsInt row_num_nz = to_iEl - this->start_[iRow];
|
|
1494
|
+
double local_density = (1.0 * result.count) * inv_num_col;
|
|
1495
|
+
bool switch_to_dense = result.count + row_num_nz >= this->num_col_ ||
|
|
1496
|
+
local_density > switch_density;
|
|
1497
|
+
if (switch_to_dense) break;
|
|
1498
|
+
double multiplier = column.array[iRow];
|
|
1499
|
+
if (debug_report == kDebugReportAll || debug_report == iRow)
|
|
1500
|
+
debugReportRowPrice(iRow, multiplier, to_iEl, result.array);
|
|
1501
|
+
if (multiplier) {
|
|
1502
|
+
if (quad_precision) {
|
|
1503
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < to_iEl; iEl++) {
|
|
1504
|
+
sum.add(this->index_[iEl], multiplier * this->value_[iEl]);
|
|
1505
|
+
}
|
|
1506
|
+
} else {
|
|
1507
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < to_iEl; iEl++) {
|
|
1508
|
+
HighsInt iCol = this->index_[iEl];
|
|
1509
|
+
double value0 = result.array[iCol];
|
|
1510
|
+
double value1 = value0 + multiplier * this->value_[iEl];
|
|
1511
|
+
if (value0 == 0) result.index[result.count++] = iCol;
|
|
1512
|
+
result.array[iCol] =
|
|
1513
|
+
(fabs(value1) < kHighsTiny) ? kHighsZero : value1;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
next_index = ix + 1;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
if (quad_precision)
|
|
1521
|
+
sum.cleanup([](HighsInt, double x) { return std::abs(x) <= kHighsTiny; });
|
|
1522
|
+
if (next_index < column.count) {
|
|
1523
|
+
// PRICE is not complete: finish without maintaining nonzeros of result
|
|
1524
|
+
if (quad_precision) {
|
|
1525
|
+
std::vector<HighsCDouble> result_array = sum.values;
|
|
1526
|
+
this->priceByRowDenseResult(result_array, column, next_index);
|
|
1527
|
+
// Determine indices of nonzeros in result
|
|
1528
|
+
result.count = 0;
|
|
1529
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
1530
|
+
double value1 = (double)result_array[iCol];
|
|
1531
|
+
if (fabs(value1) < kHighsTiny) {
|
|
1532
|
+
result.array[iCol] = 0;
|
|
1533
|
+
} else {
|
|
1534
|
+
result.array[iCol] = value1;
|
|
1535
|
+
result.index[result.count++] = iCol;
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
} else {
|
|
1539
|
+
this->priceByRowDenseResult(result.array, column, next_index);
|
|
1540
|
+
// Determine indices of nonzeros in result
|
|
1541
|
+
result.count = 0;
|
|
1542
|
+
for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
|
|
1543
|
+
double value1 = result.array[iCol];
|
|
1544
|
+
if (fabs(value1) < kHighsTiny) {
|
|
1545
|
+
result.array[iCol] = 0;
|
|
1546
|
+
} else {
|
|
1547
|
+
result.index[result.count++] = iCol;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
} else {
|
|
1552
|
+
if (quad_precision) {
|
|
1553
|
+
// HVector result should have result.index of size this->num_col_
|
|
1554
|
+
// by virtue of result.setup. However, it will generally lose
|
|
1555
|
+
// this property by virtue of the following move
|
|
1556
|
+
result.index = std::move(sum.nonzeroinds);
|
|
1557
|
+
HighsInt result_num_nz = result.index.size();
|
|
1558
|
+
// Restore the size of result.index
|
|
1559
|
+
result.index.resize(this->num_col_);
|
|
1560
|
+
result.count = result_num_nz;
|
|
1561
|
+
for (HighsInt i = 0; i < result_num_nz; ++i) {
|
|
1562
|
+
HighsInt iRow = result.index[i];
|
|
1563
|
+
result.array[iRow] = sum.getValue(iRow);
|
|
1564
|
+
}
|
|
1565
|
+
} else {
|
|
1566
|
+
// PRICE is complete maintaining nonzeros of result
|
|
1567
|
+
// Remove small values
|
|
1568
|
+
result.tight();
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
void HighsSparseMatrix::update(const HighsInt var_in, const HighsInt var_out,
|
|
1574
|
+
const HighsSparseMatrix& matrix) {
|
|
1575
|
+
assert(matrix.format_ == MatrixFormat::kColwise);
|
|
1576
|
+
assert(this->format_ == MatrixFormat::kRowwisePartitioned);
|
|
1577
|
+
if (var_in < this->num_col_) {
|
|
1578
|
+
for (HighsInt iEl = matrix.start_[var_in]; iEl < matrix.start_[var_in + 1];
|
|
1579
|
+
iEl++) {
|
|
1580
|
+
HighsInt iRow = matrix.index_[iEl];
|
|
1581
|
+
HighsInt iFind = this->start_[iRow];
|
|
1582
|
+
HighsInt iSwap = --this->p_end_[iRow];
|
|
1583
|
+
while (this->index_[iFind] != var_in) iFind++;
|
|
1584
|
+
// todo @ Julian : this assert can fail
|
|
1585
|
+
assert(iFind >= 0 && iFind < int(this->index_.size()));
|
|
1586
|
+
assert(iSwap >= 0 && iSwap < int(this->value_.size()));
|
|
1587
|
+
swap(this->index_[iFind], this->index_[iSwap]);
|
|
1588
|
+
swap(this->value_[iFind], this->value_[iSwap]);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
if (var_out < this->num_col_) {
|
|
1593
|
+
for (HighsInt iEl = matrix.start_[var_out];
|
|
1594
|
+
iEl < matrix.start_[var_out + 1]; iEl++) {
|
|
1595
|
+
HighsInt iRow = matrix.index_[iEl];
|
|
1596
|
+
HighsInt iFind = this->p_end_[iRow];
|
|
1597
|
+
HighsInt iSwap = this->p_end_[iRow]++;
|
|
1598
|
+
while (this->index_[iFind] != var_out) iFind++;
|
|
1599
|
+
swap(this->index_[iFind], this->index_[iSwap]);
|
|
1600
|
+
swap(this->value_[iFind], this->value_[iSwap]);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
double HighsSparseMatrix::computeDot(const std::vector<double>& array,
|
|
1606
|
+
const HighsInt use_col) const {
|
|
1607
|
+
assert(this->isColwise());
|
|
1608
|
+
double result = 0;
|
|
1609
|
+
if (use_col < this->num_col_) {
|
|
1610
|
+
for (HighsInt iEl = this->start_[use_col]; iEl < this->start_[use_col + 1];
|
|
1611
|
+
iEl++)
|
|
1612
|
+
result += array[this->index_[iEl]] * this->value_[iEl];
|
|
1613
|
+
} else {
|
|
1614
|
+
result = array[use_col - this->num_col_];
|
|
1615
|
+
}
|
|
1616
|
+
return result;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
void HighsSparseMatrix::collectAj(HVector& column, const HighsInt use_col,
|
|
1620
|
+
const double multiplier) const {
|
|
1621
|
+
assert(this->isColwise());
|
|
1622
|
+
if (use_col < this->num_col_) {
|
|
1623
|
+
for (HighsInt iEl = this->start_[use_col]; iEl < this->start_[use_col + 1];
|
|
1624
|
+
iEl++) {
|
|
1625
|
+
HighsInt iRow = this->index_[iEl];
|
|
1626
|
+
double value0 = column.array[iRow];
|
|
1627
|
+
double value1 = value0 + multiplier * this->value_[iEl];
|
|
1628
|
+
if (value0 == 0) column.index[column.count++] = iRow;
|
|
1629
|
+
column.array[iRow] = (fabs(value1) < kHighsTiny) ? kHighsZero : value1;
|
|
1630
|
+
}
|
|
1631
|
+
} else {
|
|
1632
|
+
HighsInt iRow = use_col - this->num_col_;
|
|
1633
|
+
double value0 = column.array[iRow];
|
|
1634
|
+
double value1 = value0 + multiplier;
|
|
1635
|
+
if (value0 == 0) column.index[column.count++] = iRow;
|
|
1636
|
+
column.array[iRow] = (fabs(value1) < kHighsTiny) ? kHighsZero : value1;
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
void HighsSparseMatrix::priceByRowDenseResult(
|
|
1641
|
+
std::vector<double>& result, const HVector& column,
|
|
1642
|
+
const HighsInt from_index, const HighsInt debug_report) const {
|
|
1643
|
+
// Assumes that result is zeroed beforehand - in case continuing
|
|
1644
|
+
// priceByRow after switch from sparse
|
|
1645
|
+
assert(this->isRowwise());
|
|
1646
|
+
for (HighsInt ix = from_index; ix < column.count; ix++) {
|
|
1647
|
+
HighsInt iRow = column.index[ix];
|
|
1648
|
+
double multiplier = column.array[iRow];
|
|
1649
|
+
// Determine whether p_end_ or the next start_ should be used to end the
|
|
1650
|
+
// loop
|
|
1651
|
+
HighsInt to_iEl;
|
|
1652
|
+
if (this->format_ == MatrixFormat::kRowwisePartitioned) {
|
|
1653
|
+
to_iEl = this->p_end_[iRow];
|
|
1654
|
+
} else {
|
|
1655
|
+
to_iEl = this->start_[iRow + 1];
|
|
1656
|
+
}
|
|
1657
|
+
if (debug_report == kDebugReportAll || debug_report == iRow)
|
|
1658
|
+
debugReportRowPrice(iRow, multiplier, to_iEl, result);
|
|
1659
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < to_iEl; iEl++) {
|
|
1660
|
+
HighsInt iCol = this->index_[iEl];
|
|
1661
|
+
double value0 = result[iCol];
|
|
1662
|
+
double value1 = value0 + multiplier * this->value_[iEl];
|
|
1663
|
+
result[iCol] = (fabs(value1) < kHighsTiny) ? kHighsZero : value1;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
void HighsSparseMatrix::priceByRowDenseResult(
|
|
1669
|
+
std::vector<HighsCDouble>& result, const HVector& column,
|
|
1670
|
+
const HighsInt from_index, const HighsInt debug_report) const {
|
|
1671
|
+
// Assumes that result is zeroed beforehand - in case continuing
|
|
1672
|
+
// priceByRow after switch from sparse
|
|
1673
|
+
assert(this->isRowwise());
|
|
1674
|
+
for (HighsInt ix = from_index; ix < column.count; ix++) {
|
|
1675
|
+
HighsInt iRow = column.index[ix];
|
|
1676
|
+
double multiplier = column.array[iRow];
|
|
1677
|
+
// Determine whether p_end_ or the next start_ should be used to end the
|
|
1678
|
+
// loop
|
|
1679
|
+
HighsInt to_iEl;
|
|
1680
|
+
if (this->format_ == MatrixFormat::kRowwisePartitioned) {
|
|
1681
|
+
to_iEl = this->p_end_[iRow];
|
|
1682
|
+
} else {
|
|
1683
|
+
to_iEl = this->start_[iRow + 1];
|
|
1684
|
+
}
|
|
1685
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < to_iEl; iEl++) {
|
|
1686
|
+
HighsInt iCol = this->index_[iEl];
|
|
1687
|
+
HighsCDouble value0 = result[iCol];
|
|
1688
|
+
HighsCDouble value1 = value0 + multiplier * this->value_[iEl];
|
|
1689
|
+
result[iCol] = (fabs((double)value1) < kHighsTiny) ? kHighsZero : value1;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
void HighsSparseMatrix::debugReportRowPrice(
|
|
1695
|
+
const HighsInt iRow, const double multiplier, const HighsInt to_iEl,
|
|
1696
|
+
const vector<double>& result) const {
|
|
1697
|
+
if (this->start_[iRow] >= to_iEl) return;
|
|
1698
|
+
printf("Row %d: value = %11.4g", (int)iRow, multiplier);
|
|
1699
|
+
HighsInt num_print = 0;
|
|
1700
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < to_iEl; iEl++) {
|
|
1701
|
+
HighsInt iCol = this->index_[iEl];
|
|
1702
|
+
double value0 = result[iCol];
|
|
1703
|
+
double value1 = value0 + multiplier * this->value_[iEl];
|
|
1704
|
+
double value2 = (fabs(value1) < kHighsTiny) ? kHighsZero : value1;
|
|
1705
|
+
if (num_print % 5 == 0) printf("\n");
|
|
1706
|
+
printf("[%4d %11.4g] ", (int)(iCol), value2);
|
|
1707
|
+
num_print++;
|
|
1708
|
+
}
|
|
1709
|
+
printf("\n");
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
void HighsSparseMatrix::debugReportRowPrice(
|
|
1713
|
+
const HighsInt iRow, const double multiplier, const HighsInt to_iEl,
|
|
1714
|
+
const vector<HighsCDouble>& result) const {
|
|
1715
|
+
if (this->start_[iRow] >= to_iEl) return;
|
|
1716
|
+
printf("Row %d: value = %11.4g", (int)iRow, multiplier);
|
|
1717
|
+
HighsInt num_print = 0;
|
|
1718
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < to_iEl; iEl++) {
|
|
1719
|
+
HighsInt iCol = this->index_[iEl];
|
|
1720
|
+
double value0 = (double)result[iCol];
|
|
1721
|
+
double value1 = value0 + multiplier * this->value_[iEl];
|
|
1722
|
+
double value2 = (fabs(value1) < kHighsTiny) ? kHighsZero : value1;
|
|
1723
|
+
if (num_print % 5 == 0) printf("\n");
|
|
1724
|
+
printf("[%4d %11.4g] ", (int)(iCol), value2);
|
|
1725
|
+
num_print++;
|
|
1726
|
+
}
|
|
1727
|
+
printf("\n");
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
void HighsSparseMatrix::debugReportRowPrice(const HighsInt iRow,
|
|
1731
|
+
const double multiplier,
|
|
1732
|
+
const HighsInt to_iEl,
|
|
1733
|
+
HighsSparseVectorSum& sum) const {
|
|
1734
|
+
if (this->start_[iRow] >= to_iEl) return;
|
|
1735
|
+
if (!multiplier) return;
|
|
1736
|
+
printf("Row %d: value = %11.4g", (int)iRow, multiplier);
|
|
1737
|
+
HighsInt num_print = 0;
|
|
1738
|
+
for (HighsInt iEl = this->start_[iRow]; iEl < to_iEl; iEl++) {
|
|
1739
|
+
HighsInt iCol = this->index_[iEl];
|
|
1740
|
+
sum.add(iCol, multiplier * this->value_[iEl]);
|
|
1741
|
+
if (num_print % 5 == 0) printf("\n");
|
|
1742
|
+
printf("[%4d %11.4g] ", (int)(iCol), sum.getValue(iCol));
|
|
1743
|
+
num_print++;
|
|
1744
|
+
}
|
|
1745
|
+
printf("\n");
|
|
1746
|
+
}
|