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,2497 @@
|
|
|
1
|
+
#include "Avgas.h"
|
|
2
|
+
#include "HCheckConfig.h"
|
|
3
|
+
#include "Highs.h"
|
|
4
|
+
#include "SpecialLps.h"
|
|
5
|
+
#include "catch.hpp"
|
|
6
|
+
#include "lp_data/HighsLpUtils.h"
|
|
7
|
+
#include "util/HighsRandom.h"
|
|
8
|
+
#include "util/HighsTimer.h"
|
|
9
|
+
#include "util/HighsUtils.h"
|
|
10
|
+
|
|
11
|
+
const bool dev_run = false;
|
|
12
|
+
// const double inf = kHighsInf;
|
|
13
|
+
const double double_equal_tolerance = 1e-5;
|
|
14
|
+
void HighsStatusReport(const HighsLogOptions& log_options, std::string message,
|
|
15
|
+
HighsStatus status);
|
|
16
|
+
|
|
17
|
+
void callRun(Highs& highs, const HighsLogOptions& log_options,
|
|
18
|
+
std::string message, const HighsStatus require_return_status);
|
|
19
|
+
|
|
20
|
+
bool areLpColEqual(const HighsInt num_col0, const double* colCost0,
|
|
21
|
+
const double* colLower0, const double* colUpper0,
|
|
22
|
+
const HighsInt num_nz0, const HighsInt* Astart0,
|
|
23
|
+
const HighsInt* Aindex0, const double* Avalue0,
|
|
24
|
+
const HighsInt num_col1, const double* colCost1,
|
|
25
|
+
const double* colLower1, const double* colUpper1,
|
|
26
|
+
const HighsInt num_nz1, const HighsInt* Astart1,
|
|
27
|
+
const HighsInt* Aindex1, const double* Avalue1,
|
|
28
|
+
const double infinite_bound);
|
|
29
|
+
|
|
30
|
+
bool areLpRowEqual(const HighsInt num_row0, const double* rowLower0,
|
|
31
|
+
const double* rowUpper0, const HighsInt num_nz0,
|
|
32
|
+
const HighsInt* ARstart0, const HighsInt* ARindex0,
|
|
33
|
+
const double* ARvalue0, const HighsInt num_row1,
|
|
34
|
+
const double* rowLower1, const double* rowUpper1,
|
|
35
|
+
const HighsInt num_nz1, const HighsInt* ARstart1,
|
|
36
|
+
const HighsInt* ARindex1, const double* ARvalue1,
|
|
37
|
+
const double infinite_bound);
|
|
38
|
+
|
|
39
|
+
bool areLpEqual(const HighsLp lp0, const HighsLp lp1,
|
|
40
|
+
const double infinite_bound);
|
|
41
|
+
|
|
42
|
+
bool equalSparseVectors(const HighsInt dim, const HighsInt num_nz0,
|
|
43
|
+
const HighsInt* index0, const double* value0,
|
|
44
|
+
const HighsInt num_nz1, const HighsInt* index1,
|
|
45
|
+
const double* value1);
|
|
46
|
+
|
|
47
|
+
void testDeleteKeep(const HighsIndexCollection& index_collection);
|
|
48
|
+
|
|
49
|
+
bool testAllDeleteKeep(HighsInt num_row);
|
|
50
|
+
|
|
51
|
+
void messageReportLp(const char* message, const HighsLp& lp);
|
|
52
|
+
|
|
53
|
+
void messageReportMatrix(const char* message, const HighsInt num_col,
|
|
54
|
+
const HighsInt num_nz, const HighsInt* start,
|
|
55
|
+
const HighsInt* index, const double* value);
|
|
56
|
+
|
|
57
|
+
TEST_CASE("LP-717-od", "[highs_data]") {
|
|
58
|
+
Highs highs;
|
|
59
|
+
if (!dev_run) highs.setOptionValue("output_flag", false);
|
|
60
|
+
REQUIRE(highs.addCol(0.0, -inf, inf, 0, nullptr, nullptr) ==
|
|
61
|
+
HighsStatus::kOk);
|
|
62
|
+
std::vector<HighsInt> index = {0};
|
|
63
|
+
std::vector<double> value = {1.0};
|
|
64
|
+
REQUIRE(highs.addRow(2.0, inf, 1, index.data(), value.data()) ==
|
|
65
|
+
HighsStatus::kOk);
|
|
66
|
+
REQUIRE(highs.addCol(0.0, -inf, inf, 0, nullptr, nullptr) ==
|
|
67
|
+
HighsStatus::kOk);
|
|
68
|
+
REQUIRE(highs.run() == HighsStatus::kOk);
|
|
69
|
+
|
|
70
|
+
highs.resetGlobalScheduler(true);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
TEST_CASE("LP-717-full0", "[highs_data]") {
|
|
74
|
+
// Add columns to an LP with a small matrix held row-wise so that
|
|
75
|
+
// the orientation is flipped
|
|
76
|
+
HighsInt row_block_num_col = 2;
|
|
77
|
+
HighsInt row_block_num_row = 3;
|
|
78
|
+
HighsInt col_block_num_col = 3;
|
|
79
|
+
|
|
80
|
+
HighsLp lp;
|
|
81
|
+
lp.num_col_ = row_block_num_col + col_block_num_col;
|
|
82
|
+
lp.num_row_ = row_block_num_row;
|
|
83
|
+
lp.col_cost_ = {-2, -1, -2, -3, -3};
|
|
84
|
+
lp.col_lower_ = {0, 0, 0, 0, 0};
|
|
85
|
+
lp.col_upper_ = {1, 1, 1, 1, 1};
|
|
86
|
+
lp.row_lower_ = {-inf, -inf, -inf};
|
|
87
|
+
lp.row_upper_ = {-2, 2, 1};
|
|
88
|
+
lp.a_matrix_.num_col_ = lp.num_col_;
|
|
89
|
+
lp.a_matrix_.num_row_ = lp.num_row_;
|
|
90
|
+
lp.a_matrix_.start_ = {0, 3, 8, 10};
|
|
91
|
+
lp.a_matrix_.index_ = {0, 2, 4, 0, 1, 2, 3, 4, 1, 3};
|
|
92
|
+
lp.a_matrix_.value_ = {1, -1, -3, 1, 1, 1, -2, 3, 1, 2};
|
|
93
|
+
lp.a_matrix_.format_ = MatrixFormat::kRowwise;
|
|
94
|
+
Highs highs;
|
|
95
|
+
if (!dev_run) highs.setOptionValue("output_flag", false);
|
|
96
|
+
const HighsLp& highs_lp = highs.getLp();
|
|
97
|
+
highs.passModel(lp);
|
|
98
|
+
highs.run();
|
|
99
|
+
if (dev_run) highs.writeSolution("", 1);
|
|
100
|
+
HighsInfo info0 = highs.getInfo();
|
|
101
|
+
HighsSolution solution0 = highs.getSolution();
|
|
102
|
+
highs.clear();
|
|
103
|
+
if (!dev_run) highs.setOptionValue("output_flag", false);
|
|
104
|
+
std::vector<double> row_block_col_cost;
|
|
105
|
+
std::vector<double> row_block_col_lower;
|
|
106
|
+
std::vector<double> row_block_col_upper;
|
|
107
|
+
std::vector<double> row_block_row_lower;
|
|
108
|
+
std::vector<double> row_block_row_upper;
|
|
109
|
+
|
|
110
|
+
std::vector<double> col_block_col_cost;
|
|
111
|
+
std::vector<double> col_block_col_lower;
|
|
112
|
+
std::vector<double> col_block_col_upper;
|
|
113
|
+
std::vector<double> col_block_row_lower;
|
|
114
|
+
std::vector<double> col_block_row_upper;
|
|
115
|
+
|
|
116
|
+
for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++) {
|
|
117
|
+
if (iCol < row_block_num_col) {
|
|
118
|
+
row_block_col_cost.push_back(lp.col_cost_[iCol]);
|
|
119
|
+
row_block_col_lower.push_back(lp.col_lower_[iCol]);
|
|
120
|
+
row_block_col_upper.push_back(lp.col_upper_[iCol]);
|
|
121
|
+
} else {
|
|
122
|
+
col_block_col_cost.push_back(lp.col_cost_[iCol]);
|
|
123
|
+
col_block_col_lower.push_back(lp.col_lower_[iCol]);
|
|
124
|
+
col_block_col_upper.push_back(lp.col_upper_[iCol]);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
row_block_row_lower = lp.row_lower_;
|
|
128
|
+
row_block_row_upper = lp.row_upper_;
|
|
129
|
+
|
|
130
|
+
HighsInt row_block_num_nz;
|
|
131
|
+
std::vector<HighsInt> row_block_start;
|
|
132
|
+
std::vector<HighsInt> row_block_index;
|
|
133
|
+
std::vector<double> row_block_value;
|
|
134
|
+
|
|
135
|
+
for (HighsInt iRow = 0; iRow < row_block_num_row; iRow++) {
|
|
136
|
+
row_block_start.push_back(row_block_index.size());
|
|
137
|
+
for (HighsInt iEl = lp.a_matrix_.start_[iRow];
|
|
138
|
+
iEl < lp.a_matrix_.start_[iRow + 1]; iEl++) {
|
|
139
|
+
HighsInt iCol = lp.a_matrix_.index_[iEl];
|
|
140
|
+
if (iCol < row_block_num_col) {
|
|
141
|
+
row_block_index.push_back(iCol);
|
|
142
|
+
row_block_value.push_back(lp.a_matrix_.value_[iEl]);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
row_block_num_nz = row_block_index.size();
|
|
147
|
+
|
|
148
|
+
REQUIRE(highs.addCols(row_block_num_col, row_block_col_cost.data(),
|
|
149
|
+
row_block_col_lower.data(), row_block_col_upper.data(),
|
|
150
|
+
0, nullptr, nullptr, nullptr) == HighsStatus::kOk);
|
|
151
|
+
|
|
152
|
+
REQUIRE(highs.addRows(row_block_num_row, row_block_row_lower.data(),
|
|
153
|
+
row_block_row_upper.data(), row_block_num_nz,
|
|
154
|
+
row_block_start.data(), row_block_index.data(),
|
|
155
|
+
row_block_value.data()) == HighsStatus::kOk);
|
|
156
|
+
|
|
157
|
+
if (dev_run)
|
|
158
|
+
printf("After adding a row-wise matrix, LP matrix has format %d\n",
|
|
159
|
+
(int)highs_lp.a_matrix_.format_);
|
|
160
|
+
|
|
161
|
+
// Column block
|
|
162
|
+
HighsInt col_block_num_nz = 6;
|
|
163
|
+
std::vector<HighsInt> col_block_start = {0, 2, 4};
|
|
164
|
+
std::vector<HighsInt> col_block_index = {0, 1, 1, 2, 0, 1};
|
|
165
|
+
std::vector<double> col_block_value = {-1, 1, -2, 2, -3, 3};
|
|
166
|
+
REQUIRE(highs.addCols(col_block_num_col, col_block_col_cost.data(),
|
|
167
|
+
col_block_col_lower.data(), col_block_col_upper.data(),
|
|
168
|
+
col_block_num_nz, col_block_start.data(),
|
|
169
|
+
col_block_index.data(),
|
|
170
|
+
col_block_value.data()) == HighsStatus::kOk);
|
|
171
|
+
if (dev_run)
|
|
172
|
+
printf("After adding a column-wise matrix, LP matrix has format %d\n",
|
|
173
|
+
(int)highs_lp.a_matrix_.format_);
|
|
174
|
+
|
|
175
|
+
highs.run();
|
|
176
|
+
if (dev_run) highs.writeSolution("", 1);
|
|
177
|
+
if (dev_run)
|
|
178
|
+
printf("After run() LP matrix has format %d\n",
|
|
179
|
+
(int)highs_lp.a_matrix_.format_);
|
|
180
|
+
|
|
181
|
+
highs.resetGlobalScheduler(true);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
TEST_CASE("LP-717-full1", "[highs_data]") {
|
|
185
|
+
// Add columns to an LP with a larger matrix held row-wise so that
|
|
186
|
+
// the orientation is not flipped
|
|
187
|
+
HighsInt row_block_num_col = 5;
|
|
188
|
+
HighsInt row_block_num_row = 3;
|
|
189
|
+
HighsInt col_block_num_col = 3;
|
|
190
|
+
|
|
191
|
+
HighsLp lp;
|
|
192
|
+
lp.num_col_ = row_block_num_col + col_block_num_col;
|
|
193
|
+
lp.num_row_ = row_block_num_row;
|
|
194
|
+
lp.col_cost_ = {-1, -1, -1, -1, -2, -2, -3, -3};
|
|
195
|
+
lp.col_lower_ = {0, 0, 0, 0, 0, 0, 0, 0};
|
|
196
|
+
lp.col_upper_ = {1, 1, 1, 1, 1, 1, 1, 1};
|
|
197
|
+
lp.row_lower_ = {-inf, -inf, -inf};
|
|
198
|
+
lp.row_upper_ = {-5, 5, 1};
|
|
199
|
+
lp.a_matrix_.num_col_ = lp.num_col_;
|
|
200
|
+
lp.a_matrix_.num_row_ = lp.num_row_;
|
|
201
|
+
lp.a_matrix_.start_ = {0, 5, 13, 16};
|
|
202
|
+
lp.a_matrix_.index_ = {0, 2, 4, 5, 7, 0, 1, 2, 3, 4, 5, 6, 7, 1, 3, 6};
|
|
203
|
+
lp.a_matrix_.value_ = {1, -1, 1, -1, -3, 1, 1, 1, 1, 1, 1, -2, 3, 1, -1, 2};
|
|
204
|
+
lp.a_matrix_.format_ = MatrixFormat::kRowwise;
|
|
205
|
+
Highs highs;
|
|
206
|
+
if (!dev_run) highs.setOptionValue("output_flag", false);
|
|
207
|
+
const HighsLp& highs_lp = highs.getLp();
|
|
208
|
+
highs.passModel(lp);
|
|
209
|
+
highs.run();
|
|
210
|
+
if (dev_run) highs.writeSolution("", 1);
|
|
211
|
+
HighsInfo info0 = highs.getInfo();
|
|
212
|
+
HighsSolution solution0 = highs.getSolution();
|
|
213
|
+
highs.clear();
|
|
214
|
+
if (!dev_run) highs.setOptionValue("output_flag", false);
|
|
215
|
+
std::vector<double> row_block_col_cost;
|
|
216
|
+
std::vector<double> row_block_col_lower;
|
|
217
|
+
std::vector<double> row_block_col_upper;
|
|
218
|
+
std::vector<double> row_block_row_lower;
|
|
219
|
+
std::vector<double> row_block_row_upper;
|
|
220
|
+
|
|
221
|
+
std::vector<double> col_block_col_cost;
|
|
222
|
+
std::vector<double> col_block_col_lower;
|
|
223
|
+
std::vector<double> col_block_col_upper;
|
|
224
|
+
std::vector<double> col_block_row_lower;
|
|
225
|
+
std::vector<double> col_block_row_upper;
|
|
226
|
+
|
|
227
|
+
for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++) {
|
|
228
|
+
if (iCol < row_block_num_col) {
|
|
229
|
+
row_block_col_cost.push_back(lp.col_cost_[iCol]);
|
|
230
|
+
row_block_col_lower.push_back(lp.col_lower_[iCol]);
|
|
231
|
+
row_block_col_upper.push_back(lp.col_upper_[iCol]);
|
|
232
|
+
} else {
|
|
233
|
+
col_block_col_cost.push_back(lp.col_cost_[iCol]);
|
|
234
|
+
col_block_col_lower.push_back(lp.col_lower_[iCol]);
|
|
235
|
+
col_block_col_upper.push_back(lp.col_upper_[iCol]);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
row_block_row_lower = lp.row_lower_;
|
|
239
|
+
row_block_row_upper = lp.row_upper_;
|
|
240
|
+
|
|
241
|
+
HighsInt row_block_num_nz;
|
|
242
|
+
std::vector<HighsInt> row_block_start;
|
|
243
|
+
std::vector<HighsInt> row_block_index;
|
|
244
|
+
std::vector<double> row_block_value;
|
|
245
|
+
|
|
246
|
+
for (HighsInt iRow = 0; iRow < row_block_num_row; iRow++) {
|
|
247
|
+
row_block_start.push_back(row_block_index.size());
|
|
248
|
+
for (HighsInt iEl = lp.a_matrix_.start_[iRow];
|
|
249
|
+
iEl < lp.a_matrix_.start_[iRow + 1]; iEl++) {
|
|
250
|
+
HighsInt iCol = lp.a_matrix_.index_[iEl];
|
|
251
|
+
if (iCol < row_block_num_col) {
|
|
252
|
+
row_block_index.push_back(iCol);
|
|
253
|
+
row_block_value.push_back(lp.a_matrix_.value_[iEl]);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
row_block_num_nz = row_block_index.size();
|
|
258
|
+
|
|
259
|
+
REQUIRE(highs.addCols(row_block_num_col, row_block_col_cost.data(),
|
|
260
|
+
row_block_col_lower.data(), row_block_col_upper.data(),
|
|
261
|
+
0, nullptr, nullptr, nullptr) == HighsStatus::kOk);
|
|
262
|
+
|
|
263
|
+
REQUIRE(highs.addRows(row_block_num_row, row_block_row_lower.data(),
|
|
264
|
+
row_block_row_upper.data(), row_block_num_nz,
|
|
265
|
+
row_block_start.data(), row_block_index.data(),
|
|
266
|
+
row_block_value.data()) == HighsStatus::kOk);
|
|
267
|
+
|
|
268
|
+
if (dev_run)
|
|
269
|
+
printf("After adding a row-wise matrix, LP matrix has format %d\n",
|
|
270
|
+
(int)highs_lp.a_matrix_.format_);
|
|
271
|
+
|
|
272
|
+
// Column block
|
|
273
|
+
HighsInt col_block_num_nz = 6;
|
|
274
|
+
std::vector<HighsInt> col_block_start = {0, 2, 4};
|
|
275
|
+
std::vector<HighsInt> col_block_index = {0, 1, 1, 2, 0, 1};
|
|
276
|
+
std::vector<double> col_block_value = {-1, 1, -2, 2, -3, 3};
|
|
277
|
+
REQUIRE(highs.addCols(col_block_num_col, col_block_col_cost.data(),
|
|
278
|
+
col_block_col_lower.data(), col_block_col_upper.data(),
|
|
279
|
+
col_block_num_nz, col_block_start.data(),
|
|
280
|
+
col_block_index.data(),
|
|
281
|
+
col_block_value.data()) == HighsStatus::kOk);
|
|
282
|
+
if (dev_run)
|
|
283
|
+
printf("After adding a column-wise matrix, LP matrix has format %d\n",
|
|
284
|
+
(int)highs_lp.a_matrix_.format_);
|
|
285
|
+
|
|
286
|
+
const bool equal_lp = lp == highs_lp;
|
|
287
|
+
REQUIRE(equal_lp);
|
|
288
|
+
highs.run();
|
|
289
|
+
if (dev_run) highs.writeSolution("", 1);
|
|
290
|
+
if (dev_run)
|
|
291
|
+
printf("After run() LP matrix has format %d\n",
|
|
292
|
+
(int)highs_lp.a_matrix_.format_);
|
|
293
|
+
|
|
294
|
+
highs.resetGlobalScheduler(true);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
TEST_CASE("LP-717-full2", "[highs_data]") {
|
|
298
|
+
// Add columns and then rows to an LP with a larger matrix held
|
|
299
|
+
// row-wise so that the orientation is not flipped
|
|
300
|
+
HighsInt row_block_num_col = 5;
|
|
301
|
+
HighsInt row_block_num_row = 3;
|
|
302
|
+
HighsInt col_block_num_col = 3;
|
|
303
|
+
|
|
304
|
+
HighsLp lp;
|
|
305
|
+
lp.num_col_ = row_block_num_col + col_block_num_col;
|
|
306
|
+
lp.num_row_ = 2 * row_block_num_row;
|
|
307
|
+
lp.col_cost_ = {-1, -1, -1, -1, -2, -2, -3, -3};
|
|
308
|
+
lp.col_lower_ = {0, 0, 0, 0, 0, 0, 0, 0};
|
|
309
|
+
lp.col_upper_ = {1, 1, 1, 1, 1, 1, 1, 1};
|
|
310
|
+
lp.row_lower_ = {-inf, -inf, -inf};
|
|
311
|
+
lp.row_upper_ = {-1, 6, 2};
|
|
312
|
+
for (HighsInt iRow = 0; iRow < row_block_num_row; iRow++) {
|
|
313
|
+
lp.row_lower_.push_back(lp.row_lower_[iRow]);
|
|
314
|
+
lp.row_upper_.push_back(lp.row_upper_[iRow]);
|
|
315
|
+
}
|
|
316
|
+
lp.a_matrix_.num_col_ = lp.num_col_;
|
|
317
|
+
lp.a_matrix_.num_row_ = lp.num_row_;
|
|
318
|
+
lp.a_matrix_.start_ = {0, 5, 13, 16, 19, 24, 26};
|
|
319
|
+
lp.a_matrix_.index_ = {0, 2, 4, 5, 7, 0, 1, 2, 3, 4, 5, 6, 7,
|
|
320
|
+
1, 3, 6, 0, 2, 4, 0, 1, 2, 3, 4, 1, 3};
|
|
321
|
+
lp.a_matrix_.value_ = {1, -1, 1, -1, -3, 1, 1, 1, 1, 1, 1, -2, 3,
|
|
322
|
+
1, -1, 2, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1};
|
|
323
|
+
lp.a_matrix_.format_ = MatrixFormat::kRowwise;
|
|
324
|
+
Highs highs;
|
|
325
|
+
if (!dev_run) highs.setOptionValue("output_flag", false);
|
|
326
|
+
const HighsLp& highs_lp = highs.getLp();
|
|
327
|
+
highs.passModel(lp);
|
|
328
|
+
highs.run();
|
|
329
|
+
if (dev_run) highs.writeSolution("", 1);
|
|
330
|
+
HighsInfo info0 = highs.getInfo();
|
|
331
|
+
HighsSolution solution0 = highs.getSolution();
|
|
332
|
+
highs.clear();
|
|
333
|
+
if (!dev_run) highs.setOptionValue("output_flag", false);
|
|
334
|
+
std::vector<double> row_block_col_cost;
|
|
335
|
+
std::vector<double> row_block_col_lower;
|
|
336
|
+
std::vector<double> row_block_col_upper;
|
|
337
|
+
std::vector<double> row_block_row_lower;
|
|
338
|
+
std::vector<double> row_block_row_upper;
|
|
339
|
+
|
|
340
|
+
std::vector<double> col_block_col_cost;
|
|
341
|
+
std::vector<double> col_block_col_lower;
|
|
342
|
+
std::vector<double> col_block_col_upper;
|
|
343
|
+
std::vector<double> col_block_row_lower;
|
|
344
|
+
std::vector<double> col_block_row_upper;
|
|
345
|
+
|
|
346
|
+
for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++) {
|
|
347
|
+
if (iCol < row_block_num_col) {
|
|
348
|
+
row_block_col_cost.push_back(lp.col_cost_[iCol]);
|
|
349
|
+
row_block_col_lower.push_back(lp.col_lower_[iCol]);
|
|
350
|
+
row_block_col_upper.push_back(lp.col_upper_[iCol]);
|
|
351
|
+
} else {
|
|
352
|
+
col_block_col_cost.push_back(lp.col_cost_[iCol]);
|
|
353
|
+
col_block_col_lower.push_back(lp.col_lower_[iCol]);
|
|
354
|
+
col_block_col_upper.push_back(lp.col_upper_[iCol]);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
row_block_row_lower = lp.row_lower_;
|
|
358
|
+
row_block_row_upper = lp.row_upper_;
|
|
359
|
+
|
|
360
|
+
HighsInt row_block_num_nz;
|
|
361
|
+
std::vector<HighsInt> row_block_start;
|
|
362
|
+
std::vector<HighsInt> row_block_index;
|
|
363
|
+
std::vector<double> row_block_value;
|
|
364
|
+
|
|
365
|
+
for (HighsInt iRow = 0; iRow < row_block_num_row; iRow++) {
|
|
366
|
+
row_block_start.push_back(row_block_index.size());
|
|
367
|
+
for (HighsInt iEl = lp.a_matrix_.start_[iRow];
|
|
368
|
+
iEl < lp.a_matrix_.start_[iRow + 1]; iEl++) {
|
|
369
|
+
HighsInt iCol = lp.a_matrix_.index_[iEl];
|
|
370
|
+
if (iCol < row_block_num_col) {
|
|
371
|
+
row_block_index.push_back(iCol);
|
|
372
|
+
row_block_value.push_back(lp.a_matrix_.value_[iEl]);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
row_block_num_nz = row_block_index.size();
|
|
377
|
+
|
|
378
|
+
REQUIRE(highs.addCols(row_block_num_col, row_block_col_cost.data(),
|
|
379
|
+
row_block_col_lower.data(), row_block_col_upper.data(),
|
|
380
|
+
0, nullptr, nullptr, nullptr) == HighsStatus::kOk);
|
|
381
|
+
|
|
382
|
+
REQUIRE(highs.addRows(row_block_num_row, row_block_row_lower.data(),
|
|
383
|
+
row_block_row_upper.data(), row_block_num_nz,
|
|
384
|
+
row_block_start.data(), row_block_index.data(),
|
|
385
|
+
row_block_value.data()) == HighsStatus::kOk);
|
|
386
|
+
|
|
387
|
+
if (dev_run)
|
|
388
|
+
printf("After adding a row-wise matrix, LP matrix has format %d\n",
|
|
389
|
+
(int)highs_lp.a_matrix_.format_);
|
|
390
|
+
|
|
391
|
+
// Column block
|
|
392
|
+
HighsInt col_block_num_nz = 6;
|
|
393
|
+
std::vector<HighsInt> col_block_start = {0, 2, 4};
|
|
394
|
+
std::vector<HighsInt> col_block_index = {0, 1, 1, 2, 0, 1};
|
|
395
|
+
std::vector<double> col_block_value = {-1, 1, -2, 2, -3, 3};
|
|
396
|
+
REQUIRE(highs.addCols(col_block_num_col, col_block_col_cost.data(),
|
|
397
|
+
col_block_col_lower.data(), col_block_col_upper.data(),
|
|
398
|
+
col_block_num_nz, col_block_start.data(),
|
|
399
|
+
col_block_index.data(),
|
|
400
|
+
col_block_value.data()) == HighsStatus::kOk);
|
|
401
|
+
if (dev_run)
|
|
402
|
+
printf("After adding a column-wise matrix, LP matrix has format %d\n",
|
|
403
|
+
(int)highs_lp.a_matrix_.format_);
|
|
404
|
+
|
|
405
|
+
REQUIRE(highs.addRows(row_block_num_row, row_block_row_lower.data(),
|
|
406
|
+
row_block_row_upper.data(), row_block_num_nz,
|
|
407
|
+
row_block_start.data(), row_block_index.data(),
|
|
408
|
+
row_block_value.data()) == HighsStatus::kOk);
|
|
409
|
+
|
|
410
|
+
if (dev_run)
|
|
411
|
+
printf("After adding a row-wise matrix, LP matrix has format %d\n",
|
|
412
|
+
(int)highs_lp.a_matrix_.format_);
|
|
413
|
+
|
|
414
|
+
const bool equal_lp = lp == highs_lp;
|
|
415
|
+
REQUIRE(equal_lp);
|
|
416
|
+
highs.run();
|
|
417
|
+
if (dev_run) highs.writeSolution("", 1);
|
|
418
|
+
if (dev_run)
|
|
419
|
+
printf("After run() LP matrix has format %d\n",
|
|
420
|
+
(int)highs_lp.a_matrix_.format_);
|
|
421
|
+
|
|
422
|
+
highs.resetGlobalScheduler(true);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
TEST_CASE("LP-modification", "[highs_data]") {
|
|
426
|
+
if (dev_run) printf("testAllDeleteKeep\n");
|
|
427
|
+
testAllDeleteKeep(10);
|
|
428
|
+
|
|
429
|
+
HighsOptions options;
|
|
430
|
+
// options.log_dev_level = kHighsLogDevLevelVerbose;
|
|
431
|
+
|
|
432
|
+
Avgas avgas;
|
|
433
|
+
HighsInt num_row = 0;
|
|
434
|
+
HighsInt num_row_nz = 0;
|
|
435
|
+
std::vector<double> rowLower;
|
|
436
|
+
std::vector<double> rowUpper;
|
|
437
|
+
std::vector<HighsInt> ARstart;
|
|
438
|
+
std::vector<HighsInt> ARindex;
|
|
439
|
+
std::vector<double> ARvalue;
|
|
440
|
+
|
|
441
|
+
for (HighsInt row = 0; row < avgas_num_row; row++) {
|
|
442
|
+
avgas.addRow(row, num_row, num_row_nz, rowLower, rowUpper, ARstart, ARindex,
|
|
443
|
+
ARvalue);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
HighsInt num_col = 0;
|
|
447
|
+
HighsInt num_col_nz = 0;
|
|
448
|
+
std::vector<double> colCost;
|
|
449
|
+
std::vector<double> colLower;
|
|
450
|
+
std::vector<double> colUpper;
|
|
451
|
+
std::vector<HighsInt> Astart;
|
|
452
|
+
std::vector<HighsInt> Aindex;
|
|
453
|
+
std::vector<double> Avalue;
|
|
454
|
+
for (HighsInt col = 0; col < avgas_num_col; col++) {
|
|
455
|
+
avgas.addCol(col, num_col, num_col_nz, colCost, colLower, colUpper, Astart,
|
|
456
|
+
Aindex, Avalue);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
HighsStatus return_status;
|
|
460
|
+
HighsModelStatus model_status;
|
|
461
|
+
|
|
462
|
+
// Create two empty LPs: one to be initialised as AVGAS by adding
|
|
463
|
+
// all the columns and rows separately, the other to be built by
|
|
464
|
+
// adding piecemeal.
|
|
465
|
+
HighsLp avgas_lp;
|
|
466
|
+
HighsLp lp;
|
|
467
|
+
|
|
468
|
+
Highs avgas_highs;
|
|
469
|
+
avgas_highs.passOptions(options);
|
|
470
|
+
if (!dev_run) avgas_highs.setOptionValue("output_flag", false);
|
|
471
|
+
return_status = avgas_highs.passModel(avgas_lp);
|
|
472
|
+
HighsStatusReport(options.log_options, "avgas_highs.passModel(avgas_lp)",
|
|
473
|
+
return_status);
|
|
474
|
+
REQUIRE(return_status == HighsStatus::kOk);
|
|
475
|
+
|
|
476
|
+
REQUIRE(avgas_highs.addCols(num_col, colCost.data(), colLower.data(),
|
|
477
|
+
colUpper.data(), 0, NULL, NULL,
|
|
478
|
+
NULL) == HighsStatus::kOk);
|
|
479
|
+
REQUIRE(avgas_highs.addRows(num_row, rowLower.data(), rowUpper.data(),
|
|
480
|
+
num_row_nz, ARstart.data(), ARindex.data(),
|
|
481
|
+
ARvalue.data()) == HighsStatus::kOk);
|
|
482
|
+
|
|
483
|
+
// return_status = avgas_highs.writeModel("");
|
|
484
|
+
|
|
485
|
+
Highs highs;
|
|
486
|
+
highs.passOptions(options);
|
|
487
|
+
if (!dev_run) highs.setOptionValue("output_flag", false);
|
|
488
|
+
return_status = highs.setOptionValue("highs_debug_level", 3);
|
|
489
|
+
REQUIRE(return_status == HighsStatus::kOk);
|
|
490
|
+
|
|
491
|
+
lp.model_name_ = "Building avgas";
|
|
492
|
+
return_status = highs.passModel(lp);
|
|
493
|
+
REQUIRE(return_status == HighsStatus::kOk);
|
|
494
|
+
|
|
495
|
+
model_status = highs.getModelStatus();
|
|
496
|
+
REQUIRE(model_status == HighsModelStatus::kNotset);
|
|
497
|
+
|
|
498
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
499
|
+
|
|
500
|
+
model_status = highs.getModelStatus();
|
|
501
|
+
REQUIRE(model_status == HighsModelStatus::kModelEmpty);
|
|
502
|
+
|
|
503
|
+
// Adding column vectors and matrix to model with no rows returns an error
|
|
504
|
+
REQUIRE(highs.addCols(num_col, colCost.data(), colLower.data(),
|
|
505
|
+
colUpper.data(), num_col_nz, Astart.data(),
|
|
506
|
+
Aindex.data(), Avalue.data()) == HighsStatus::kError);
|
|
507
|
+
|
|
508
|
+
// Adding column vectors to model with no rows returns OK
|
|
509
|
+
REQUIRE(highs.addCols(num_col, colCost.data(), colLower.data(),
|
|
510
|
+
colUpper.data(), 0, NULL, NULL,
|
|
511
|
+
NULL) == HighsStatus::kOk);
|
|
512
|
+
|
|
513
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
514
|
+
|
|
515
|
+
// return_status = highs.writeModel("");
|
|
516
|
+
|
|
517
|
+
// Adding row vectors and matrix to model with columns returns OK
|
|
518
|
+
REQUIRE(highs.addRows(num_row, rowLower.data(), rowUpper.data(), num_row_nz,
|
|
519
|
+
ARstart.data(), ARindex.data(),
|
|
520
|
+
ARvalue.data()) == HighsStatus::kOk);
|
|
521
|
+
|
|
522
|
+
// return_status = highs.writeModel("");
|
|
523
|
+
|
|
524
|
+
REQUIRE(
|
|
525
|
+
areLpEqual(highs.getLp(), avgas_highs.getLp(), options.infinite_bound));
|
|
526
|
+
|
|
527
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
528
|
+
|
|
529
|
+
model_status = highs.getModelStatus();
|
|
530
|
+
REQUIRE(model_status == HighsModelStatus::kOptimal);
|
|
531
|
+
|
|
532
|
+
double avgas_optimal_objective_value;
|
|
533
|
+
highs.getInfoValue("objective_function_value", avgas_optimal_objective_value);
|
|
534
|
+
double optimal_objective_value;
|
|
535
|
+
|
|
536
|
+
// Getting columns from the LP is OK
|
|
537
|
+
HighsInt col1357_col_mask[] = {0, 1, 0, 1, 0, 1, 0, 1};
|
|
538
|
+
HighsInt col1357_col_set[] = {1, 3, 5, 7};
|
|
539
|
+
HighsInt col1357_illegal_col_set[] = {3, 7, 1, 5};
|
|
540
|
+
HighsInt col1357_num_ix = 4;
|
|
541
|
+
HighsInt col1357_num_col;
|
|
542
|
+
HighsInt col1357_num_nz;
|
|
543
|
+
double* col1357_cost = (double*)malloc(sizeof(double) * col1357_num_ix);
|
|
544
|
+
double* col1357_lower = (double*)malloc(sizeof(double) * col1357_num_ix);
|
|
545
|
+
double* col1357_upper = (double*)malloc(sizeof(double) * col1357_num_ix);
|
|
546
|
+
HighsInt* col1357_start =
|
|
547
|
+
(HighsInt*)malloc(sizeof(HighsInt) * col1357_num_ix);
|
|
548
|
+
HighsInt* col1357_index = (HighsInt*)malloc(sizeof(HighsInt) * num_col_nz);
|
|
549
|
+
double* col1357_value = (double*)malloc(sizeof(double) * num_col_nz);
|
|
550
|
+
|
|
551
|
+
REQUIRE(highs.getCols(3, 6, col1357_num_col, col1357_cost, col1357_lower,
|
|
552
|
+
col1357_upper, col1357_num_nz, col1357_start,
|
|
553
|
+
col1357_index, col1357_value) == HighsStatus::kOk);
|
|
554
|
+
|
|
555
|
+
REQUIRE(highs.getCols(col1357_num_ix, col1357_illegal_col_set,
|
|
556
|
+
col1357_num_col, col1357_cost, col1357_lower,
|
|
557
|
+
col1357_upper, col1357_num_nz, col1357_start,
|
|
558
|
+
col1357_index, col1357_value) == HighsStatus::kError);
|
|
559
|
+
|
|
560
|
+
REQUIRE(highs.getCols(col1357_num_ix, col1357_col_set, col1357_num_col,
|
|
561
|
+
col1357_cost, col1357_lower, col1357_upper,
|
|
562
|
+
col1357_num_nz, col1357_start, col1357_index,
|
|
563
|
+
col1357_value) == HighsStatus::kOk);
|
|
564
|
+
|
|
565
|
+
REQUIRE(highs.getCols(col1357_col_mask, col1357_num_col, col1357_cost,
|
|
566
|
+
col1357_lower, col1357_upper, col1357_num_nz,
|
|
567
|
+
col1357_start, col1357_index,
|
|
568
|
+
col1357_value) == HighsStatus::kOk);
|
|
569
|
+
|
|
570
|
+
// Try to delete an empty range of cols: OK
|
|
571
|
+
REQUIRE(highs.deleteCols(0, -1) == HighsStatus::kOk);
|
|
572
|
+
|
|
573
|
+
// Try to delete more cols than there are: ERROR
|
|
574
|
+
REQUIRE(highs.deleteCols(0, num_col + 1) == HighsStatus::kError);
|
|
575
|
+
|
|
576
|
+
REQUIRE(highs.deleteCols(col1357_num_ix, col1357_col_set) ==
|
|
577
|
+
HighsStatus::kOk);
|
|
578
|
+
|
|
579
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
580
|
+
|
|
581
|
+
REQUIRE(highs.addCols(col1357_num_col, col1357_cost, col1357_lower,
|
|
582
|
+
col1357_upper, col1357_num_nz, col1357_start,
|
|
583
|
+
col1357_index, col1357_value) == HighsStatus::kOk);
|
|
584
|
+
|
|
585
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
586
|
+
|
|
587
|
+
model_status = highs.getModelStatus();
|
|
588
|
+
REQUIRE(model_status == HighsModelStatus::kOptimal);
|
|
589
|
+
|
|
590
|
+
highs.getInfoValue("objective_function_value", optimal_objective_value);
|
|
591
|
+
REQUIRE(optimal_objective_value == avgas_optimal_objective_value);
|
|
592
|
+
|
|
593
|
+
// Delete all the columns: OK
|
|
594
|
+
REQUIRE(highs.deleteCols(0, num_col - 1) == HighsStatus::kOk);
|
|
595
|
+
|
|
596
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
597
|
+
|
|
598
|
+
// Delete all the rows: OK
|
|
599
|
+
REQUIRE(highs.deleteRows(0, num_row - 1) == HighsStatus::kOk);
|
|
600
|
+
|
|
601
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
602
|
+
|
|
603
|
+
// Adding column vectors to model with no rows returns OK
|
|
604
|
+
REQUIRE(highs.addCols(num_col, colCost.data(), colLower.data(),
|
|
605
|
+
colUpper.data(), 0, NULL, NULL,
|
|
606
|
+
NULL) == HighsStatus::kOk);
|
|
607
|
+
|
|
608
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
609
|
+
|
|
610
|
+
// Adding row vectors and matrix to model with columns returns OK
|
|
611
|
+
REQUIRE(highs.addRows(num_row, rowLower.data(), rowUpper.data(), num_row_nz,
|
|
612
|
+
ARstart.data(), ARindex.data(),
|
|
613
|
+
ARvalue.data()) == HighsStatus::kOk);
|
|
614
|
+
|
|
615
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
616
|
+
|
|
617
|
+
// Getting rows from the LP is OK
|
|
618
|
+
HighsInt from_row_ix = 0;
|
|
619
|
+
HighsInt to_row_ix = 3;
|
|
620
|
+
HighsInt row0135789_row_set[] = {0, 1, 3, 5, 7, 8, 9};
|
|
621
|
+
HighsInt row0135789_row_mask[] = {1, 1, 0, 1, 0, 1, 0, 1, 1, 1};
|
|
622
|
+
HighsInt row0135789_num_ix = 7;
|
|
623
|
+
HighsInt row0135789_num_row;
|
|
624
|
+
HighsInt row0135789_num_nz;
|
|
625
|
+
double* row0135789_lower =
|
|
626
|
+
(double*)malloc(sizeof(double) * row0135789_num_ix);
|
|
627
|
+
double* row0135789_upper =
|
|
628
|
+
(double*)malloc(sizeof(double) * row0135789_num_ix);
|
|
629
|
+
HighsInt* row0135789_start =
|
|
630
|
+
(HighsInt*)malloc(sizeof(HighsInt) * row0135789_num_ix);
|
|
631
|
+
HighsInt* row0135789_index = (HighsInt*)malloc(sizeof(HighsInt) * num_row_nz);
|
|
632
|
+
double* row0135789_value = (double*)malloc(sizeof(double) * num_row_nz);
|
|
633
|
+
|
|
634
|
+
REQUIRE(highs.getRows(from_row_ix, to_row_ix, row0135789_num_row,
|
|
635
|
+
row0135789_lower, row0135789_upper, row0135789_num_nz,
|
|
636
|
+
row0135789_start, row0135789_index,
|
|
637
|
+
row0135789_value) == HighsStatus::kOk);
|
|
638
|
+
|
|
639
|
+
REQUIRE(highs.getRows(row0135789_num_ix, row0135789_row_set,
|
|
640
|
+
row0135789_num_row, row0135789_lower, row0135789_upper,
|
|
641
|
+
row0135789_num_nz, row0135789_start, row0135789_index,
|
|
642
|
+
row0135789_value) == HighsStatus::kOk);
|
|
643
|
+
|
|
644
|
+
REQUIRE(highs.getRows(row0135789_row_mask, row0135789_num_row,
|
|
645
|
+
row0135789_lower, row0135789_upper, row0135789_num_nz,
|
|
646
|
+
row0135789_start, row0135789_index,
|
|
647
|
+
row0135789_value) == HighsStatus::kOk);
|
|
648
|
+
|
|
649
|
+
REQUIRE(highs.getRows(row0135789_num_ix, row0135789_row_set,
|
|
650
|
+
row0135789_num_row, row0135789_lower, row0135789_upper,
|
|
651
|
+
row0135789_num_nz, row0135789_start, row0135789_index,
|
|
652
|
+
row0135789_value) == HighsStatus::kOk);
|
|
653
|
+
|
|
654
|
+
REQUIRE(highs.deleteRows(row0135789_num_ix, row0135789_row_set) ==
|
|
655
|
+
HighsStatus::kOk);
|
|
656
|
+
|
|
657
|
+
HighsInt row012_row_set[] = {0, 1, 2};
|
|
658
|
+
HighsInt row012_row_mask[] = {1, 1, 1};
|
|
659
|
+
HighsInt row012_num_ix = 3;
|
|
660
|
+
HighsInt row012_num_row;
|
|
661
|
+
HighsInt row012_num_nz;
|
|
662
|
+
double* row012_lower = (double*)malloc(sizeof(double) * row012_num_ix);
|
|
663
|
+
double* row012_upper = (double*)malloc(sizeof(double) * row012_num_ix);
|
|
664
|
+
HighsInt* row012_start = (HighsInt*)malloc(sizeof(HighsInt) * row012_num_ix);
|
|
665
|
+
HighsInt* row012_index = (HighsInt*)malloc(sizeof(HighsInt) * num_row_nz);
|
|
666
|
+
double* row012_value = (double*)malloc(sizeof(double) * num_row_nz);
|
|
667
|
+
|
|
668
|
+
REQUIRE(highs.getRows(row012_num_ix, row012_row_set, row012_num_row,
|
|
669
|
+
row012_lower, row012_upper, row012_num_nz, row012_start,
|
|
670
|
+
row012_index, row012_value) == HighsStatus::kOk);
|
|
671
|
+
|
|
672
|
+
REQUIRE(highs.deleteRows(row012_row_mask) == HighsStatus::kOk);
|
|
673
|
+
|
|
674
|
+
// Delete all the columns: OK
|
|
675
|
+
REQUIRE(highs.deleteCols(0, num_col - 1) == HighsStatus::kOk);
|
|
676
|
+
|
|
677
|
+
messageReportLp("After deleting all columns", highs.getLp());
|
|
678
|
+
|
|
679
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
680
|
+
|
|
681
|
+
// Can't add rows with no columns
|
|
682
|
+
REQUIRE(highs.addRows(row0135789_num_row, row0135789_lower, row0135789_upper,
|
|
683
|
+
row0135789_num_nz, row0135789_start, row0135789_index,
|
|
684
|
+
row0135789_value) == HighsStatus::kError);
|
|
685
|
+
|
|
686
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
687
|
+
|
|
688
|
+
// Adding column vectors to model with no rows returns OK
|
|
689
|
+
REQUIRE(highs.addCols(num_col, colCost.data(), colLower.data(),
|
|
690
|
+
colUpper.data(), 0, NULL, NULL,
|
|
691
|
+
NULL) == HighsStatus::kOk);
|
|
692
|
+
|
|
693
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
694
|
+
|
|
695
|
+
REQUIRE(highs.addRows(row0135789_num_row, row0135789_lower, row0135789_upper,
|
|
696
|
+
row0135789_num_nz, row0135789_start, row0135789_index,
|
|
697
|
+
row0135789_value) == HighsStatus::kOk);
|
|
698
|
+
|
|
699
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
700
|
+
|
|
701
|
+
// highs.setOptionValue("log_dev_level", 2);
|
|
702
|
+
// highs.setOptionValue("highs_debug_level", 3);
|
|
703
|
+
// highs.setOptionValue("output_flag", true);
|
|
704
|
+
REQUIRE(highs.addRows(row012_num_row, row012_lower, row012_upper,
|
|
705
|
+
row012_num_nz, row012_start, row012_index,
|
|
706
|
+
row012_value) == HighsStatus::kOk);
|
|
707
|
+
|
|
708
|
+
// messageReportLp("After restoring all rows", highs.getLp());
|
|
709
|
+
|
|
710
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
711
|
+
|
|
712
|
+
// highs.setOptionValue("log_dev_level", 0);
|
|
713
|
+
// highs.setOptionValue("highs_debug_level", 0);
|
|
714
|
+
// highs.setOptionValue("output_flag", false);
|
|
715
|
+
|
|
716
|
+
model_status = highs.getModelStatus();
|
|
717
|
+
REQUIRE(model_status == HighsModelStatus::kOptimal);
|
|
718
|
+
|
|
719
|
+
highs.getInfoValue("objective_function_value", optimal_objective_value);
|
|
720
|
+
REQUIRE(std::fabs(optimal_objective_value - avgas_optimal_objective_value) <
|
|
721
|
+
double_equal_tolerance);
|
|
722
|
+
|
|
723
|
+
// Try to delete an empty range of rows: OK
|
|
724
|
+
REQUIRE(highs.deleteRows(0, -1) == HighsStatus::kOk);
|
|
725
|
+
|
|
726
|
+
// Try to delete more rows than there are: ERROR
|
|
727
|
+
REQUIRE(highs.deleteRows(0, num_row) == HighsStatus::kError);
|
|
728
|
+
|
|
729
|
+
REQUIRE(highs.getCols(col1357_col_mask, col1357_num_col, col1357_cost,
|
|
730
|
+
col1357_lower, col1357_upper, col1357_num_nz,
|
|
731
|
+
col1357_start, col1357_index,
|
|
732
|
+
col1357_value) == HighsStatus::kOk);
|
|
733
|
+
|
|
734
|
+
REQUIRE(highs.deleteCols(col1357_num_ix, col1357_col_set) ==
|
|
735
|
+
HighsStatus::kOk);
|
|
736
|
+
|
|
737
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
738
|
+
|
|
739
|
+
HighsInt col0123_col_mask[] = {1, 1, 1, 1};
|
|
740
|
+
// HighsInt col0123_col_set[] = {0, 1, 2, 3};
|
|
741
|
+
HighsInt col0123_num_ix = 4;
|
|
742
|
+
HighsInt col0123_num_col;
|
|
743
|
+
HighsInt col0123_num_nz;
|
|
744
|
+
double* col0123_cost = (double*)malloc(sizeof(double) * col0123_num_ix);
|
|
745
|
+
double* col0123_lower = (double*)malloc(sizeof(double) * col0123_num_ix);
|
|
746
|
+
double* col0123_upper = (double*)malloc(sizeof(double) * col0123_num_ix);
|
|
747
|
+
HighsInt* col0123_start =
|
|
748
|
+
(HighsInt*)malloc(sizeof(HighsInt) * col0123_num_ix);
|
|
749
|
+
HighsInt* col0123_index = (HighsInt*)malloc(sizeof(HighsInt) * num_col_nz);
|
|
750
|
+
double* col0123_value = (double*)malloc(sizeof(double) * num_col_nz);
|
|
751
|
+
|
|
752
|
+
REQUIRE(highs.getCols(col0123_col_mask, col0123_num_col, col0123_cost,
|
|
753
|
+
col0123_lower, col0123_upper, col0123_num_nz,
|
|
754
|
+
col0123_start, col0123_index,
|
|
755
|
+
col0123_value) == HighsStatus::kOk);
|
|
756
|
+
// messageReportMatrix("Get col1357 by mask\nRow ", col1357_num_col,
|
|
757
|
+
// col1357_num_nz, col1357_start, col1357_index, col1357_value);
|
|
758
|
+
// messageReportMatrix("Get col0123 by mask\nRow ", col0123_num_col,
|
|
759
|
+
// col0123_num_nz, col0123_start, col0123_index, col0123_value);
|
|
760
|
+
|
|
761
|
+
REQUIRE(highs.deleteRows(0, num_row - 1) == HighsStatus::kOk);
|
|
762
|
+
|
|
763
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
764
|
+
|
|
765
|
+
REQUIRE(highs.deleteCols(col0123_col_mask) == HighsStatus::kOk);
|
|
766
|
+
|
|
767
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
768
|
+
|
|
769
|
+
// Adding row vectors to model with no columns returns OK
|
|
770
|
+
REQUIRE(highs.addRows(row0135789_num_row, row0135789_lower, row0135789_upper,
|
|
771
|
+
0, NULL, NULL, NULL) == HighsStatus::kOk);
|
|
772
|
+
|
|
773
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
774
|
+
|
|
775
|
+
REQUIRE(highs.addRows(row012_num_row, row012_lower, row012_upper, 0,
|
|
776
|
+
row012_start, row012_index,
|
|
777
|
+
row012_value) == HighsStatus::kOk);
|
|
778
|
+
|
|
779
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
780
|
+
|
|
781
|
+
REQUIRE(highs.addCols(col1357_num_col, col1357_cost, col1357_lower,
|
|
782
|
+
col1357_upper, col1357_num_nz, col1357_start,
|
|
783
|
+
col1357_index, col1357_value) == HighsStatus::kOk);
|
|
784
|
+
|
|
785
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
786
|
+
|
|
787
|
+
model_status = highs.getModelStatus();
|
|
788
|
+
REQUIRE(model_status == HighsModelStatus::kOptimal);
|
|
789
|
+
|
|
790
|
+
REQUIRE(highs.addCols(col0123_num_col, col0123_cost, col0123_lower,
|
|
791
|
+
col0123_upper, col0123_num_nz, col0123_start,
|
|
792
|
+
col0123_index, col0123_value) == HighsStatus::kOk);
|
|
793
|
+
|
|
794
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
795
|
+
|
|
796
|
+
model_status = highs.getModelStatus();
|
|
797
|
+
REQUIRE(model_status == HighsModelStatus::kOptimal);
|
|
798
|
+
|
|
799
|
+
highs.getInfoValue("objective_function_value", optimal_objective_value);
|
|
800
|
+
REQUIRE(optimal_objective_value - avgas_optimal_objective_value < 1e-10);
|
|
801
|
+
|
|
802
|
+
// Fix columns 1, 3, 5, 7 to check resetting of their nonbasic status
|
|
803
|
+
col1357_lower[0] = 0;
|
|
804
|
+
col1357_lower[1] = 0;
|
|
805
|
+
col1357_lower[2] = 0;
|
|
806
|
+
col1357_lower[3] = 0;
|
|
807
|
+
col1357_upper[0] = 0;
|
|
808
|
+
col1357_upper[1] = 0;
|
|
809
|
+
col1357_upper[2] = 0;
|
|
810
|
+
col1357_upper[3] = 0;
|
|
811
|
+
|
|
812
|
+
REQUIRE(highs.changeColsBounds(col1357_num_ix, col1357_col_set, col1357_lower,
|
|
813
|
+
col1357_upper) == HighsStatus::kOk);
|
|
814
|
+
|
|
815
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
816
|
+
|
|
817
|
+
// Now restore the upper bounds to check resetting of their nonbasic status
|
|
818
|
+
col1357_upper[0] = 1;
|
|
819
|
+
col1357_upper[1] = 1;
|
|
820
|
+
col1357_upper[2] = 1;
|
|
821
|
+
col1357_upper[3] = 1;
|
|
822
|
+
|
|
823
|
+
REQUIRE(highs.changeColsBounds(col1357_num_ix, col1357_col_set, col1357_lower,
|
|
824
|
+
col1357_upper) == HighsStatus::kOk);
|
|
825
|
+
|
|
826
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
827
|
+
|
|
828
|
+
highs.getInfoValue("objective_function_value", optimal_objective_value);
|
|
829
|
+
REQUIRE(optimal_objective_value - avgas_optimal_objective_value < 1e-10);
|
|
830
|
+
|
|
831
|
+
const HighsLp& local_lp = highs.getLp();
|
|
832
|
+
row0135789_lower[0] = local_lp.row_lower_[0];
|
|
833
|
+
row0135789_lower[1] = local_lp.row_lower_[1];
|
|
834
|
+
row0135789_lower[2] = local_lp.row_lower_[3];
|
|
835
|
+
row0135789_lower[3] = local_lp.row_lower_[5];
|
|
836
|
+
row0135789_lower[4] = local_lp.row_lower_[7];
|
|
837
|
+
row0135789_lower[5] = local_lp.row_lower_[8];
|
|
838
|
+
row0135789_lower[6] = local_lp.row_lower_[9];
|
|
839
|
+
row0135789_upper[0] = local_lp.row_lower_[0];
|
|
840
|
+
row0135789_upper[1] = local_lp.row_lower_[1];
|
|
841
|
+
row0135789_upper[2] = local_lp.row_lower_[3];
|
|
842
|
+
row0135789_upper[3] = local_lp.row_lower_[5];
|
|
843
|
+
row0135789_upper[4] = local_lp.row_lower_[7];
|
|
844
|
+
row0135789_upper[5] = local_lp.row_lower_[8];
|
|
845
|
+
row0135789_upper[6] = local_lp.row_lower_[9];
|
|
846
|
+
|
|
847
|
+
REQUIRE(highs.changeRowsBounds(row0135789_num_ix, row0135789_row_set,
|
|
848
|
+
row0135789_lower,
|
|
849
|
+
row0135789_upper) == HighsStatus::kOk);
|
|
850
|
+
|
|
851
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
852
|
+
|
|
853
|
+
row0135789_upper[0] = local_lp.row_upper_[0];
|
|
854
|
+
row0135789_upper[1] = local_lp.row_upper_[1];
|
|
855
|
+
row0135789_upper[2] = local_lp.row_upper_[3];
|
|
856
|
+
row0135789_upper[3] = local_lp.row_upper_[5];
|
|
857
|
+
row0135789_upper[4] = local_lp.row_upper_[7];
|
|
858
|
+
row0135789_upper[5] = local_lp.row_upper_[8];
|
|
859
|
+
row0135789_upper[6] = local_lp.row_upper_[9];
|
|
860
|
+
|
|
861
|
+
REQUIRE(highs.changeRowsBounds(row0135789_num_ix, row0135789_row_set,
|
|
862
|
+
row0135789_lower,
|
|
863
|
+
row0135789_upper) == HighsStatus::kOk);
|
|
864
|
+
|
|
865
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
866
|
+
|
|
867
|
+
REQUIRE(highs.deleteRows(0, num_row - 1) == HighsStatus::kOk);
|
|
868
|
+
|
|
869
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
870
|
+
|
|
871
|
+
REQUIRE(highs.deleteCols(0, num_col - 1) == HighsStatus::kOk);
|
|
872
|
+
|
|
873
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
874
|
+
|
|
875
|
+
// Adding column vectors to model with no rows returns OK
|
|
876
|
+
REQUIRE(highs.addCols(num_col, colCost.data(), colLower.data(),
|
|
877
|
+
colUpper.data(), 0, NULL, NULL,
|
|
878
|
+
NULL) == HighsStatus::kOk);
|
|
879
|
+
|
|
880
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
881
|
+
|
|
882
|
+
// Adding row vectors and matrix to model with columns returns OK
|
|
883
|
+
REQUIRE(highs.addRows(num_row, rowLower.data(), rowUpper.data(), num_row_nz,
|
|
884
|
+
ARstart.data(), ARindex.data(),
|
|
885
|
+
ARvalue.data()) == HighsStatus::kOk);
|
|
886
|
+
|
|
887
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
888
|
+
|
|
889
|
+
col1357_cost[0] = 2.01;
|
|
890
|
+
col1357_cost[1] = 2.31;
|
|
891
|
+
col1357_cost[2] = 2.51;
|
|
892
|
+
col1357_cost[3] = 2.71;
|
|
893
|
+
col1357_lower[0] = 0.01;
|
|
894
|
+
col1357_lower[1] = 0.31;
|
|
895
|
+
col1357_lower[2] = 0.51;
|
|
896
|
+
col1357_lower[3] = 0.71;
|
|
897
|
+
col1357_upper[0] = 1.01;
|
|
898
|
+
col1357_upper[1] = 1.31;
|
|
899
|
+
col1357_upper[2] = 1.51;
|
|
900
|
+
col1357_upper[3] = 1.71;
|
|
901
|
+
|
|
902
|
+
row0135789_lower[0] = -0.01;
|
|
903
|
+
row0135789_lower[1] = -0.11;
|
|
904
|
+
row0135789_lower[2] = -0.31;
|
|
905
|
+
row0135789_lower[3] = -0.51;
|
|
906
|
+
row0135789_lower[4] = -0.71;
|
|
907
|
+
row0135789_lower[5] = -0.81;
|
|
908
|
+
row0135789_lower[6] = -0.91;
|
|
909
|
+
row0135789_upper[0] = 3.01;
|
|
910
|
+
row0135789_upper[1] = 3.11;
|
|
911
|
+
row0135789_upper[2] = 3.31;
|
|
912
|
+
row0135789_upper[3] = 3.51;
|
|
913
|
+
row0135789_upper[4] = 3.71;
|
|
914
|
+
row0135789_upper[5] = 3.81;
|
|
915
|
+
row0135789_upper[6] = 3.91;
|
|
916
|
+
|
|
917
|
+
// Attempting to set a cost to infinity may return error
|
|
918
|
+
return_status = highs.changeColCost(7, kHighsInf);
|
|
919
|
+
REQUIRE(return_status == HighsStatus::kOk);
|
|
920
|
+
|
|
921
|
+
// Attempting to set a cost to a finite value returns OK
|
|
922
|
+
REQUIRE(highs.changeColCost(7, 77) == HighsStatus::kOk);
|
|
923
|
+
|
|
924
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
925
|
+
|
|
926
|
+
REQUIRE(highs.changeColsCost(col1357_num_ix, col1357_col_set, col1357_cost) ==
|
|
927
|
+
HighsStatus::kOk);
|
|
928
|
+
|
|
929
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
930
|
+
|
|
931
|
+
// Attempting to set row bounds with infinite lower bound returns error
|
|
932
|
+
REQUIRE(highs.changeRowBounds(2, kHighsInf, 3.21) == HighsStatus::kError);
|
|
933
|
+
|
|
934
|
+
REQUIRE(highs.changeRowBounds(2, -kHighsInf, 3.21) == HighsStatus::kOk);
|
|
935
|
+
|
|
936
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
937
|
+
|
|
938
|
+
// Attempting to set col bounds with -infinite upper bound returns error
|
|
939
|
+
REQUIRE(highs.changeColBounds(2, 0.21, -kHighsInf) == HighsStatus::kError);
|
|
940
|
+
|
|
941
|
+
REQUIRE(highs.changeColBounds(2, 0.21, kHighsInf) == HighsStatus::kOk);
|
|
942
|
+
|
|
943
|
+
REQUIRE(highs.changeRowsBounds(row0135789_num_ix, row0135789_row_set,
|
|
944
|
+
row0135789_lower,
|
|
945
|
+
row0135789_upper) == HighsStatus::kOk);
|
|
946
|
+
|
|
947
|
+
REQUIRE(highs.changeColsBounds(col1357_num_ix, col1357_col_set, col1357_lower,
|
|
948
|
+
col1357_upper) == HighsStatus::kOk);
|
|
949
|
+
|
|
950
|
+
// Return the LP to its original state with a mask
|
|
951
|
+
REQUIRE(highs.changeColsCost(col1357_col_mask, colCost.data()) ==
|
|
952
|
+
HighsStatus::kOk);
|
|
953
|
+
|
|
954
|
+
REQUIRE(highs.changeColBounds(2, colLower[2], colUpper[2]) ==
|
|
955
|
+
HighsStatus::kOk);
|
|
956
|
+
|
|
957
|
+
REQUIRE(highs.changeColsBounds(col1357_col_mask, colLower.data(),
|
|
958
|
+
colUpper.data()) == HighsStatus::kOk);
|
|
959
|
+
|
|
960
|
+
REQUIRE(highs.changeRowsBounds(row0135789_row_mask, rowLower.data(),
|
|
961
|
+
rowUpper.data()) == HighsStatus::kOk);
|
|
962
|
+
|
|
963
|
+
REQUIRE(highs.changeRowBounds(2, rowLower[2], rowUpper[2]) ==
|
|
964
|
+
HighsStatus::kOk);
|
|
965
|
+
|
|
966
|
+
avgas_highs.setMatrixFormat(MatrixFormat::kColwise);
|
|
967
|
+
REQUIRE(
|
|
968
|
+
areLpEqual(avgas_highs.getLp(), highs.getLp(), options.infinite_bound));
|
|
969
|
+
|
|
970
|
+
HighsInt before_num_col;
|
|
971
|
+
HighsInt after_num_col;
|
|
972
|
+
HighsInt rm_col;
|
|
973
|
+
HighsInt before_num_row;
|
|
974
|
+
HighsInt after_num_row;
|
|
975
|
+
HighsInt rm_row;
|
|
976
|
+
|
|
977
|
+
before_num_col = highs.getNumCol();
|
|
978
|
+
rm_col = 0;
|
|
979
|
+
REQUIRE(highs.deleteCols(rm_col, rm_col) == HighsStatus::kOk);
|
|
980
|
+
after_num_col = highs.getNumCol();
|
|
981
|
+
if (dev_run)
|
|
982
|
+
printf("After removing col %" HIGHSINT_FORMAT " / %" HIGHSINT_FORMAT
|
|
983
|
+
" have %" HIGHSINT_FORMAT " cols\n",
|
|
984
|
+
rm_col, before_num_col, after_num_col);
|
|
985
|
+
REQUIRE(after_num_col == before_num_col - 1);
|
|
986
|
+
|
|
987
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
988
|
+
|
|
989
|
+
before_num_row = highs.getNumRow();
|
|
990
|
+
rm_row = 0;
|
|
991
|
+
REQUIRE(highs.deleteRows(rm_row, rm_row) == HighsStatus::kOk);
|
|
992
|
+
after_num_row = highs.getNumRow();
|
|
993
|
+
if (dev_run)
|
|
994
|
+
printf("After removing row %" HIGHSINT_FORMAT " / %" HIGHSINT_FORMAT
|
|
995
|
+
" have %" HIGHSINT_FORMAT " rows\n",
|
|
996
|
+
rm_row, before_num_row, after_num_row);
|
|
997
|
+
REQUIRE(after_num_row == before_num_row - 1);
|
|
998
|
+
|
|
999
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
1000
|
+
|
|
1001
|
+
before_num_col = highs.getNumCol();
|
|
1002
|
+
rm_col = before_num_col - 1;
|
|
1003
|
+
REQUIRE(highs.deleteCols(rm_col, rm_col) == HighsStatus::kOk);
|
|
1004
|
+
after_num_col = highs.getNumCol();
|
|
1005
|
+
if (dev_run)
|
|
1006
|
+
printf("After removing col %" HIGHSINT_FORMAT " / %" HIGHSINT_FORMAT
|
|
1007
|
+
" have %" HIGHSINT_FORMAT " cols\n",
|
|
1008
|
+
rm_col, before_num_col, after_num_col);
|
|
1009
|
+
REQUIRE(after_num_col == before_num_col - 1);
|
|
1010
|
+
|
|
1011
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
1012
|
+
|
|
1013
|
+
before_num_row = highs.getNumRow();
|
|
1014
|
+
rm_row = before_num_row - 1;
|
|
1015
|
+
REQUIRE(highs.deleteRows(rm_row, rm_row) == HighsStatus::kOk);
|
|
1016
|
+
after_num_row = highs.getNumRow();
|
|
1017
|
+
if (dev_run)
|
|
1018
|
+
printf("After removing row %" HIGHSINT_FORMAT " / %" HIGHSINT_FORMAT
|
|
1019
|
+
" have %" HIGHSINT_FORMAT " rows\n",
|
|
1020
|
+
rm_row, before_num_row, after_num_row);
|
|
1021
|
+
REQUIRE(after_num_row == before_num_row - 1);
|
|
1022
|
+
|
|
1023
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
1024
|
+
|
|
1025
|
+
REQUIRE(highs.scaleCol(-1, 2.0) == HighsStatus::kError);
|
|
1026
|
+
|
|
1027
|
+
REQUIRE(highs.scaleCol(highs.getNumCol(), 2.0) == HighsStatus::kError);
|
|
1028
|
+
|
|
1029
|
+
REQUIRE(highs.scaleCol(0, 0) == HighsStatus::kError);
|
|
1030
|
+
|
|
1031
|
+
REQUIRE(highs.scaleCol(highs.getNumCol() - 1, 2.0) == HighsStatus::kOk);
|
|
1032
|
+
|
|
1033
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
1034
|
+
|
|
1035
|
+
REQUIRE(highs.scaleCol(0, -2.0) == HighsStatus::kOk);
|
|
1036
|
+
|
|
1037
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
1038
|
+
|
|
1039
|
+
REQUIRE(highs.scaleRow(-1, 2.0) == HighsStatus::kError);
|
|
1040
|
+
|
|
1041
|
+
REQUIRE(highs.scaleRow(highs.getNumRow(), 2.0) == HighsStatus::kError);
|
|
1042
|
+
|
|
1043
|
+
REQUIRE(highs.scaleRow(0, 0) == HighsStatus::kError);
|
|
1044
|
+
|
|
1045
|
+
REQUIRE(highs.scaleRow(0, 2.0) == HighsStatus::kOk);
|
|
1046
|
+
|
|
1047
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
1048
|
+
|
|
1049
|
+
REQUIRE(highs.scaleRow(highs.getNumRow() - 1, -2.0) == HighsStatus::kOk);
|
|
1050
|
+
|
|
1051
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
1052
|
+
|
|
1053
|
+
free(col1357_cost);
|
|
1054
|
+
free(col1357_lower);
|
|
1055
|
+
free(col1357_upper);
|
|
1056
|
+
free(col1357_start);
|
|
1057
|
+
free(col1357_index);
|
|
1058
|
+
free(col1357_value);
|
|
1059
|
+
|
|
1060
|
+
free(row0135789_lower);
|
|
1061
|
+
free(row0135789_upper);
|
|
1062
|
+
free(row0135789_start);
|
|
1063
|
+
free(row0135789_index);
|
|
1064
|
+
free(row0135789_value);
|
|
1065
|
+
|
|
1066
|
+
free(row012_lower);
|
|
1067
|
+
free(row012_upper);
|
|
1068
|
+
free(row012_start);
|
|
1069
|
+
free(row012_index);
|
|
1070
|
+
free(row012_value);
|
|
1071
|
+
|
|
1072
|
+
free(col0123_cost);
|
|
1073
|
+
free(col0123_lower);
|
|
1074
|
+
free(col0123_upper);
|
|
1075
|
+
free(col0123_start);
|
|
1076
|
+
free(col0123_index);
|
|
1077
|
+
free(col0123_value);
|
|
1078
|
+
|
|
1079
|
+
highs.resetGlobalScheduler(true);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
TEST_CASE("LP-getcols", "[highs_data]") {
|
|
1083
|
+
Highs highs;
|
|
1084
|
+
if (!dev_run) highs.setOptionValue("output_flag", false);
|
|
1085
|
+
highs.addCol(-1.0, 0.0, 1.0, 0, NULL, NULL);
|
|
1086
|
+
highs.addCol(-1.0, 0.0, 1.0, 0, NULL, NULL);
|
|
1087
|
+
HighsInt aindex[2] = {0, 1};
|
|
1088
|
+
double avalue[2] = {1.0, -1.0};
|
|
1089
|
+
highs.addRow(0.0, 0.0, 2, aindex, avalue);
|
|
1090
|
+
HighsInt num_cols;
|
|
1091
|
+
HighsInt num_nz;
|
|
1092
|
+
HighsInt matrix_start[2] = {-1, -1};
|
|
1093
|
+
highs.getCols(0, 1, num_cols, NULL, NULL, NULL, num_nz, matrix_start, NULL,
|
|
1094
|
+
NULL);
|
|
1095
|
+
REQUIRE(num_cols == 2);
|
|
1096
|
+
REQUIRE(num_nz == 2);
|
|
1097
|
+
REQUIRE(matrix_start[0] == 0);
|
|
1098
|
+
REQUIRE(matrix_start[1] == 1);
|
|
1099
|
+
HighsInt matrix_indices[2] = {-1, -1};
|
|
1100
|
+
double matrix_values[2] = {0.0, 0.0};
|
|
1101
|
+
highs.getCols(0, 1, num_cols, NULL, NULL, NULL, num_nz, matrix_start,
|
|
1102
|
+
matrix_indices, matrix_values);
|
|
1103
|
+
REQUIRE(matrix_indices[0] == 0);
|
|
1104
|
+
REQUIRE(matrix_indices[1] == 0);
|
|
1105
|
+
REQUIRE(matrix_values[0] == 1.0);
|
|
1106
|
+
REQUIRE(matrix_values[1] == -1.0);
|
|
1107
|
+
|
|
1108
|
+
highs.resetGlobalScheduler(true);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
TEST_CASE("LP-getrows", "[highs_data]") {
|
|
1112
|
+
Highs highs;
|
|
1113
|
+
if (!dev_run) highs.setOptionValue("output_flag", false);
|
|
1114
|
+
highs.addCol(-1.0, 0.0, 1.0, 0, NULL, NULL);
|
|
1115
|
+
highs.addCol(-1.0, 0.0, 1.0, 0, NULL, NULL);
|
|
1116
|
+
HighsInt aindex = 0;
|
|
1117
|
+
double avalue = 1.0;
|
|
1118
|
+
highs.addRow(0.0, 0.0, 1, &aindex, &avalue);
|
|
1119
|
+
aindex = 1;
|
|
1120
|
+
avalue = -2.0;
|
|
1121
|
+
highs.addRow(0.0, 0.0, 1, &aindex, &avalue);
|
|
1122
|
+
HighsInt num_rows;
|
|
1123
|
+
HighsInt num_nz;
|
|
1124
|
+
HighsInt matrix_start[2] = {-1, -1};
|
|
1125
|
+
highs.getRows(0, 1, num_rows, NULL, NULL, num_nz, matrix_start, NULL, NULL);
|
|
1126
|
+
REQUIRE(num_rows == 2);
|
|
1127
|
+
REQUIRE(num_nz == 2);
|
|
1128
|
+
REQUIRE(matrix_start[0] == 0);
|
|
1129
|
+
REQUIRE(matrix_start[1] == 1);
|
|
1130
|
+
HighsInt matrix_indices[2] = {-1, -1};
|
|
1131
|
+
double matrix_values[2] = {0.0, 0.0};
|
|
1132
|
+
highs.getRows(0, 1, num_rows, NULL, NULL, num_nz, matrix_start,
|
|
1133
|
+
matrix_indices, matrix_values);
|
|
1134
|
+
REQUIRE(matrix_indices[0] == 0);
|
|
1135
|
+
REQUIRE(matrix_indices[1] == 1);
|
|
1136
|
+
REQUIRE(matrix_values[0] == 1.0);
|
|
1137
|
+
REQUIRE(matrix_values[1] == -2.0);
|
|
1138
|
+
|
|
1139
|
+
highs.resetGlobalScheduler(true);
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
TEST_CASE("LP-interval-changes", "[highs_data]") {
|
|
1143
|
+
Highs highs;
|
|
1144
|
+
highs.setOptionValue("output_flag", dev_run);
|
|
1145
|
+
const HighsOptions& options = highs.getOptions();
|
|
1146
|
+
const HighsInfo& info = highs.getInfo();
|
|
1147
|
+
|
|
1148
|
+
if (dev_run) {
|
|
1149
|
+
highs.setOptionValue("log_to_console", true);
|
|
1150
|
+
highs.setOptionValue("log_dev_level", kHighsLogDevLevelVerbose);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
std::string model_file =
|
|
1154
|
+
std::string(HIGHS_DIR) + "/check/instances/avgas.mps";
|
|
1155
|
+
REQUIRE(highs.readModel(model_file) == HighsStatus::kOk);
|
|
1156
|
+
|
|
1157
|
+
const HighsLp& lp = highs.getLp();
|
|
1158
|
+
|
|
1159
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
1160
|
+
|
|
1161
|
+
double avgas_optimal_objective_function_value = info.objective_function_value;
|
|
1162
|
+
|
|
1163
|
+
REQUIRE(info.objective_function_value ==
|
|
1164
|
+
avgas_optimal_objective_function_value);
|
|
1165
|
+
// messageReportLp("LP-interval-changes", lp);
|
|
1166
|
+
|
|
1167
|
+
// Change an interval of column costs
|
|
1168
|
+
HighsInt from_col = 2;
|
|
1169
|
+
HighsInt to_col = 5;
|
|
1170
|
+
HighsInt set_num_col = to_col - from_col + 1;
|
|
1171
|
+
HighsInt get_num_col;
|
|
1172
|
+
HighsInt get_num_nz;
|
|
1173
|
+
std::vector<double> og_col2345_cost;
|
|
1174
|
+
std::vector<double> set_col2345_cost;
|
|
1175
|
+
std::vector<double> get_col2345_cost;
|
|
1176
|
+
og_col2345_cost.resize(lp.num_col_);
|
|
1177
|
+
set_col2345_cost.resize(set_num_col);
|
|
1178
|
+
get_col2345_cost.resize(lp.num_col_);
|
|
1179
|
+
set_col2345_cost[0] = 2.0;
|
|
1180
|
+
set_col2345_cost[1] = 3.0;
|
|
1181
|
+
set_col2345_cost[2] = 4.0;
|
|
1182
|
+
set_col2345_cost[3] = 5.0;
|
|
1183
|
+
REQUIRE(highs.getCols(from_col, to_col, get_num_col, og_col2345_cost.data(),
|
|
1184
|
+
NULL, NULL, get_num_nz, NULL, NULL,
|
|
1185
|
+
NULL) == HighsStatus::kOk);
|
|
1186
|
+
REQUIRE(highs.changeColsCost(from_col, to_col, set_col2345_cost.data()) ==
|
|
1187
|
+
HighsStatus::kOk);
|
|
1188
|
+
REQUIRE(highs.getCols(from_col, to_col, get_num_col, get_col2345_cost.data(),
|
|
1189
|
+
NULL, NULL, get_num_nz, NULL, NULL,
|
|
1190
|
+
NULL) == HighsStatus::kOk);
|
|
1191
|
+
REQUIRE(get_num_col == set_num_col);
|
|
1192
|
+
for (HighsInt usr_col = 0; usr_col < get_num_col; usr_col++)
|
|
1193
|
+
REQUIRE(get_col2345_cost[usr_col] == set_col2345_cost[usr_col]);
|
|
1194
|
+
REQUIRE(highs.changeColsCost(from_col, to_col, og_col2345_cost.data()) ==
|
|
1195
|
+
HighsStatus::kOk);
|
|
1196
|
+
|
|
1197
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
1198
|
+
|
|
1199
|
+
double optimal_objective_function_value;
|
|
1200
|
+
highs.getInfoValue("objective_function_value",
|
|
1201
|
+
optimal_objective_function_value);
|
|
1202
|
+
REQUIRE(optimal_objective_function_value ==
|
|
1203
|
+
avgas_optimal_objective_function_value);
|
|
1204
|
+
|
|
1205
|
+
from_col = 0;
|
|
1206
|
+
to_col = 4;
|
|
1207
|
+
set_num_col = to_col - from_col + 1;
|
|
1208
|
+
std::vector<double> og_col01234_lower;
|
|
1209
|
+
std::vector<double> og_col01234_upper;
|
|
1210
|
+
std::vector<double> set_col01234_lower;
|
|
1211
|
+
std::vector<double> get_col01234_lower;
|
|
1212
|
+
og_col01234_lower.resize(lp.num_col_);
|
|
1213
|
+
og_col01234_upper.resize(lp.num_col_);
|
|
1214
|
+
set_col01234_lower.resize(set_num_col);
|
|
1215
|
+
get_col01234_lower.resize(lp.num_col_);
|
|
1216
|
+
set_col01234_lower[0] = 0.0;
|
|
1217
|
+
set_col01234_lower[1] = 1.0;
|
|
1218
|
+
set_col01234_lower[2] = 2.0;
|
|
1219
|
+
set_col01234_lower[3] = 3.0;
|
|
1220
|
+
set_col01234_lower[4] = 4.0;
|
|
1221
|
+
REQUIRE(highs.getCols(from_col, to_col, get_num_col, NULL,
|
|
1222
|
+
og_col01234_lower.data(), og_col01234_upper.data(),
|
|
1223
|
+
get_num_nz, NULL, NULL, NULL) == HighsStatus::kOk);
|
|
1224
|
+
REQUIRE(highs.changeColsBounds(from_col, to_col, set_col01234_lower.data(),
|
|
1225
|
+
og_col01234_upper.data()) == HighsStatus::kOk);
|
|
1226
|
+
REQUIRE(highs.getCols(from_col, to_col, get_num_col, NULL,
|
|
1227
|
+
get_col01234_lower.data(), og_col01234_upper.data(),
|
|
1228
|
+
get_num_nz, NULL, NULL, NULL) == HighsStatus::kOk);
|
|
1229
|
+
REQUIRE(get_num_col == set_num_col);
|
|
1230
|
+
for (HighsInt usr_col = 0; usr_col < get_num_col; usr_col++)
|
|
1231
|
+
REQUIRE(get_col01234_lower[usr_col] == set_col01234_lower[usr_col]);
|
|
1232
|
+
REQUIRE(highs.changeColsBounds(from_col, to_col, og_col01234_lower.data(),
|
|
1233
|
+
og_col01234_upper.data()) == HighsStatus::kOk);
|
|
1234
|
+
|
|
1235
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
1236
|
+
|
|
1237
|
+
highs.getInfoValue("objective_function_value",
|
|
1238
|
+
optimal_objective_function_value);
|
|
1239
|
+
REQUIRE(optimal_objective_function_value ==
|
|
1240
|
+
avgas_optimal_objective_function_value);
|
|
1241
|
+
|
|
1242
|
+
HighsInt from_row = 5;
|
|
1243
|
+
HighsInt to_row = 9;
|
|
1244
|
+
HighsInt set_num_row = to_row - from_row + 1;
|
|
1245
|
+
HighsInt get_num_row;
|
|
1246
|
+
std::vector<double> og_row56789_lower;
|
|
1247
|
+
std::vector<double> og_row56789_upper;
|
|
1248
|
+
std::vector<double> set_row56789_lower;
|
|
1249
|
+
std::vector<double> get_row56789_lower;
|
|
1250
|
+
og_row56789_lower.resize(lp.num_row_);
|
|
1251
|
+
og_row56789_upper.resize(lp.num_row_);
|
|
1252
|
+
set_row56789_lower.resize(set_num_row);
|
|
1253
|
+
get_row56789_lower.resize(lp.num_row_);
|
|
1254
|
+
set_row56789_lower[0] = 5.0;
|
|
1255
|
+
set_row56789_lower[1] = 6.0;
|
|
1256
|
+
set_row56789_lower[2] = 7.0;
|
|
1257
|
+
set_row56789_lower[3] = 8.0;
|
|
1258
|
+
set_row56789_lower[4] = 9.0;
|
|
1259
|
+
REQUIRE(highs.getRows(from_row, to_row, get_num_row, og_row56789_lower.data(),
|
|
1260
|
+
og_row56789_upper.data(), get_num_nz, NULL, NULL,
|
|
1261
|
+
NULL) == HighsStatus::kOk);
|
|
1262
|
+
REQUIRE(highs.changeRowsBounds(from_row, to_row, set_row56789_lower.data(),
|
|
1263
|
+
og_row56789_upper.data()) == HighsStatus::kOk);
|
|
1264
|
+
REQUIRE(highs.getRows(from_row, to_row, get_num_row,
|
|
1265
|
+
get_row56789_lower.data(), og_row56789_upper.data(),
|
|
1266
|
+
get_num_nz, NULL, NULL, NULL) == HighsStatus::kOk);
|
|
1267
|
+
REQUIRE(get_num_row == set_num_row);
|
|
1268
|
+
for (HighsInt usr_row = 0; usr_row < get_num_row; usr_row++)
|
|
1269
|
+
REQUIRE(get_row56789_lower[usr_row] == set_row56789_lower[usr_row]);
|
|
1270
|
+
REQUIRE(highs.changeRowsBounds(from_row, to_row, og_row56789_lower.data(),
|
|
1271
|
+
og_row56789_upper.data()) == HighsStatus::kOk);
|
|
1272
|
+
|
|
1273
|
+
callRun(highs, options.log_options, "highs.run()", HighsStatus::kOk);
|
|
1274
|
+
|
|
1275
|
+
highs.getInfoValue("objective_function_value",
|
|
1276
|
+
optimal_objective_function_value);
|
|
1277
|
+
REQUIRE(optimal_objective_function_value ==
|
|
1278
|
+
avgas_optimal_objective_function_value);
|
|
1279
|
+
|
|
1280
|
+
highs.resetGlobalScheduler(true);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
TEST_CASE("LP-delete", "[highs_data]") {
|
|
1284
|
+
// Rather better testing of deleteCols() and deleteRows()
|
|
1285
|
+
Highs highs;
|
|
1286
|
+
HighsOptions options;
|
|
1287
|
+
HighsLogOptions& log_options = options.log_options;
|
|
1288
|
+
|
|
1289
|
+
if (!dev_run) {
|
|
1290
|
+
highs.setOptionValue("output_flag", false);
|
|
1291
|
+
options.output_flag = false;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
std::string model_file =
|
|
1295
|
+
std::string(HIGHS_DIR) + "/check/instances/adlittle.mps";
|
|
1296
|
+
REQUIRE(highs.readModel(model_file) == HighsStatus::kOk);
|
|
1297
|
+
|
|
1298
|
+
REQUIRE(highs.readModel(model_file) == HighsStatus::kOk);
|
|
1299
|
+
|
|
1300
|
+
const HighsLp& lp = highs.getLp();
|
|
1301
|
+
|
|
1302
|
+
callRun(highs, log_options, "highs.run()", HighsStatus::kOk);
|
|
1303
|
+
|
|
1304
|
+
double adlittle_objective_function_value;
|
|
1305
|
+
highs.getInfoValue("objective_function_value",
|
|
1306
|
+
adlittle_objective_function_value);
|
|
1307
|
+
|
|
1308
|
+
HighsRandom random(0);
|
|
1309
|
+
double objective_function_value;
|
|
1310
|
+
HighsInt num_nz = lp.a_matrix_.numNz();
|
|
1311
|
+
std::vector<HighsInt> mask;
|
|
1312
|
+
std::vector<HighsInt> mask_check;
|
|
1313
|
+
HighsInt get_num_nz;
|
|
1314
|
+
std::vector<HighsInt> get_start;
|
|
1315
|
+
std::vector<HighsInt> get_index;
|
|
1316
|
+
std::vector<double> get_cost;
|
|
1317
|
+
std::vector<double> get_lower;
|
|
1318
|
+
std::vector<double> get_upper;
|
|
1319
|
+
std::vector<double> get_value;
|
|
1320
|
+
|
|
1321
|
+
// Test deleteCols
|
|
1322
|
+
HighsInt num_col = lp.num_col_;
|
|
1323
|
+
HighsInt rm_num_col = num_col / 5;
|
|
1324
|
+
assert(rm_num_col >= 10);
|
|
1325
|
+
mask.assign(num_col, 0);
|
|
1326
|
+
mask_check.assign(num_col, 0);
|
|
1327
|
+
HighsInt num_col_k = 0;
|
|
1328
|
+
for (;;) {
|
|
1329
|
+
HighsInt iCol = random.integer(num_col);
|
|
1330
|
+
if (mask[iCol]) continue;
|
|
1331
|
+
mask[iCol] = 1;
|
|
1332
|
+
num_col_k++;
|
|
1333
|
+
if (num_col_k >= rm_num_col) break;
|
|
1334
|
+
}
|
|
1335
|
+
HighsInt new_col_index = 0;
|
|
1336
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
1337
|
+
if (!mask[iCol]) {
|
|
1338
|
+
mask_check[iCol] = new_col_index;
|
|
1339
|
+
new_col_index++;
|
|
1340
|
+
} else {
|
|
1341
|
+
mask_check[iCol] = -1;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
HighsInt get_num_col;
|
|
1345
|
+
get_cost.resize(rm_num_col);
|
|
1346
|
+
get_lower.resize(rm_num_col);
|
|
1347
|
+
get_upper.resize(rm_num_col);
|
|
1348
|
+
get_start.resize(rm_num_col);
|
|
1349
|
+
get_index.resize(num_nz);
|
|
1350
|
+
get_value.resize(num_nz);
|
|
1351
|
+
|
|
1352
|
+
// Get the set of cols to be removed - so that they can be reintroduced
|
|
1353
|
+
REQUIRE(highs.getCols(mask.data(), get_num_col, get_cost.data(),
|
|
1354
|
+
get_lower.data(), get_upper.data(), get_num_nz,
|
|
1355
|
+
get_start.data(), get_index.data(),
|
|
1356
|
+
get_value.data()) == HighsStatus::kOk);
|
|
1357
|
+
REQUIRE(get_num_col == rm_num_col);
|
|
1358
|
+
get_index.resize(get_num_nz);
|
|
1359
|
+
get_value.resize(get_num_nz);
|
|
1360
|
+
|
|
1361
|
+
// Remove the set of cols
|
|
1362
|
+
REQUIRE(highs.deleteCols(mask.data()) == HighsStatus::kOk);
|
|
1363
|
+
REQUIRE(mask == mask_check);
|
|
1364
|
+
REQUIRE(lp.num_col_ == num_col - rm_num_col);
|
|
1365
|
+
|
|
1366
|
+
// Replace the set of cols
|
|
1367
|
+
REQUIRE(highs.addCols(get_num_col, get_cost.data(), get_lower.data(),
|
|
1368
|
+
get_upper.data(), get_num_nz, get_start.data(),
|
|
1369
|
+
get_index.data(),
|
|
1370
|
+
get_value.data()) == HighsStatus::kOk);
|
|
1371
|
+
REQUIRE(lp.num_col_ == num_col);
|
|
1372
|
+
|
|
1373
|
+
callRun(highs, log_options, "highs.run()", HighsStatus::kOk);
|
|
1374
|
+
|
|
1375
|
+
highs.getInfoValue("objective_function_value", objective_function_value);
|
|
1376
|
+
|
|
1377
|
+
REQUIRE(
|
|
1378
|
+
std::fabs(objective_function_value - adlittle_objective_function_value) <
|
|
1379
|
+
double_equal_tolerance);
|
|
1380
|
+
|
|
1381
|
+
// Test deleteRows
|
|
1382
|
+
HighsInt num_row = lp.num_row_;
|
|
1383
|
+
HighsInt rm_num_row = num_row / 5;
|
|
1384
|
+
assert(rm_num_row >= 10);
|
|
1385
|
+
mask.assign(num_row, 0);
|
|
1386
|
+
mask_check.assign(num_row, 0);
|
|
1387
|
+
HighsInt num_row_k = 0;
|
|
1388
|
+
for (;;) {
|
|
1389
|
+
HighsInt iRow = random.integer(num_row);
|
|
1390
|
+
if (mask[iRow]) continue;
|
|
1391
|
+
mask[iRow] = 1;
|
|
1392
|
+
num_row_k++;
|
|
1393
|
+
if (num_row_k >= rm_num_row) break;
|
|
1394
|
+
}
|
|
1395
|
+
HighsInt new_row_index = 0;
|
|
1396
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++) {
|
|
1397
|
+
if (!mask[iRow]) {
|
|
1398
|
+
mask_check[iRow] = new_row_index;
|
|
1399
|
+
new_row_index++;
|
|
1400
|
+
} else {
|
|
1401
|
+
mask_check[iRow] = -1;
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
HighsInt get_num_row;
|
|
1405
|
+
get_lower.resize(rm_num_row);
|
|
1406
|
+
get_upper.resize(rm_num_row);
|
|
1407
|
+
get_start.resize(rm_num_row);
|
|
1408
|
+
get_index.resize(num_nz);
|
|
1409
|
+
get_value.resize(num_nz);
|
|
1410
|
+
|
|
1411
|
+
// Get the set of rows to be removed - so that they can be reintroduced
|
|
1412
|
+
REQUIRE(highs.getRows(mask.data(), get_num_row, get_lower.data(),
|
|
1413
|
+
get_upper.data(), get_num_nz, get_start.data(),
|
|
1414
|
+
get_index.data(),
|
|
1415
|
+
get_value.data()) == HighsStatus::kOk);
|
|
1416
|
+
REQUIRE(get_num_row == rm_num_row);
|
|
1417
|
+
get_index.resize(get_num_nz);
|
|
1418
|
+
get_value.resize(get_num_nz);
|
|
1419
|
+
|
|
1420
|
+
// Remove the set of rows
|
|
1421
|
+
REQUIRE(highs.deleteRows(mask.data()) == HighsStatus::kOk);
|
|
1422
|
+
REQUIRE(mask == mask_check);
|
|
1423
|
+
REQUIRE(lp.num_row_ == num_row - rm_num_row);
|
|
1424
|
+
|
|
1425
|
+
// Replace the set of rows
|
|
1426
|
+
REQUIRE(highs.addRows(get_num_row, get_lower.data(), get_upper.data(),
|
|
1427
|
+
get_num_nz, get_start.data(), get_index.data(),
|
|
1428
|
+
get_value.data()) == HighsStatus::kOk);
|
|
1429
|
+
REQUIRE(lp.num_row_ == num_row);
|
|
1430
|
+
|
|
1431
|
+
callRun(highs, log_options, "highs.run()", HighsStatus::kOk);
|
|
1432
|
+
|
|
1433
|
+
highs.getInfoValue("objective_function_value", objective_function_value);
|
|
1434
|
+
|
|
1435
|
+
REQUIRE(
|
|
1436
|
+
std::fabs(objective_function_value - adlittle_objective_function_value) <
|
|
1437
|
+
double_equal_tolerance);
|
|
1438
|
+
|
|
1439
|
+
highs.resetGlobalScheduler(true);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
TEST_CASE("LP-free-row", "[highs_data]") {
|
|
1443
|
+
HighsLp lp;
|
|
1444
|
+
lp.num_col_ = 2;
|
|
1445
|
+
lp.num_row_ = 1;
|
|
1446
|
+
lp.col_cost_ = {-1, -2};
|
|
1447
|
+
lp.col_lower_ = {0, 0};
|
|
1448
|
+
lp.col_upper_ = {1, 1};
|
|
1449
|
+
lp.row_lower_ = {-inf};
|
|
1450
|
+
lp.row_upper_ = {1};
|
|
1451
|
+
lp.a_matrix_.start_ = {0, 2};
|
|
1452
|
+
lp.a_matrix_.index_ = {0, 1};
|
|
1453
|
+
lp.a_matrix_.value_ = {1, 1};
|
|
1454
|
+
lp.a_matrix_.format_ = MatrixFormat::kRowwise;
|
|
1455
|
+
Highs highs;
|
|
1456
|
+
highs.setOptionValue("output_flag", dev_run);
|
|
1457
|
+
highs.setOptionValue("presolve", kHighsOffString);
|
|
1458
|
+
|
|
1459
|
+
highs.passModel(lp);
|
|
1460
|
+
highs.run();
|
|
1461
|
+
REQUIRE(highs.getInfo().objective_function_value == -2);
|
|
1462
|
+
// Row is nonbasic at its lower bound with negative dual
|
|
1463
|
+
REQUIRE(highs.getBasis().row_status[0] == HighsBasisStatus::kUpper);
|
|
1464
|
+
REQUIRE(highs.getSolution().row_dual[0] < -.5);
|
|
1465
|
+
// Make row free and re-solve from current basis. Analogous
|
|
1466
|
+
// situation exposed error in HEkk::initialiseBound when solving
|
|
1467
|
+
// bell5 with SCIP
|
|
1468
|
+
highs.changeRowBounds(0, -inf, inf);
|
|
1469
|
+
highs.run();
|
|
1470
|
+
REQUIRE(highs.getInfo().objective_function_value == -3);
|
|
1471
|
+
|
|
1472
|
+
highs.resetGlobalScheduler(true);
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
TEST_CASE("LP-delete-ip-var", "[highs_data]") {
|
|
1476
|
+
Highs highs;
|
|
1477
|
+
highs.setOptionValue("output_flag", dev_run);
|
|
1478
|
+
HighsInt num_var = 5;
|
|
1479
|
+
std::vector<double> lower = {1, 2, 3, 4, 5};
|
|
1480
|
+
std::vector<double> upper = {1, 2, 3, 4, 5};
|
|
1481
|
+
highs.addVars(num_var, lower.data(), upper.data());
|
|
1482
|
+
const HighsInt og_ip_var = 3;
|
|
1483
|
+
const std::vector<HighsInt> og_ip_var_set = {og_ip_var};
|
|
1484
|
+
const std::vector<HighsVarType> og_ip_var_integrality = {
|
|
1485
|
+
HighsVarType::kInteger};
|
|
1486
|
+
const HighsInt delete_var = 2;
|
|
1487
|
+
const std::vector<HighsInt> delete_var_set = {delete_var};
|
|
1488
|
+
const HighsInt later_ip_var = 2;
|
|
1489
|
+
highs.changeColsIntegrality(1, og_ip_var_set.data(),
|
|
1490
|
+
og_ip_var_integrality.data());
|
|
1491
|
+
|
|
1492
|
+
for (HighsInt iCol = 0; iCol < num_var; iCol++) {
|
|
1493
|
+
if (iCol == og_ip_var) {
|
|
1494
|
+
REQUIRE(highs.getLp().integrality_[iCol] == HighsVarType::kInteger);
|
|
1495
|
+
} else {
|
|
1496
|
+
REQUIRE(highs.getLp().integrality_[iCol] == HighsVarType::kContinuous);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
highs.deleteVars(1, delete_var_set.data());
|
|
1500
|
+
// Now that #1386 is fixed, the integrality should be correct
|
|
1501
|
+
num_var--;
|
|
1502
|
+
for (HighsInt iCol = 0; iCol < num_var; iCol++) {
|
|
1503
|
+
if (iCol == later_ip_var) {
|
|
1504
|
+
REQUIRE(highs.getLp().integrality_[iCol] == HighsVarType::kInteger);
|
|
1505
|
+
} else {
|
|
1506
|
+
REQUIRE(highs.getLp().integrality_[iCol] == HighsVarType::kContinuous);
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
highs.resetGlobalScheduler(true);
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
void HighsStatusReport(const HighsLogOptions& log_options, std::string message,
|
|
1514
|
+
HighsStatus status) {
|
|
1515
|
+
if (!dev_run) return;
|
|
1516
|
+
highsLogUser(log_options, HighsLogType::kInfo,
|
|
1517
|
+
"%s: HighsStatus = %" HIGHSINT_FORMAT " - %s\n", message.c_str(),
|
|
1518
|
+
(int)status, highsStatusToString(status).c_str());
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
void callRun(Highs& highs, const HighsLogOptions& log_options,
|
|
1522
|
+
std::string message, const HighsStatus require_return_status) {
|
|
1523
|
+
HighsStatus return_status = highs.run();
|
|
1524
|
+
HighsStatusReport(log_options, message, return_status);
|
|
1525
|
+
REQUIRE(return_status == require_return_status);
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
bool areLpColEqual(const HighsInt num_col0, const double* colCost0,
|
|
1529
|
+
const double* colLower0, const double* colUpper0,
|
|
1530
|
+
const HighsInt num_nz0, const HighsInt* Astart0,
|
|
1531
|
+
const HighsInt* Aindex0, const double* Avalue0,
|
|
1532
|
+
const HighsInt num_col1, const double* colCost1,
|
|
1533
|
+
const double* colLower1, const double* colUpper1,
|
|
1534
|
+
const HighsInt num_nz1, const HighsInt* Astart1,
|
|
1535
|
+
const HighsInt* Aindex1, const double* Avalue1,
|
|
1536
|
+
const double infinite_bound) {
|
|
1537
|
+
if (num_col0 != num_col1) {
|
|
1538
|
+
if (dev_run)
|
|
1539
|
+
printf("areLpColEqual: %" HIGHSINT_FORMAT
|
|
1540
|
+
" = num_col0 != num_col1 = %" HIGHSINT_FORMAT "\n",
|
|
1541
|
+
num_col0, num_col1);
|
|
1542
|
+
return false;
|
|
1543
|
+
}
|
|
1544
|
+
if (!num_col0) return true;
|
|
1545
|
+
HighsInt num_col = num_col0;
|
|
1546
|
+
for (HighsInt col = 0; col < num_col; col++) {
|
|
1547
|
+
if (colCost0[col] != colCost1[col]) {
|
|
1548
|
+
if (dev_run)
|
|
1549
|
+
printf("areLpColEqual: %g = colCost0[%" HIGHSINT_FORMAT
|
|
1550
|
+
"] != colCost1[%" HIGHSINT_FORMAT "] = %g\n",
|
|
1551
|
+
colCost0[col], col, col, colCost1[col]);
|
|
1552
|
+
return false;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
for (HighsInt col = 0; col < num_col; col++) {
|
|
1556
|
+
if (colLower0[col] <= -infinite_bound && colLower1[col] <= -infinite_bound)
|
|
1557
|
+
continue;
|
|
1558
|
+
if (colLower0[col] != colLower1[col]) {
|
|
1559
|
+
if (dev_run)
|
|
1560
|
+
printf("areLpColEqual: %g = colLower0[%" HIGHSINT_FORMAT
|
|
1561
|
+
"] != colLower1[%" HIGHSINT_FORMAT "] = %g\n",
|
|
1562
|
+
colLower0[col], col, col, colLower1[col]);
|
|
1563
|
+
return false;
|
|
1564
|
+
}
|
|
1565
|
+
if (colUpper0[col] >= infinite_bound && colUpper1[col] >= infinite_bound)
|
|
1566
|
+
continue;
|
|
1567
|
+
if (colUpper0[col] != colUpper1[col]) {
|
|
1568
|
+
if (dev_run)
|
|
1569
|
+
printf("areLpColEqual: %g = colUpper0[%" HIGHSINT_FORMAT
|
|
1570
|
+
"] != colUpper1[%" HIGHSINT_FORMAT "] = %g\n",
|
|
1571
|
+
colUpper0[col], col, col, colUpper1[col]);
|
|
1572
|
+
return false;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
if (num_nz0 != num_nz1) {
|
|
1576
|
+
if (dev_run)
|
|
1577
|
+
printf("areLpColEqual: %" HIGHSINT_FORMAT
|
|
1578
|
+
" = num_nz0 != num_nz1 = %" HIGHSINT_FORMAT "\n",
|
|
1579
|
+
num_nz0, num_nz1);
|
|
1580
|
+
return false;
|
|
1581
|
+
}
|
|
1582
|
+
if (!num_nz0) return true;
|
|
1583
|
+
for (HighsInt col = 0; col < num_col; col++) {
|
|
1584
|
+
if (Astart0[col] != Astart1[col]) {
|
|
1585
|
+
if (dev_run)
|
|
1586
|
+
printf("areLpColEqual: %" HIGHSINT_FORMAT " = Astart0[%" HIGHSINT_FORMAT
|
|
1587
|
+
"] != Astart1[%" HIGHSINT_FORMAT "] = %" HIGHSINT_FORMAT "\n",
|
|
1588
|
+
Astart0[col], col, col, Astart1[col]);
|
|
1589
|
+
return false;
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
HighsInt num_nz = num_nz0;
|
|
1593
|
+
for (HighsInt nz = 0; nz < num_nz; nz++) {
|
|
1594
|
+
if (Aindex0[nz] != Aindex1[nz]) {
|
|
1595
|
+
if (dev_run)
|
|
1596
|
+
printf("areLpColEqual: %" HIGHSINT_FORMAT " = Aindex0[%" HIGHSINT_FORMAT
|
|
1597
|
+
"] != Aindex1[%" HIGHSINT_FORMAT "] = %" HIGHSINT_FORMAT "\n",
|
|
1598
|
+
Aindex0[nz], nz, nz, Aindex1[nz]);
|
|
1599
|
+
return false;
|
|
1600
|
+
}
|
|
1601
|
+
if (Avalue0[nz] != Avalue1[nz]) {
|
|
1602
|
+
if (dev_run)
|
|
1603
|
+
printf("areLpColEqual: %g = Avalue0[%" HIGHSINT_FORMAT
|
|
1604
|
+
"] != Avalue1[%" HIGHSINT_FORMAT "] = %g\n",
|
|
1605
|
+
Avalue0[nz], nz, nz, Avalue1[nz]);
|
|
1606
|
+
return false;
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
return true;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
bool areLpRowEqual(const HighsInt num_row0, const double* rowLower0,
|
|
1613
|
+
const double* rowUpper0, const HighsInt num_nz0,
|
|
1614
|
+
const HighsInt* ARstart0, const HighsInt* ARindex0,
|
|
1615
|
+
const double* ARvalue0, const HighsInt num_row1,
|
|
1616
|
+
const double* rowLower1, const double* rowUpper1,
|
|
1617
|
+
const HighsInt num_nz1, const HighsInt* ARstart1,
|
|
1618
|
+
const HighsInt* ARindex1, const double* ARvalue1,
|
|
1619
|
+
const double infinite_bound) {
|
|
1620
|
+
if (num_row0 != num_row1) {
|
|
1621
|
+
if (dev_run)
|
|
1622
|
+
printf("areLpRowEqual: %" HIGHSINT_FORMAT
|
|
1623
|
+
" = num_row0 != num_row1 = %" HIGHSINT_FORMAT "\n",
|
|
1624
|
+
num_row0, num_row1);
|
|
1625
|
+
return false;
|
|
1626
|
+
}
|
|
1627
|
+
if (!num_row0) return true;
|
|
1628
|
+
HighsInt num_row = num_row0;
|
|
1629
|
+
for (HighsInt row = 0; row < num_row; row++) {
|
|
1630
|
+
if (rowLower0[row] <= -infinite_bound && rowLower1[row] <= -infinite_bound)
|
|
1631
|
+
continue;
|
|
1632
|
+
if (rowLower0[row] != rowLower1[row]) {
|
|
1633
|
+
if (dev_run)
|
|
1634
|
+
printf("areLpRowEqual: %g = rowLower0[%" HIGHSINT_FORMAT
|
|
1635
|
+
"] != rowLower1[%" HIGHSINT_FORMAT "] = %g\n",
|
|
1636
|
+
rowLower0[row], row, row, rowLower1[row]);
|
|
1637
|
+
return false;
|
|
1638
|
+
}
|
|
1639
|
+
if (rowUpper0[row] >= infinite_bound && rowUpper1[row] >= infinite_bound)
|
|
1640
|
+
continue;
|
|
1641
|
+
if (rowUpper0[row] != rowUpper1[row]) {
|
|
1642
|
+
if (dev_run)
|
|
1643
|
+
printf("areLpRowEqual: %g = rowUpper0[%" HIGHSINT_FORMAT
|
|
1644
|
+
"] != rowUpper1[%" HIGHSINT_FORMAT "] = %g\n",
|
|
1645
|
+
rowUpper0[row], row, row, rowUpper1[row]);
|
|
1646
|
+
return false;
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
if (num_nz0 != num_nz1) {
|
|
1650
|
+
if (dev_run)
|
|
1651
|
+
printf("areLpRowEqual: %" HIGHSINT_FORMAT
|
|
1652
|
+
" = num_nz0 != num_nz1 = %" HIGHSINT_FORMAT "\n",
|
|
1653
|
+
num_nz0, num_nz1);
|
|
1654
|
+
return false;
|
|
1655
|
+
}
|
|
1656
|
+
if (!num_nz0) return true;
|
|
1657
|
+
for (HighsInt row = 0; row < num_row; row++) {
|
|
1658
|
+
if (ARstart0[row] != ARstart1[row]) {
|
|
1659
|
+
if (dev_run)
|
|
1660
|
+
printf("areLpRowEqual: %" HIGHSINT_FORMAT
|
|
1661
|
+
" = ARstart0[%" HIGHSINT_FORMAT "] != ARstart1[%" HIGHSINT_FORMAT
|
|
1662
|
+
"] = %" HIGHSINT_FORMAT "\n",
|
|
1663
|
+
ARstart0[row], row, row, ARstart1[row]);
|
|
1664
|
+
return false;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
HighsInt num_nz = num_nz0;
|
|
1668
|
+
for (HighsInt nz = 0; nz < num_nz; nz++) {
|
|
1669
|
+
if (ARindex0[nz] != ARindex1[nz]) {
|
|
1670
|
+
if (dev_run)
|
|
1671
|
+
printf("areLpRowEqual: %" HIGHSINT_FORMAT
|
|
1672
|
+
" = ARindex0[%" HIGHSINT_FORMAT "] != ARindex1[%" HIGHSINT_FORMAT
|
|
1673
|
+
"] = %" HIGHSINT_FORMAT "\n",
|
|
1674
|
+
ARindex0[nz], nz, nz, ARindex1[nz]);
|
|
1675
|
+
return false;
|
|
1676
|
+
}
|
|
1677
|
+
if (ARvalue0[nz] != ARvalue1[nz]) {
|
|
1678
|
+
if (dev_run)
|
|
1679
|
+
printf("areLpRowEqual: %g = ARvalue0[%" HIGHSINT_FORMAT
|
|
1680
|
+
"] != ARvalue1[%" HIGHSINT_FORMAT "] = %g\n",
|
|
1681
|
+
ARvalue0[nz], nz, nz, ARvalue1[nz]);
|
|
1682
|
+
return false;
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
return true;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
bool areLpEqual(const HighsLp lp0, const HighsLp lp1,
|
|
1689
|
+
const double infinite_bound) {
|
|
1690
|
+
bool return_bool;
|
|
1691
|
+
if (lp0.a_matrix_.format_ != lp1.a_matrix_.format_) return false;
|
|
1692
|
+
if (lp0.num_col_ > 0 && lp1.num_col_ > 0) {
|
|
1693
|
+
HighsInt lp0_num_nz = lp0.a_matrix_.start_[lp0.num_col_];
|
|
1694
|
+
HighsInt lp1_num_nz = lp1.a_matrix_.start_[lp1.num_col_];
|
|
1695
|
+
return_bool = areLpColEqual(
|
|
1696
|
+
lp0.num_col_, lp0.col_cost_.data(), lp0.col_lower_.data(),
|
|
1697
|
+
lp0.col_upper_.data(), lp0_num_nz, lp0.a_matrix_.start_.data(),
|
|
1698
|
+
lp0.a_matrix_.index_.data(), lp0.a_matrix_.value_.data(), lp1.num_col_,
|
|
1699
|
+
lp1.col_cost_.data(), lp1.col_lower_.data(), lp1.col_upper_.data(),
|
|
1700
|
+
lp1_num_nz, lp1.a_matrix_.start_.data(), lp1.a_matrix_.index_.data(),
|
|
1701
|
+
lp1.a_matrix_.value_.data(), infinite_bound);
|
|
1702
|
+
if (!return_bool) return return_bool;
|
|
1703
|
+
}
|
|
1704
|
+
if (lp0.num_row_ > 0 && lp1.num_row_ > 0) {
|
|
1705
|
+
HighsInt lp0_num_nz = 0;
|
|
1706
|
+
HighsInt lp1_num_nz = 0;
|
|
1707
|
+
return_bool = areLpRowEqual(
|
|
1708
|
+
lp0.num_row_, lp0.row_lower_.data(), lp0.row_upper_.data(), lp0_num_nz,
|
|
1709
|
+
NULL, NULL, NULL, lp1.num_row_, lp1.row_lower_.data(),
|
|
1710
|
+
lp1.row_upper_.data(), lp1_num_nz, NULL, NULL, NULL, infinite_bound);
|
|
1711
|
+
}
|
|
1712
|
+
return return_bool;
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
void testDeleteKeep(const HighsIndexCollection& index_collection) {
|
|
1716
|
+
HighsInt delete_from_index;
|
|
1717
|
+
HighsInt delete_to_index;
|
|
1718
|
+
HighsInt keep_from_index;
|
|
1719
|
+
HighsInt keep_to_index;
|
|
1720
|
+
HighsInt current_set_entry;
|
|
1721
|
+
const std::vector<HighsInt>& set = index_collection.set_;
|
|
1722
|
+
const std::vector<HighsInt>& mask = index_collection.mask_;
|
|
1723
|
+
const HighsInt dimension = index_collection.dimension_;
|
|
1724
|
+
if (dev_run) {
|
|
1725
|
+
if (index_collection.is_interval_) {
|
|
1726
|
+
printf("With index interval [%" HIGHSINT_FORMAT ", %" HIGHSINT_FORMAT
|
|
1727
|
+
"] in [%d, %" HIGHSINT_FORMAT "]\n",
|
|
1728
|
+
index_collection.from_, index_collection.to_, 0, dimension - 1);
|
|
1729
|
+
} else if (index_collection.is_set_) {
|
|
1730
|
+
printf("With index set\n");
|
|
1731
|
+
for (HighsInt entry = 0; entry < index_collection.set_num_entries_;
|
|
1732
|
+
entry++)
|
|
1733
|
+
printf(" %2" HIGHSINT_FORMAT "", entry);
|
|
1734
|
+
printf("\n");
|
|
1735
|
+
for (HighsInt entry = 0; entry < index_collection.set_num_entries_;
|
|
1736
|
+
entry++)
|
|
1737
|
+
printf(" %2" HIGHSINT_FORMAT "", set[entry]);
|
|
1738
|
+
printf("\n");
|
|
1739
|
+
} else {
|
|
1740
|
+
printf("With index mask\n");
|
|
1741
|
+
for (HighsInt index = 0; index < dimension; index++)
|
|
1742
|
+
printf(" %2" HIGHSINT_FORMAT "", index);
|
|
1743
|
+
printf("\n");
|
|
1744
|
+
for (HighsInt index = 0; index < dimension; index++)
|
|
1745
|
+
printf(" %2" HIGHSINT_FORMAT "", mask[index]);
|
|
1746
|
+
printf("\n");
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
keep_from_index = 0;
|
|
1751
|
+
if (index_collection.is_interval_) {
|
|
1752
|
+
keep_to_index = index_collection.from_ - 1;
|
|
1753
|
+
} else if (index_collection.is_set_) {
|
|
1754
|
+
current_set_entry = 0;
|
|
1755
|
+
keep_to_index = set[0] - 1;
|
|
1756
|
+
} else {
|
|
1757
|
+
keep_to_index = dimension;
|
|
1758
|
+
for (HighsInt index = 0; index < dimension; index++) {
|
|
1759
|
+
if (mask[index]) {
|
|
1760
|
+
keep_to_index = index - 1;
|
|
1761
|
+
break;
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
if (dev_run)
|
|
1766
|
+
printf("Keep [%2d, %2" HIGHSINT_FORMAT "]\n", 0, keep_to_index);
|
|
1767
|
+
if (keep_to_index >= dimension - 1) return;
|
|
1768
|
+
for (HighsInt k = 0; k < dimension; k++) {
|
|
1769
|
+
updateOutInIndex(index_collection, delete_from_index, delete_to_index,
|
|
1770
|
+
keep_from_index, keep_to_index, current_set_entry);
|
|
1771
|
+
if (dev_run)
|
|
1772
|
+
printf("Delete [%2" HIGHSINT_FORMAT ", %2" HIGHSINT_FORMAT
|
|
1773
|
+
"]; keep [%2" HIGHSINT_FORMAT ", %2" HIGHSINT_FORMAT "]\n",
|
|
1774
|
+
delete_from_index, delete_to_index, keep_from_index,
|
|
1775
|
+
keep_to_index);
|
|
1776
|
+
if (delete_to_index >= dimension - 1 || keep_to_index >= dimension - 1)
|
|
1777
|
+
break;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
bool testAllDeleteKeep(HighsInt num_row) {
|
|
1782
|
+
// Test the extraction of intervals from index collections
|
|
1783
|
+
std::vector<HighsInt> set = {1, 4, 5, 8};
|
|
1784
|
+
std::vector<HighsInt> mask = {0, 1, 0, 0, 1, 1, 0, 0, 1, 0};
|
|
1785
|
+
|
|
1786
|
+
HighsIndexCollection index_collection;
|
|
1787
|
+
index_collection.dimension_ = num_row;
|
|
1788
|
+
index_collection.is_interval_ = false;
|
|
1789
|
+
index_collection.from_ = 3;
|
|
1790
|
+
index_collection.to_ = 6;
|
|
1791
|
+
index_collection.is_set_ = false;
|
|
1792
|
+
index_collection.set_num_entries_ = 4;
|
|
1793
|
+
index_collection.set_ = set;
|
|
1794
|
+
index_collection.is_mask_ = false;
|
|
1795
|
+
index_collection.mask_ = mask;
|
|
1796
|
+
|
|
1797
|
+
HighsInt save_from = index_collection.from_;
|
|
1798
|
+
HighsInt save_set_0 = set[0];
|
|
1799
|
+
HighsInt save_mask_0 = mask[0];
|
|
1800
|
+
|
|
1801
|
+
HighsInt to_pass = 2; // 2
|
|
1802
|
+
for (HighsInt pass = 0; pass <= to_pass; pass++) {
|
|
1803
|
+
if (dev_run)
|
|
1804
|
+
printf("\nTesting delete-keep: pass %" HIGHSINT_FORMAT "\n", pass);
|
|
1805
|
+
if (pass == 1) {
|
|
1806
|
+
// Mods to test LH limit behaviour
|
|
1807
|
+
index_collection.from_ = 0;
|
|
1808
|
+
set[0] = 0;
|
|
1809
|
+
mask[0] = 1;
|
|
1810
|
+
} else if (pass == 2) {
|
|
1811
|
+
// Mods to test RH limit behaviour
|
|
1812
|
+
index_collection.from_ = save_from;
|
|
1813
|
+
index_collection.to_ = 9;
|
|
1814
|
+
set[0] = save_set_0;
|
|
1815
|
+
set[3] = 9;
|
|
1816
|
+
mask[0] = save_mask_0;
|
|
1817
|
+
mask[9] = 1;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
index_collection.is_interval_ = true;
|
|
1821
|
+
testDeleteKeep(index_collection);
|
|
1822
|
+
index_collection.is_interval_ = false;
|
|
1823
|
+
|
|
1824
|
+
index_collection.is_set_ = true;
|
|
1825
|
+
testDeleteKeep(index_collection);
|
|
1826
|
+
index_collection.is_set_ = false;
|
|
1827
|
+
|
|
1828
|
+
index_collection.is_mask_ = true;
|
|
1829
|
+
testDeleteKeep(index_collection);
|
|
1830
|
+
}
|
|
1831
|
+
return true;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
void messageReportLp(const char* message, const HighsLp& lp) {
|
|
1835
|
+
HighsLogOptions log_options;
|
|
1836
|
+
bool output_flag;
|
|
1837
|
+
bool log_to_console;
|
|
1838
|
+
HighsInt log_dev_level;
|
|
1839
|
+
output_flag = dev_run;
|
|
1840
|
+
log_to_console = true;
|
|
1841
|
+
log_dev_level = kHighsLogDevLevelVerbose;
|
|
1842
|
+
log_options.output_flag = &output_flag;
|
|
1843
|
+
log_options.log_stream = NULL;
|
|
1844
|
+
log_options.log_to_console = &log_to_console;
|
|
1845
|
+
log_options.log_dev_level = &log_dev_level;
|
|
1846
|
+
highsLogDev(log_options, HighsLogType::kVerbose, "\nReporting LP: %s\n",
|
|
1847
|
+
message);
|
|
1848
|
+
reportLp(log_options, lp, HighsLogType::kVerbose);
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
void messageReportMatrix(const char* message, const HighsInt num_col,
|
|
1852
|
+
const HighsInt num_nz, const HighsInt* start,
|
|
1853
|
+
const HighsInt* index, const double* value) {
|
|
1854
|
+
HighsLogOptions log_options;
|
|
1855
|
+
bool output_flag = true;
|
|
1856
|
+
bool log_to_console = false;
|
|
1857
|
+
HighsInt log_dev_level = kHighsLogDevLevelInfo;
|
|
1858
|
+
log_options.log_stream = stdout;
|
|
1859
|
+
log_options.output_flag = &output_flag;
|
|
1860
|
+
log_options.log_to_console = &log_to_console;
|
|
1861
|
+
log_options.log_dev_level = &log_dev_level;
|
|
1862
|
+
highsLogDev(log_options, HighsLogType::kVerbose, "\nReporting Matrix: %s\n",
|
|
1863
|
+
message);
|
|
1864
|
+
reportMatrix(log_options, message, num_col, num_nz, start, index, value);
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
TEST_CASE("mod-duplicate-indices", "[highs_data]") {
|
|
1868
|
+
Highs highs;
|
|
1869
|
+
highs.setOptionValue("output_flag", dev_run);
|
|
1870
|
+
const std::string filename =
|
|
1871
|
+
std::string(HIGHS_DIR) + "/check/instances/avgas.mps";
|
|
1872
|
+
highs.readModel(filename);
|
|
1873
|
+
std::vector<double> lower = {0, 0, 0, 0};
|
|
1874
|
+
std::vector<HighsInt> set0 = {5, 2, 7, 3};
|
|
1875
|
+
std::vector<double> lower0 = {1, 1, 1, 1};
|
|
1876
|
+
std::vector<double> upper0 = {1, 1, 1, 1};
|
|
1877
|
+
std::vector<HighsInt> set1 = {5, 2, 7, 3, 2};
|
|
1878
|
+
std::vector<double> lower1 = {0, 0, 0, 0, 0};
|
|
1879
|
+
std::vector<double> upper1 = {1, 1, 1, 1, 1};
|
|
1880
|
+
REQUIRE(highs.changeColsBounds(HighsInt(set0.size()), set0.data(),
|
|
1881
|
+
lower0.data(),
|
|
1882
|
+
upper0.data()) == HighsStatus::kOk);
|
|
1883
|
+
highs.run();
|
|
1884
|
+
double objective1 = highs.getInfo().objective_function_value;
|
|
1885
|
+
// Reverting the change with duplicate index should fail
|
|
1886
|
+
REQUIRE(highs.changeColsBounds(HighsInt(set1.size()), set1.data(),
|
|
1887
|
+
lower1.data(),
|
|
1888
|
+
upper1.data()) == HighsStatus::kError);
|
|
1889
|
+
// Reverting the change without duplicate index should be OK
|
|
1890
|
+
REQUIRE(highs.changeColsBounds(HighsInt(set0.size()), set0.data(),
|
|
1891
|
+
lower.data(),
|
|
1892
|
+
upper0.data()) == HighsStatus::kOk);
|
|
1893
|
+
highs.run();
|
|
1894
|
+
double objective0 = highs.getInfo().objective_function_value;
|
|
1895
|
+
REQUIRE(objective0 < objective1);
|
|
1896
|
+
REQUIRE(objective0 == -7.75);
|
|
1897
|
+
|
|
1898
|
+
highs.resetGlobalScheduler(true);
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
bool equalSparseVectors(const HighsInt dim, const HighsInt num_nz0,
|
|
1902
|
+
const HighsInt* index0, const double* value0,
|
|
1903
|
+
const HighsInt num_nz1, const HighsInt* index1,
|
|
1904
|
+
const double* value1) {
|
|
1905
|
+
if (num_nz0 != num_nz1) {
|
|
1906
|
+
if (dev_run) printf("num_nz0 != num_nz1\n");
|
|
1907
|
+
return false;
|
|
1908
|
+
}
|
|
1909
|
+
std::vector<double> full_vector;
|
|
1910
|
+
full_vector.assign(dim, 0);
|
|
1911
|
+
for (HighsInt iEl = 0; iEl < num_nz0; iEl++)
|
|
1912
|
+
full_vector[index0[iEl]] = value0[iEl];
|
|
1913
|
+
for (HighsInt iEl = 0; iEl < num_nz1; iEl++) {
|
|
1914
|
+
HighsInt iRow = index1[iEl];
|
|
1915
|
+
if (full_vector[iRow] != value1[iEl]) {
|
|
1916
|
+
if (dev_run)
|
|
1917
|
+
printf("vector0[%d] = %g <> %g = vector1[%d]\n", int(iRow),
|
|
1918
|
+
full_vector[iRow], value1[iEl], int(iRow));
|
|
1919
|
+
return false;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
full_vector[iRow] = 0;
|
|
1923
|
+
}
|
|
1924
|
+
for (HighsInt iRow = 0; iRow < dim; iRow++)
|
|
1925
|
+
if (full_vector[iRow]) {
|
|
1926
|
+
if (dev_run)
|
|
1927
|
+
printf("Full vector[%d] = %g, not zero\n", int(iRow),
|
|
1928
|
+
full_vector[iRow]);
|
|
1929
|
+
return false;
|
|
1930
|
+
}
|
|
1931
|
+
return true;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
TEST_CASE("resize-integrality", "[highs_data]") {
|
|
1935
|
+
Highs highs;
|
|
1936
|
+
highs.setOptionValue("output_flag", dev_run);
|
|
1937
|
+
SpecialLps special_lps;
|
|
1938
|
+
HighsLp lp;
|
|
1939
|
+
HighsModelStatus require_model_status;
|
|
1940
|
+
double optimal_objective;
|
|
1941
|
+
special_lps.distillationLp(lp, require_model_status, optimal_objective);
|
|
1942
|
+
HighsInt original_num_col = lp.num_col_;
|
|
1943
|
+
for (HighsInt k = 0; k < 4; k++) {
|
|
1944
|
+
// k = 0: Add continuous column to LP, so final integrality.size() should be
|
|
1945
|
+
// 0
|
|
1946
|
+
//
|
|
1947
|
+
// k = 1: Add continuous column to IP, so final integrality.size() should be
|
|
1948
|
+
// full
|
|
1949
|
+
//
|
|
1950
|
+
// k = 2: Add integer column to LP, so final integrality.size() should be
|
|
1951
|
+
// full
|
|
1952
|
+
//
|
|
1953
|
+
// k = 3: Add integer column to IP, so final integrality.size() should be
|
|
1954
|
+
// full
|
|
1955
|
+
if (k == 1 || k == 3) {
|
|
1956
|
+
lp.integrality_.assign(original_num_col, HighsVarType::kInteger);
|
|
1957
|
+
} else {
|
|
1958
|
+
lp.integrality_.clear();
|
|
1959
|
+
}
|
|
1960
|
+
REQUIRE(highs.passModel(lp) == HighsStatus::kOk);
|
|
1961
|
+
REQUIRE(highs.getNumCol() == original_num_col);
|
|
1962
|
+
double cost = 0.0;
|
|
1963
|
+
double lower = 0.0;
|
|
1964
|
+
double upper = 1.0;
|
|
1965
|
+
highs.addCols(1, &cost, &lower, &upper, 0, nullptr, nullptr, nullptr);
|
|
1966
|
+
const std::vector<HighsVarType>& integrality = highs.getLp().integrality_;
|
|
1967
|
+
if (k == 0 || k == 2) {
|
|
1968
|
+
// Model is LP
|
|
1969
|
+
REQUIRE(int(integrality.size()) == 0);
|
|
1970
|
+
} else {
|
|
1971
|
+
// Model is MIP
|
|
1972
|
+
REQUIRE(int(integrality.size()) == int(original_num_col + 1));
|
|
1973
|
+
}
|
|
1974
|
+
if (k >= 2)
|
|
1975
|
+
REQUIRE(highs.changeColIntegrality(2, HighsVarType::kInteger) ==
|
|
1976
|
+
HighsStatus::kOk);
|
|
1977
|
+
if (k == 0) {
|
|
1978
|
+
// Model is LP
|
|
1979
|
+
REQUIRE(int(integrality.size()) == 0);
|
|
1980
|
+
} else {
|
|
1981
|
+
// Model is MIP
|
|
1982
|
+
REQUIRE(int(integrality.size()) == int(original_num_col + 1));
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
TEST_CASE("modify-empty-model", "[highs_data]") {
|
|
1988
|
+
Highs highs;
|
|
1989
|
+
highs.setOptionValue("output_flag", dev_run);
|
|
1990
|
+
REQUIRE(highs.changeColIntegrality(0, HighsVarType::kInteger) ==
|
|
1991
|
+
HighsStatus::kError);
|
|
1992
|
+
REQUIRE(highs.changeColCost(0, 1) == HighsStatus::kError);
|
|
1993
|
+
REQUIRE(highs.changeColBounds(0, 1, 1) == HighsStatus::kError);
|
|
1994
|
+
REQUIRE(highs.changeRowBounds(0, 1, 1) == HighsStatus::kError);
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
TEST_CASE("zero-matrix-entries", "[highs_data]") {
|
|
1998
|
+
Highs highs;
|
|
1999
|
+
highs.setOptionValue("output_flag", dev_run);
|
|
2000
|
+
HighsLp lp;
|
|
2001
|
+
lp.num_col_ = 2;
|
|
2002
|
+
lp.num_row_ = 2;
|
|
2003
|
+
lp.col_cost_ = {0, 0};
|
|
2004
|
+
lp.col_lower_ = {0, 0};
|
|
2005
|
+
lp.col_upper_ = {1, 1};
|
|
2006
|
+
lp.row_lower_ = {-kHighsInf, -kHighsInf};
|
|
2007
|
+
lp.row_upper_ = {5, 8};
|
|
2008
|
+
lp.a_matrix_.start_ = {0, 2, 4};
|
|
2009
|
+
lp.a_matrix_.index_ = {0, 1, 0, 1};
|
|
2010
|
+
lp.a_matrix_.value_ = {1, 0, 0, 1};
|
|
2011
|
+
REQUIRE(highs.passModel(lp) == HighsStatus::kOk);
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
void testAvgasGetRow(Highs& h) {
|
|
2015
|
+
Avgas avgas;
|
|
2016
|
+
double lower;
|
|
2017
|
+
double upper;
|
|
2018
|
+
std::vector<HighsInt> index;
|
|
2019
|
+
std::vector<double> value;
|
|
2020
|
+
HighsInt get_num;
|
|
2021
|
+
HighsInt lp_nnz;
|
|
2022
|
+
std::vector<double> lp_cost(1);
|
|
2023
|
+
std::vector<double> lp_lower(1);
|
|
2024
|
+
std::vector<double> lp_upper(1);
|
|
2025
|
+
std::vector<HighsInt> lp_start(1);
|
|
2026
|
+
std::vector<HighsInt> lp_index(avgas_num_col);
|
|
2027
|
+
std::vector<double> lp_value(avgas_num_col);
|
|
2028
|
+
std::vector<HighsInt> set(1);
|
|
2029
|
+
std::vector<HighsInt> mask(avgas_num_row);
|
|
2030
|
+
for (HighsInt row = 0; row < avgas_num_row; row++) {
|
|
2031
|
+
avgas.getRow(row, lower, upper, index, value);
|
|
2032
|
+
HighsInt avgas_nnz = index.size();
|
|
2033
|
+
h.getRows(row, row, get_num, lp_lower.data(), lp_upper.data(), lp_nnz,
|
|
2034
|
+
lp_start.data(), lp_index.data(), lp_value.data());
|
|
2035
|
+
REQUIRE(lp_lower[0] == lower);
|
|
2036
|
+
REQUIRE(lp_upper[0] == upper);
|
|
2037
|
+
REQUIRE(equalSparseVectors(avgas_num_col, avgas_nnz, index.data(),
|
|
2038
|
+
value.data(), lp_nnz, lp_index.data(),
|
|
2039
|
+
lp_value.data()));
|
|
2040
|
+
}
|
|
2041
|
+
HighsInt from_row = 2;
|
|
2042
|
+
HighsInt to_row = 5;
|
|
2043
|
+
HighsInt num_row = to_row - from_row + 1;
|
|
2044
|
+
lp_lower.resize(num_row);
|
|
2045
|
+
lp_upper.resize(num_row);
|
|
2046
|
+
lp_start.resize(num_row);
|
|
2047
|
+
lp_index.resize(num_row * avgas_num_col);
|
|
2048
|
+
lp_value.resize(num_row * avgas_num_col);
|
|
2049
|
+
h.getRows(from_row, to_row, get_num, lp_lower.data(), lp_upper.data(), lp_nnz,
|
|
2050
|
+
lp_start.data(), lp_index.data(), lp_value.data());
|
|
2051
|
+
REQUIRE(get_num == num_row);
|
|
2052
|
+
for (HighsInt row = 0; row < num_row; row++) {
|
|
2053
|
+
HighsInt avgas_row = from_row + row;
|
|
2054
|
+
avgas.getRow(avgas_row, lower, upper, index, value);
|
|
2055
|
+
HighsInt avgas_nnz = index.size();
|
|
2056
|
+
REQUIRE(lp_lower[row] == lower);
|
|
2057
|
+
REQUIRE(lp_upper[row] == upper);
|
|
2058
|
+
HighsInt from_el = lp_start[row];
|
|
2059
|
+
HighsInt lp_col_nnz =
|
|
2060
|
+
row < num_row - 1 ? lp_start[row + 1] - from_el : lp_nnz - from_el;
|
|
2061
|
+
REQUIRE(equalSparseVectors(avgas_num_col, avgas_nnz, index.data(),
|
|
2062
|
+
value.data(), lp_col_nnz, &lp_index[from_el],
|
|
2063
|
+
&lp_value[from_el]));
|
|
2064
|
+
}
|
|
2065
|
+
set = {1, 2, 3, 6, 7};
|
|
2066
|
+
num_row = set.size();
|
|
2067
|
+
lp_lower.resize(num_row);
|
|
2068
|
+
lp_upper.resize(num_row);
|
|
2069
|
+
lp_start.resize(num_row);
|
|
2070
|
+
lp_index.resize(num_row * avgas_num_col);
|
|
2071
|
+
lp_value.resize(num_row * avgas_num_col);
|
|
2072
|
+
h.getRows(num_row, set.data(), get_num, lp_lower.data(), lp_upper.data(),
|
|
2073
|
+
lp_nnz, lp_start.data(), lp_index.data(), lp_value.data());
|
|
2074
|
+
REQUIRE(get_num == num_row);
|
|
2075
|
+
for (HighsInt row = 0; row < num_row; row++) {
|
|
2076
|
+
HighsInt avgas_row = set[row];
|
|
2077
|
+
avgas.getRow(avgas_row, lower, upper, index, value);
|
|
2078
|
+
HighsInt avgas_nnz = index.size();
|
|
2079
|
+
REQUIRE(lp_lower[row] == lower);
|
|
2080
|
+
REQUIRE(lp_upper[row] == upper);
|
|
2081
|
+
HighsInt from_el = lp_start[row];
|
|
2082
|
+
HighsInt lp_col_nnz =
|
|
2083
|
+
row < num_row - 1 ? lp_start[row + 1] - from_el : lp_nnz - from_el;
|
|
2084
|
+
REQUIRE(equalSparseVectors(avgas_num_col, avgas_nnz, index.data(),
|
|
2085
|
+
value.data(), lp_col_nnz, &lp_index[from_el],
|
|
2086
|
+
&lp_value[from_el]));
|
|
2087
|
+
}
|
|
2088
|
+
mask[0] = 1;
|
|
2089
|
+
mask[1] = 1;
|
|
2090
|
+
mask[4] = 1;
|
|
2091
|
+
mask[6] = 1;
|
|
2092
|
+
mask[7] = 1;
|
|
2093
|
+
num_row = 5;
|
|
2094
|
+
lp_lower.resize(num_row);
|
|
2095
|
+
lp_upper.resize(num_row);
|
|
2096
|
+
lp_start.resize(num_row);
|
|
2097
|
+
lp_index.resize(num_row * avgas_num_col);
|
|
2098
|
+
lp_value.resize(num_row * avgas_num_col);
|
|
2099
|
+
h.getRows(mask.data(), get_num, lp_lower.data(), lp_upper.data(), lp_nnz,
|
|
2100
|
+
lp_start.data(), lp_index.data(), lp_value.data());
|
|
2101
|
+
REQUIRE(get_num == num_row);
|
|
2102
|
+
HighsInt row = 0;
|
|
2103
|
+
for (HighsInt iRow = 0; iRow < avgas_num_row; iRow++) {
|
|
2104
|
+
if (!mask[iRow]) continue;
|
|
2105
|
+
HighsInt avgas_row = iRow;
|
|
2106
|
+
avgas.getRow(avgas_row, lower, upper, index, value);
|
|
2107
|
+
HighsInt avgas_nnz = index.size();
|
|
2108
|
+
REQUIRE(lp_lower[row] == lower);
|
|
2109
|
+
REQUIRE(lp_upper[row] == upper);
|
|
2110
|
+
HighsInt from_el = lp_start[row];
|
|
2111
|
+
HighsInt lp_col_nnz =
|
|
2112
|
+
row < num_row - 1 ? lp_start[row + 1] - from_el : lp_nnz - from_el;
|
|
2113
|
+
REQUIRE(equalSparseVectors(avgas_num_col, avgas_nnz, index.data(),
|
|
2114
|
+
value.data(), lp_col_nnz, &lp_index[from_el],
|
|
2115
|
+
&lp_value[from_el]));
|
|
2116
|
+
row++;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
void testAvgasGetCol(Highs& h) {
|
|
2121
|
+
Avgas avgas;
|
|
2122
|
+
double cost;
|
|
2123
|
+
double lower;
|
|
2124
|
+
double upper;
|
|
2125
|
+
std::vector<HighsInt> index;
|
|
2126
|
+
std::vector<double> value;
|
|
2127
|
+
HighsInt get_num;
|
|
2128
|
+
HighsInt lp_nnz;
|
|
2129
|
+
std::vector<double> lp_cost(1);
|
|
2130
|
+
std::vector<double> lp_lower(1);
|
|
2131
|
+
std::vector<double> lp_upper(1);
|
|
2132
|
+
std::vector<HighsInt> lp_start(1);
|
|
2133
|
+
std::vector<HighsInt> lp_index(avgas_num_row);
|
|
2134
|
+
std::vector<double> lp_value(avgas_num_row);
|
|
2135
|
+
std::vector<HighsInt> set(1);
|
|
2136
|
+
std::vector<HighsInt> mask(avgas_num_col);
|
|
2137
|
+
mask.assign(avgas_num_col, 0);
|
|
2138
|
+
for (HighsInt col = 0; col < avgas_num_col; col++) {
|
|
2139
|
+
avgas.getCol(col, cost, lower, upper, index, value);
|
|
2140
|
+
HighsInt avgas_nnz = index.size();
|
|
2141
|
+
h.getCols(col, col, get_num, lp_cost.data(), lp_lower.data(),
|
|
2142
|
+
lp_upper.data(), lp_nnz, lp_start.data(), lp_index.data(),
|
|
2143
|
+
lp_value.data());
|
|
2144
|
+
REQUIRE(lp_cost[0] == cost);
|
|
2145
|
+
REQUIRE(lp_lower[0] == lower);
|
|
2146
|
+
REQUIRE(lp_upper[0] == upper);
|
|
2147
|
+
REQUIRE(equalSparseVectors(avgas_num_row, avgas_nnz, index.data(),
|
|
2148
|
+
value.data(), lp_nnz, lp_index.data(),
|
|
2149
|
+
lp_value.data()));
|
|
2150
|
+
set[0] = col;
|
|
2151
|
+
h.getCols(1, set.data(), get_num, lp_cost.data(), lp_lower.data(),
|
|
2152
|
+
lp_upper.data(), lp_nnz, lp_start.data(), lp_index.data(),
|
|
2153
|
+
lp_value.data());
|
|
2154
|
+
REQUIRE(lp_cost[0] == cost);
|
|
2155
|
+
REQUIRE(lp_lower[0] == lower);
|
|
2156
|
+
REQUIRE(lp_upper[0] == upper);
|
|
2157
|
+
REQUIRE(equalSparseVectors(avgas_num_row, avgas_nnz, index.data(),
|
|
2158
|
+
value.data(), lp_nnz, lp_index.data(),
|
|
2159
|
+
lp_value.data()));
|
|
2160
|
+
mask[col] = 1;
|
|
2161
|
+
h.getCols(mask.data(), get_num, lp_cost.data(), lp_lower.data(),
|
|
2162
|
+
lp_upper.data(), lp_nnz, lp_start.data(), lp_index.data(),
|
|
2163
|
+
lp_value.data());
|
|
2164
|
+
REQUIRE(lp_cost[0] == cost);
|
|
2165
|
+
REQUIRE(lp_lower[0] == lower);
|
|
2166
|
+
REQUIRE(lp_upper[0] == upper);
|
|
2167
|
+
REQUIRE(equalSparseVectors(avgas_num_row, avgas_nnz, index.data(),
|
|
2168
|
+
value.data(), lp_nnz, lp_index.data(),
|
|
2169
|
+
lp_value.data()));
|
|
2170
|
+
mask[col] = 0;
|
|
2171
|
+
}
|
|
2172
|
+
HighsInt from_col = 2;
|
|
2173
|
+
HighsInt to_col = 5;
|
|
2174
|
+
HighsInt num_col = to_col - from_col + 1;
|
|
2175
|
+
lp_cost.resize(num_col);
|
|
2176
|
+
lp_lower.resize(num_col);
|
|
2177
|
+
lp_upper.resize(num_col);
|
|
2178
|
+
lp_start.resize(num_col);
|
|
2179
|
+
lp_index.resize(num_col * avgas_num_row);
|
|
2180
|
+
lp_value.resize(num_col * avgas_num_row);
|
|
2181
|
+
h.getCols(from_col, to_col, get_num, lp_cost.data(), lp_lower.data(),
|
|
2182
|
+
lp_upper.data(), lp_nnz, lp_start.data(), lp_index.data(),
|
|
2183
|
+
lp_value.data());
|
|
2184
|
+
REQUIRE(get_num == num_col);
|
|
2185
|
+
for (HighsInt col = 0; col < num_col; col++) {
|
|
2186
|
+
HighsInt avgas_col = from_col + col;
|
|
2187
|
+
avgas.getCol(avgas_col, cost, lower, upper, index, value);
|
|
2188
|
+
HighsInt avgas_nnz = index.size();
|
|
2189
|
+
REQUIRE(lp_cost[col] == cost);
|
|
2190
|
+
REQUIRE(lp_lower[col] == lower);
|
|
2191
|
+
REQUIRE(lp_upper[col] == upper);
|
|
2192
|
+
HighsInt from_el = lp_start[col];
|
|
2193
|
+
HighsInt lp_row_nnz =
|
|
2194
|
+
col < num_col - 1 ? lp_start[col + 1] - from_el : lp_nnz - from_el;
|
|
2195
|
+
REQUIRE(equalSparseVectors(avgas_num_row, avgas_nnz, index.data(),
|
|
2196
|
+
value.data(), lp_row_nnz, &lp_index[from_el],
|
|
2197
|
+
&lp_value[from_el]));
|
|
2198
|
+
}
|
|
2199
|
+
set = {1, 2, 3, 6, 7};
|
|
2200
|
+
num_col = set.size();
|
|
2201
|
+
lp_cost.resize(num_col);
|
|
2202
|
+
lp_lower.resize(num_col);
|
|
2203
|
+
lp_upper.resize(num_col);
|
|
2204
|
+
lp_start.resize(num_col);
|
|
2205
|
+
lp_index.resize(num_col * avgas_num_row);
|
|
2206
|
+
lp_value.resize(num_col * avgas_num_row);
|
|
2207
|
+
h.getCols(num_col, set.data(), get_num, lp_cost.data(), lp_lower.data(),
|
|
2208
|
+
lp_upper.data(), lp_nnz, lp_start.data(), lp_index.data(),
|
|
2209
|
+
lp_value.data());
|
|
2210
|
+
REQUIRE(get_num == num_col);
|
|
2211
|
+
for (HighsInt col = 0; col < num_col; col++) {
|
|
2212
|
+
HighsInt avgas_col = set[col];
|
|
2213
|
+
avgas.getCol(avgas_col, cost, lower, upper, index, value);
|
|
2214
|
+
HighsInt avgas_nnz = index.size();
|
|
2215
|
+
REQUIRE(lp_cost[col] == cost);
|
|
2216
|
+
REQUIRE(lp_lower[col] == lower);
|
|
2217
|
+
REQUIRE(lp_upper[col] == upper);
|
|
2218
|
+
HighsInt from_el = lp_start[col];
|
|
2219
|
+
HighsInt lp_row_nnz =
|
|
2220
|
+
col < num_col - 1 ? lp_start[col + 1] - from_el : lp_nnz - from_el;
|
|
2221
|
+
REQUIRE(equalSparseVectors(avgas_num_row, avgas_nnz, index.data(),
|
|
2222
|
+
value.data(), lp_row_nnz, &lp_index[from_el],
|
|
2223
|
+
&lp_value[from_el]));
|
|
2224
|
+
}
|
|
2225
|
+
mask[0] = 1;
|
|
2226
|
+
mask[1] = 1;
|
|
2227
|
+
mask[4] = 1;
|
|
2228
|
+
mask[6] = 1;
|
|
2229
|
+
mask[7] = 1;
|
|
2230
|
+
num_col = 5;
|
|
2231
|
+
lp_cost.resize(num_col);
|
|
2232
|
+
lp_lower.resize(num_col);
|
|
2233
|
+
lp_upper.resize(num_col);
|
|
2234
|
+
lp_start.resize(num_col);
|
|
2235
|
+
lp_index.resize(num_col * avgas_num_row);
|
|
2236
|
+
lp_value.resize(num_col * avgas_num_row);
|
|
2237
|
+
h.getCols(mask.data(), get_num, lp_cost.data(), lp_lower.data(),
|
|
2238
|
+
lp_upper.data(), lp_nnz, lp_start.data(), lp_index.data(),
|
|
2239
|
+
lp_value.data());
|
|
2240
|
+
REQUIRE(get_num == num_col);
|
|
2241
|
+
HighsInt col = 0;
|
|
2242
|
+
for (HighsInt iCol = 0; iCol < avgas_num_col; iCol++) {
|
|
2243
|
+
if (!mask[iCol]) continue;
|
|
2244
|
+
HighsInt avgas_col = iCol;
|
|
2245
|
+
avgas.getCol(avgas_col, cost, lower, upper, index, value);
|
|
2246
|
+
HighsInt avgas_nnz = index.size();
|
|
2247
|
+
REQUIRE(lp_cost[col] == cost);
|
|
2248
|
+
REQUIRE(lp_lower[col] == lower);
|
|
2249
|
+
REQUIRE(lp_upper[col] == upper);
|
|
2250
|
+
HighsInt from_el = lp_start[col];
|
|
2251
|
+
HighsInt lp_row_nnz =
|
|
2252
|
+
col < num_col - 1 ? lp_start[col + 1] - from_el : lp_nnz - from_el;
|
|
2253
|
+
REQUIRE(equalSparseVectors(avgas_num_row, avgas_nnz, index.data(),
|
|
2254
|
+
value.data(), lp_row_nnz, &lp_index[from_el],
|
|
2255
|
+
&lp_value[from_el]));
|
|
2256
|
+
col++;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
TEST_CASE("row-wise-get-row-avgas", "[highs_data]") {
|
|
2261
|
+
Avgas avgas;
|
|
2262
|
+
const HighsInt avgas_num_col = 8;
|
|
2263
|
+
const HighsInt avgas_num_row = 10;
|
|
2264
|
+
|
|
2265
|
+
Highs h;
|
|
2266
|
+
h.setOptionValue("output_flag", dev_run);
|
|
2267
|
+
double cost;
|
|
2268
|
+
double lower;
|
|
2269
|
+
double upper;
|
|
2270
|
+
std::vector<HighsInt> index;
|
|
2271
|
+
std::vector<double> value;
|
|
2272
|
+
|
|
2273
|
+
for (HighsInt col = 0; col < avgas_num_col; col++) {
|
|
2274
|
+
avgas.getCol(col, cost, lower, upper, index, value);
|
|
2275
|
+
REQUIRE(h.addCol(cost, lower, upper, 0, nullptr, nullptr) ==
|
|
2276
|
+
HighsStatus::kOk);
|
|
2277
|
+
}
|
|
2278
|
+
for (HighsInt row = 0; row < avgas_num_row; row++) {
|
|
2279
|
+
avgas.getRow(row, lower, upper, index, value);
|
|
2280
|
+
HighsInt avgas_nnz = index.size();
|
|
2281
|
+
REQUIRE(h.addRow(lower, upper, avgas_nnz, index.data(), value.data()) ==
|
|
2282
|
+
HighsStatus::kOk);
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
// Test extraction of rows and columns, with rowwise and colwise
|
|
2286
|
+
// internal storage
|
|
2287
|
+
h.ensureRowwise();
|
|
2288
|
+
testAvgasGetRow(h);
|
|
2289
|
+
testAvgasGetCol(h);
|
|
2290
|
+
|
|
2291
|
+
h.ensureColwise();
|
|
2292
|
+
testAvgasGetRow(h);
|
|
2293
|
+
testAvgasGetCol(h);
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
TEST_CASE("hot-start-after-delete", "[highs_data]") {
|
|
2297
|
+
Highs h;
|
|
2298
|
+
h.setOptionValue("output_flag", dev_run);
|
|
2299
|
+
const HighsLp& lp = h.getLp();
|
|
2300
|
+
const HighsInfo& info = h.getInfo();
|
|
2301
|
+
const HighsBasis& basis = h.getBasis();
|
|
2302
|
+
const HighsSolution& solution = h.getSolution();
|
|
2303
|
+
std::string model = "avgas";
|
|
2304
|
+
std::string model_file =
|
|
2305
|
+
std::string(HIGHS_DIR) + "/check/instances/" + model + ".mps";
|
|
2306
|
+
h.readModel(model_file);
|
|
2307
|
+
h.run();
|
|
2308
|
+
HighsInt ieration_count0 = info.simplex_iteration_count;
|
|
2309
|
+
if (dev_run)
|
|
2310
|
+
printf("Initial solve takes %d iterations and yields objective = %g\n",
|
|
2311
|
+
int(info.simplex_iteration_count), info.objective_function_value);
|
|
2312
|
+
|
|
2313
|
+
HighsInt max_dim = std::max(lp.num_col_, lp.num_row_);
|
|
2314
|
+
std::vector<double> cost(1);
|
|
2315
|
+
std::vector<double> lower(1);
|
|
2316
|
+
std::vector<double> upper(1);
|
|
2317
|
+
HighsInt nnz;
|
|
2318
|
+
std::vector<HighsInt> start(1);
|
|
2319
|
+
std::vector<HighsInt> index(max_dim);
|
|
2320
|
+
std::vector<double> value(max_dim);
|
|
2321
|
+
HighsInt get_num;
|
|
2322
|
+
HighsInt use_col, use_row;
|
|
2323
|
+
for (HighsInt k = 0; k < 2; k++) {
|
|
2324
|
+
if (dev_run) {
|
|
2325
|
+
for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++)
|
|
2326
|
+
printf("Col %2d is %s\n", int(iCol),
|
|
2327
|
+
basis.col_status[iCol] == HighsBasisStatus::kBasic ? "basic"
|
|
2328
|
+
: "nonbasic");
|
|
2329
|
+
printf("\n");
|
|
2330
|
+
}
|
|
2331
|
+
if (k == 0) {
|
|
2332
|
+
use_col = 1; // Nonbasic
|
|
2333
|
+
} else {
|
|
2334
|
+
use_col = 4; // Basic
|
|
2335
|
+
}
|
|
2336
|
+
if (dev_run)
|
|
2337
|
+
printf(
|
|
2338
|
+
"\nDeleting and adding column %1d with status \"%s\" and value %g\n",
|
|
2339
|
+
int(use_col),
|
|
2340
|
+
h.basisStatusToString(basis.col_status[use_col]).c_str(),
|
|
2341
|
+
solution.col_value[use_col]);
|
|
2342
|
+
|
|
2343
|
+
h.getCols(use_col, use_col, get_num, cost.data(), lower.data(),
|
|
2344
|
+
upper.data(), nnz, start.data(), index.data(), value.data());
|
|
2345
|
+
|
|
2346
|
+
h.deleteCols(use_col, use_col);
|
|
2347
|
+
if (dev_run) basis.printScalars();
|
|
2348
|
+
|
|
2349
|
+
h.addCol(cost[0], lower[0], upper[0], nnz, index.data(), value.data());
|
|
2350
|
+
|
|
2351
|
+
h.run();
|
|
2352
|
+
if (dev_run)
|
|
2353
|
+
printf(
|
|
2354
|
+
"After deleting and adding column %1d, solve takes %d iterations and "
|
|
2355
|
+
"yields objective = %g\n",
|
|
2356
|
+
int(use_col), int(info.simplex_iteration_count),
|
|
2357
|
+
info.objective_function_value);
|
|
2358
|
+
REQUIRE(info.simplex_iteration_count < ieration_count0);
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
for (HighsInt k = 0; k < 2; k++) {
|
|
2362
|
+
if (dev_run) {
|
|
2363
|
+
for (HighsInt iRow = 0; iRow < lp.num_row_; iRow++)
|
|
2364
|
+
printf("Row %2d is %s\n", int(iRow),
|
|
2365
|
+
basis.row_status[iRow] == HighsBasisStatus::kBasic ? "basic"
|
|
2366
|
+
: "nonbasic");
|
|
2367
|
+
}
|
|
2368
|
+
if (k == 0) {
|
|
2369
|
+
use_row = 1; // Nonbasic
|
|
2370
|
+
} else {
|
|
2371
|
+
use_row = 8; // Basic
|
|
2372
|
+
}
|
|
2373
|
+
if (dev_run)
|
|
2374
|
+
printf("\nDeleting and adding row %1d with status \"%s\" and value %g\n",
|
|
2375
|
+
int(use_row),
|
|
2376
|
+
h.basisStatusToString(basis.row_status[use_row]).c_str(),
|
|
2377
|
+
solution.row_value[use_row]);
|
|
2378
|
+
|
|
2379
|
+
h.getRows(use_row, use_row, get_num, lower.data(), upper.data(), nnz,
|
|
2380
|
+
start.data(), index.data(), value.data());
|
|
2381
|
+
|
|
2382
|
+
h.deleteRows(use_row, use_row);
|
|
2383
|
+
if (dev_run) basis.printScalars();
|
|
2384
|
+
|
|
2385
|
+
h.addRow(lower[0], upper[0], nnz, index.data(), value.data());
|
|
2386
|
+
|
|
2387
|
+
h.run();
|
|
2388
|
+
if (dev_run)
|
|
2389
|
+
printf(
|
|
2390
|
+
"After deleting and adding row %1d, solve takes %d iterations and "
|
|
2391
|
+
"yields objective = %g\n",
|
|
2392
|
+
int(use_row), int(info.simplex_iteration_count),
|
|
2393
|
+
info.objective_function_value);
|
|
2394
|
+
REQUIRE(info.simplex_iteration_count < ieration_count0);
|
|
2395
|
+
}
|
|
2396
|
+
std::vector<HighsInt> set = {1, 3, 4};
|
|
2397
|
+
HighsInt num_set_en = set.size();
|
|
2398
|
+
cost.resize(num_set_en);
|
|
2399
|
+
lower.resize(num_set_en);
|
|
2400
|
+
upper.resize(num_set_en);
|
|
2401
|
+
start.resize(num_set_en);
|
|
2402
|
+
index.resize(num_set_en * max_dim);
|
|
2403
|
+
value.resize(num_set_en * max_dim);
|
|
2404
|
+
|
|
2405
|
+
h.getCols(num_set_en, set.data(), get_num, cost.data(), lower.data(),
|
|
2406
|
+
upper.data(), nnz, start.data(), index.data(), value.data());
|
|
2407
|
+
|
|
2408
|
+
h.deleteCols(num_set_en, set.data());
|
|
2409
|
+
if (dev_run) basis.printScalars();
|
|
2410
|
+
|
|
2411
|
+
h.addCols(get_num, cost.data(), lower.data(), upper.data(), nnz, start.data(),
|
|
2412
|
+
index.data(), value.data());
|
|
2413
|
+
|
|
2414
|
+
h.run();
|
|
2415
|
+
if (dev_run)
|
|
2416
|
+
printf(
|
|
2417
|
+
"After deleting and adding %d columns in set, solve takes %d "
|
|
2418
|
+
"iterations and yields objective = %g\n",
|
|
2419
|
+
int(get_num), int(info.simplex_iteration_count),
|
|
2420
|
+
info.objective_function_value);
|
|
2421
|
+
// REQUIRE(info.simplex_iteration_count < ieration_count0);
|
|
2422
|
+
|
|
2423
|
+
h.getRows(num_set_en, set.data(), get_num, lower.data(), upper.data(), nnz,
|
|
2424
|
+
start.data(), index.data(), value.data());
|
|
2425
|
+
|
|
2426
|
+
h.deleteRows(num_set_en, set.data());
|
|
2427
|
+
if (dev_run) basis.printScalars();
|
|
2428
|
+
|
|
2429
|
+
h.addRows(get_num, lower.data(), upper.data(), nnz, start.data(),
|
|
2430
|
+
index.data(), value.data());
|
|
2431
|
+
|
|
2432
|
+
h.run();
|
|
2433
|
+
if (dev_run)
|
|
2434
|
+
printf(
|
|
2435
|
+
"After deleting and adding %d rows in set, solve takes %d iterations "
|
|
2436
|
+
"and yields objective = %g\n",
|
|
2437
|
+
int(get_num), int(info.simplex_iteration_count),
|
|
2438
|
+
info.objective_function_value);
|
|
2439
|
+
// REQUIRE(info.simplex_iteration_count < ieration_count0);
|
|
2440
|
+
std::vector<HighsInt> mask;
|
|
2441
|
+
mask.assign(max_dim, 0);
|
|
2442
|
+
mask[1] = 1;
|
|
2443
|
+
mask[4] = 1;
|
|
2444
|
+
mask[5] = 1;
|
|
2445
|
+
|
|
2446
|
+
h.getCols(mask.data(), get_num, cost.data(), lower.data(), upper.data(), nnz,
|
|
2447
|
+
start.data(), index.data(), value.data());
|
|
2448
|
+
|
|
2449
|
+
h.deleteCols(mask.data());
|
|
2450
|
+
if (dev_run) basis.printScalars();
|
|
2451
|
+
|
|
2452
|
+
h.addCols(get_num, cost.data(), lower.data(), upper.data(), nnz, start.data(),
|
|
2453
|
+
index.data(), value.data());
|
|
2454
|
+
|
|
2455
|
+
h.run();
|
|
2456
|
+
if (dev_run)
|
|
2457
|
+
printf(
|
|
2458
|
+
"After deleting and adding %d columns in mask, solve takes %d "
|
|
2459
|
+
"iterations and yields objective = %g\n",
|
|
2460
|
+
int(get_num), int(info.simplex_iteration_count),
|
|
2461
|
+
info.objective_function_value);
|
|
2462
|
+
// REQUIRE(info.simplex_iteration_count < ieration_count0);
|
|
2463
|
+
|
|
2464
|
+
mask.assign(max_dim, 0);
|
|
2465
|
+
mask[1] = 1;
|
|
2466
|
+
mask[4] = 1;
|
|
2467
|
+
mask[5] = 1;
|
|
2468
|
+
mask[8] = 1;
|
|
2469
|
+
mask[9] = 1;
|
|
2470
|
+
HighsInt num_mask_en = mask.size();
|
|
2471
|
+
cost.resize(num_mask_en);
|
|
2472
|
+
lower.resize(num_mask_en);
|
|
2473
|
+
upper.resize(num_mask_en);
|
|
2474
|
+
start.resize(num_mask_en);
|
|
2475
|
+
index.resize(num_mask_en * max_dim);
|
|
2476
|
+
value.resize(num_mask_en * max_dim);
|
|
2477
|
+
|
|
2478
|
+
h.getRows(mask.data(), get_num, lower.data(), upper.data(), nnz, start.data(),
|
|
2479
|
+
index.data(), value.data());
|
|
2480
|
+
|
|
2481
|
+
h.deleteRows(mask.data());
|
|
2482
|
+
if (dev_run) basis.printScalars();
|
|
2483
|
+
|
|
2484
|
+
h.addRows(get_num, lower.data(), upper.data(), nnz, start.data(),
|
|
2485
|
+
index.data(), value.data());
|
|
2486
|
+
|
|
2487
|
+
h.run();
|
|
2488
|
+
if (dev_run)
|
|
2489
|
+
printf(
|
|
2490
|
+
"After deleting and adding %d rows in mask, solve takes %d iterations "
|
|
2491
|
+
"and yields objective = %g\n",
|
|
2492
|
+
int(get_num), int(info.simplex_iteration_count),
|
|
2493
|
+
info.objective_function_value);
|
|
2494
|
+
// REQUIRE(info.simplex_iteration_count < ieration_count0);
|
|
2495
|
+
|
|
2496
|
+
h.resetGlobalScheduler(true);
|
|
2497
|
+
}
|