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,1528 @@
|
|
|
1
|
+
#include "ipm/ipx/model.h"
|
|
2
|
+
#include <algorithm>
|
|
3
|
+
#include <cassert>
|
|
4
|
+
#include <cmath>
|
|
5
|
+
#include "ipm/ipx/utils.h"
|
|
6
|
+
#include "../extern/pdqsort/pdqsort.h"
|
|
7
|
+
|
|
8
|
+
namespace ipx {
|
|
9
|
+
|
|
10
|
+
Int Model::Load(const Control& control, Int num_constr, Int num_var,
|
|
11
|
+
const Int* Ap, const Int* Ai, const double* Ax,
|
|
12
|
+
const double* rhs, const char* constr_type, const double offset,
|
|
13
|
+
const double* obj, const double* lbuser, const double* ubuser) {
|
|
14
|
+
clear();
|
|
15
|
+
Int errflag = CopyInput(num_constr, num_var, Ap, Ai, Ax, rhs, constr_type,
|
|
16
|
+
offset, obj, lbuser, ubuser);
|
|
17
|
+
if (errflag)
|
|
18
|
+
return errflag;
|
|
19
|
+
std::stringstream h_logging_stream;
|
|
20
|
+
h_logging_stream.str(std::string());
|
|
21
|
+
h_logging_stream
|
|
22
|
+
<< "Input\n"
|
|
23
|
+
<< Textline("Number of variables:") << num_var_ << '\n'
|
|
24
|
+
<< Textline("Number of free variables:") << num_free_var_ << '\n'
|
|
25
|
+
<< Textline("Number of constraints:") << num_constr_ << '\n'
|
|
26
|
+
<< Textline("Number of equality constraints:") << num_eqconstr_ << '\n'
|
|
27
|
+
<< Textline("Number of matrix entries:") << num_entries_ << '\n';
|
|
28
|
+
control.hLog(h_logging_stream);
|
|
29
|
+
PrintCoefficientRange(control);
|
|
30
|
+
|
|
31
|
+
ScaleModel(control);
|
|
32
|
+
|
|
33
|
+
// Make an automatic decision for dualization if not specified by user.
|
|
34
|
+
Int dualize = control.dualize();
|
|
35
|
+
// dualize = -2 => Possibly dualize - Filippo style
|
|
36
|
+
// dualize = -1 => Possibly dualize - Lukas style
|
|
37
|
+
// dualize = 0 => No dualization
|
|
38
|
+
// dualize = 1 => Perform dualization
|
|
39
|
+
//
|
|
40
|
+
// Was just assert(dualize == -1) since the default value of
|
|
41
|
+
// HighsOptions::ipx_dualize_strategy is kIpxDualizeStrategyLukas
|
|
42
|
+
// = -1, but when refining with IPX in HiPO, dualization must be
|
|
43
|
+
// prevented, so ipx_param.dualize is set to 0 in
|
|
44
|
+
// Solver::prepareIpx()
|
|
45
|
+
assert(dualize == 0 || dualize == -1);
|
|
46
|
+
const bool dualize_lukas = num_constr > 2*num_var;
|
|
47
|
+
const bool dualize_filippo = filippoDualizationTest();
|
|
48
|
+
if (dualize == -1) {
|
|
49
|
+
dualize = dualize_lukas;
|
|
50
|
+
} else if (dualize == -2) {
|
|
51
|
+
dualize = dualize_filippo;
|
|
52
|
+
}
|
|
53
|
+
if (dualize)
|
|
54
|
+
LoadDual();
|
|
55
|
+
else
|
|
56
|
+
LoadPrimal();
|
|
57
|
+
|
|
58
|
+
A_.clear();
|
|
59
|
+
AIt_ = Transpose(AI_);
|
|
60
|
+
assert(AI_.begin(num_cols_ + num_rows_) == AIt_.begin(num_rows_));
|
|
61
|
+
FindDenseColumns();
|
|
62
|
+
norm_c_ = Infnorm(c_);
|
|
63
|
+
norm_bounds_ = Infnorm(b_);
|
|
64
|
+
for (double x : lb_)
|
|
65
|
+
if (std::isfinite(x))
|
|
66
|
+
norm_bounds_ = std::max(norm_bounds_, std::abs(x));
|
|
67
|
+
for (double x : ub_)
|
|
68
|
+
if (std::isfinite(x))
|
|
69
|
+
norm_bounds_ = std::max(norm_bounds_, std::abs(x));
|
|
70
|
+
|
|
71
|
+
PrintPreprocessingLog(control);
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
bool Model::filippoDualizationTest() const {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
void Model::GetInfo(Info *info) const {
|
|
80
|
+
info->num_var = num_var_;
|
|
81
|
+
info->num_constr = num_constr_;
|
|
82
|
+
info->num_entries = num_entries_;
|
|
83
|
+
info->num_rows_solver = num_rows_;
|
|
84
|
+
info->num_cols_solver = num_cols_ + num_rows_; // including slack columns
|
|
85
|
+
info->num_entries_solver = AI_.entries();
|
|
86
|
+
info->dualized = dualized_;
|
|
87
|
+
info->dense_cols = num_dense_cols();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
void Model::clear() {
|
|
91
|
+
// clear computational form model
|
|
92
|
+
dualized_ = false;
|
|
93
|
+
num_rows_ = 0;
|
|
94
|
+
num_cols_ = 0;
|
|
95
|
+
num_dense_cols_ = 0;
|
|
96
|
+
nz_dense_ = 0;
|
|
97
|
+
AI_.clear();
|
|
98
|
+
AIt_.clear();
|
|
99
|
+
b_.resize(0);
|
|
100
|
+
c_.resize(0);
|
|
101
|
+
lb_.resize(0);
|
|
102
|
+
ub_.resize(0);
|
|
103
|
+
norm_bounds_ = 0.0;
|
|
104
|
+
norm_c_ = 0.0;
|
|
105
|
+
|
|
106
|
+
// clear user model
|
|
107
|
+
num_constr_ = 0;
|
|
108
|
+
num_eqconstr_ = 0;
|
|
109
|
+
num_var_ = 0;
|
|
110
|
+
num_free_var_ = 0;
|
|
111
|
+
num_entries_ = 0;
|
|
112
|
+
boxed_vars_.clear();
|
|
113
|
+
constr_type_.clear();
|
|
114
|
+
norm_obj_ = 0.0;
|
|
115
|
+
norm_rhs_ = 0.0;
|
|
116
|
+
scaled_obj_.resize(0);
|
|
117
|
+
scaled_rhs_.resize(0);
|
|
118
|
+
scaled_lbuser_.resize(0);
|
|
119
|
+
scaled_ubuser_.resize(0);
|
|
120
|
+
A_.clear();
|
|
121
|
+
|
|
122
|
+
flipped_vars_.clear();
|
|
123
|
+
colscale_.resize(0);
|
|
124
|
+
rowscale_.resize(0);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
void Model::PresolveStartingPoint(const double* x_user,
|
|
128
|
+
const double* slack_user,
|
|
129
|
+
const double* y_user,
|
|
130
|
+
const double* z_user,
|
|
131
|
+
Vector& x_solver,
|
|
132
|
+
Vector& y_solver,
|
|
133
|
+
Vector& z_solver) const {
|
|
134
|
+
const Int m = rows();
|
|
135
|
+
const Int n = cols();
|
|
136
|
+
assert((Int)x_solver.size() == n+m);
|
|
137
|
+
assert((Int)y_solver.size() == m);
|
|
138
|
+
assert((Int)z_solver.size() == n+m);
|
|
139
|
+
|
|
140
|
+
Vector x_temp(num_var_);
|
|
141
|
+
Vector slack_temp(num_constr_);
|
|
142
|
+
Vector y_temp(num_constr_);
|
|
143
|
+
Vector z_temp(num_var_);
|
|
144
|
+
if (x_user)
|
|
145
|
+
std::copy_n(x_user, num_var_, std::begin(x_temp));
|
|
146
|
+
if (slack_user)
|
|
147
|
+
std::copy_n(slack_user, num_constr_, std::begin(slack_temp));
|
|
148
|
+
if (y_user)
|
|
149
|
+
std::copy_n(y_user, num_constr_, std::begin(y_temp));
|
|
150
|
+
if (z_user)
|
|
151
|
+
std::copy_n(z_user, num_var_, std::begin(z_temp));
|
|
152
|
+
ScalePoint(x_temp, slack_temp, y_temp, z_temp);
|
|
153
|
+
DualizeBasicSolution(x_temp, slack_temp, y_temp, z_temp,
|
|
154
|
+
x_solver, y_solver, z_solver);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
Int Model::PresolveIPMStartingPoint(const double* x_user,
|
|
158
|
+
const double* xl_user,
|
|
159
|
+
const double* xu_user,
|
|
160
|
+
const double* slack_user,
|
|
161
|
+
const double* y_user,
|
|
162
|
+
const double* zl_user,
|
|
163
|
+
const double* zu_user,
|
|
164
|
+
Vector& x_solver,
|
|
165
|
+
Vector& xl_solver,
|
|
166
|
+
Vector& xu_solver,
|
|
167
|
+
Vector& y_solver,
|
|
168
|
+
Vector& zl_solver,
|
|
169
|
+
Vector& zu_solver) const {
|
|
170
|
+
if (!x_user || !xl_user || !xu_user || !slack_user ||
|
|
171
|
+
!y_user || !zl_user || !zu_user)
|
|
172
|
+
return IPX_ERROR_argument_null;
|
|
173
|
+
if (dualized_)
|
|
174
|
+
return IPX_ERROR_not_implemented;
|
|
175
|
+
|
|
176
|
+
// Copy user point into workspace and apply model scaling.
|
|
177
|
+
Vector x_temp(x_user, num_var_);
|
|
178
|
+
Vector xl_temp(xl_user, num_var_);
|
|
179
|
+
Vector xu_temp(xu_user, num_var_);
|
|
180
|
+
Vector slack_temp(slack_user, num_constr_);
|
|
181
|
+
Vector y_temp(y_user, num_constr_);
|
|
182
|
+
Vector zl_temp(zl_user, num_var_);
|
|
183
|
+
Vector zu_temp(zu_user, num_var_);
|
|
184
|
+
ScalePoint(x_temp, xl_temp, xu_temp, slack_temp, y_temp, zl_temp, zu_temp);
|
|
185
|
+
|
|
186
|
+
// Check that point is compatible with bounds.
|
|
187
|
+
for (Int j = 0; j < num_var_; ++j) {
|
|
188
|
+
if (!std::isfinite(x_temp[j]))
|
|
189
|
+
return IPX_ERROR_invalid_vector;
|
|
190
|
+
}
|
|
191
|
+
for (Int j = 0; j < num_var_; ++j) {
|
|
192
|
+
if (!(xl_temp[j] >= 0.0) ||
|
|
193
|
+
(scaled_lbuser_[j] == -INFINITY && xl_temp[j] != INFINITY) ||
|
|
194
|
+
(scaled_lbuser_[j] != -INFINITY && xl_temp[j] == INFINITY))
|
|
195
|
+
return IPX_ERROR_invalid_vector;
|
|
196
|
+
}
|
|
197
|
+
for (Int j = 0; j < num_var_; ++j) {
|
|
198
|
+
if (!(xu_temp[j] >= 0.0) ||
|
|
199
|
+
(scaled_ubuser_[j] == INFINITY && xu_temp[j] != INFINITY) ||
|
|
200
|
+
(scaled_ubuser_[j] != INFINITY && xu_temp[j] == INFINITY))
|
|
201
|
+
return IPX_ERROR_invalid_vector;
|
|
202
|
+
}
|
|
203
|
+
for (Int i = 0; i < num_constr_; ++i) {
|
|
204
|
+
if (!std::isfinite(slack_temp[i]) ||
|
|
205
|
+
(constr_type_[i] == '=' && !(slack_temp[i] == 0.0)) ||
|
|
206
|
+
(constr_type_[i] == '<' && !(slack_temp[i] >= 0.0)) ||
|
|
207
|
+
(constr_type_[i] == '>' && !(slack_temp[i] <= 0.0)) )
|
|
208
|
+
return IPX_ERROR_invalid_vector;
|
|
209
|
+
}
|
|
210
|
+
for (Int i = 0; i < num_constr_; ++i) {
|
|
211
|
+
if (!std::isfinite(y_temp[i]) ||
|
|
212
|
+
(constr_type_[i] == '<' && !(y_temp[i] <= 0.0)) ||
|
|
213
|
+
(constr_type_[i] == '>' && !(y_temp[i] >= 0.0)) )
|
|
214
|
+
return IPX_ERROR_invalid_vector;
|
|
215
|
+
}
|
|
216
|
+
for (Int j = 0; j < num_var_; ++j) {
|
|
217
|
+
if (!(zl_temp[j] >= 0.0 && zl_temp[j] < INFINITY) ||
|
|
218
|
+
(scaled_lbuser_[j] == -INFINITY && zl_temp[j] != 0.0))
|
|
219
|
+
return IPX_ERROR_invalid_vector;
|
|
220
|
+
}
|
|
221
|
+
for (Int j = 0; j < num_var_; ++j) {
|
|
222
|
+
if (!(zu_temp[j] >= 0.0 && zu_temp[j] < INFINITY) ||
|
|
223
|
+
(scaled_ubuser_[j] == INFINITY && zu_temp[j] != 0.0))
|
|
224
|
+
return IPX_ERROR_invalid_vector;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
DualizeIPMStartingPoint(x_temp, xl_temp, xu_temp, slack_temp,
|
|
228
|
+
y_temp, zl_temp, zu_temp,
|
|
229
|
+
x_solver, xl_solver, xu_solver,
|
|
230
|
+
y_solver, zl_solver, zu_solver);
|
|
231
|
+
return 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
void Model::PostsolveInteriorSolution(const Vector& x_solver,
|
|
236
|
+
const Vector& xl_solver,
|
|
237
|
+
const Vector& xu_solver,
|
|
238
|
+
const Vector& y_solver,
|
|
239
|
+
const Vector& zl_solver,
|
|
240
|
+
const Vector& zu_solver,
|
|
241
|
+
double* x_user,
|
|
242
|
+
double* xl_user, double* xu_user,
|
|
243
|
+
double* slack_user,
|
|
244
|
+
double* y_user,
|
|
245
|
+
double* zl_user, double* zu_user) const {
|
|
246
|
+
const Int m = rows();
|
|
247
|
+
const Int n = cols();
|
|
248
|
+
assert((Int)x_solver.size() == n+m);
|
|
249
|
+
assert((Int)xl_solver.size() == n+m);
|
|
250
|
+
assert((Int)xu_solver.size() == n+m);
|
|
251
|
+
assert((Int)y_solver.size() == m);
|
|
252
|
+
assert((Int)zl_solver.size() == n+m);
|
|
253
|
+
assert((Int)zu_solver.size() == n+m);
|
|
254
|
+
|
|
255
|
+
Vector x_temp(num_var_);
|
|
256
|
+
Vector xl_temp(num_var_);
|
|
257
|
+
Vector xu_temp(num_var_);
|
|
258
|
+
Vector slack_temp(num_constr_);
|
|
259
|
+
Vector y_temp(num_constr_);
|
|
260
|
+
Vector zl_temp(num_var_);
|
|
261
|
+
Vector zu_temp(num_var_);
|
|
262
|
+
DualizeBackInteriorSolution(x_solver, xl_solver, xu_solver, y_solver,
|
|
263
|
+
zl_solver, zu_solver, x_temp, xl_temp, xu_temp,
|
|
264
|
+
slack_temp, y_temp, zl_temp, zu_temp);
|
|
265
|
+
ScaleBackInteriorSolution(x_temp, xl_temp, xu_temp, slack_temp, y_temp,
|
|
266
|
+
zl_temp, zu_temp);
|
|
267
|
+
if (x_user)
|
|
268
|
+
std::copy(std::begin(x_temp), std::end(x_temp), x_user);
|
|
269
|
+
if (xl_user)
|
|
270
|
+
std::copy(std::begin(xl_temp), std::end(xl_temp), xl_user);
|
|
271
|
+
if (xu_user)
|
|
272
|
+
std::copy(std::begin(xu_temp), std::end(xu_temp), xu_user);
|
|
273
|
+
if (slack_user)
|
|
274
|
+
std::copy(std::begin(slack_temp), std::end(slack_temp), slack_user);
|
|
275
|
+
if (y_user)
|
|
276
|
+
std::copy(std::begin(y_temp), std::end(y_temp), y_user);
|
|
277
|
+
if (zl_user)
|
|
278
|
+
std::copy(std::begin(zl_temp), std::end(zl_temp), zl_user);
|
|
279
|
+
if (zu_user)
|
|
280
|
+
std::copy(std::begin(zu_temp), std::end(zu_temp), zu_user);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
void Model::EvaluateInteriorSolution(const Vector& x_solver,
|
|
284
|
+
const Vector& xl_solver,
|
|
285
|
+
const Vector& xu_solver,
|
|
286
|
+
const Vector& y_solver,
|
|
287
|
+
const Vector& zl_solver,
|
|
288
|
+
const Vector& zu_solver,
|
|
289
|
+
Info* info) const {
|
|
290
|
+
const Int m = rows();
|
|
291
|
+
const Int n = cols();
|
|
292
|
+
assert((Int)x_solver.size() == n+m);
|
|
293
|
+
assert((Int)xl_solver.size() == n+m);
|
|
294
|
+
assert((Int)xu_solver.size() == n+m);
|
|
295
|
+
assert((Int)y_solver.size() == m);
|
|
296
|
+
assert((Int)zl_solver.size() == n+m);
|
|
297
|
+
assert((Int)zu_solver.size() == n+m);
|
|
298
|
+
|
|
299
|
+
// Build solution to scaled user model.
|
|
300
|
+
Vector x(num_var_);
|
|
301
|
+
Vector xl(num_var_);
|
|
302
|
+
Vector xu(num_var_);
|
|
303
|
+
Vector slack(num_constr_);
|
|
304
|
+
Vector y(num_constr_);
|
|
305
|
+
Vector zl(num_var_);
|
|
306
|
+
Vector zu(num_var_);
|
|
307
|
+
DualizeBackInteriorSolution(x_solver, xl_solver, xu_solver, y_solver,
|
|
308
|
+
zl_solver, zu_solver, x, xl, xu, slack, y, zl,
|
|
309
|
+
zu);
|
|
310
|
+
|
|
311
|
+
// Build residuals for scaled model.
|
|
312
|
+
// rl = lb-x+xl
|
|
313
|
+
Vector rl(num_var_);
|
|
314
|
+
for (Int j = 0; j < num_var_; j++) {
|
|
315
|
+
if (std::isfinite(scaled_lbuser_[j]))
|
|
316
|
+
rl[j] = scaled_lbuser_[j] - x[j] + xl[j];
|
|
317
|
+
else
|
|
318
|
+
assert(xl[j] == INFINITY);
|
|
319
|
+
}
|
|
320
|
+
// ru = ub-x-xu
|
|
321
|
+
Vector ru(num_var_);
|
|
322
|
+
for (Int j = 0; j < num_var_; j++) {
|
|
323
|
+
if (std::isfinite(scaled_ubuser_[j]))
|
|
324
|
+
ru[j] = scaled_ubuser_[j] - x[j] - xu[j];
|
|
325
|
+
else
|
|
326
|
+
assert(xu[j] == INFINITY);
|
|
327
|
+
}
|
|
328
|
+
// rb = rhs-slack-A*x
|
|
329
|
+
// Add rhs at the end to avoid losing digits when x is huge.
|
|
330
|
+
Vector rb(num_constr_);
|
|
331
|
+
MultiplyWithScaledMatrix(x, -1.0, rb, 'N');
|
|
332
|
+
rb -= slack;
|
|
333
|
+
rb += scaled_rhs_;
|
|
334
|
+
// rc = obj-zl+zu-A'y
|
|
335
|
+
// Add obj at the end to avoid losing digits when y, z are huge.
|
|
336
|
+
Vector rc(num_var_);
|
|
337
|
+
MultiplyWithScaledMatrix(y, -1.0, rc, 'T');
|
|
338
|
+
rc -= zl - zu;
|
|
339
|
+
rc += scaled_obj_;
|
|
340
|
+
|
|
341
|
+
ScaleBackResiduals(rb, rc, rl, ru);
|
|
342
|
+
double presidual = Infnorm(rb);
|
|
343
|
+
presidual = std::max(presidual, Infnorm(rl));
|
|
344
|
+
presidual = std::max(presidual, Infnorm(ru));
|
|
345
|
+
double dresidual = Infnorm(rc);
|
|
346
|
+
|
|
347
|
+
double pobjective = offset_ + Dot(scaled_obj_, x);
|
|
348
|
+
double dobjective = offset_ + Dot(scaled_rhs_, y);
|
|
349
|
+
for (Int j = 0; j < num_var_; j++) {
|
|
350
|
+
if (std::isfinite(scaled_lbuser_[j]))
|
|
351
|
+
dobjective += scaled_lbuser_[j] * zl[j];
|
|
352
|
+
if (std::isfinite(scaled_ubuser_[j]))
|
|
353
|
+
dobjective -= scaled_ubuser_[j] * zu[j];
|
|
354
|
+
}
|
|
355
|
+
assert(std::isfinite(dobjective));
|
|
356
|
+
double objective_gap = (pobjective-dobjective) /
|
|
357
|
+
(1.0 + 0.5*std::abs(pobjective+dobjective));
|
|
358
|
+
|
|
359
|
+
double complementarity = 0.0;
|
|
360
|
+
for (Int j = 0; j < num_var_; j++) {
|
|
361
|
+
if (std::isfinite(scaled_lbuser_[j]))
|
|
362
|
+
complementarity += xl[j]*zl[j];
|
|
363
|
+
if (std::isfinite(scaled_ubuser_[j]))
|
|
364
|
+
complementarity += xu[j]*zu[j];
|
|
365
|
+
}
|
|
366
|
+
for (Int i = 0; i < num_constr_; i++)
|
|
367
|
+
complementarity -= y[i]*slack[i];
|
|
368
|
+
|
|
369
|
+
// For computing the norms of the user variables, we have to scale back.
|
|
370
|
+
ScaleBackInteriorSolution(x, xl, xu, slack, y, zl, zu);
|
|
371
|
+
|
|
372
|
+
info->abs_presidual = presidual;
|
|
373
|
+
info->abs_dresidual = dresidual;
|
|
374
|
+
info->rel_presidual = presidual/(1.0+norm_rhs_);
|
|
375
|
+
info->rel_dresidual = dresidual/(1.0+norm_obj_);
|
|
376
|
+
info->pobjval = pobjective;
|
|
377
|
+
info->dobjval = dobjective;
|
|
378
|
+
info->rel_objgap = objective_gap;
|
|
379
|
+
info->complementarity = complementarity;
|
|
380
|
+
info->normx = Infnorm(x);
|
|
381
|
+
info->normy = Infnorm(y);
|
|
382
|
+
info->normz = std::max(Infnorm(zl), Infnorm(zu));
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
void Model::PostsolveBasicSolution(const Vector& x_solver,
|
|
386
|
+
const Vector& y_solver,
|
|
387
|
+
const Vector& z_solver,
|
|
388
|
+
const std::vector<Int>& basic_status_solver,
|
|
389
|
+
double* x_user, double* slack_user,
|
|
390
|
+
double* y_user, double* z_user) const {
|
|
391
|
+
const Int m = rows();
|
|
392
|
+
const Int n = cols();
|
|
393
|
+
assert((Int)x_solver.size() == n+m);
|
|
394
|
+
assert((Int)y_solver.size() == m);
|
|
395
|
+
assert((Int)z_solver.size() == n+m);
|
|
396
|
+
assert((Int)basic_status_solver.size() == n+m);
|
|
397
|
+
|
|
398
|
+
Vector x_temp(num_var_);
|
|
399
|
+
Vector slack_temp(num_constr_);
|
|
400
|
+
Vector y_temp(num_constr_);
|
|
401
|
+
Vector z_temp(num_var_);
|
|
402
|
+
std::vector<Int> cbasis_temp(num_constr_);
|
|
403
|
+
std::vector<Int> vbasis_temp(num_var_);
|
|
404
|
+
DualizeBackBasicSolution(x_solver, y_solver, z_solver, x_temp, slack_temp,
|
|
405
|
+
y_temp, z_temp);
|
|
406
|
+
DualizeBackBasis(basic_status_solver, cbasis_temp, vbasis_temp);
|
|
407
|
+
CorrectScaledBasicSolution(x_temp, slack_temp, y_temp, z_temp, cbasis_temp,
|
|
408
|
+
vbasis_temp);
|
|
409
|
+
ScaleBackBasicSolution(x_temp, slack_temp, y_temp, z_temp);
|
|
410
|
+
if (x_user)
|
|
411
|
+
std::copy(std::begin(x_temp), std::end(x_temp), x_user);
|
|
412
|
+
if (slack_user)
|
|
413
|
+
std::copy(std::begin(slack_temp), std::end(slack_temp), slack_user);
|
|
414
|
+
if (y_user)
|
|
415
|
+
std::copy(std::begin(y_temp), std::end(y_temp), y_user);
|
|
416
|
+
if (z_user)
|
|
417
|
+
std::copy(std::begin(z_temp), std::end(z_temp), z_user);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
void Model::EvaluateBasicSolution(const Vector& x_solver,
|
|
421
|
+
const Vector& y_solver,
|
|
422
|
+
const Vector& z_solver,
|
|
423
|
+
const std::vector<Int>& basic_status_solver,
|
|
424
|
+
Info* info) const {
|
|
425
|
+
const Int m = rows();
|
|
426
|
+
const Int n = cols();
|
|
427
|
+
assert((Int)x_solver.size() == n+m);
|
|
428
|
+
assert((Int)y_solver.size() == m);
|
|
429
|
+
assert((Int)z_solver.size() == n+m);
|
|
430
|
+
assert((Int)basic_status_solver.size() == n+m);
|
|
431
|
+
|
|
432
|
+
// Build basic solution to scaled user model.
|
|
433
|
+
Vector x(num_var_);
|
|
434
|
+
Vector slack(num_constr_);
|
|
435
|
+
Vector y(num_constr_);
|
|
436
|
+
Vector z(num_var_);
|
|
437
|
+
std::vector<Int> cbasis(num_constr_);
|
|
438
|
+
std::vector<Int> vbasis(num_var_);
|
|
439
|
+
DualizeBackBasicSolution(x_solver, y_solver, z_solver, x, slack, y, z);
|
|
440
|
+
DualizeBackBasis(basic_status_solver, cbasis, vbasis);
|
|
441
|
+
CorrectScaledBasicSolution(x, slack, y, z, cbasis, vbasis);
|
|
442
|
+
double pobj = Dot(scaled_obj_, x);
|
|
443
|
+
|
|
444
|
+
// Build infeasibilities in scaled user model.
|
|
445
|
+
Vector xinfeas(num_var_);
|
|
446
|
+
Vector sinfeas(num_constr_);
|
|
447
|
+
Vector yinfeas(num_constr_);
|
|
448
|
+
Vector zinfeas(num_var_);
|
|
449
|
+
for (Int j = 0; j < num_var_; j++) {
|
|
450
|
+
if (x[j] < scaled_lbuser_[j])
|
|
451
|
+
xinfeas[j] = x[j]-scaled_lbuser_[j];
|
|
452
|
+
if (x[j] > scaled_ubuser_[j])
|
|
453
|
+
xinfeas[j] = x[j]-scaled_ubuser_[j];
|
|
454
|
+
if (vbasis[j] != IPX_nonbasic_lb && z[j] > 0.0)
|
|
455
|
+
zinfeas[j] = z[j];
|
|
456
|
+
if (vbasis[j] != IPX_nonbasic_ub && z[j] < 0.0)
|
|
457
|
+
zinfeas[j] = z[j];
|
|
458
|
+
}
|
|
459
|
+
for (Int i = 0; i < num_constr_; i++) {
|
|
460
|
+
if (constr_type_[i] == '<') {
|
|
461
|
+
if (slack[i] < 0.0)
|
|
462
|
+
sinfeas[i] = slack[i];
|
|
463
|
+
if (y[i] > 0.0)
|
|
464
|
+
yinfeas[i] = y[i];
|
|
465
|
+
}
|
|
466
|
+
if (constr_type_[i] == '>') {
|
|
467
|
+
if (slack[i] > 0.0)
|
|
468
|
+
sinfeas[i] = slack[i];
|
|
469
|
+
if (y[i] < 0.0)
|
|
470
|
+
yinfeas[i] = y[i];
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// Scale back basic solution and infeasibilities.
|
|
475
|
+
ScaleBackBasicSolution(x, slack, y, z);
|
|
476
|
+
ScaleBackBasicSolution(xinfeas, sinfeas, yinfeas, zinfeas);
|
|
477
|
+
|
|
478
|
+
info->primal_infeas = std::max(Infnorm(xinfeas), Infnorm(sinfeas));
|
|
479
|
+
info->dual_infeas = std::max(Infnorm(zinfeas), Infnorm(yinfeas));
|
|
480
|
+
info->objval = pobj;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
void Model::PostsolveBasis(const std::vector<Int>& basic_status_solver,
|
|
484
|
+
Int* cbasis_user, Int* vbasis_user) const {
|
|
485
|
+
const Int m = rows();
|
|
486
|
+
const Int n = cols();
|
|
487
|
+
assert((Int)basic_status_solver.size() == n+m);
|
|
488
|
+
|
|
489
|
+
std::vector<Int> cbasis_temp(num_constr_);
|
|
490
|
+
std::vector<Int> vbasis_temp(num_var_);
|
|
491
|
+
DualizeBackBasis(basic_status_solver, cbasis_temp, vbasis_temp);
|
|
492
|
+
ScaleBackBasis(cbasis_temp, vbasis_temp);
|
|
493
|
+
if (cbasis_user)
|
|
494
|
+
std::copy(std::begin(cbasis_temp), std::end(cbasis_temp), cbasis_user);
|
|
495
|
+
if (vbasis_user)
|
|
496
|
+
std::copy(std::begin(vbasis_temp), std::end(vbasis_temp), vbasis_user);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// Checks if the vectors are valid LP data vectors. Returns 0 if OK and a
|
|
500
|
+
// negative value if a vector is invalid.
|
|
501
|
+
static int CheckVectors(Int m, Int n, const double* rhs,const char* constr_type,
|
|
502
|
+
const double* obj, const double* lb, const double* ub) {
|
|
503
|
+
for (Int i = 0; i < m; i++)
|
|
504
|
+
if (!std::isfinite(rhs[i]))
|
|
505
|
+
return -1;
|
|
506
|
+
for (Int j = 0; j < n; j++)
|
|
507
|
+
if (!std::isfinite(obj[j]))
|
|
508
|
+
return -2;
|
|
509
|
+
for (Int j = 0; j < n; j++) {
|
|
510
|
+
if (!std::isfinite(lb[j]) && lb[j] != -INFINITY)
|
|
511
|
+
return -3;
|
|
512
|
+
if (!std::isfinite(ub[j]) && ub[j] != INFINITY)
|
|
513
|
+
return -3;
|
|
514
|
+
if (lb[j] > ub[j])
|
|
515
|
+
return -3;
|
|
516
|
+
}
|
|
517
|
+
for (Int i = 0; i < m; i++)
|
|
518
|
+
if (constr_type[i] != '=' && constr_type[i] != '<' &&
|
|
519
|
+
constr_type[i] != '>')
|
|
520
|
+
return -4;
|
|
521
|
+
return 0;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// Checks if A is a valid m-by-n matrix in CSC format. Returns 0 if OK and a
|
|
525
|
+
// negative value otherwise.
|
|
526
|
+
static Int CheckMatrix(Int m, Int n, const Int *Ap, const Int *Ai, const double *Ax) {
|
|
527
|
+
if (Ap[0] != 0)
|
|
528
|
+
return -5;
|
|
529
|
+
for (Int j = 0; j < n; j++)
|
|
530
|
+
if (Ap[j] > Ap[j+1])
|
|
531
|
+
return -5;
|
|
532
|
+
for (Int p = 0; p < Ap[n]; p++)
|
|
533
|
+
if (!std::isfinite(Ax[p]))
|
|
534
|
+
return -6;
|
|
535
|
+
// Test for out of bound indices and duplicates.
|
|
536
|
+
std::vector<Int> marked(m, -1);
|
|
537
|
+
for (Int j = 0; j < n; j++) {
|
|
538
|
+
for (Int p = Ap[j]; p < Ap[j+1]; p++) {
|
|
539
|
+
Int i = Ai[p];
|
|
540
|
+
if (i < 0 || i >= m)
|
|
541
|
+
return -7;
|
|
542
|
+
if (marked[i] == j)
|
|
543
|
+
return -8;
|
|
544
|
+
marked[i] = j;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return 0;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
Int Model::CopyInput(Int num_constr, Int num_var, const Int* Ap, const Int* Ai,
|
|
551
|
+
const double* Ax, const double* rhs,
|
|
552
|
+
const char* constr_type, const double offset, const double* obj,
|
|
553
|
+
const double* lbuser, const double* ubuser) {
|
|
554
|
+
if (!(Ap && Ai && Ax && rhs && constr_type && obj && lbuser && ubuser)) {
|
|
555
|
+
return IPX_ERROR_argument_null;
|
|
556
|
+
}
|
|
557
|
+
if (num_constr < 0 || num_var <= 0) {
|
|
558
|
+
return IPX_ERROR_invalid_dimension;
|
|
559
|
+
}
|
|
560
|
+
if (CheckVectors(num_constr, num_var, rhs, constr_type, obj, lbuser, ubuser)
|
|
561
|
+
!= 0) {
|
|
562
|
+
return IPX_ERROR_invalid_vector;
|
|
563
|
+
}
|
|
564
|
+
if (CheckMatrix(num_constr, num_var, Ap, Ai, Ax) != 0) {
|
|
565
|
+
return IPX_ERROR_invalid_matrix;
|
|
566
|
+
}
|
|
567
|
+
num_constr_ = num_constr;
|
|
568
|
+
num_eqconstr_ = std::count(constr_type, constr_type+num_constr, '=');
|
|
569
|
+
num_var_ = num_var;
|
|
570
|
+
num_entries_ = Ap[num_var];
|
|
571
|
+
num_free_var_ = 0;
|
|
572
|
+
boxed_vars_.clear();
|
|
573
|
+
for (Int j = 0; j < num_var; j++) {
|
|
574
|
+
if (std::isinf(lbuser[j]) && std::isinf(ubuser[j]))
|
|
575
|
+
num_free_var_++;
|
|
576
|
+
if (std::isfinite(lbuser[j]) && std::isfinite(ubuser[j]))
|
|
577
|
+
boxed_vars_.push_back(j);
|
|
578
|
+
}
|
|
579
|
+
constr_type_ = std::vector<char>(constr_type, constr_type+num_constr);
|
|
580
|
+
offset_ = offset;
|
|
581
|
+
scaled_obj_ = Vector(obj, num_var);
|
|
582
|
+
scaled_rhs_ = Vector(rhs, num_constr);
|
|
583
|
+
scaled_lbuser_ = Vector(lbuser, num_var);
|
|
584
|
+
scaled_ubuser_ = Vector(ubuser, num_var);
|
|
585
|
+
A_.LoadFromArrays(num_constr, num_var, Ap, Ap+1, Ai, Ax);
|
|
586
|
+
norm_obj_ = Infnorm(scaled_obj_);
|
|
587
|
+
norm_rhs_ = Infnorm(scaled_rhs_);
|
|
588
|
+
for (double x : scaled_lbuser_)
|
|
589
|
+
if (std::isfinite(x))
|
|
590
|
+
norm_rhs_ = std::max(norm_rhs_, std::abs(x));
|
|
591
|
+
for (double x : scaled_ubuser_)
|
|
592
|
+
if (std::isfinite(x))
|
|
593
|
+
norm_rhs_ = std::max(norm_rhs_, std::abs(x));
|
|
594
|
+
return 0;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
void Model::ScaleModel(const Control& control) {
|
|
598
|
+
flipped_vars_.clear();
|
|
599
|
+
for (Int j = 0; j < num_var_; j++) {
|
|
600
|
+
if (std::isfinite(scaled_ubuser_[j]) && std::isinf(scaled_lbuser_[j])) {
|
|
601
|
+
scaled_lbuser_[j] = -scaled_ubuser_[j];
|
|
602
|
+
scaled_ubuser_[j] = INFINITY;
|
|
603
|
+
ScaleColumn(A_, j, -1.0);
|
|
604
|
+
scaled_obj_[j] *= -1.0;
|
|
605
|
+
flipped_vars_.push_back(j);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
colscale_.resize(0);
|
|
609
|
+
rowscale_.resize(0);
|
|
610
|
+
|
|
611
|
+
// Choose scaling method.
|
|
612
|
+
if (control.scale() >= 1)
|
|
613
|
+
EquilibrateMatrix();
|
|
614
|
+
|
|
615
|
+
// Apply scaling to vectors.
|
|
616
|
+
if (colscale_.size() > 0) {
|
|
617
|
+
assert((Int)colscale_.size() == num_var_);
|
|
618
|
+
scaled_obj_ *= colscale_;
|
|
619
|
+
scaled_lbuser_ /= colscale_;
|
|
620
|
+
scaled_ubuser_ /= colscale_;
|
|
621
|
+
}
|
|
622
|
+
if (rowscale_.size() > 0) {
|
|
623
|
+
assert((Int)rowscale_.size() == num_constr_);
|
|
624
|
+
scaled_rhs_ *= rowscale_;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
void Model::LoadPrimal() {
|
|
629
|
+
num_rows_ = num_constr_;
|
|
630
|
+
num_cols_ = num_var_;
|
|
631
|
+
dualized_ = false;
|
|
632
|
+
|
|
633
|
+
// Copy A and append identity matrix.
|
|
634
|
+
AI_ = A_;
|
|
635
|
+
for (Int i = 0; i < num_constr_; i++) {
|
|
636
|
+
AI_.push_back(i, 1.0);
|
|
637
|
+
AI_.add_column();
|
|
638
|
+
}
|
|
639
|
+
assert(AI_.cols() == num_var_+num_constr_);
|
|
640
|
+
|
|
641
|
+
// Copy vectors and set bounds on slack variables.
|
|
642
|
+
b_ = scaled_rhs_;
|
|
643
|
+
c_.resize(num_var_+num_constr_);
|
|
644
|
+
c_ = 0.0;
|
|
645
|
+
std::copy_n(std::begin(scaled_obj_), num_var_, std::begin(c_));
|
|
646
|
+
lb_.resize(num_rows_+num_cols_);
|
|
647
|
+
std::copy_n(std::begin(scaled_lbuser_), num_var_, std::begin(lb_));
|
|
648
|
+
ub_.resize(num_rows_+num_cols_);
|
|
649
|
+
std::copy_n(std::begin(scaled_ubuser_), num_var_, std::begin(ub_));
|
|
650
|
+
for (Int i = 0; i < num_constr_; i++) {
|
|
651
|
+
switch(constr_type_[i]) {
|
|
652
|
+
case '=':
|
|
653
|
+
lb_[num_var_+i] = 0.0;
|
|
654
|
+
ub_[num_var_+i] = 0.0;
|
|
655
|
+
break;
|
|
656
|
+
case '<':
|
|
657
|
+
lb_[num_var_+i] = 0.0;
|
|
658
|
+
ub_[num_var_+i] = INFINITY;
|
|
659
|
+
break;
|
|
660
|
+
case '>':
|
|
661
|
+
lb_[num_var_+i] = -INFINITY;
|
|
662
|
+
ub_[num_var_+i] = 0.0;
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
void Model::LoadDual() {
|
|
669
|
+
num_rows_ = num_var_;
|
|
670
|
+
num_cols_ = num_constr_ + boxed_vars_.size();
|
|
671
|
+
dualized_ = true;
|
|
672
|
+
|
|
673
|
+
// Check that every variable with finite scaled_ubuser_ has finite
|
|
674
|
+
// scaled_lbuser_ (must be the case after scaling).
|
|
675
|
+
for (Int j = 0; j < num_var_; j++) {
|
|
676
|
+
if (std::isfinite(scaled_ubuser_[j]))
|
|
677
|
+
assert(std::isfinite(scaled_lbuser_[j]));
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
// Build AI.
|
|
681
|
+
AI_ = Transpose(A_);
|
|
682
|
+
for (Int j = 0; j < num_var_; j++) {
|
|
683
|
+
if (std::isfinite(scaled_ubuser_[j])) {
|
|
684
|
+
AI_.push_back(j, -1.0);
|
|
685
|
+
AI_.add_column();
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
assert(AI_.cols() == num_cols_);
|
|
689
|
+
for (Int i = 0; i < num_rows_; i++) {
|
|
690
|
+
AI_.push_back(i, 1.0);
|
|
691
|
+
AI_.add_column();
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// Build vectors.
|
|
695
|
+
b_ = scaled_obj_;
|
|
696
|
+
c_.resize(num_cols_+num_rows_);
|
|
697
|
+
Int put = 0;
|
|
698
|
+
for (double x : scaled_rhs_)
|
|
699
|
+
c_[put++] = -x;
|
|
700
|
+
for (double x : scaled_ubuser_)
|
|
701
|
+
if (std::isfinite(x))
|
|
702
|
+
c_[put++] = x;
|
|
703
|
+
assert(put == num_cols_);
|
|
704
|
+
for (double x : scaled_lbuser_)
|
|
705
|
+
// If x is negative infinity, then the variable will be fixed and we can
|
|
706
|
+
// give it any (finite) cost.
|
|
707
|
+
c_[put++] = std::isfinite(x) ? -x : 0.0;
|
|
708
|
+
lb_.resize(num_cols_+num_rows_);
|
|
709
|
+
ub_.resize(num_cols_+num_rows_);
|
|
710
|
+
for (Int i = 0; i < num_constr_; i++)
|
|
711
|
+
switch(constr_type_[i]) {
|
|
712
|
+
case '=':
|
|
713
|
+
lb_[i] = -INFINITY;
|
|
714
|
+
ub_[i] = INFINITY;
|
|
715
|
+
break;
|
|
716
|
+
case '<':
|
|
717
|
+
lb_[i] = -INFINITY;
|
|
718
|
+
ub_[i] = 0.0;
|
|
719
|
+
break;
|
|
720
|
+
case '>':
|
|
721
|
+
lb_[i] = 0.0;
|
|
722
|
+
ub_[i] = INFINITY;
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
for (Int j = num_constr_; j < num_cols_; j++) {
|
|
726
|
+
lb_[j] = 0.0;
|
|
727
|
+
ub_[j] = INFINITY;
|
|
728
|
+
}
|
|
729
|
+
for (Int j = 0; j < num_var_; j++) {
|
|
730
|
+
lb_[num_cols_+j] = 0.0;
|
|
731
|
+
ub_[num_cols_+j] = std::isfinite(scaled_lbuser_[j]) ? INFINITY : 0.0;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// Returns a power-of-2 factor s such that s*2^exp becomes closer to the
|
|
736
|
+
// interval [2^expmin, 2^expmax].
|
|
737
|
+
static double EquilibrationFactor(int expmin, int expmax, int exp) {
|
|
738
|
+
if (exp < expmin)
|
|
739
|
+
return std::ldexp(1.0, (expmin-exp+1)/2);
|
|
740
|
+
if (exp > expmax)
|
|
741
|
+
return std::ldexp(1.0, -((exp-expmax+1)/2));
|
|
742
|
+
return 1.0;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
void Model::EquilibrateMatrix() {
|
|
746
|
+
const Int m = A_.rows();
|
|
747
|
+
const Int n = A_.cols();
|
|
748
|
+
const Int* Ap = A_.colptr();
|
|
749
|
+
const Int* Ai = A_.rowidx();
|
|
750
|
+
double* Ax = A_.values();
|
|
751
|
+
|
|
752
|
+
colscale_.resize(0);
|
|
753
|
+
rowscale_.resize(0);
|
|
754
|
+
|
|
755
|
+
// The absolute value of each nonzero entry of AI can be written as x*2^exp
|
|
756
|
+
// with x in the range [0.5,1). We consider AI well scaled if each entry is
|
|
757
|
+
// such that expmin <= exp <= expmax for parameters expmin and expmax.
|
|
758
|
+
// For example,
|
|
759
|
+
//
|
|
760
|
+
// expmin expmax allowed range
|
|
761
|
+
// -----------------------------
|
|
762
|
+
// 0 2 [0.5, 4)
|
|
763
|
+
// -1 3 [0.25, 8)
|
|
764
|
+
// 1 7 [1.0, 128)
|
|
765
|
+
//
|
|
766
|
+
// If AI is not well scaled, a recursive row and column equilibration is
|
|
767
|
+
// applied. In each iteration, the scaling factors are roughly 1/sqrt(max),
|
|
768
|
+
// where max is the maximum row or column entry. However, the factors are
|
|
769
|
+
// truncated to powers of 2, so that no round-off errors occur.
|
|
770
|
+
|
|
771
|
+
constexpr int expmin = 0;
|
|
772
|
+
constexpr int expmax = 3;
|
|
773
|
+
constexpr Int maxround = 10;
|
|
774
|
+
|
|
775
|
+
// Quick return if entries are within the target range.
|
|
776
|
+
bool out_of_range = false;
|
|
777
|
+
for (Int p = 0; p < Ap[n]; p++) {
|
|
778
|
+
int exp;
|
|
779
|
+
std::frexp(std::abs(Ax[p]), &exp);
|
|
780
|
+
if (exp < expmin || exp > expmax) {
|
|
781
|
+
out_of_range = true;
|
|
782
|
+
break;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
if (!out_of_range)
|
|
786
|
+
return;
|
|
787
|
+
|
|
788
|
+
colscale_.resize(n);
|
|
789
|
+
rowscale_.resize(m);
|
|
790
|
+
colscale_ = 1.0;
|
|
791
|
+
rowscale_ = 1.0;
|
|
792
|
+
Vector colmax(n), rowmax(m);
|
|
793
|
+
|
|
794
|
+
for (Int round = 0; round < maxround; round++) {
|
|
795
|
+
// Compute infinity norm of each row and column.
|
|
796
|
+
rowmax = 0.0;
|
|
797
|
+
for (Int j = 0; j < n; j++) {
|
|
798
|
+
colmax[j] = 0.0;
|
|
799
|
+
for (Int p = Ap[j]; p < Ap[j+1]; p++) {
|
|
800
|
+
Int i = Ai[p];
|
|
801
|
+
double xa = std::abs(Ax[p]);
|
|
802
|
+
colmax[j] = std::max(colmax[j], xa);
|
|
803
|
+
rowmax[i] = std::max(rowmax[i], xa);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
// Replace rowmax and colmax entries by scaling factors from this round.
|
|
807
|
+
bool out_of_range = false;
|
|
808
|
+
for (Int i = 0; i < m; i++) {
|
|
809
|
+
int exp;
|
|
810
|
+
std::frexp(rowmax[i], &exp);
|
|
811
|
+
rowmax[i] = EquilibrationFactor(expmin, expmax, exp);
|
|
812
|
+
if (rowmax[i] != 1.0) {
|
|
813
|
+
out_of_range = true;
|
|
814
|
+
rowscale_[i] *= rowmax[i];
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
for (Int j = 0; j < n; j++) {
|
|
818
|
+
int exp;
|
|
819
|
+
std::frexp(colmax[j], &exp);
|
|
820
|
+
colmax[j] = EquilibrationFactor(expmin, expmax, exp);
|
|
821
|
+
if (colmax[j] != 1.0) {
|
|
822
|
+
out_of_range = true;
|
|
823
|
+
colscale_[j] *= colmax[j];
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
if (!out_of_range)
|
|
827
|
+
break;
|
|
828
|
+
// Rescale A.
|
|
829
|
+
for (Int j = 0; j < n; j++) {
|
|
830
|
+
for (Int p = Ap[j]; p < Ap[j+1]; p++) {
|
|
831
|
+
Ax[p] *= colmax[j]; // column scaling
|
|
832
|
+
Ax[p] *= rowmax[Ai[p]]; // row scaling
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
void Model::FindDenseColumns() {
|
|
839
|
+
num_dense_cols_ = 0;
|
|
840
|
+
nz_dense_ = rows() + 1;
|
|
841
|
+
|
|
842
|
+
std::vector<Int> colcount(num_cols_);
|
|
843
|
+
for (Int j = 0; j < num_cols_; j++)
|
|
844
|
+
colcount[j] = AI_.end(j)-AI_.begin(j);
|
|
845
|
+
pdqsort(colcount.begin(), colcount.end());
|
|
846
|
+
|
|
847
|
+
for (Int j = 1; j < num_cols_; j++) {
|
|
848
|
+
if (colcount[j] >
|
|
849
|
+
std::max((ipx::Int)40l, (ipx::Int)10l*colcount[j-1])) {
|
|
850
|
+
// j is the first dense column
|
|
851
|
+
num_dense_cols_ = num_cols_ - j;
|
|
852
|
+
nz_dense_ = colcount[j];
|
|
853
|
+
break;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
if (num_dense_cols_ > 1000) {
|
|
858
|
+
num_dense_cols_ = 0;
|
|
859
|
+
nz_dense_ = rows() + 1;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
void Model::PrintCoefficientRange(const Control& control) const {
|
|
864
|
+
double amin = INFINITY;
|
|
865
|
+
double amax = 0.0;
|
|
866
|
+
for (Int j = 0; j < A_.cols(); j++) {
|
|
867
|
+
for (Int p = A_.begin(j); p < A_.end(j); p++) {
|
|
868
|
+
double x = A_.value(p);
|
|
869
|
+
if (x != 0.0) {
|
|
870
|
+
amin = std::min(amin, std::abs(x));
|
|
871
|
+
amax = std::max(amax, std::abs(x));
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
if (amin == INFINITY) // no nonzero entries in A_
|
|
876
|
+
amin = 0.0;
|
|
877
|
+
std::stringstream h_logging_stream;
|
|
878
|
+
h_logging_stream.str(std::string());
|
|
879
|
+
h_logging_stream
|
|
880
|
+
<< Textline("Matrix range:")
|
|
881
|
+
<< "[" << Scientific(amin, 5, 0) << ", "
|
|
882
|
+
<< Scientific(amax, 5, 0) << "]\n";
|
|
883
|
+
control.hLog(h_logging_stream);
|
|
884
|
+
|
|
885
|
+
double rhsmin = INFINITY;
|
|
886
|
+
double rhsmax = 0.0;
|
|
887
|
+
for (double x : scaled_rhs_) {
|
|
888
|
+
if (x != 0.0) {
|
|
889
|
+
rhsmin = std::min(rhsmin, std::abs(x));
|
|
890
|
+
rhsmax = std::max(rhsmax, std::abs(x));
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
if (rhsmin == INFINITY) // no nonzero entries in rhs
|
|
894
|
+
rhsmin = 0.0;
|
|
895
|
+
h_logging_stream
|
|
896
|
+
<< Textline("RHS range:")
|
|
897
|
+
<< "[" << Scientific(rhsmin, 5, 0) << ", "
|
|
898
|
+
<< Scientific(rhsmax, 5, 0) << "]\n";
|
|
899
|
+
control.hLog(h_logging_stream);
|
|
900
|
+
|
|
901
|
+
double objmin = INFINITY;
|
|
902
|
+
double objmax = 0.0;
|
|
903
|
+
for (double x : scaled_obj_) {
|
|
904
|
+
if (x != 0.0) {
|
|
905
|
+
objmin = std::min(objmin, std::abs(x));
|
|
906
|
+
objmax = std::max(objmax, std::abs(x));
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
if (objmin == INFINITY) // no nonzero entries in obj
|
|
910
|
+
objmin = 0.0;
|
|
911
|
+
h_logging_stream
|
|
912
|
+
<< Textline("Objective range:")
|
|
913
|
+
<< "[" << Scientific(objmin, 5, 0) << ", "
|
|
914
|
+
<< Scientific(objmax, 5, 0) << "]\n";
|
|
915
|
+
control.hLog(h_logging_stream);
|
|
916
|
+
|
|
917
|
+
double boundmin = INFINITY;
|
|
918
|
+
double boundmax = 0.0;
|
|
919
|
+
for (double x : scaled_lbuser_) {
|
|
920
|
+
if (x != 0.0 && std::isfinite(x)) {
|
|
921
|
+
boundmin = std::min(boundmin, std::abs(x));
|
|
922
|
+
boundmax = std::max(boundmax, std::abs(x));
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
for (double x : scaled_ubuser_) {
|
|
926
|
+
if (x != 0.0 && std::isfinite(x)) {
|
|
927
|
+
boundmin = std::min(boundmin, std::abs(x));
|
|
928
|
+
boundmax = std::max(boundmax, std::abs(x));
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
if (boundmin == INFINITY) // no finite nonzeros entries in bounds
|
|
932
|
+
boundmin = 0.0;
|
|
933
|
+
h_logging_stream
|
|
934
|
+
<< Textline("Bounds range:")
|
|
935
|
+
<< "[" << Scientific(boundmin, 5, 0) << ", "
|
|
936
|
+
<< Scientific(boundmax, 5, 0) << "]\n";
|
|
937
|
+
control.hLog(h_logging_stream);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
void Model::PrintPreprocessingLog(const Control& control) const {
|
|
941
|
+
// Find the minimum and maximum scaling factor.
|
|
942
|
+
double minscale = INFINITY;
|
|
943
|
+
double maxscale = 0.0;
|
|
944
|
+
if (colscale_.size() > 0) {
|
|
945
|
+
auto minmax = std::minmax_element(std::begin(colscale_),
|
|
946
|
+
std::end(colscale_));
|
|
947
|
+
minscale = std::min(minscale, *minmax.first);
|
|
948
|
+
maxscale = std::max(maxscale, *minmax.second);
|
|
949
|
+
}
|
|
950
|
+
if (rowscale_.size() > 0) {
|
|
951
|
+
auto minmax = std::minmax_element(std::begin(rowscale_),
|
|
952
|
+
std::end(rowscale_));
|
|
953
|
+
minscale = std::min(minscale, *minmax.first);
|
|
954
|
+
maxscale = std::max(maxscale, *minmax.second);
|
|
955
|
+
}
|
|
956
|
+
if (minscale == INFINITY)
|
|
957
|
+
minscale = 1.0;
|
|
958
|
+
if (maxscale == 0.0)
|
|
959
|
+
maxscale = 1.0;
|
|
960
|
+
|
|
961
|
+
std::stringstream h_logging_stream;
|
|
962
|
+
h_logging_stream.str(std::string());
|
|
963
|
+
h_logging_stream
|
|
964
|
+
<< "Preprocessing\n"
|
|
965
|
+
<< Textline("Dualized model:") << (dualized() ? "yes" : "no") << '\n'
|
|
966
|
+
<< Textline("Number of dense columns:") << num_dense_cols() << '\n';
|
|
967
|
+
control.hLog(h_logging_stream);
|
|
968
|
+
if (control.scale() > 0) {
|
|
969
|
+
h_logging_stream
|
|
970
|
+
<< Textline("Range of scaling factors:") << "["
|
|
971
|
+
<< Scientific(minscale, 8, 2) << ", "
|
|
972
|
+
<< Scientific(maxscale, 8, 2) << "]\n";
|
|
973
|
+
control.hLog(h_logging_stream);
|
|
974
|
+
}
|
|
975
|
+
h_logging_stream
|
|
976
|
+
<< Textline("Scaled cost norm: ") << norm_c_ << '\n'
|
|
977
|
+
<< Textline("Scaled bounds norm: ") << norm_bounds_ << '\n';
|
|
978
|
+
control.hLog(h_logging_stream);
|
|
979
|
+
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
void Model::ScalePoint(Vector& x, Vector& slack, Vector& y, Vector& z) const {
|
|
983
|
+
if (colscale_.size() > 0) {
|
|
984
|
+
x /= colscale_;
|
|
985
|
+
z *= colscale_;
|
|
986
|
+
}
|
|
987
|
+
if (rowscale_.size() > 0) {
|
|
988
|
+
y /= rowscale_;
|
|
989
|
+
slack *= rowscale_;
|
|
990
|
+
}
|
|
991
|
+
for (Int j : flipped_vars_) {
|
|
992
|
+
x[j] *= -1.0;
|
|
993
|
+
z[j] *= -1.0;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
void Model::ScalePoint(Vector& x, Vector& xl, Vector& xu, Vector& slack,
|
|
998
|
+
Vector& y, Vector& zl, Vector& zu) const {
|
|
999
|
+
if (colscale_.size() > 0) {
|
|
1000
|
+
x /= colscale_;
|
|
1001
|
+
xl /= colscale_;
|
|
1002
|
+
xu /= colscale_;
|
|
1003
|
+
zl *= colscale_;
|
|
1004
|
+
zu *= colscale_;
|
|
1005
|
+
}
|
|
1006
|
+
if (rowscale_.size() > 0) {
|
|
1007
|
+
y /= rowscale_;
|
|
1008
|
+
slack *= rowscale_;
|
|
1009
|
+
}
|
|
1010
|
+
for (Int j : flipped_vars_) {
|
|
1011
|
+
x[j] *= -1.0;
|
|
1012
|
+
xl[j] = xu[j];
|
|
1013
|
+
xu[j] = INFINITY;
|
|
1014
|
+
zl[j] = zu[j];
|
|
1015
|
+
zu[j] = 0.0;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
void Model::ScaleBackInteriorSolution(Vector& x, Vector& xl, Vector& xu,
|
|
1020
|
+
Vector& slack, Vector& y, Vector& zl,
|
|
1021
|
+
Vector& zu) const {
|
|
1022
|
+
if (colscale_.size() > 0) {
|
|
1023
|
+
x *= colscale_;
|
|
1024
|
+
xl *= colscale_;
|
|
1025
|
+
xu *= colscale_;
|
|
1026
|
+
zl /= colscale_;
|
|
1027
|
+
zu /= colscale_;
|
|
1028
|
+
}
|
|
1029
|
+
if (rowscale_.size() > 0) {
|
|
1030
|
+
y *= rowscale_;
|
|
1031
|
+
slack /= rowscale_;
|
|
1032
|
+
}
|
|
1033
|
+
for (Int j : flipped_vars_) {
|
|
1034
|
+
assert(std::isfinite(xl[j]));
|
|
1035
|
+
assert(std::isinf(xu[j]));
|
|
1036
|
+
assert(zu[j] == 0.0);
|
|
1037
|
+
x[j] *= -1.0;
|
|
1038
|
+
xu[j] = xl[j];
|
|
1039
|
+
xl[j] = INFINITY;
|
|
1040
|
+
zu[j] = zl[j];
|
|
1041
|
+
zl[j] = 0.0;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
void Model::ScaleBackResiduals(Vector& rb, Vector& rc, Vector& rl,
|
|
1046
|
+
Vector& ru) const {
|
|
1047
|
+
if (colscale_.size() > 0) {
|
|
1048
|
+
rc /= colscale_;
|
|
1049
|
+
rl *= colscale_;
|
|
1050
|
+
ru *= colscale_;
|
|
1051
|
+
}
|
|
1052
|
+
if (rowscale_.size() > 0)
|
|
1053
|
+
rb /= rowscale_;
|
|
1054
|
+
for (Int j : flipped_vars_) {
|
|
1055
|
+
rc[j] *= -1.0;
|
|
1056
|
+
assert(ru[j] == 0.0);
|
|
1057
|
+
ru[j] = -rl[j];
|
|
1058
|
+
rl[j] = 0.0;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
void Model::ScaleBackBasicSolution(Vector& x, Vector& slack, Vector& y,
|
|
1063
|
+
Vector& z) const {
|
|
1064
|
+
if (colscale_.size() > 0) {
|
|
1065
|
+
x *= colscale_;
|
|
1066
|
+
z /= colscale_;
|
|
1067
|
+
}
|
|
1068
|
+
if (rowscale_.size() > 0) {
|
|
1069
|
+
y *= rowscale_;
|
|
1070
|
+
slack /= rowscale_;
|
|
1071
|
+
}
|
|
1072
|
+
for (Int j : flipped_vars_) {
|
|
1073
|
+
x[j] *= -1.0;
|
|
1074
|
+
z[j] *= -1.0;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
void Model::ScaleBackBasis(std::vector<Int>& cbasis,
|
|
1079
|
+
std::vector<Int>& vbasis) const {
|
|
1080
|
+
for (Int j : flipped_vars_) {
|
|
1081
|
+
assert(vbasis[j] != IPX_nonbasic_ub);
|
|
1082
|
+
if (vbasis[j] == IPX_nonbasic_lb)
|
|
1083
|
+
vbasis[j] = IPX_nonbasic_ub;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
void Model::DualizeBasicSolution(const Vector& x_user,
|
|
1088
|
+
const Vector& slack_user,
|
|
1089
|
+
const Vector& y_user,
|
|
1090
|
+
const Vector& z_user,
|
|
1091
|
+
Vector& x_solver,
|
|
1092
|
+
Vector& y_solver,
|
|
1093
|
+
Vector& z_solver) const {
|
|
1094
|
+
const Int m = rows();
|
|
1095
|
+
const Int n = cols();
|
|
1096
|
+
|
|
1097
|
+
if (dualized_) {
|
|
1098
|
+
assert(num_var_ == m);
|
|
1099
|
+
assert(num_constr_ + boxed_vars_.size() == static_cast<size_t>(n));
|
|
1100
|
+
|
|
1101
|
+
// Build dual solver variables from primal user variables.
|
|
1102
|
+
y_solver = -x_user;
|
|
1103
|
+
for (Int i = 0; i < num_constr_; i++)
|
|
1104
|
+
z_solver[i] = -slack_user[i];
|
|
1105
|
+
for (size_t k = 0; k < boxed_vars_.size(); k++) {
|
|
1106
|
+
Int j = boxed_vars_[k];
|
|
1107
|
+
z_solver[num_constr_+k] = c(num_constr_+k) + y_solver[j];
|
|
1108
|
+
}
|
|
1109
|
+
for (Int i = 0; i < m; i++)
|
|
1110
|
+
z_solver[n+i] = c(n+i)-y_solver[i];
|
|
1111
|
+
|
|
1112
|
+
// Build primal solver variables from dual user variables.
|
|
1113
|
+
std::copy_n(std::begin(y_user), num_constr_, std::begin(x_solver));
|
|
1114
|
+
std::copy_n(std::begin(z_user), num_var_, std::begin(x_solver) + n);
|
|
1115
|
+
for (size_t k = 0; k < boxed_vars_.size(); k++) {
|
|
1116
|
+
Int j = boxed_vars_[k];
|
|
1117
|
+
if (x_solver[n+j] < 0.0) {
|
|
1118
|
+
// j is a boxed variable and z_user[j] < 0
|
|
1119
|
+
x_solver[num_constr_+k] = -x_solver[n+j];
|
|
1120
|
+
x_solver[n+j] = 0.0;
|
|
1121
|
+
} else {
|
|
1122
|
+
x_solver[num_constr_+k] = 0.0;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
else {
|
|
1127
|
+
assert(num_constr_ == m);
|
|
1128
|
+
assert(num_var_ == n);
|
|
1129
|
+
std::copy_n(std::begin(x_user), n, std::begin(x_solver));
|
|
1130
|
+
std::copy_n(std::begin(slack_user), m, std::begin(x_solver) + n);
|
|
1131
|
+
std::copy_n(std::begin(y_user), m, std::begin(y_solver));
|
|
1132
|
+
std::copy_n(std::begin(z_user), n, std::begin(z_solver));
|
|
1133
|
+
for (Int i = 0; i < m; i++)
|
|
1134
|
+
z_solver[n+i] = c(n+i)-y_solver[i];
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
void Model::DualizeIPMStartingPoint(const Vector& x_user,
|
|
1139
|
+
const Vector& xl_user,
|
|
1140
|
+
const Vector& xu_user,
|
|
1141
|
+
const Vector& slack_user,
|
|
1142
|
+
const Vector& y_user,
|
|
1143
|
+
const Vector& zl_user,
|
|
1144
|
+
const Vector& zu_user,
|
|
1145
|
+
Vector& x_solver,
|
|
1146
|
+
Vector& xl_solver,
|
|
1147
|
+
Vector& xu_solver,
|
|
1148
|
+
Vector& y_solver,
|
|
1149
|
+
Vector& zl_solver,
|
|
1150
|
+
Vector& zu_solver) const {
|
|
1151
|
+
const Int m = rows();
|
|
1152
|
+
const Int n = cols();
|
|
1153
|
+
|
|
1154
|
+
if (dualized_) {
|
|
1155
|
+
// Not implemented.
|
|
1156
|
+
assert(false);
|
|
1157
|
+
}
|
|
1158
|
+
else {
|
|
1159
|
+
assert(num_constr_ == m);
|
|
1160
|
+
assert(num_var_ == n);
|
|
1161
|
+
|
|
1162
|
+
std::copy_n(std::begin(x_user), num_var_, std::begin(x_solver));
|
|
1163
|
+
std::copy_n(std::begin(slack_user), num_constr_,
|
|
1164
|
+
std::begin(x_solver) + n);
|
|
1165
|
+
std::copy_n(std::begin(xl_user), num_var_, std::begin(xl_solver));
|
|
1166
|
+
std::copy_n(std::begin(xu_user), num_var_, std::begin(xu_solver));
|
|
1167
|
+
std::copy_n(std::begin(y_user), num_constr_, std::begin(y_solver));
|
|
1168
|
+
std::copy_n(std::begin(zl_user), num_var_, std::begin(zl_solver));
|
|
1169
|
+
std::copy_n(std::begin(zu_user), num_var_, std::begin(zu_solver));
|
|
1170
|
+
|
|
1171
|
+
for (Int i = 0; i < m; i++) {
|
|
1172
|
+
switch (constr_type_[i]) {
|
|
1173
|
+
case '=':
|
|
1174
|
+
assert(lb_[n+i] == 0.0 && ub_[n+i] == 0.0);
|
|
1175
|
+
// For a fixed slack variable xl, xu, zl and zu won't be used
|
|
1176
|
+
// by the IPM. Just put them to zero.
|
|
1177
|
+
xl_solver[n+i] = 0.0;
|
|
1178
|
+
xu_solver[n+i] = 0.0;
|
|
1179
|
+
zl_solver[n+i] = 0.0;
|
|
1180
|
+
zu_solver[n+i] = 0.0;
|
|
1181
|
+
break;
|
|
1182
|
+
case '<':
|
|
1183
|
+
assert(lb_[n+i] == 0.0 && ub_[n+i] == INFINITY);
|
|
1184
|
+
xl_solver[n+i] = slack_user[i];
|
|
1185
|
+
xu_solver[n+i] = INFINITY;
|
|
1186
|
+
zl_solver[n+i] = -y_user[i];
|
|
1187
|
+
zu_solver[n+i] = 0.0;
|
|
1188
|
+
break;
|
|
1189
|
+
case '>':
|
|
1190
|
+
assert(lb_[n+i] == -INFINITY && ub_[n+i] == 0.0);
|
|
1191
|
+
xl_solver[n+i] = INFINITY;
|
|
1192
|
+
xu_solver[n+i] = -slack_user[i];
|
|
1193
|
+
zl_solver[n+i] = 0.0;
|
|
1194
|
+
zu_solver[n+i] = y_user[i];
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
void Model::DualizeBackInteriorSolution(const Vector& x_solver,
|
|
1202
|
+
const Vector& xl_solver,
|
|
1203
|
+
const Vector& xu_solver,
|
|
1204
|
+
const Vector& y_solver,
|
|
1205
|
+
const Vector& zl_solver,
|
|
1206
|
+
const Vector& zu_solver,
|
|
1207
|
+
Vector& x_user,
|
|
1208
|
+
Vector& xl_user,
|
|
1209
|
+
Vector& xu_user,
|
|
1210
|
+
Vector& slack_user,
|
|
1211
|
+
Vector& y_user,
|
|
1212
|
+
Vector& zl_user,
|
|
1213
|
+
Vector& zu_user) const {
|
|
1214
|
+
const Int m = rows();
|
|
1215
|
+
const Int n = cols();
|
|
1216
|
+
|
|
1217
|
+
if (dualized_) {
|
|
1218
|
+
assert(num_var_ == m);
|
|
1219
|
+
assert(num_constr_ + (Int)boxed_vars_.size() == n);
|
|
1220
|
+
x_user = -y_solver;
|
|
1221
|
+
|
|
1222
|
+
// If the solution from the solver would be exact, we could copy the
|
|
1223
|
+
// first num_constr_ entries from x_solver into y_user. However, to
|
|
1224
|
+
// satisfy the sign condition on y_user even if the solution is not
|
|
1225
|
+
// exact, we have to use the xl_solver and xu_solver entries for
|
|
1226
|
+
// inequality constraints.
|
|
1227
|
+
for (Int i = 0; i < num_constr_; i++) {
|
|
1228
|
+
switch (constr_type_[i]) {
|
|
1229
|
+
case '=':
|
|
1230
|
+
y_user[i] = x_solver[i];
|
|
1231
|
+
break;
|
|
1232
|
+
case '<':
|
|
1233
|
+
y_user[i] = -xu_solver[i];
|
|
1234
|
+
break;
|
|
1235
|
+
case '>':
|
|
1236
|
+
y_user[i] = xl_solver[i];
|
|
1237
|
+
break;
|
|
1238
|
+
}
|
|
1239
|
+
assert(std::isfinite(y_user[i]));
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
// Dual variables associated with lbuser <= x in the scaled user model
|
|
1243
|
+
// are the slack variables from the solver. For an exact solution we
|
|
1244
|
+
// would have x_solver[n+1:n+m] == xl_solver[n+1:n+m]. Using xl_solver
|
|
1245
|
+
// guarantees that zl_user >= 0 in any case. If variable j has no lower
|
|
1246
|
+
// bound in the scaled user model (i.e. is free), then the j-th slack
|
|
1247
|
+
// variable was fixed at zero in the solver model, but the IPM solution
|
|
1248
|
+
// may not satisfy this. Hence we must set zl_user[j] = 0 explicitly.
|
|
1249
|
+
std::copy_n(std::begin(xl_solver) + n, num_var_, std::begin(zl_user));
|
|
1250
|
+
for (Int j = 0; j < num_var_; j++)
|
|
1251
|
+
if (!std::isfinite(scaled_lbuser_[j]))
|
|
1252
|
+
zl_user[j] = 0.0;
|
|
1253
|
+
|
|
1254
|
+
// Dual variables associated with x <= ubuser in the scaled user model
|
|
1255
|
+
// are the primal variables that were added for boxed variables in the
|
|
1256
|
+
// solver model.
|
|
1257
|
+
zu_user = 0.0;
|
|
1258
|
+
Int k = num_constr_;
|
|
1259
|
+
for (Int j : boxed_vars_)
|
|
1260
|
+
zu_user[j] = xl_solver[k++];
|
|
1261
|
+
assert(k == n);
|
|
1262
|
+
|
|
1263
|
+
// xl in the scaled user model is zl[n+1:n+m] in the solver model or
|
|
1264
|
+
// infinity.
|
|
1265
|
+
for (Int i = 0; i < m; i++) {
|
|
1266
|
+
if (std::isfinite(scaled_lbuser_[i]))
|
|
1267
|
+
xl_user[i] = zl_solver[n+i];
|
|
1268
|
+
else
|
|
1269
|
+
xl_user[i] = INFINITY;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
// xu in the scaled user model are the entries in zl for columns of the
|
|
1273
|
+
// negative identity matrix (that were added for boxed variables).
|
|
1274
|
+
xu_user = INFINITY;
|
|
1275
|
+
k = num_constr_;
|
|
1276
|
+
for (Int j : boxed_vars_)
|
|
1277
|
+
xu_user[j] = zl_solver[k++];
|
|
1278
|
+
assert(k == n);
|
|
1279
|
+
|
|
1280
|
+
for (Int i = 0; i < num_constr_; i++) {
|
|
1281
|
+
switch (constr_type_[i]) {
|
|
1282
|
+
case '=':
|
|
1283
|
+
slack_user[i] = 0.0;
|
|
1284
|
+
break;
|
|
1285
|
+
case '<':
|
|
1286
|
+
slack_user[i] = zu_solver[i];
|
|
1287
|
+
break;
|
|
1288
|
+
case '>':
|
|
1289
|
+
slack_user[i] = -zl_solver[i];
|
|
1290
|
+
break;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
else {
|
|
1295
|
+
assert(num_constr_ == m);
|
|
1296
|
+
assert(num_var_ == n);
|
|
1297
|
+
std::copy_n(std::begin(x_solver), num_var_, std::begin(x_user));
|
|
1298
|
+
|
|
1299
|
+
// Instead of copying y_solver into y_user, we use the entries from
|
|
1300
|
+
// zl_solver and zu_solver for inequality constraints, so that the sign
|
|
1301
|
+
// condition on y_user is satisfied.
|
|
1302
|
+
for (Int i = 0; i < m; i++) {
|
|
1303
|
+
assert(lb_[n+i] == 0.0 || lb_[n+i] == -INFINITY);
|
|
1304
|
+
assert(ub_[n+i] == 0.0 || ub_[n+i] == INFINITY);
|
|
1305
|
+
assert(lb_[n+i] == 0.0 || ub_[n+i] == 0.0);
|
|
1306
|
+
switch (constr_type_[i]) {
|
|
1307
|
+
case '=':
|
|
1308
|
+
y_user[i] = y_solver[i];
|
|
1309
|
+
break;
|
|
1310
|
+
case '<':
|
|
1311
|
+
y_user[i] = -zl_solver[n+i];
|
|
1312
|
+
break;
|
|
1313
|
+
case '>':
|
|
1314
|
+
y_user[i] = zu_solver[n+i];
|
|
1315
|
+
break;
|
|
1316
|
+
}
|
|
1317
|
+
assert(std::isfinite(y_user[i]));
|
|
1318
|
+
}
|
|
1319
|
+
std::copy_n(std::begin(zl_solver), num_var_, std::begin(zl_user));
|
|
1320
|
+
std::copy_n(std::begin(zu_solver), num_var_, std::begin(zu_user));
|
|
1321
|
+
std::copy_n(std::begin(xl_solver), num_var_, std::begin(xl_user));
|
|
1322
|
+
std::copy_n(std::begin(xu_solver), num_var_, std::begin(xu_user));
|
|
1323
|
+
|
|
1324
|
+
// If the solution would be exact, slack_user were given by the entries
|
|
1325
|
+
// of x_solver corresponding to slack columns. To satisfy the sign
|
|
1326
|
+
// condition in any case, we build the slack for inequality constraints
|
|
1327
|
+
// from xl_solver and xu_solver and set the slack for equality
|
|
1328
|
+
// constraints to zero.
|
|
1329
|
+
for (Int i = 0; i < m; i++) {
|
|
1330
|
+
switch (constr_type_[i]) {
|
|
1331
|
+
case '=':
|
|
1332
|
+
slack_user[i] = 0.0;
|
|
1333
|
+
break;
|
|
1334
|
+
case '<':
|
|
1335
|
+
slack_user[i] = xl_solver[n+i];
|
|
1336
|
+
break;
|
|
1337
|
+
case '>':
|
|
1338
|
+
slack_user[i] = -xu_solver[n+i];
|
|
1339
|
+
break;
|
|
1340
|
+
}
|
|
1341
|
+
assert(std::isfinite(slack_user[i]));
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
void Model::DualizeBackBasicSolution(const Vector& x_solver,
|
|
1347
|
+
const Vector& y_solver,
|
|
1348
|
+
const Vector& z_solver,
|
|
1349
|
+
Vector& x_user,
|
|
1350
|
+
Vector& slack_user,
|
|
1351
|
+
Vector& y_user,
|
|
1352
|
+
Vector& z_user) const {
|
|
1353
|
+
const Int m = rows();
|
|
1354
|
+
const Int n = cols();
|
|
1355
|
+
|
|
1356
|
+
if (dualized_) {
|
|
1357
|
+
assert(num_var_ == m);
|
|
1358
|
+
assert(num_constr_ + (Int)boxed_vars_.size() == n);
|
|
1359
|
+
x_user = -y_solver;
|
|
1360
|
+
for (Int i = 0; i < num_constr_; i++)
|
|
1361
|
+
slack_user[i] = -z_solver[i];
|
|
1362
|
+
std::copy_n(std::begin(x_solver), num_constr_, std::begin(y_user));
|
|
1363
|
+
std::copy_n(std::begin(x_solver) + n, num_var_, std::begin(z_user));
|
|
1364
|
+
Int k = num_constr_;
|
|
1365
|
+
for (Int j : boxed_vars_)
|
|
1366
|
+
z_user[j] -= x_solver[k++];
|
|
1367
|
+
assert(k == n);
|
|
1368
|
+
}
|
|
1369
|
+
else {
|
|
1370
|
+
assert(num_constr_ == m);
|
|
1371
|
+
assert(num_var_ == n);
|
|
1372
|
+
std::copy_n(std::begin(x_solver), num_var_, std::begin(x_user));
|
|
1373
|
+
std::copy_n(std::begin(x_solver) + n, num_constr_,
|
|
1374
|
+
std::begin(slack_user));
|
|
1375
|
+
std::copy_n(std::begin(y_solver), num_constr_, std::begin(y_user));
|
|
1376
|
+
std::copy_n(std::begin(z_solver), num_var_, std::begin(z_user));
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
void Model::DualizeBackBasis(const std::vector<Int>& basic_status_solver,
|
|
1381
|
+
std::vector<Int>& cbasis_user,
|
|
1382
|
+
std::vector<Int>& vbasis_user) const {
|
|
1383
|
+
const Int m = rows();
|
|
1384
|
+
const Int n = cols();
|
|
1385
|
+
|
|
1386
|
+
if (dualized_) {
|
|
1387
|
+
assert(num_var_ == m);
|
|
1388
|
+
assert(num_constr_ + (Int)boxed_vars_.size() == n);
|
|
1389
|
+
for (Int i = 0; i < num_constr_; i++) {
|
|
1390
|
+
if (basic_status_solver[i] == IPX_basic)
|
|
1391
|
+
cbasis_user[i] = IPX_nonbasic;
|
|
1392
|
+
else
|
|
1393
|
+
cbasis_user[i] = IPX_basic;
|
|
1394
|
+
}
|
|
1395
|
+
for (Int j = 0; j < num_var_; j++) {
|
|
1396
|
+
// slack cannot be superbasic
|
|
1397
|
+
assert(basic_status_solver[n+j] != IPX_superbasic);
|
|
1398
|
+
if (basic_status_solver[n+j] == 0)
|
|
1399
|
+
vbasis_user[j] = std::isfinite(scaled_lbuser_[j]) ?
|
|
1400
|
+
IPX_nonbasic_lb : IPX_superbasic;
|
|
1401
|
+
else
|
|
1402
|
+
vbasis_user[j] = IPX_basic;
|
|
1403
|
+
}
|
|
1404
|
+
Int k = num_constr_;
|
|
1405
|
+
for (Int j : boxed_vars_)
|
|
1406
|
+
if (basic_status_solver[k++] == IPX_basic) {
|
|
1407
|
+
assert(vbasis_user[j] == IPX_basic);
|
|
1408
|
+
vbasis_user[j] = IPX_nonbasic_ub;
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
else {
|
|
1412
|
+
assert(num_constr_ == m);
|
|
1413
|
+
assert(num_var_ == n);
|
|
1414
|
+
for (Int i = 0; i < num_constr_; i++) {
|
|
1415
|
+
// slack cannot be superbasic
|
|
1416
|
+
assert(basic_status_solver[n+i] != IPX_superbasic);
|
|
1417
|
+
if (basic_status_solver[n+i] == IPX_basic)
|
|
1418
|
+
cbasis_user[i] = IPX_basic;
|
|
1419
|
+
else
|
|
1420
|
+
cbasis_user[i] = IPX_nonbasic;
|
|
1421
|
+
}
|
|
1422
|
+
for (Int j = 0; j < num_var_; j++)
|
|
1423
|
+
vbasis_user[j] = basic_status_solver[j];
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
void Model::CorrectScaledBasicSolution(Vector& x, Vector& slack, Vector& y,
|
|
1428
|
+
Vector& z,
|
|
1429
|
+
const std::vector<Int> cbasis,
|
|
1430
|
+
const std::vector<Int> vbasis) const {
|
|
1431
|
+
for (Int j = 0; j < num_var_; j++) {
|
|
1432
|
+
if (vbasis[j] == IPX_nonbasic_lb)
|
|
1433
|
+
x[j] = scaled_lbuser_[j];
|
|
1434
|
+
if (vbasis[j] == IPX_nonbasic_ub)
|
|
1435
|
+
x[j] = scaled_ubuser_[j];
|
|
1436
|
+
if (vbasis[j] == IPX_basic)
|
|
1437
|
+
z[j] = 0.0;
|
|
1438
|
+
}
|
|
1439
|
+
for (Int i = 0; i < num_constr_; i++) {
|
|
1440
|
+
if (cbasis[i] == IPX_nonbasic)
|
|
1441
|
+
slack[i] = 0.0;
|
|
1442
|
+
if (cbasis[i] == IPX_basic)
|
|
1443
|
+
y[i] = 0.0;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
void Model::MultiplyWithScaledMatrix(const Vector& rhs, double alpha,
|
|
1448
|
+
Vector& lhs, char trans) const {
|
|
1449
|
+
if (trans == 't' || trans == 'T') {
|
|
1450
|
+
assert((Int)rhs.size() == num_constr_);
|
|
1451
|
+
assert((Int)lhs.size() == num_var_);
|
|
1452
|
+
if (dualized())
|
|
1453
|
+
for (Int i = 0; i < num_constr_; i++)
|
|
1454
|
+
ScatterColumn(AI_, i, alpha*rhs[i], lhs);
|
|
1455
|
+
else
|
|
1456
|
+
for (Int j = 0; j < num_var_; j++)
|
|
1457
|
+
lhs[j] += alpha * DotColumn(AI_, j, rhs);
|
|
1458
|
+
}
|
|
1459
|
+
else {
|
|
1460
|
+
assert((Int)rhs.size() == num_var_);
|
|
1461
|
+
assert((Int)lhs.size() == num_constr_);
|
|
1462
|
+
if (dualized())
|
|
1463
|
+
for (Int i = 0; i < num_constr_; i++)
|
|
1464
|
+
lhs[i] += alpha * DotColumn(AI_, i, rhs);
|
|
1465
|
+
else
|
|
1466
|
+
for (Int j = 0; j < num_var_; j++)
|
|
1467
|
+
ScatterColumn(AI_, j, alpha*rhs[j], lhs);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
double PrimalInfeasibility(const Model& model, const Vector& x) {
|
|
1472
|
+
const Vector& lb = model.lb();
|
|
1473
|
+
const Vector& ub = model.ub();
|
|
1474
|
+
assert(x.size() == lb.size());
|
|
1475
|
+
|
|
1476
|
+
double infeas = 0.0;
|
|
1477
|
+
for (size_t j = 0; j < x.size(); j++) {
|
|
1478
|
+
infeas = std::max(infeas, lb[j]-x[j]);
|
|
1479
|
+
infeas = std::max(infeas, x[j]-ub[j]);
|
|
1480
|
+
}
|
|
1481
|
+
return infeas;
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
double DualInfeasibility(const Model& model, const Vector& x,
|
|
1485
|
+
const Vector& z) {
|
|
1486
|
+
const Vector& lb = model.lb();
|
|
1487
|
+
const Vector& ub = model.ub();
|
|
1488
|
+
assert(x.size() == lb.size());
|
|
1489
|
+
assert(z.size() == lb.size());
|
|
1490
|
+
|
|
1491
|
+
double infeas = 0.0;
|
|
1492
|
+
for (size_t j = 0; j < x.size(); j++) {
|
|
1493
|
+
if (x[j] > lb[j])
|
|
1494
|
+
infeas = std::max(infeas, z[j]);
|
|
1495
|
+
if (x[j] < ub[j])
|
|
1496
|
+
infeas = std::max(infeas, -z[j]);
|
|
1497
|
+
}
|
|
1498
|
+
return infeas;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
double PrimalResidual(const Model& model, const Vector& x) {
|
|
1502
|
+
const SparseMatrix& AIt = model.AIt();
|
|
1503
|
+
const Vector& b = model.b();
|
|
1504
|
+
assert((Int)x.size() == AIt.rows());
|
|
1505
|
+
|
|
1506
|
+
double res = 0.0;
|
|
1507
|
+
for (Int i = 0; i < (Int)b.size(); i++) {
|
|
1508
|
+
double r = b[i] - DotColumn(AIt, i, x);
|
|
1509
|
+
res = std::max(res, std::abs(r));
|
|
1510
|
+
}
|
|
1511
|
+
return res;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
double DualResidual(const Model& model, const Vector& y, const Vector& z) {
|
|
1515
|
+
const SparseMatrix& AI = model.AI();
|
|
1516
|
+
const Vector& c = model.c();
|
|
1517
|
+
assert((Int)y.size() == AI.rows());
|
|
1518
|
+
assert((Int)z.size() == AI.cols());
|
|
1519
|
+
|
|
1520
|
+
double res = 0.0;
|
|
1521
|
+
for (Int j = 0; j < (Int)c.size(); j++) {
|
|
1522
|
+
double r = c[j] - z[j] - DotColumn(AI, j, y);
|
|
1523
|
+
res = std::max(res, std::abs(r));
|
|
1524
|
+
}
|
|
1525
|
+
return res;
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
} // namespace ipx
|