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,2236 @@
|
|
|
1
|
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
2
|
+
/* */
|
|
3
|
+
/* This file is part of the HiGHS linear optimization suite */
|
|
4
|
+
/* */
|
|
5
|
+
/* Available as open-source under the MIT License */
|
|
6
|
+
/* */
|
|
7
|
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
8
|
+
#include "mip/HighsCliqueTable.h"
|
|
9
|
+
|
|
10
|
+
#include <algorithm>
|
|
11
|
+
#include <cassert>
|
|
12
|
+
#include <cstdio>
|
|
13
|
+
#include <numeric>
|
|
14
|
+
|
|
15
|
+
#include "../extern/pdqsort/pdqsort.h"
|
|
16
|
+
#include "mip/HighsCutPool.h"
|
|
17
|
+
#include "mip/HighsDomain.h"
|
|
18
|
+
#include "mip/HighsMipSolver.h"
|
|
19
|
+
#include "mip/HighsMipSolverData.h"
|
|
20
|
+
#include "parallel/HighsCombinable.h"
|
|
21
|
+
#include "parallel/HighsParallel.h"
|
|
22
|
+
#include "presolve/HighsPostsolveStack.h"
|
|
23
|
+
#include "util/HighsSplay.h"
|
|
24
|
+
|
|
25
|
+
#define ADD_ZERO_WEIGHT_VARS
|
|
26
|
+
|
|
27
|
+
static std::pair<HighsCliqueTable::CliqueVar, HighsCliqueTable::CliqueVar>
|
|
28
|
+
sortedEdge(HighsCliqueTable::CliqueVar v1, HighsCliqueTable::CliqueVar v2) {
|
|
29
|
+
if (v1.col > v2.col) return std::make_pair(v2, v1);
|
|
30
|
+
|
|
31
|
+
return std::make_pair(v1, v2);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void HighsCliqueTable::unlink(HighsInt pos, HighsInt cliqueid) {
|
|
35
|
+
assert(pos >= 0);
|
|
36
|
+
--numcliquesvar[cliqueentries[pos].index()];
|
|
37
|
+
|
|
38
|
+
HighsInt cliquelen = cliques[cliqueid].end - cliques[cliqueid].start;
|
|
39
|
+
if (cliquelen == 2)
|
|
40
|
+
invertedHashListSizeTwo[cliqueentries[pos].index()].erase(cliqueid);
|
|
41
|
+
else
|
|
42
|
+
invertedHashList[cliqueentries[pos].index()].erase(cliqueid);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void HighsCliqueTable::link(HighsInt pos, HighsInt cliqueid) {
|
|
46
|
+
assert(pos >= 0);
|
|
47
|
+
assert(!colDeleted[cliqueentries[pos].col]);
|
|
48
|
+
++numcliquesvar[cliqueentries[pos].index()];
|
|
49
|
+
|
|
50
|
+
HighsInt cliquelen = cliques[cliqueid].end - cliques[cliqueid].start;
|
|
51
|
+
if (cliquelen == 2)
|
|
52
|
+
invertedHashListSizeTwo[cliqueentries[pos].index()].insert(cliqueid);
|
|
53
|
+
else
|
|
54
|
+
invertedHashList[cliqueentries[pos].index()].insert(cliqueid, pos);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
HighsInt HighsCliqueTable::findCommonCliqueId(int64_t& numQueries, CliqueVar v1,
|
|
58
|
+
CliqueVar v2) const {
|
|
59
|
+
++numQueries;
|
|
60
|
+
if (!invertedHashListSizeTwo[v1.index()].empty() &&
|
|
61
|
+
!invertedHashListSizeTwo[v2.index()].empty()) {
|
|
62
|
+
const HighsInt* sizeTwoCliqueId = sizeTwoCliques.find(sortedEdge(v1, v2));
|
|
63
|
+
if (sizeTwoCliqueId != nullptr) return *sizeTwoCliqueId;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const HighsHashTree<HighsInt, HighsInt>& h1 = invertedHashList[v1.index()];
|
|
67
|
+
const HighsHashTree<HighsInt, HighsInt>& h2 = invertedHashList[v2.index()];
|
|
68
|
+
|
|
69
|
+
const HighsHashTableEntry<HighsInt, HighsInt>* commonClique =
|
|
70
|
+
h1.find_common(h2);
|
|
71
|
+
|
|
72
|
+
if (commonClique) return commonClique->key();
|
|
73
|
+
return -1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
void HighsCliqueTable::resolveSubstitution(CliqueVar& v) const {
|
|
77
|
+
while (colsubstituted[v.col]) {
|
|
78
|
+
Substitution subst = substitutions[colsubstituted[v.col] - 1];
|
|
79
|
+
v = v.val == 1 ? subst.replace : subst.replace.complement();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
void HighsCliqueTable::resolveSubstitution(HighsInt& col, double& val,
|
|
84
|
+
double& offset) const {
|
|
85
|
+
while (colsubstituted[col]) {
|
|
86
|
+
Substitution subst = substitutions[colsubstituted[col] - 1];
|
|
87
|
+
if (subst.replace.val == 0) {
|
|
88
|
+
offset += val;
|
|
89
|
+
val = -val;
|
|
90
|
+
}
|
|
91
|
+
col = subst.replace.col;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
HighsInt HighsCliqueTable::runCliqueSubsumption(
|
|
96
|
+
const HighsDomain& globaldom, std::vector<CliqueVar>& clique) {
|
|
97
|
+
// remove deleted cols
|
|
98
|
+
clique.erase(
|
|
99
|
+
std::remove_if(clique.begin(), clique.end(),
|
|
100
|
+
[&](CliqueVar clqvar) { return colDeleted[clqvar.col]; }),
|
|
101
|
+
clique.end());
|
|
102
|
+
|
|
103
|
+
// return if clique does not have enough elements
|
|
104
|
+
if (clique.size() <= 2) return 0;
|
|
105
|
+
|
|
106
|
+
// callback for removing cliques
|
|
107
|
+
HighsInt nremoved = 0;
|
|
108
|
+
auto removeCliques = [&](HighsInt cliqueid) {
|
|
109
|
+
++nremoved;
|
|
110
|
+
cliques[cliqueid].origin = kHighsIInf;
|
|
111
|
+
removeClique(cliqueid);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// check clique
|
|
115
|
+
bool redundant;
|
|
116
|
+
HighsInt dominatingOrigin;
|
|
117
|
+
cliqueSubsumption(clique, redundant, dominatingOrigin, removeCliques);
|
|
118
|
+
|
|
119
|
+
if (redundant) clique.clear();
|
|
120
|
+
|
|
121
|
+
if (!infeasvertexstack.empty()) {
|
|
122
|
+
clique.erase(
|
|
123
|
+
std::remove_if(clique.begin(), clique.end(),
|
|
124
|
+
[&](CliqueVar v) { return globaldom.isFixed(v.col); }),
|
|
125
|
+
clique.end());
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return nremoved;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
void HighsCliqueTable::cliqueSubsumption(
|
|
132
|
+
const std::vector<CliqueVar>& clique, bool& redundant,
|
|
133
|
+
HighsInt& dominatingOrigin,
|
|
134
|
+
std::function<void(HighsInt)> removeCliqueCallback) {
|
|
135
|
+
// collect indices of cliques that contain variables from the
|
|
136
|
+
// provided vector
|
|
137
|
+
collectCliques(clique);
|
|
138
|
+
|
|
139
|
+
// initialise
|
|
140
|
+
redundant = false;
|
|
141
|
+
dominatingOrigin = kHighsIInf;
|
|
142
|
+
|
|
143
|
+
for (HighsInt cliqueid : cliquehitinds) {
|
|
144
|
+
// remember hits and zero out vector
|
|
145
|
+
HighsInt hits = cliquehits[cliqueid];
|
|
146
|
+
cliquehits[cliqueid] = 0;
|
|
147
|
+
|
|
148
|
+
if (hits == static_cast<HighsInt>(clique.size())) {
|
|
149
|
+
// clique is redundant
|
|
150
|
+
redundant = true;
|
|
151
|
+
if (cliques[cliqueid].origin != kHighsIInf &&
|
|
152
|
+
cliques[cliqueid].origin != -1)
|
|
153
|
+
dominatingOrigin = cliques[cliqueid].origin;
|
|
154
|
+
} else if (cliques[cliqueid].numActive() == hits) {
|
|
155
|
+
// clique is subset of another clique
|
|
156
|
+
if (cliques[cliqueid].equality) {
|
|
157
|
+
// subset of clique is an equality clique (stored in the clique table),
|
|
158
|
+
// thus the remaining variables can be fixed
|
|
159
|
+
bool sizeTwo = cliques[cliqueid].end - cliques[cliqueid].start == 2;
|
|
160
|
+
for (CliqueVar v : clique) {
|
|
161
|
+
bool vHasClq =
|
|
162
|
+
sizeTwo ? invertedHashListSizeTwo[v.index()].contains(cliqueid)
|
|
163
|
+
: invertedHashList[v.index()].contains(cliqueid);
|
|
164
|
+
if (!vHasClq) infeasvertexstack.push_back(v);
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
// clique from clique table contains a subset of the variables, thus it
|
|
168
|
+
// can be removed
|
|
169
|
+
removeCliqueCallback(cliqueid);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// clear vector of cliques indices
|
|
174
|
+
cliquehitinds.clear();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
void HighsCliqueTable::collectCliques(const std::vector<CliqueVar>& clique) {
|
|
178
|
+
// resize vector
|
|
179
|
+
if (cliquehits.size() < cliques.size()) cliquehits.resize(cliques.size());
|
|
180
|
+
|
|
181
|
+
// collect indices of cliques that contain variables from the
|
|
182
|
+
// provided vector
|
|
183
|
+
for (CliqueVar v : clique) {
|
|
184
|
+
invertedHashList[v.index()].for_each([&](HighsInt cliqueid) {
|
|
185
|
+
if (cliquehits[cliqueid] == 0) cliquehitinds.push_back(cliqueid);
|
|
186
|
+
++cliquehits[cliqueid];
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
invertedHashListSizeTwo[v.index()].for_each([&](HighsInt cliqueid) {
|
|
190
|
+
if (cliquehits[cliqueid] == 0) cliquehitinds.push_back(cliqueid);
|
|
191
|
+
++cliquehits[cliqueid];
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
void HighsCliqueTable::bronKerboschRecurse(BronKerboschData& data,
|
|
197
|
+
HighsInt Plen, const CliqueVar* X,
|
|
198
|
+
HighsInt Xlen) const {
|
|
199
|
+
double w = data.wR;
|
|
200
|
+
|
|
201
|
+
for (HighsInt i = 0; i != Plen; ++i) w += data.P[i].weight(data.sol);
|
|
202
|
+
|
|
203
|
+
if (w < data.minW - data.feastol) return;
|
|
204
|
+
|
|
205
|
+
if (Plen == 0 && Xlen == 0) {
|
|
206
|
+
std::vector<CliqueVar> clique = data.R;
|
|
207
|
+
|
|
208
|
+
if (data.minW < w - data.feastol) {
|
|
209
|
+
data.maxcliques -= data.cliques.size();
|
|
210
|
+
data.cliques.clear();
|
|
211
|
+
data.minW = w;
|
|
212
|
+
}
|
|
213
|
+
data.cliques.emplace_back(std::move(clique));
|
|
214
|
+
// do not further search for cliques that are violated less than this
|
|
215
|
+
// current clique
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
++data.ncalls;
|
|
220
|
+
|
|
221
|
+
if (data.stop()) return;
|
|
222
|
+
|
|
223
|
+
double pivweight = -1.0;
|
|
224
|
+
CliqueVar pivot{0, 0};
|
|
225
|
+
|
|
226
|
+
for (HighsInt i = 0; i != Xlen; ++i) {
|
|
227
|
+
if (X[i].weight(data.sol) > pivweight) {
|
|
228
|
+
pivweight = X[i].weight(data.sol);
|
|
229
|
+
pivot = X[i];
|
|
230
|
+
if (pivweight >= 1.0 - data.feastol) break;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (pivweight < 1.0 - data.feastol) {
|
|
235
|
+
for (HighsInt i = 0; i != Plen; ++i) {
|
|
236
|
+
if (data.P[i].weight(data.sol) > pivweight) {
|
|
237
|
+
pivweight = data.P[i].weight(data.sol);
|
|
238
|
+
pivot = data.P[i];
|
|
239
|
+
if (pivweight >= 1.0 - data.feastol) break;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
std::vector<CliqueVar> PminusNu;
|
|
245
|
+
PminusNu.reserve(Plen);
|
|
246
|
+
queryNeighbourhood(data.neighbourhoodInds, data.numNeighbourhoodQueries,
|
|
247
|
+
pivot, data.P.data(), Plen);
|
|
248
|
+
data.neighbourhoodInds.push_back(Plen);
|
|
249
|
+
HighsInt k = 0;
|
|
250
|
+
for (HighsInt i : data.neighbourhoodInds) {
|
|
251
|
+
while (k < i) PminusNu.push_back(data.P[k++]);
|
|
252
|
+
++k;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
pdqsort(PminusNu.begin(), PminusNu.end(), [&](CliqueVar a, CliqueVar b) {
|
|
256
|
+
return std::make_pair(a.weight(data.sol), a.index()) >
|
|
257
|
+
std::make_pair(b.weight(data.sol), b.index());
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
std::vector<CliqueVar> localX;
|
|
261
|
+
localX.insert(localX.end(), X, X + Xlen);
|
|
262
|
+
|
|
263
|
+
for (CliqueVar v : PminusNu) {
|
|
264
|
+
HighsInt newPlen = partitionNeighbourhood(data.neighbourhoodInds,
|
|
265
|
+
data.numNeighbourhoodQueries, v,
|
|
266
|
+
data.P.data(), Plen);
|
|
267
|
+
HighsInt newXlen = partitionNeighbourhood(data.neighbourhoodInds,
|
|
268
|
+
data.numNeighbourhoodQueries, v,
|
|
269
|
+
localX.data(), localX.size());
|
|
270
|
+
|
|
271
|
+
// add v to R, update the weight, and do the recursive call
|
|
272
|
+
data.R.push_back(v);
|
|
273
|
+
double wv = v.weight(data.sol);
|
|
274
|
+
data.wR += wv;
|
|
275
|
+
bronKerboschRecurse(data, newPlen, localX.data(), newXlen);
|
|
276
|
+
if (data.stop()) return;
|
|
277
|
+
|
|
278
|
+
// remove v from R restore the weight and continue the loop in this call
|
|
279
|
+
data.R.pop_back();
|
|
280
|
+
data.wR -= wv;
|
|
281
|
+
|
|
282
|
+
w -= wv;
|
|
283
|
+
if (w < data.minW) return;
|
|
284
|
+
// find the position of v in the vertices removed from P for the recursive
|
|
285
|
+
// call
|
|
286
|
+
// and also remove it from the set P for this call
|
|
287
|
+
HighsInt vpos = -1;
|
|
288
|
+
for (HighsInt i = newPlen; i != Plen; ++i) {
|
|
289
|
+
if (data.P[i] == v) {
|
|
290
|
+
vpos = i;
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// do the removal by first swapping it to the end of P and reduce the size
|
|
296
|
+
// of P accordingly
|
|
297
|
+
assert(vpos != -1);
|
|
298
|
+
|
|
299
|
+
--Plen;
|
|
300
|
+
std::swap(data.P[vpos], data.P[Plen]);
|
|
301
|
+
|
|
302
|
+
localX.push_back(v);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
#if 0
|
|
307
|
+
static void printRow(const HighsDomain& domain, const HighsInt* inds,
|
|
308
|
+
const double* vals, HighsInt len, double lhs, double rhs) {
|
|
309
|
+
printf("%g <= ", lhs);
|
|
310
|
+
|
|
311
|
+
for (HighsInt i = 0; i != len; ++i) {
|
|
312
|
+
char sign = vals[i] > 0 ? '+' : '-';
|
|
313
|
+
char var = domain.isBinary(inds[i]) ? 'x' : 'y';
|
|
314
|
+
printf("%c%g %c%" HIGHSINT_FORMAT " ", sign, std::abs(vals[i]), var, inds[i]);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
printf("<= %g\n", rhs);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
static void printClique(
|
|
321
|
+
const std::vector<HighsCliqueTable::CliqueVar>& clique) {
|
|
322
|
+
bool first = true;
|
|
323
|
+
for (HighsCliqueTable::CliqueVar v : clique) {
|
|
324
|
+
if (!first) printf("+ ");
|
|
325
|
+
char complemented = v.val == 0 ? '~' : ' ';
|
|
326
|
+
printf("%cx%" HIGHSINT_FORMAT " ", complemented, v.col);
|
|
327
|
+
first = false;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
printf("<= 1\n");
|
|
331
|
+
}
|
|
332
|
+
#endif
|
|
333
|
+
|
|
334
|
+
void HighsCliqueTable::doAddClique(const CliqueVar* cliquevars,
|
|
335
|
+
HighsInt numcliquevars, bool equality,
|
|
336
|
+
HighsInt origin) {
|
|
337
|
+
HighsInt cliqueid;
|
|
338
|
+
|
|
339
|
+
if (freeslots.empty()) {
|
|
340
|
+
cliqueid = cliques.size();
|
|
341
|
+
cliques.emplace_back();
|
|
342
|
+
} else {
|
|
343
|
+
cliqueid = freeslots.back();
|
|
344
|
+
freeslots.pop_back();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
cliques[cliqueid].equality = equality;
|
|
348
|
+
cliques[cliqueid].origin = origin;
|
|
349
|
+
|
|
350
|
+
decltype(freespaces)::iterator it;
|
|
351
|
+
HighsInt maxEnd;
|
|
352
|
+
if (freespaces.empty() ||
|
|
353
|
+
(it = freespaces.lower_bound(
|
|
354
|
+
std::make_pair(numcliquevars, HighsInt{-1}))) == freespaces.end()) {
|
|
355
|
+
cliques[cliqueid].start = cliqueentries.size();
|
|
356
|
+
cliques[cliqueid].end = cliques[cliqueid].start + numcliquevars;
|
|
357
|
+
maxEnd = cliques[cliqueid].end;
|
|
358
|
+
cliqueentries.resize(cliques[cliqueid].end);
|
|
359
|
+
} else {
|
|
360
|
+
auto freespace = *it;
|
|
361
|
+
freespaces.erase(it);
|
|
362
|
+
|
|
363
|
+
cliques[cliqueid].start = freespace.second;
|
|
364
|
+
cliques[cliqueid].end = cliques[cliqueid].start + numcliquevars;
|
|
365
|
+
maxEnd = cliques[cliqueid].start + freespace.first;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
cliques[cliqueid].numZeroFixed = 0;
|
|
369
|
+
|
|
370
|
+
bool fixtozero = false;
|
|
371
|
+
HighsInt k = cliques[cliqueid].start;
|
|
372
|
+
for (HighsInt i = 0; i != numcliquevars; ++i) {
|
|
373
|
+
CliqueVar v = cliquevars[i];
|
|
374
|
+
|
|
375
|
+
resolveSubstitution(v);
|
|
376
|
+
|
|
377
|
+
if (fixtozero) {
|
|
378
|
+
infeasvertexstack.push_back(v);
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// due to substitutions the variable may occur together with its complement
|
|
383
|
+
// in this clique and we can fix all other variables in the clique to zero:
|
|
384
|
+
// x + ~x + ... <= 1
|
|
385
|
+
// <=> x + 1 - x + ... <= 1
|
|
386
|
+
// <=> ... <= 0
|
|
387
|
+
bool clqHasVCompl =
|
|
388
|
+
numcliquevars == 2
|
|
389
|
+
? invertedHashListSizeTwo[v.complement().index()].contains(cliqueid)
|
|
390
|
+
: invertedHashList[v.complement().index()].contains(cliqueid);
|
|
391
|
+
|
|
392
|
+
if (clqHasVCompl) {
|
|
393
|
+
fixtozero = true;
|
|
394
|
+
for (HighsInt j = cliques[cliqueid].start; j != k; ++j) {
|
|
395
|
+
if (cliqueentries[j].col != v.col)
|
|
396
|
+
infeasvertexstack.push_back(cliqueentries[j]);
|
|
397
|
+
unlink(j, cliqueid);
|
|
398
|
+
}
|
|
399
|
+
k = cliques[cliqueid].start;
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// due to substitutions the variable may occur twice in this clique and
|
|
404
|
+
// we can fix it to zero: x + x + ... <= 1 <=> 2x <= 1 <=> x <= 0.5 <=>
|
|
405
|
+
// x = 0
|
|
406
|
+
bool inserted;
|
|
407
|
+
if (numcliquevars == 2)
|
|
408
|
+
inserted = invertedHashListSizeTwo[v.index()].insert(cliqueid);
|
|
409
|
+
else
|
|
410
|
+
inserted = invertedHashList[v.index()].insert(cliqueid, k);
|
|
411
|
+
|
|
412
|
+
if (!inserted) {
|
|
413
|
+
infeasvertexstack.push_back(v);
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
cliqueentries[k] = v;
|
|
418
|
+
++numcliquesvar[v.index()];
|
|
419
|
+
++k;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
if (maxEnd > k) {
|
|
423
|
+
if (int(cliqueentries.size()) == maxEnd)
|
|
424
|
+
cliqueentries.resize(k);
|
|
425
|
+
else
|
|
426
|
+
freespaces.emplace(maxEnd - k, k);
|
|
427
|
+
|
|
428
|
+
if (cliques[cliqueid].end > k) {
|
|
429
|
+
switch (k - cliques[cliqueid].start) {
|
|
430
|
+
case 0:
|
|
431
|
+
// clique empty, so just mark it as deleted
|
|
432
|
+
cliques[cliqueid].start = -1;
|
|
433
|
+
cliques[cliqueid].end = -1;
|
|
434
|
+
freeslots.push_back(cliqueid);
|
|
435
|
+
return;
|
|
436
|
+
case 1:
|
|
437
|
+
// size 1 clique is redundant, so unlink the single linked entry
|
|
438
|
+
// and mark it as deleted
|
|
439
|
+
unlink(cliques[cliqueid].start, cliqueid);
|
|
440
|
+
cliques[cliqueid].start = -1;
|
|
441
|
+
cliques[cliqueid].end = -1;
|
|
442
|
+
freeslots.push_back(cliqueid);
|
|
443
|
+
return;
|
|
444
|
+
case 2:
|
|
445
|
+
// due to substitutions the clique became smaller and is now of size
|
|
446
|
+
// two as a result we need to link it to the size two cliqueset
|
|
447
|
+
// instead of the normal cliqueset
|
|
448
|
+
assert(cliqueid >= 0 &&
|
|
449
|
+
cliqueid < static_cast<HighsInt>(cliques.size()));
|
|
450
|
+
assert(cliques[cliqueid].start >= 0 &&
|
|
451
|
+
cliques[cliqueid].start <
|
|
452
|
+
static_cast<HighsInt>(cliqueentries.size()));
|
|
453
|
+
unlink(cliques[cliqueid].start, cliqueid);
|
|
454
|
+
unlink(cliques[cliqueid].start + 1, cliqueid);
|
|
455
|
+
|
|
456
|
+
cliques[cliqueid].end = k;
|
|
457
|
+
|
|
458
|
+
link(cliques[cliqueid].start, cliqueid);
|
|
459
|
+
link(cliques[cliqueid].start + 1, cliqueid);
|
|
460
|
+
break;
|
|
461
|
+
default:
|
|
462
|
+
cliques[cliqueid].end = k;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
HighsInt cliqueLen = cliques[cliqueid].end - cliques[cliqueid].start;
|
|
468
|
+
numEntries += cliqueLen;
|
|
469
|
+
if (cliqueLen == 2)
|
|
470
|
+
sizeTwoCliques.insert(
|
|
471
|
+
sortedEdge(cliqueentries[cliques[cliqueid].start],
|
|
472
|
+
cliqueentries[cliques[cliqueid].start + 1]),
|
|
473
|
+
cliqueid);
|
|
474
|
+
}
|
|
475
|
+
struct ThreadNeighbourhoodQueryData {
|
|
476
|
+
int64_t numQueries;
|
|
477
|
+
std::vector<HighsInt> neighbourhoodInds;
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
void HighsCliqueTable::queryNeighbourhood(
|
|
481
|
+
std::vector<HighsInt>& neighbourhoodInds, int64_t& numQueries, CliqueVar v,
|
|
482
|
+
CliqueVar* q, HighsInt N) const {
|
|
483
|
+
neighbourhoodInds.clear();
|
|
484
|
+
|
|
485
|
+
if (numCliques(v) == 0) return;
|
|
486
|
+
|
|
487
|
+
if (numEntries - sizeTwoCliques.size() * 2 < minEntriesForParallelism) {
|
|
488
|
+
for (HighsInt i = 0; i < N; ++i) {
|
|
489
|
+
if (haveCommonClique(numQueries, v, q[i])) neighbourhoodInds.push_back(i);
|
|
490
|
+
}
|
|
491
|
+
} else {
|
|
492
|
+
auto neighbourhoodData =
|
|
493
|
+
makeHighsCombinable<ThreadNeighbourhoodQueryData>([N]() {
|
|
494
|
+
ThreadNeighbourhoodQueryData d;
|
|
495
|
+
d.neighbourhoodInds.reserve(N);
|
|
496
|
+
d.numQueries = 0;
|
|
497
|
+
return d;
|
|
498
|
+
});
|
|
499
|
+
highs::parallel::for_each(
|
|
500
|
+
0, N,
|
|
501
|
+
[this, &neighbourhoodData, v, q](HighsInt start, HighsInt end) {
|
|
502
|
+
ThreadNeighbourhoodQueryData& d = neighbourhoodData.local();
|
|
503
|
+
for (HighsInt i = start; i < end; ++i) {
|
|
504
|
+
if (haveCommonClique(d.numQueries, v, q[i]))
|
|
505
|
+
d.neighbourhoodInds.push_back(i);
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
10);
|
|
509
|
+
|
|
510
|
+
neighbourhoodData.combine_each([&](ThreadNeighbourhoodQueryData& d) {
|
|
511
|
+
neighbourhoodInds.insert(neighbourhoodInds.end(),
|
|
512
|
+
d.neighbourhoodInds.begin(),
|
|
513
|
+
d.neighbourhoodInds.end());
|
|
514
|
+
numQueries += d.numQueries;
|
|
515
|
+
});
|
|
516
|
+
pdqsort(neighbourhoodInds.begin(), neighbourhoodInds.end());
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
HighsInt HighsCliqueTable::partitionNeighbourhood(
|
|
521
|
+
std::vector<HighsInt>& neighbourhoodInds, int64_t& numQueries, CliqueVar v,
|
|
522
|
+
CliqueVar* q, HighsInt N) const {
|
|
523
|
+
queryNeighbourhood(neighbourhoodInds, numQueries, v, q, N);
|
|
524
|
+
|
|
525
|
+
for (size_t i = 0; i < neighbourhoodInds.size(); ++i)
|
|
526
|
+
std::swap(q[i], q[neighbourhoodInds[i]]);
|
|
527
|
+
|
|
528
|
+
return static_cast<HighsInt>(neighbourhoodInds.size());
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
HighsInt HighsCliqueTable::shrinkToNeighbourhood(
|
|
532
|
+
std::vector<HighsInt>& neighbourhoodInds, int64_t& numQueries, CliqueVar v,
|
|
533
|
+
CliqueVar* q, HighsInt N) {
|
|
534
|
+
queryNeighbourhood(neighbourhoodInds, numQueries, v, q, N);
|
|
535
|
+
|
|
536
|
+
for (size_t i = 0; i < neighbourhoodInds.size(); ++i)
|
|
537
|
+
q[i] = q[neighbourhoodInds[i]];
|
|
538
|
+
|
|
539
|
+
return static_cast<HighsInt>(neighbourhoodInds.size());
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
bool HighsCliqueTable::fixCol(HighsDomain& globaldom, CliqueVar v,
|
|
543
|
+
bool doProcessInfeasibleVertices) {
|
|
544
|
+
bool wasfixed = globaldom.isFixed(v.col);
|
|
545
|
+
globaldom.fixCol(v.col, static_cast<double>(1 - v.val));
|
|
546
|
+
if (globaldom.infeasible()) return false;
|
|
547
|
+
if (!wasfixed) {
|
|
548
|
+
++nfixings;
|
|
549
|
+
infeasvertexstack.push_back(v);
|
|
550
|
+
if (doProcessInfeasibleVertices) processInfeasibleVertices(globaldom);
|
|
551
|
+
}
|
|
552
|
+
return true;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
bool HighsCliqueTable::processNewEdge(HighsDomain& globaldom, CliqueVar v1,
|
|
556
|
+
CliqueVar v2) {
|
|
557
|
+
if (v1.col == v2.col) {
|
|
558
|
+
if (v1.val == v2.val) {
|
|
559
|
+
fixCol(globaldom, v1, true);
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
return true;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// invertedEdgeCache.erase(sortedEdge(v1, v2));
|
|
567
|
+
|
|
568
|
+
if (haveCommonClique(v1.complement(), v2)) {
|
|
569
|
+
fixCol(globaldom, v2, true);
|
|
570
|
+
return false;
|
|
571
|
+
} else if (haveCommonClique(v2.complement(), v1)) {
|
|
572
|
+
fixCol(globaldom, v1, true);
|
|
573
|
+
return false;
|
|
574
|
+
} else {
|
|
575
|
+
// return if complements are not in a clique
|
|
576
|
+
if (!foundCover(globaldom, v1.complement(), v2.complement())) return false;
|
|
577
|
+
if (globaldom.infeasible()) return true;
|
|
578
|
+
|
|
579
|
+
foundCover(globaldom, v1, v2);
|
|
580
|
+
if (globaldom.isFixed(v1.col) || globaldom.isFixed(v2.col) ||
|
|
581
|
+
globaldom.infeasible())
|
|
582
|
+
return true;
|
|
583
|
+
|
|
584
|
+
Substitution substitution;
|
|
585
|
+
if (v2.col < v1.col) {
|
|
586
|
+
if (v1.val == 1) v2 = v2.complement();
|
|
587
|
+
|
|
588
|
+
substitution.substcol = v1.col;
|
|
589
|
+
substitution.replace = v2;
|
|
590
|
+
} else {
|
|
591
|
+
if (v2.val == 1) v1 = v1.complement();
|
|
592
|
+
|
|
593
|
+
substitution.substcol = v2.col;
|
|
594
|
+
substitution.replace = v1;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
substitutions.push_back(substitution);
|
|
598
|
+
colsubstituted[substitution.substcol] = substitutions.size();
|
|
599
|
+
|
|
600
|
+
auto replace = [&](CliqueVar substitutedVar, CliqueVar replacementVar) {
|
|
601
|
+
HighsHashTree<HighsInt, HighsInt>& substList =
|
|
602
|
+
invertedHashList[substitutedVar.index()];
|
|
603
|
+
HighsHashTree<HighsInt, HighsInt>& replaceList =
|
|
604
|
+
invertedHashList[replacementVar.index()];
|
|
605
|
+
numcliquesvar[replacementVar.index()] +=
|
|
606
|
+
numcliquesvar[substitutedVar.index()];
|
|
607
|
+
numcliquesvar[substitutedVar.index()] = 0;
|
|
608
|
+
|
|
609
|
+
substList.for_each([&](HighsInt cliqueid, HighsInt location) {
|
|
610
|
+
replaceList.insert(cliqueid, location);
|
|
611
|
+
cliqueentries[location] = replacementVar;
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
substList.clear();
|
|
615
|
+
|
|
616
|
+
HighsHashTree<HighsInt>& substListSizeTwo =
|
|
617
|
+
invertedHashListSizeTwo[substitutedVar.index()];
|
|
618
|
+
HighsHashTree<HighsInt>& replaceListSizeTwo =
|
|
619
|
+
invertedHashListSizeTwo[replacementVar.index()];
|
|
620
|
+
|
|
621
|
+
substListSizeTwo.for_each([&](HighsInt cliqueid) {
|
|
622
|
+
HighsInt pos = cliques[cliqueid].start;
|
|
623
|
+
HighsInt otherPos = pos + 1;
|
|
624
|
+
|
|
625
|
+
if (cliqueentries[otherPos] == substitutedVar) std::swap(pos, otherPos);
|
|
626
|
+
|
|
627
|
+
replaceListSizeTwo.insert(cliqueid);
|
|
628
|
+
cliqueentries[pos] = replacementVar;
|
|
629
|
+
|
|
630
|
+
sizeTwoCliques.erase(
|
|
631
|
+
sortedEdge(substitutedVar, cliqueentries[otherPos]));
|
|
632
|
+
sizeTwoCliques.insert(
|
|
633
|
+
sortedEdge(replacementVar, cliqueentries[otherPos]), cliqueid);
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
substListSizeTwo.clear();
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
replace(CliqueVar(substitution.substcol, 1), substitution.replace);
|
|
640
|
+
replace(CliqueVar(substitution.substcol, 0),
|
|
641
|
+
substitution.replace.complement());
|
|
642
|
+
|
|
643
|
+
return true;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
void HighsCliqueTable::addClique(const HighsMipSolver& mipsolver,
|
|
648
|
+
CliqueVar* cliquevars, HighsInt numcliquevars,
|
|
649
|
+
bool equality, HighsInt origin) {
|
|
650
|
+
HighsDomain& globaldom = mipsolver.mipdata_->domain;
|
|
651
|
+
mipsolver.mipdata_->debugSolution.checkClique(cliquevars, numcliquevars);
|
|
652
|
+
const HighsInt maxNumCliqueVars = 100;
|
|
653
|
+
|
|
654
|
+
// lambda for complementing clique
|
|
655
|
+
auto complementClique = [&]() {
|
|
656
|
+
for (HighsInt i = 0; i != numcliquevars; ++i) {
|
|
657
|
+
cliquevars[i] = cliquevars[i].complement();
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
// lambda for analysing the clique to see if all variables can be fixed
|
|
662
|
+
auto fixAllVarsInClique = [&](bool& hasNewEdge) {
|
|
663
|
+
for (HighsInt i = 0; i != numcliquevars; ++i) {
|
|
664
|
+
if (!globaldom.isFixed(cliquevars[i].col) ||
|
|
665
|
+
cliquevars[i].val != globaldom.col_lower_[cliquevars[i].col])
|
|
666
|
+
continue;
|
|
667
|
+
// column is fixed to 1, every other entry can be fixed to zero
|
|
668
|
+
for (HighsInt k = 0; k != numcliquevars; ++k) {
|
|
669
|
+
if (k == i) continue;
|
|
670
|
+
if (!fixCol(globaldom, cliquevars[k])) return false;
|
|
671
|
+
}
|
|
672
|
+
processInfeasibleVertices(globaldom);
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
if (numcliquevars > maxNumCliqueVars) return false;
|
|
677
|
+
|
|
678
|
+
// todo, sort new clique to allow log n lookup of membership in size by
|
|
679
|
+
// binary search
|
|
680
|
+
|
|
681
|
+
for (HighsInt i = 0; i < numcliquevars - 1; ++i) {
|
|
682
|
+
if (globaldom.isFixed(cliquevars[i].col)) continue;
|
|
683
|
+
if (numCliques(cliquevars[i]) == 0 &&
|
|
684
|
+
numCliques(cliquevars[i].complement()) == 0) {
|
|
685
|
+
hasNewEdge = true;
|
|
686
|
+
continue;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
for (HighsInt j = i + 1; j < numcliquevars; ++j) {
|
|
690
|
+
if (globaldom.isFixed(cliquevars[j].col)) continue;
|
|
691
|
+
|
|
692
|
+
if (haveCommonClique(cliquevars[i], cliquevars[j])) continue;
|
|
693
|
+
// todo: Instead of haveCommonClique use findCommonClique. If the
|
|
694
|
+
// common clique is smaller than this clique check if it is a subset
|
|
695
|
+
// of this clique. If it is a subset remove the clique and iterate the
|
|
696
|
+
// process until either a common clique that is not a subset of this
|
|
697
|
+
// one is found, or no common clique exists anymore in which case we
|
|
698
|
+
// proceed with the code below and set hasNewEdge to true
|
|
699
|
+
|
|
700
|
+
hasNewEdge = true;
|
|
701
|
+
|
|
702
|
+
bool iscover = processNewEdge(globaldom, cliquevars[i], cliquevars[j]);
|
|
703
|
+
if (globaldom.infeasible()) return false;
|
|
704
|
+
|
|
705
|
+
if (!mipsolver.mipdata_->nodequeue.empty()) {
|
|
706
|
+
const auto& v1Nodes =
|
|
707
|
+
cliquevars[i].val == 1
|
|
708
|
+
? mipsolver.mipdata_->nodequeue.getUpNodes(cliquevars[i].col)
|
|
709
|
+
: mipsolver.mipdata_->nodequeue.getDownNodes(
|
|
710
|
+
cliquevars[i].col);
|
|
711
|
+
const auto& v2Nodes =
|
|
712
|
+
cliquevars[j].val == 1
|
|
713
|
+
? mipsolver.mipdata_->nodequeue.getUpNodes(cliquevars[j].col)
|
|
714
|
+
: mipsolver.mipdata_->nodequeue.getDownNodes(
|
|
715
|
+
cliquevars[j].col);
|
|
716
|
+
|
|
717
|
+
if (!v1Nodes.empty() && !v2Nodes.empty()) {
|
|
718
|
+
// general integer variables can become binary during the search
|
|
719
|
+
// and the cliques might be discovered. That means we need to take
|
|
720
|
+
// care here, since the set of nodes branched upwards or downwards
|
|
721
|
+
// are not necessarily containing domain changes setting the
|
|
722
|
+
// variables to the corresponding clique value but could be
|
|
723
|
+
// redundant bound changes setting the upper bound to u >= 1 or
|
|
724
|
+
// the lower bound to l <= 0.
|
|
725
|
+
|
|
726
|
+
// itV1 will point to the first node where v1 is fixed to val and
|
|
727
|
+
// endV1 to the end of the range of such nodes. Same for
|
|
728
|
+
// itV2/endV2 with v2.
|
|
729
|
+
auto itV1 = v1Nodes.lower_bound(std::make_pair(
|
|
730
|
+
static_cast<double>(cliquevars[i].val), kHighsIInf));
|
|
731
|
+
auto endV1 = v1Nodes.upper_bound(std::make_pair(
|
|
732
|
+
static_cast<double>(cliquevars[i].val), kHighsIInf));
|
|
733
|
+
auto itV2 = v2Nodes.lower_bound(std::make_pair(
|
|
734
|
+
static_cast<double>(cliquevars[j].val), kHighsIInf));
|
|
735
|
+
auto endV2 = v2Nodes.upper_bound(std::make_pair(
|
|
736
|
+
static_cast<double>(cliquevars[j].val), kHighsIInf));
|
|
737
|
+
|
|
738
|
+
if (itV1 != endV1 && itV2 != endV2 &&
|
|
739
|
+
(itV1->second <= std::prev(endV2)->second ||
|
|
740
|
+
itV2->second <= std::prev(endV1)->second)) {
|
|
741
|
+
// node ranges overlap, check for nodes that can be pruned
|
|
742
|
+
while (itV1 != endV1 && itV2 != endV2) {
|
|
743
|
+
if (itV1->second < itV2->second) {
|
|
744
|
+
++itV1;
|
|
745
|
+
} else if (itV2->second < itV1->second) {
|
|
746
|
+
++itV2;
|
|
747
|
+
} else {
|
|
748
|
+
// if (!mipsolver.submip)
|
|
749
|
+
// printf("node %d can be pruned\n", itV2->second);
|
|
750
|
+
HighsInt prunedNode = itV2->second;
|
|
751
|
+
++itV1;
|
|
752
|
+
++itV2;
|
|
753
|
+
mipsolver.mipdata_->pruned_treeweight +=
|
|
754
|
+
mipsolver.mipdata_->nodequeue.pruneNode(prunedNode);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
if (iscover) {
|
|
762
|
+
for (HighsInt k = 0; k != numcliquevars; ++k) {
|
|
763
|
+
if (k == i || k == j) continue;
|
|
764
|
+
if (!fixCol(globaldom, cliquevars[k])) return false;
|
|
765
|
+
}
|
|
766
|
+
processInfeasibleVertices(globaldom);
|
|
767
|
+
return true;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return false;
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
// lambda for checking the (complemented) clique
|
|
775
|
+
auto checkClique = [&](bool& hasNewEdge, bool complement) {
|
|
776
|
+
if (complement) complementClique();
|
|
777
|
+
bool done = fixAllVarsInClique(hasNewEdge);
|
|
778
|
+
if (complement) complementClique();
|
|
779
|
+
if (done) return true;
|
|
780
|
+
return false;
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
// resolve substitutions
|
|
784
|
+
for (HighsInt i = 0; i != numcliquevars; ++i) {
|
|
785
|
+
resolveSubstitution(cliquevars[i]);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// initialise flag
|
|
789
|
+
bool hasNewEdge = false;
|
|
790
|
+
|
|
791
|
+
// check if all variables can be fixed or infeasibility is detected
|
|
792
|
+
if (checkClique(hasNewEdge, false)) return;
|
|
793
|
+
if (globaldom.infeasible()) return;
|
|
794
|
+
|
|
795
|
+
if (numcliquevars == 2 && equality) {
|
|
796
|
+
// try complemented clique
|
|
797
|
+
if (checkClique(hasNewEdge, true)) return;
|
|
798
|
+
if (globaldom.infeasible()) return;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
if (!hasNewEdge && origin == kHighsIInf) return;
|
|
802
|
+
|
|
803
|
+
CliqueVar* unfixedend =
|
|
804
|
+
std::remove_if(cliquevars, cliquevars + numcliquevars,
|
|
805
|
+
[&](CliqueVar v) { return globaldom.isFixed(v.col); });
|
|
806
|
+
numcliquevars = unfixedend - cliquevars;
|
|
807
|
+
if (numcliquevars < 2) return;
|
|
808
|
+
|
|
809
|
+
doAddClique(cliquevars, numcliquevars, equality, origin);
|
|
810
|
+
processInfeasibleVertices(globaldom);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
void HighsCliqueTable::removeClique(HighsInt cliqueid) {
|
|
814
|
+
if (cliques[cliqueid].origin != kHighsIInf && cliques[cliqueid].origin != -1)
|
|
815
|
+
deletedrows.push_back(cliques[cliqueid].origin);
|
|
816
|
+
|
|
817
|
+
HighsInt start = cliques[cliqueid].start;
|
|
818
|
+
assert(start != -1);
|
|
819
|
+
HighsInt end = cliques[cliqueid].end;
|
|
820
|
+
HighsInt len = end - start;
|
|
821
|
+
if (len == 2) {
|
|
822
|
+
sizeTwoCliques.erase(
|
|
823
|
+
sortedEdge(cliqueentries[start], cliqueentries[start + 1]));
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
for (HighsInt i = start; i != end; ++i) {
|
|
827
|
+
unlink(i, cliqueid);
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
freeslots.push_back(cliqueid);
|
|
831
|
+
freespaces.emplace(len, start);
|
|
832
|
+
|
|
833
|
+
cliques[cliqueid].start = -1;
|
|
834
|
+
cliques[cliqueid].end = -1;
|
|
835
|
+
numEntries -= len;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
void HighsCliqueTable::extractCliques(
|
|
839
|
+
const HighsMipSolver& mipsolver, std::vector<HighsInt>& inds,
|
|
840
|
+
std::vector<double>& vals, std::vector<int8_t>& complementation, double rhs,
|
|
841
|
+
HighsInt nbin, std::vector<HighsInt>& perm, std::vector<CliqueVar>& clique,
|
|
842
|
+
double feastol) {
|
|
843
|
+
HighsImplications& implics = mipsolver.mipdata_->implications;
|
|
844
|
+
HighsDomain& globaldom = mipsolver.mipdata_->domain;
|
|
845
|
+
|
|
846
|
+
perm.resize(inds.size());
|
|
847
|
+
std::iota(perm.begin(), perm.end(), 0);
|
|
848
|
+
|
|
849
|
+
auto binaryend = std::partition(perm.begin(), perm.end(), [&](HighsInt pos) {
|
|
850
|
+
return globaldom.isBinary(inds[pos]);
|
|
851
|
+
});
|
|
852
|
+
nbin = binaryend - perm.begin();
|
|
853
|
+
HighsInt ntotal = static_cast<HighsInt>(perm.size());
|
|
854
|
+
|
|
855
|
+
// if not all variables are binary, we extract variable upper and lower bounds
|
|
856
|
+
// constraints on the non-binary variable for each binary variable in the
|
|
857
|
+
// constraint
|
|
858
|
+
if (nbin < ntotal) {
|
|
859
|
+
for (HighsInt i = 0; i != nbin; ++i) {
|
|
860
|
+
HighsInt bincol = inds[perm[i]];
|
|
861
|
+
HighsCDouble impliedub = static_cast<HighsCDouble>(rhs) - vals[perm[i]];
|
|
862
|
+
if (implics.tooManyVarBounds()) break;
|
|
863
|
+
for (HighsInt j = nbin; j != ntotal; ++j) {
|
|
864
|
+
HighsInt col = inds[perm[j]];
|
|
865
|
+
if (globaldom.isFixed(col)) continue;
|
|
866
|
+
|
|
867
|
+
HighsCDouble colub =
|
|
868
|
+
static_cast<HighsCDouble>(globaldom.col_upper_[col]) -
|
|
869
|
+
globaldom.col_lower_[col];
|
|
870
|
+
HighsCDouble implcolub = impliedub / vals[perm[j]];
|
|
871
|
+
if (mipsolver.isColIntegral(col))
|
|
872
|
+
implcolub = std::floor(static_cast<double>(implcolub) +
|
|
873
|
+
mipsolver.mipdata_->feastol);
|
|
874
|
+
|
|
875
|
+
if (implcolub < colub - feastol) {
|
|
876
|
+
HighsCDouble coef;
|
|
877
|
+
HighsCDouble constant;
|
|
878
|
+
|
|
879
|
+
if (complementation[perm[i]] == -1) {
|
|
880
|
+
coef = colub - implcolub;
|
|
881
|
+
constant = implcolub;
|
|
882
|
+
} else {
|
|
883
|
+
coef = implcolub - colub;
|
|
884
|
+
constant = colub;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
if (complementation[perm[j]] == -1) {
|
|
888
|
+
constant -= globaldom.col_upper_[col];
|
|
889
|
+
implics.addVLB(col, bincol, -static_cast<double>(coef),
|
|
890
|
+
-static_cast<double>(constant));
|
|
891
|
+
} else {
|
|
892
|
+
constant += globaldom.col_lower_[col];
|
|
893
|
+
implics.addVUB(col, bincol, static_cast<double>(coef),
|
|
894
|
+
static_cast<double>(constant));
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// only one binary means we do have no cliques
|
|
902
|
+
if (nbin <= 1) return;
|
|
903
|
+
|
|
904
|
+
pdqsort(perm.begin(), binaryend, [&](HighsInt p1, HighsInt p2) {
|
|
905
|
+
return std::make_pair(vals[p1], p1) > std::make_pair(vals[p2], p2);
|
|
906
|
+
});
|
|
907
|
+
// check if any cliques exists
|
|
908
|
+
if (vals[perm[0]] + vals[perm[1]] <= rhs + feastol) return;
|
|
909
|
+
|
|
910
|
+
// check if this is a set packing constraint (or easily transformable
|
|
911
|
+
// into one)
|
|
912
|
+
if (std::abs(vals[0] - vals[perm[nbin - 1]]) <= feastol &&
|
|
913
|
+
rhs < 2 * vals[perm[nbin - 1]] - feastol) {
|
|
914
|
+
// the coefficients on the binary variables are all equal and the
|
|
915
|
+
// right hand side is strictly below two times the coefficient value.
|
|
916
|
+
// Therefore the constraint can be transformed into a set packing
|
|
917
|
+
// constraint by relaxing out all non-binary variables (if any),
|
|
918
|
+
// dividing by the coefficient value of the binary variables, and then
|
|
919
|
+
// possibly rounding down the right hand side
|
|
920
|
+
clique.clear();
|
|
921
|
+
|
|
922
|
+
for (auto j = 0; j != nbin; ++j) {
|
|
923
|
+
HighsInt pos = perm[j];
|
|
924
|
+
if (complementation[pos] == -1)
|
|
925
|
+
clique.emplace_back(inds[pos], 0);
|
|
926
|
+
else
|
|
927
|
+
clique.emplace_back(inds[pos], 1);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
addClique(mipsolver, clique.data(), nbin);
|
|
931
|
+
if (globaldom.infeasible()) return;
|
|
932
|
+
// printf("extracted this clique:\n");
|
|
933
|
+
// printClique(clique);
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
for (HighsInt k = nbin - 1; k != 0; --k) {
|
|
938
|
+
double mincliqueval = rhs - vals[perm[k]] + feastol;
|
|
939
|
+
auto cliqueend = std::partition_point(
|
|
940
|
+
perm.begin(), perm.begin() + k,
|
|
941
|
+
[&](HighsInt p) { return vals[p] > mincliqueval; });
|
|
942
|
+
|
|
943
|
+
// no clique for this variable
|
|
944
|
+
if (cliqueend == perm.begin()) continue;
|
|
945
|
+
|
|
946
|
+
clique.clear();
|
|
947
|
+
|
|
948
|
+
for (auto j = perm.begin(); j != cliqueend; ++j) {
|
|
949
|
+
HighsInt pos = *j;
|
|
950
|
+
if (complementation[pos] == -1)
|
|
951
|
+
clique.emplace_back(inds[pos], 0);
|
|
952
|
+
else
|
|
953
|
+
clique.emplace_back(inds[pos], 1);
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
if (complementation[perm[k]] == -1)
|
|
957
|
+
clique.emplace_back(inds[perm[k]], 0);
|
|
958
|
+
else
|
|
959
|
+
clique.emplace_back(inds[perm[k]], 1);
|
|
960
|
+
|
|
961
|
+
// printf("extracted this clique:\n");
|
|
962
|
+
// printClique(clique);
|
|
963
|
+
|
|
964
|
+
if (clique.size() >= 2) {
|
|
965
|
+
// if (clique.size() > 2) runCliqueSubsumption(globaldom, clique);
|
|
966
|
+
// runCliqueMerging(globaldom, clique);
|
|
967
|
+
// if (clique.size() >= 2) {
|
|
968
|
+
addClique(mipsolver, clique.data(), static_cast<HighsInt>(clique.size()));
|
|
969
|
+
if (globaldom.infeasible()) return;
|
|
970
|
+
//}
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
// further cliques are just subsets of this clique
|
|
974
|
+
if (cliqueend == perm.begin() + k) return;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
void HighsCliqueTable::cliquePartition(std::vector<CliqueVar>& clqVars,
|
|
979
|
+
std::vector<HighsInt>& partitionStart) {
|
|
980
|
+
randgen.shuffle(clqVars.data(), clqVars.size());
|
|
981
|
+
|
|
982
|
+
std::vector<HighsInt> neighbourhoodInds;
|
|
983
|
+
neighbourhoodInds.reserve(clqVars.size());
|
|
984
|
+
|
|
985
|
+
HighsInt numClqVars = clqVars.size();
|
|
986
|
+
partitionStart.clear();
|
|
987
|
+
partitionStart.reserve(clqVars.size());
|
|
988
|
+
HighsInt extensionEnd = numClqVars;
|
|
989
|
+
partitionStart.push_back(0);
|
|
990
|
+
for (HighsInt i = 0; i < numClqVars; ++i) {
|
|
991
|
+
if (i == extensionEnd) {
|
|
992
|
+
partitionStart.push_back(i);
|
|
993
|
+
extensionEnd = numClqVars;
|
|
994
|
+
}
|
|
995
|
+
CliqueVar v = clqVars[i];
|
|
996
|
+
HighsInt extensionStart = i + 1;
|
|
997
|
+
extensionEnd =
|
|
998
|
+
partitionNeighbourhood(neighbourhoodInds, numNeighbourhoodQueries, v,
|
|
999
|
+
clqVars.data() + extensionStart,
|
|
1000
|
+
extensionEnd - extensionStart) +
|
|
1001
|
+
extensionStart;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
partitionStart.push_back(numClqVars);
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
void HighsCliqueTable::cliquePartition(const std::vector<double>& objective,
|
|
1008
|
+
std::vector<CliqueVar>& clqVars,
|
|
1009
|
+
std::vector<HighsInt>& partitionStart) {
|
|
1010
|
+
randgen.shuffle(clqVars.data(), clqVars.size());
|
|
1011
|
+
|
|
1012
|
+
pdqsort_branchless(clqVars.begin(), clqVars.end(),
|
|
1013
|
+
[&](CliqueVar v1, CliqueVar v2) {
|
|
1014
|
+
return (2 * v1.val - 1) * objective[v1.col] >
|
|
1015
|
+
(2 * v2.val - 1) * objective[v2.col];
|
|
1016
|
+
});
|
|
1017
|
+
|
|
1018
|
+
std::vector<HighsInt> neighbourhoodInds;
|
|
1019
|
+
neighbourhoodInds.reserve(clqVars.size());
|
|
1020
|
+
|
|
1021
|
+
HighsInt numClqVars = clqVars.size();
|
|
1022
|
+
partitionStart.clear();
|
|
1023
|
+
partitionStart.reserve(clqVars.size());
|
|
1024
|
+
HighsInt extensionEnd = numClqVars;
|
|
1025
|
+
partitionStart.push_back(0);
|
|
1026
|
+
HighsInt lastSwappedIndex = 0;
|
|
1027
|
+
for (HighsInt i = 0; i < numClqVars; ++i) {
|
|
1028
|
+
if (i == extensionEnd) {
|
|
1029
|
+
partitionStart.push_back(i);
|
|
1030
|
+
extensionEnd = numClqVars;
|
|
1031
|
+
if (lastSwappedIndex >= i)
|
|
1032
|
+
pdqsort_branchless(clqVars.begin() + i,
|
|
1033
|
+
clqVars.begin() + lastSwappedIndex + 1,
|
|
1034
|
+
[&](CliqueVar v1, CliqueVar v2) {
|
|
1035
|
+
return (2 * v1.val - 1) * objective[v1.col] >
|
|
1036
|
+
(2 * v2.val - 1) * objective[v2.col];
|
|
1037
|
+
});
|
|
1038
|
+
lastSwappedIndex = 0;
|
|
1039
|
+
}
|
|
1040
|
+
CliqueVar v = clqVars[i];
|
|
1041
|
+
HighsInt extensionStart = i + 1;
|
|
1042
|
+
extensionEnd =
|
|
1043
|
+
partitionNeighbourhood(neighbourhoodInds, numNeighbourhoodQueries, v,
|
|
1044
|
+
clqVars.data() + extensionStart,
|
|
1045
|
+
extensionEnd - extensionStart) +
|
|
1046
|
+
extensionStart;
|
|
1047
|
+
if (!neighbourhoodInds.empty())
|
|
1048
|
+
lastSwappedIndex =
|
|
1049
|
+
std::max(neighbourhoodInds.back() + extensionStart, lastSwappedIndex);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
partitionStart.push_back(numClqVars);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
bool HighsCliqueTable::foundCover(HighsDomain& globaldom, CliqueVar v1,
|
|
1056
|
+
CliqueVar v2) {
|
|
1057
|
+
HighsInt commonclique = findCommonCliqueId(v1, v2);
|
|
1058
|
+
if (commonclique == -1) return false;
|
|
1059
|
+
|
|
1060
|
+
while (commonclique != -1) {
|
|
1061
|
+
HighsInt start = cliques[commonclique].start;
|
|
1062
|
+
HighsInt end = cliques[commonclique].end;
|
|
1063
|
+
|
|
1064
|
+
for (HighsInt i = start; i != end; ++i) {
|
|
1065
|
+
if (cliqueentries[i] == v1 || cliqueentries[i] == v2) continue;
|
|
1066
|
+
if (!fixCol(globaldom, cliqueentries[i])) return true;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
removeClique(commonclique);
|
|
1070
|
+
commonclique = findCommonCliqueId(v1, v2);
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
processInfeasibleVertices(globaldom);
|
|
1074
|
+
return true;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
void HighsCliqueTable::extractCliquesFromCut(const HighsMipSolver& mipsolver,
|
|
1078
|
+
const HighsInt* inds,
|
|
1079
|
+
const double* vals, HighsInt len,
|
|
1080
|
+
double rhs) {
|
|
1081
|
+
if (isFull()) return;
|
|
1082
|
+
|
|
1083
|
+
HighsImplications& implics = mipsolver.mipdata_->implications;
|
|
1084
|
+
HighsDomain& globaldom = mipsolver.mipdata_->domain;
|
|
1085
|
+
|
|
1086
|
+
const double feastol = mipsolver.mipdata_->feastol;
|
|
1087
|
+
|
|
1088
|
+
HighsCDouble minact = 0.0;
|
|
1089
|
+
HighsInt nbin = 0;
|
|
1090
|
+
for (HighsInt i = 0; i != len; ++i) {
|
|
1091
|
+
if (globaldom.isBinary(inds[i])) ++nbin;
|
|
1092
|
+
|
|
1093
|
+
if (vals[i] > 0) {
|
|
1094
|
+
if (globaldom.col_lower_[inds[i]] == -kHighsInf) return;
|
|
1095
|
+
minact += vals[i] * globaldom.col_lower_[inds[i]];
|
|
1096
|
+
} else {
|
|
1097
|
+
if (globaldom.col_upper_[inds[i]] == kHighsInf) return;
|
|
1098
|
+
minact += vals[i] * globaldom.col_upper_[inds[i]];
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
if (rhs - minact < 0.0) {
|
|
1103
|
+
minact = rhs;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
for (HighsInt i = 0; i != len; ++i) {
|
|
1107
|
+
if (mipsolver.isColContinuous(inds[i])) continue;
|
|
1108
|
+
|
|
1109
|
+
double boundVal = static_cast<double>((rhs - minact) / vals[i]);
|
|
1110
|
+
if (vals[i] > 0) {
|
|
1111
|
+
boundVal = std::floor(boundVal + globaldom.col_lower_[inds[i]] +
|
|
1112
|
+
globaldom.feastol());
|
|
1113
|
+
globaldom.changeBound(HighsBoundType::kUpper, inds[i], boundVal,
|
|
1114
|
+
HighsDomain::Reason::unspecified());
|
|
1115
|
+
if (globaldom.infeasible()) return;
|
|
1116
|
+
} else {
|
|
1117
|
+
boundVal = std::ceil(boundVal + globaldom.col_upper_[inds[i]] -
|
|
1118
|
+
globaldom.feastol());
|
|
1119
|
+
globaldom.changeBound(HighsBoundType::kLower, inds[i], boundVal,
|
|
1120
|
+
HighsDomain::Reason::unspecified());
|
|
1121
|
+
if (globaldom.infeasible()) return;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
if (nbin <= 1) return;
|
|
1126
|
+
|
|
1127
|
+
std::vector<HighsInt> perm;
|
|
1128
|
+
perm.resize(len);
|
|
1129
|
+
std::iota(perm.begin(), perm.end(), 0);
|
|
1130
|
+
|
|
1131
|
+
auto binaryend = std::partition(perm.begin(), perm.end(), [&](HighsInt pos) {
|
|
1132
|
+
return globaldom.isBinary(inds[pos]);
|
|
1133
|
+
});
|
|
1134
|
+
|
|
1135
|
+
nbin = binaryend - perm.begin();
|
|
1136
|
+
|
|
1137
|
+
// if not all variables are binary, we extract variable upper and lower bounds
|
|
1138
|
+
// constraints on the non-binary variable for each binary variable in the
|
|
1139
|
+
// constraint:
|
|
1140
|
+
if (nbin < len) {
|
|
1141
|
+
for (HighsInt i = 0; i != nbin; ++i) {
|
|
1142
|
+
HighsInt bincol = inds[perm[i]];
|
|
1143
|
+
HighsCDouble impliedActivity = rhs - minact - std::abs(vals[perm[i]]);
|
|
1144
|
+
for (HighsInt j = nbin; j != len; ++j) {
|
|
1145
|
+
HighsInt col = inds[perm[j]];
|
|
1146
|
+
if (globaldom.isFixed(col)) continue;
|
|
1147
|
+
|
|
1148
|
+
if (vals[perm[j]] > 0) {
|
|
1149
|
+
double implcolub =
|
|
1150
|
+
static_cast<double>(impliedActivity +
|
|
1151
|
+
vals[perm[j]] * globaldom.col_lower_[col]) /
|
|
1152
|
+
vals[perm[j]];
|
|
1153
|
+
if (mipsolver.isColIntegral(col))
|
|
1154
|
+
implcolub = std::floor(implcolub + mipsolver.mipdata_->feastol);
|
|
1155
|
+
|
|
1156
|
+
if (implcolub < globaldom.col_upper_[col] - feastol) {
|
|
1157
|
+
double coef;
|
|
1158
|
+
double constant;
|
|
1159
|
+
if (vals[perm[i]] < 0) {
|
|
1160
|
+
coef = globaldom.col_upper_[col] - implcolub;
|
|
1161
|
+
constant = implcolub;
|
|
1162
|
+
} else {
|
|
1163
|
+
// make sure that upper bound is not infinite to avoid adding VUB
|
|
1164
|
+
// with coefficient '-kHighsInf' and constant 'kHighsInf'
|
|
1165
|
+
if (globaldom.col_upper_[col] == kHighsInf) continue;
|
|
1166
|
+
coef = implcolub - globaldom.col_upper_[col];
|
|
1167
|
+
constant = globaldom.col_upper_[col];
|
|
1168
|
+
}
|
|
1169
|
+
// printf("extracted VUB from cut: x%" HIGHSINT_FORMAT " <= %g*y%"
|
|
1170
|
+
// HIGHSINT_FORMAT " + %g\n", col, coef,
|
|
1171
|
+
// bincol, constant);
|
|
1172
|
+
implics.addVUB(col, bincol, coef, constant);
|
|
1173
|
+
}
|
|
1174
|
+
} else {
|
|
1175
|
+
double implcollb =
|
|
1176
|
+
static_cast<double>(impliedActivity +
|
|
1177
|
+
vals[perm[j]] * globaldom.col_upper_[col]) /
|
|
1178
|
+
vals[perm[j]];
|
|
1179
|
+
if (mipsolver.isColIntegral(col))
|
|
1180
|
+
implcollb = std::ceil(implcollb - mipsolver.mipdata_->feastol);
|
|
1181
|
+
|
|
1182
|
+
if (implcollb > globaldom.col_lower_[col] + feastol) {
|
|
1183
|
+
double coef;
|
|
1184
|
+
double constant;
|
|
1185
|
+
if (vals[perm[i]] < 0) {
|
|
1186
|
+
coef = globaldom.col_lower_[col] - implcollb;
|
|
1187
|
+
constant = implcollb;
|
|
1188
|
+
} else {
|
|
1189
|
+
// make sure that lower bound is not infinite to avoid adding VLB
|
|
1190
|
+
// with coefficient 'kHighsInf' and constant '-kHighsInf'
|
|
1191
|
+
if (globaldom.col_lower_[col] == -kHighsInf) continue;
|
|
1192
|
+
coef = implcollb - globaldom.col_lower_[col];
|
|
1193
|
+
constant = globaldom.col_lower_[col];
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
// printf("extracted VLB from cut: x%" HIGHSINT_FORMAT " >= %g*y%"
|
|
1197
|
+
// HIGHSINT_FORMAT " + %g\n", col, coef,
|
|
1198
|
+
// bincol, constant);
|
|
1199
|
+
implics.addVLB(col, bincol, coef, constant);
|
|
1200
|
+
// printf("extracted VLB from cut\n");
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
// only one binary means we do have no cliques
|
|
1208
|
+
if (nbin <= 1) return;
|
|
1209
|
+
|
|
1210
|
+
std::vector<CliqueVar> clique;
|
|
1211
|
+
clique.reserve(nbin);
|
|
1212
|
+
|
|
1213
|
+
pdqsort(perm.begin(), binaryend, [&](HighsInt p1, HighsInt p2) {
|
|
1214
|
+
return std::make_pair(std::abs(vals[p1]), p1) >
|
|
1215
|
+
std::make_pair(std::abs(vals[p2]), p2);
|
|
1216
|
+
});
|
|
1217
|
+
// check if any cliques exists
|
|
1218
|
+
if (std::abs(vals[perm[0]]) + std::abs(vals[perm[1]]) <=
|
|
1219
|
+
static_cast<double>(rhs - minact + feastol))
|
|
1220
|
+
return;
|
|
1221
|
+
|
|
1222
|
+
HighsInt maxNewEntries =
|
|
1223
|
+
std::min(mipsolver.mipdata_->numCliqueEntriesAfterPresolve + 100000 +
|
|
1224
|
+
4 * globaldom.numModelNonzeros(),
|
|
1225
|
+
numEntries + 10 * nbin);
|
|
1226
|
+
|
|
1227
|
+
for (HighsInt k = nbin - 1; k != 0 && numEntries < maxNewEntries; --k) {
|
|
1228
|
+
double mincliqueval =
|
|
1229
|
+
static_cast<double>(rhs - minact - std::abs(vals[perm[k]]) + feastol);
|
|
1230
|
+
auto cliqueend = std::partition_point(
|
|
1231
|
+
perm.begin(), perm.begin() + k,
|
|
1232
|
+
[&](HighsInt p) { return std::abs(vals[p]) > mincliqueval; });
|
|
1233
|
+
|
|
1234
|
+
// no clique for this variable
|
|
1235
|
+
if (cliqueend == perm.begin()) continue;
|
|
1236
|
+
|
|
1237
|
+
clique.clear();
|
|
1238
|
+
|
|
1239
|
+
for (auto j = perm.begin(); j != cliqueend; ++j) {
|
|
1240
|
+
HighsInt pos = *j;
|
|
1241
|
+
if (vals[pos] < 0)
|
|
1242
|
+
clique.emplace_back(inds[pos], 0);
|
|
1243
|
+
else
|
|
1244
|
+
clique.emplace_back(inds[pos], 1);
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
if (vals[perm[k]] < 0)
|
|
1248
|
+
clique.emplace_back(inds[perm[k]], 0);
|
|
1249
|
+
else
|
|
1250
|
+
clique.emplace_back(inds[perm[k]], 1);
|
|
1251
|
+
|
|
1252
|
+
// printf("extracted this clique:\n");
|
|
1253
|
+
// printClique(clique);
|
|
1254
|
+
if (clique.size() >= 2) {
|
|
1255
|
+
// printf("extracted clique from cut\n");
|
|
1256
|
+
// if (clique.size() > 2) runCliqueSubsumption(globaldom, clique);
|
|
1257
|
+
|
|
1258
|
+
addClique(mipsolver, clique.data(), static_cast<HighsInt>(clique.size()));
|
|
1259
|
+
if (globaldom.infeasible() || numEntries >= maxNewEntries) return;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
// further cliques are just subsets of this clique
|
|
1263
|
+
if (cliqueend == perm.begin() + k) return;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
void HighsCliqueTable::extractCliques(HighsMipSolver& mipsolver,
|
|
1268
|
+
bool transformRows) {
|
|
1269
|
+
std::vector<HighsInt> inds;
|
|
1270
|
+
std::vector<double> vals;
|
|
1271
|
+
std::vector<HighsInt> perm;
|
|
1272
|
+
std::vector<int8_t> complementation;
|
|
1273
|
+
std::vector<CliqueVar> clique;
|
|
1274
|
+
HighsHashTable<HighsInt, double> entries;
|
|
1275
|
+
double offset;
|
|
1276
|
+
|
|
1277
|
+
double rhs;
|
|
1278
|
+
|
|
1279
|
+
HighsDomain& globaldom = mipsolver.mipdata_->domain;
|
|
1280
|
+
|
|
1281
|
+
for (HighsInt i = 0; i != mipsolver.numRow(); ++i) {
|
|
1282
|
+
HighsInt start = mipsolver.mipdata_->ARstart_[i];
|
|
1283
|
+
HighsInt end = mipsolver.mipdata_->ARstart_[i + 1];
|
|
1284
|
+
|
|
1285
|
+
if (mipsolver.mipdata_->postSolveStack.getOrigRowIndex(i) >=
|
|
1286
|
+
mipsolver.orig_model_->num_row_)
|
|
1287
|
+
break;
|
|
1288
|
+
|
|
1289
|
+
// catch set packing and partitioning constraints that already have the form
|
|
1290
|
+
// of a clique without transformations and add those cliques with the rows
|
|
1291
|
+
// being recorded
|
|
1292
|
+
if (mipsolver.rowUpper(i) == 1.0) {
|
|
1293
|
+
bool issetppc = true;
|
|
1294
|
+
|
|
1295
|
+
clique.clear();
|
|
1296
|
+
|
|
1297
|
+
for (HighsInt j = start; j != end; ++j) {
|
|
1298
|
+
HighsInt col = mipsolver.mipdata_->ARindex_[j];
|
|
1299
|
+
if (globaldom.col_upper_[col] == 0.0 &&
|
|
1300
|
+
globaldom.col_lower_[col] == 0.0)
|
|
1301
|
+
continue;
|
|
1302
|
+
|
|
1303
|
+
issetppc =
|
|
1304
|
+
globaldom.isBinary(col) && mipsolver.mipdata_->ARvalue_[j] == 1.0;
|
|
1305
|
+
if (!issetppc) break;
|
|
1306
|
+
|
|
1307
|
+
clique.emplace_back(col, 1);
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
if (issetppc) {
|
|
1311
|
+
addClique(mipsolver, clique.data(),
|
|
1312
|
+
static_cast<HighsInt>(clique.size()),
|
|
1313
|
+
mipsolver.rowLower(i) == 1.0, i);
|
|
1314
|
+
if (globaldom.infeasible()) return;
|
|
1315
|
+
continue;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
if (!transformRows || isFull()) continue;
|
|
1319
|
+
|
|
1320
|
+
offset = 0;
|
|
1321
|
+
for (HighsInt j = start; j != end; ++j) {
|
|
1322
|
+
HighsInt col = mipsolver.mipdata_->ARindex_[j];
|
|
1323
|
+
double val = mipsolver.mipdata_->ARvalue_[j];
|
|
1324
|
+
|
|
1325
|
+
resolveSubstitution(col, val, offset);
|
|
1326
|
+
entries[col] += val;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
auto checkRow = [&](double rhs, HighsInt direction) {
|
|
1330
|
+
if (direction * rhs == kHighsInf) return;
|
|
1331
|
+
rhs = direction * (rhs - offset);
|
|
1332
|
+
inds.clear();
|
|
1333
|
+
vals.clear();
|
|
1334
|
+
complementation.clear();
|
|
1335
|
+
bool freevar = false;
|
|
1336
|
+
HighsInt nbin = 0;
|
|
1337
|
+
|
|
1338
|
+
for (const auto& entry : entries) {
|
|
1339
|
+
HighsInt col = entry.key();
|
|
1340
|
+
double val = direction * entry.value();
|
|
1341
|
+
|
|
1342
|
+
if (std::abs(val) < mipsolver.mipdata_->epsilon) continue;
|
|
1343
|
+
|
|
1344
|
+
if (globaldom.isBinary(col)) ++nbin;
|
|
1345
|
+
|
|
1346
|
+
if (val < 0) {
|
|
1347
|
+
freevar = globaldom.col_upper_[col] == kHighsInf;
|
|
1348
|
+
if (freevar) break;
|
|
1349
|
+
|
|
1350
|
+
vals.push_back(-val);
|
|
1351
|
+
inds.push_back(col);
|
|
1352
|
+
complementation.push_back(-1);
|
|
1353
|
+
rhs -= val * globaldom.col_upper_[col];
|
|
1354
|
+
} else {
|
|
1355
|
+
freevar = globaldom.col_lower_[col] == -kHighsInf;
|
|
1356
|
+
if (freevar) break;
|
|
1357
|
+
|
|
1358
|
+
vals.push_back(val);
|
|
1359
|
+
inds.push_back(col);
|
|
1360
|
+
complementation.push_back(1);
|
|
1361
|
+
rhs -= val * globaldom.col_lower_[col];
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
if (!freevar && nbin != 0) {
|
|
1366
|
+
extractCliques(mipsolver, inds, vals, complementation, rhs, nbin, perm,
|
|
1367
|
+
clique, mipsolver.mipdata_->feastol);
|
|
1368
|
+
if (globaldom.infeasible()) return;
|
|
1369
|
+
}
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
checkRow(mipsolver.rowUpper(i), HighsInt{1});
|
|
1373
|
+
checkRow(mipsolver.rowLower(i), HighsInt{-1});
|
|
1374
|
+
|
|
1375
|
+
entries.clear();
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
void HighsCliqueTable::extractObjCliques(HighsMipSolver& mipsolver) {
|
|
1380
|
+
HighsInt nbin =
|
|
1381
|
+
mipsolver.mipdata_->objectiveFunction.getNumBinariesInObjective();
|
|
1382
|
+
if (nbin <= 1) return;
|
|
1383
|
+
HighsDomain& globaldom = mipsolver.mipdata_->domain;
|
|
1384
|
+
if (globaldom.getObjectiveLowerBound() == -kHighsInf) return;
|
|
1385
|
+
|
|
1386
|
+
const double* vals;
|
|
1387
|
+
const HighsInt* inds;
|
|
1388
|
+
HighsInt len;
|
|
1389
|
+
double rhs;
|
|
1390
|
+
globaldom.getCutoffConstraint(vals, inds, len, rhs);
|
|
1391
|
+
|
|
1392
|
+
std::vector<HighsInt> perm;
|
|
1393
|
+
perm.resize(nbin);
|
|
1394
|
+
std::iota(perm.begin(), perm.end(), 0);
|
|
1395
|
+
|
|
1396
|
+
auto binaryend = std::partition(perm.begin(), perm.end(), [&](HighsInt pos) {
|
|
1397
|
+
return vals[pos] != 0.0 && !globaldom.isFixed(inds[pos]);
|
|
1398
|
+
});
|
|
1399
|
+
|
|
1400
|
+
nbin = binaryend - perm.begin();
|
|
1401
|
+
|
|
1402
|
+
// only one binary means we do have no cliques
|
|
1403
|
+
if (nbin <= 1) return;
|
|
1404
|
+
|
|
1405
|
+
std::vector<CliqueVar> clique;
|
|
1406
|
+
clique.reserve(nbin);
|
|
1407
|
+
|
|
1408
|
+
pdqsort(perm.begin(), binaryend, [&](HighsInt p1, HighsInt p2) {
|
|
1409
|
+
return std::make_pair(std::fabs(vals[p1]), p1) >
|
|
1410
|
+
std::make_pair(std::fabs(vals[p2]), p2);
|
|
1411
|
+
});
|
|
1412
|
+
|
|
1413
|
+
// check if any cliques exists
|
|
1414
|
+
HighsCDouble minact;
|
|
1415
|
+
HighsInt ninf;
|
|
1416
|
+
globaldom.computeMinActivity(0, len, inds, vals, ninf, minact);
|
|
1417
|
+
const double feastol = mipsolver.mipdata_->feastol;
|
|
1418
|
+
if (std::fabs(vals[perm[0]]) + std::fabs(vals[perm[1]]) <=
|
|
1419
|
+
static_cast<double>(rhs - minact + feastol))
|
|
1420
|
+
return;
|
|
1421
|
+
|
|
1422
|
+
for (HighsInt k = nbin - 1; k != 0; --k) {
|
|
1423
|
+
double mincliqueval =
|
|
1424
|
+
static_cast<double>(rhs - minact - std::fabs(vals[perm[k]]) + feastol);
|
|
1425
|
+
auto cliqueend = std::partition_point(
|
|
1426
|
+
perm.begin(), perm.begin() + k,
|
|
1427
|
+
[&](HighsInt p) { return std::abs(vals[p]) > mincliqueval; });
|
|
1428
|
+
|
|
1429
|
+
// no clique for this variable
|
|
1430
|
+
if (cliqueend == perm.begin()) continue;
|
|
1431
|
+
|
|
1432
|
+
clique.clear();
|
|
1433
|
+
|
|
1434
|
+
for (auto j = perm.begin(); j != cliqueend; ++j) {
|
|
1435
|
+
HighsInt pos = *j;
|
|
1436
|
+
if (vals[pos] < 0)
|
|
1437
|
+
clique.emplace_back(inds[pos], 0);
|
|
1438
|
+
else
|
|
1439
|
+
clique.emplace_back(inds[pos], 1);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
if (vals[perm[k]] < 0)
|
|
1443
|
+
clique.emplace_back(inds[perm[k]], 0);
|
|
1444
|
+
else
|
|
1445
|
+
clique.emplace_back(inds[perm[k]], 1);
|
|
1446
|
+
|
|
1447
|
+
// printf("extracted this clique from obj:\n");
|
|
1448
|
+
// printClique(clique);
|
|
1449
|
+
if (clique.size() >= 2) {
|
|
1450
|
+
// printf("extracted clique from obj\n");
|
|
1451
|
+
// if (clique.size() > 2) runCliqueSubsumption(globaldom, clique);
|
|
1452
|
+
|
|
1453
|
+
addClique(mipsolver, clique.data(), static_cast<HighsInt>(clique.size()));
|
|
1454
|
+
if (globaldom.infeasible()) return;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
// further cliques are just subsets of this clique
|
|
1458
|
+
if (cliqueend == perm.begin() + k) return;
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
void HighsCliqueTable::processInfeasibleVertices(HighsDomain& globaldom) {
|
|
1463
|
+
while (!infeasvertexstack.empty() && !globaldom.infeasible()) {
|
|
1464
|
+
CliqueVar v = infeasvertexstack.back().complement();
|
|
1465
|
+
infeasvertexstack.pop_back();
|
|
1466
|
+
|
|
1467
|
+
resolveSubstitution(v);
|
|
1468
|
+
bool wasfixed = globaldom.isFixed(v.col);
|
|
1469
|
+
globaldom.fixCol(v.col, static_cast<double>(v.val));
|
|
1470
|
+
if (globaldom.infeasible()) return;
|
|
1471
|
+
if (!wasfixed) ++nfixings;
|
|
1472
|
+
if (colDeleted[v.col]) continue;
|
|
1473
|
+
colDeleted[v.col] = true;
|
|
1474
|
+
|
|
1475
|
+
HighsHashTree<HighsInt, HighsInt> vHashLists =
|
|
1476
|
+
std::move(invertedHashList[v.index()]);
|
|
1477
|
+
HighsHashTree<HighsInt> vHashListsSizeTwo =
|
|
1478
|
+
std::move(invertedHashListSizeTwo[v.index()]);
|
|
1479
|
+
|
|
1480
|
+
bool infeas = vHashLists.for_each([&](HighsInt cliqueid) {
|
|
1481
|
+
HighsInt start = cliques[cliqueid].start;
|
|
1482
|
+
HighsInt end = cliques[cliqueid].end;
|
|
1483
|
+
|
|
1484
|
+
for (HighsInt i = start; i != end; ++i) {
|
|
1485
|
+
if (cliqueentries[i].col == v.col) continue;
|
|
1486
|
+
if (!fixCol(globaldom, cliqueentries[i])) return true;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
removeClique(cliqueid);
|
|
1490
|
+
return false;
|
|
1491
|
+
});
|
|
1492
|
+
|
|
1493
|
+
if (infeas) return;
|
|
1494
|
+
|
|
1495
|
+
infeas = vHashListsSizeTwo.for_each([&](HighsInt cliqueid) {
|
|
1496
|
+
HighsInt start = cliques[cliqueid].start;
|
|
1497
|
+
HighsInt end = cliques[cliqueid].end;
|
|
1498
|
+
|
|
1499
|
+
for (HighsInt i = start; i != end; ++i) {
|
|
1500
|
+
if (cliqueentries[i].col == v.col) continue;
|
|
1501
|
+
if (!fixCol(globaldom, cliqueentries[i])) return true;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
removeClique(cliqueid);
|
|
1505
|
+
return false;
|
|
1506
|
+
});
|
|
1507
|
+
|
|
1508
|
+
if (infeas) return;
|
|
1509
|
+
|
|
1510
|
+
vHashLists = std::move(invertedHashList[v.complement().index()]);
|
|
1511
|
+
vHashListsSizeTwo =
|
|
1512
|
+
std::move(invertedHashListSizeTwo[v.complement().index()]);
|
|
1513
|
+
|
|
1514
|
+
if (inPresolve) {
|
|
1515
|
+
// during presolve we only count the number of zeros within each clique
|
|
1516
|
+
// and only remove fully redundant cliques that are larger than two
|
|
1517
|
+
// in the process since during presolve a lot of cliques of size two
|
|
1518
|
+
// may be found by probing and will be deleted upon rebuild anyways
|
|
1519
|
+
vHashLists.for_each([&](HighsInt cliqueid) {
|
|
1520
|
+
cliques[cliqueid].numZeroFixed += 1;
|
|
1521
|
+
if (cliques[cliqueid].numActive() <= 1) removeClique(cliqueid);
|
|
1522
|
+
});
|
|
1523
|
+
continue;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
vHashListsSizeTwo.for_each(
|
|
1527
|
+
[&](HighsInt cliqueid) { removeClique(cliqueid); });
|
|
1528
|
+
|
|
1529
|
+
assert(cliquehitinds.empty());
|
|
1530
|
+
std::vector<CliqueVar> clq;
|
|
1531
|
+
vHashLists.for_each([&](HighsInt cliqueid) {
|
|
1532
|
+
// assert(cliqueentries[entry.value()].val == 1 - v.val);
|
|
1533
|
+
|
|
1534
|
+
cliques[cliqueid].numZeroFixed += 1;
|
|
1535
|
+
if (cliques[cliqueid].numActive() <= 1) {
|
|
1536
|
+
removeClique(cliqueid);
|
|
1537
|
+
} else if (cliques[cliqueid].numZeroFixed >=
|
|
1538
|
+
std::max(
|
|
1539
|
+
HighsInt{10},
|
|
1540
|
+
(cliques[cliqueid].end - cliques[cliqueid].start) >> 1)) {
|
|
1541
|
+
clq.assign(cliqueentries.begin() + cliques[cliqueid].start,
|
|
1542
|
+
cliqueentries.begin() + cliques[cliqueid].end);
|
|
1543
|
+
|
|
1544
|
+
auto computeNumDeleted = [&](const std::vector<CliqueVar>& clq) {
|
|
1545
|
+
HighsInt numDel = 0;
|
|
1546
|
+
for (CliqueVar x : clq) numDel += colDeleted[x.col];
|
|
1547
|
+
return numDel;
|
|
1548
|
+
};
|
|
1549
|
+
|
|
1550
|
+
assert(computeNumDeleted(clq) == cliques[cliqueid].numZeroFixed);
|
|
1551
|
+
|
|
1552
|
+
removeClique(cliqueid);
|
|
1553
|
+
clq.erase(std::remove_if(clq.begin(), clq.end(),
|
|
1554
|
+
[&](CliqueVar x) {
|
|
1555
|
+
return globaldom.isFixed(x.col) &&
|
|
1556
|
+
globaldom.col_lower_[x.col] ==
|
|
1557
|
+
1 - x.val;
|
|
1558
|
+
}),
|
|
1559
|
+
clq.end());
|
|
1560
|
+
if (clq.size() > 1) doAddClique(clq.data(), clq.size());
|
|
1561
|
+
}
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
propagateAndCleanup(globaldom);
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
void HighsCliqueTable::propagateAndCleanup(HighsDomain& globaldom) {
|
|
1569
|
+
const auto& domchgstack = globaldom.getDomainChangeStack();
|
|
1570
|
+
HighsInt start = domchgstack.size();
|
|
1571
|
+
globaldom.propagate();
|
|
1572
|
+
HighsInt end = domchgstack.size();
|
|
1573
|
+
|
|
1574
|
+
while (!globaldom.infeasible() && start != end) {
|
|
1575
|
+
for (HighsInt k = start; k != end; ++k) {
|
|
1576
|
+
HighsInt col = domchgstack[k].column;
|
|
1577
|
+
if (!globaldom.isFixed(col)) continue;
|
|
1578
|
+
if (globaldom.col_lower_[col] != 1.0 && globaldom.col_lower_[col] != 0.0)
|
|
1579
|
+
continue;
|
|
1580
|
+
|
|
1581
|
+
HighsInt fixval = static_cast<HighsInt>(globaldom.col_lower_[col]);
|
|
1582
|
+
CliqueVar v(col, 1 - fixval);
|
|
1583
|
+
if (numCliques(v) != 0) {
|
|
1584
|
+
vertexInfeasible(globaldom, col, 1 - fixval);
|
|
1585
|
+
if (globaldom.infeasible()) return;
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
start = domchgstack.size();
|
|
1589
|
+
globaldom.propagate();
|
|
1590
|
+
end = domchgstack.size();
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
void HighsCliqueTable::vertexInfeasible(HighsDomain& globaldom, HighsInt col,
|
|
1595
|
+
HighsInt val) {
|
|
1596
|
+
bool wasfixed = globaldom.isFixed(col);
|
|
1597
|
+
globaldom.fixCol(col, static_cast<double>(1 - val));
|
|
1598
|
+
if (globaldom.infeasible()) return;
|
|
1599
|
+
if (!wasfixed) ++nfixings;
|
|
1600
|
+
infeasvertexstack.emplace_back(col, val);
|
|
1601
|
+
processInfeasibleVertices(globaldom);
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
void HighsCliqueTable::separateCliques(const HighsMipSolver& mipsolver,
|
|
1605
|
+
const std::vector<double>& sol,
|
|
1606
|
+
HighsCutPool& cutpool, double feastol) {
|
|
1607
|
+
BronKerboschData data(sol);
|
|
1608
|
+
data.feastol = feastol;
|
|
1609
|
+
data.maxNeighbourhoodQueries = 1000000 +
|
|
1610
|
+
int64_t{100} * mipsolver.numNonzero() +
|
|
1611
|
+
mipsolver.mipdata_->total_lp_iterations * 1000;
|
|
1612
|
+
if (numNeighbourhoodQueries > data.maxNeighbourhoodQueries) return;
|
|
1613
|
+
data.maxNeighbourhoodQueries -= numNeighbourhoodQueries;
|
|
1614
|
+
const HighsDomain& globaldom = mipsolver.mipdata_->domain;
|
|
1615
|
+
|
|
1616
|
+
for (HighsInt i : mipsolver.mipdata_->integral_cols) {
|
|
1617
|
+
if (colsubstituted[i] || colDeleted[i]) continue;
|
|
1618
|
+
#ifdef ADD_ZERO_WEIGHT_VARS
|
|
1619
|
+
if (numCliques(i, 0) != 0) {
|
|
1620
|
+
if (CliqueVar(i, 0).weight(sol) > feastol)
|
|
1621
|
+
data.P.emplace_back(i, 0);
|
|
1622
|
+
else
|
|
1623
|
+
data.Z.emplace_back(i, 0);
|
|
1624
|
+
}
|
|
1625
|
+
if (numCliques(i, 1) != 0) {
|
|
1626
|
+
if (CliqueVar(i, 1).weight(sol) > feastol)
|
|
1627
|
+
data.P.emplace_back(i, 1);
|
|
1628
|
+
else
|
|
1629
|
+
data.Z.emplace_back(i, 1);
|
|
1630
|
+
}
|
|
1631
|
+
#else
|
|
1632
|
+
if (numcliquesvar[CliqueVar(i, 0).index()] != 0 &&
|
|
1633
|
+
CliqueVar(i, 0).weight(sol) > feastol)
|
|
1634
|
+
data.P.emplace_back(i, 0);
|
|
1635
|
+
if (numcliquesvar[CliqueVar(i, 1).index()] != 0 &&
|
|
1636
|
+
CliqueVar(i, 1).weight(sol) > feastol)
|
|
1637
|
+
data.P.emplace_back(i, 1);
|
|
1638
|
+
#endif
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
// auto t1 = std::chrono::high_resolution_clock::now();
|
|
1642
|
+
bronKerboschRecurse(data, data.P.size(), nullptr, 0);
|
|
1643
|
+
|
|
1644
|
+
// auto t2 = std::chrono::high_resolution_clock::now();
|
|
1645
|
+
|
|
1646
|
+
// printf(
|
|
1647
|
+
// "bron kerbosch: %" HIGHSINT_FORMAT " calls, %" HIGHSINT_FORMAT "
|
|
1648
|
+
// cliques, %ldms\n", data.ncalls, int(data.cliques.size()),
|
|
1649
|
+
// std::chrono::duration_cast<std::chrono::milliseconds>(t2 -
|
|
1650
|
+
// t1).count());
|
|
1651
|
+
|
|
1652
|
+
bool runcliquesubsumption = false;
|
|
1653
|
+
std::vector<HighsInt> inds;
|
|
1654
|
+
std::vector<double> vals;
|
|
1655
|
+
for (std::vector<CliqueVar>& clique : data.cliques) {
|
|
1656
|
+
#ifdef ADD_ZERO_WEIGHT_VARS
|
|
1657
|
+
HighsInt extensionend = static_cast<HighsInt>(data.Z.size());
|
|
1658
|
+
for (CliqueVar v : clique) {
|
|
1659
|
+
extensionend = partitionNeighbourhood(data.neighbourhoodInds,
|
|
1660
|
+
data.numNeighbourhoodQueries, v,
|
|
1661
|
+
data.Z.data(), extensionend);
|
|
1662
|
+
if (extensionend == 0) break;
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
if (extensionend != 0) {
|
|
1666
|
+
randgen.shuffle(data.Z.data(), extensionend);
|
|
1667
|
+
|
|
1668
|
+
for (HighsInt i = 0; i < extensionend; ++i) {
|
|
1669
|
+
HighsInt k = i + 1;
|
|
1670
|
+
extensionend =
|
|
1671
|
+
k + partitionNeighbourhood(data.neighbourhoodInds,
|
|
1672
|
+
data.numNeighbourhoodQueries, data.Z[i],
|
|
1673
|
+
data.Z.data() + k, extensionend - k);
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
clique.insert(clique.end(), data.Z.begin(),
|
|
1677
|
+
data.Z.begin() + extensionend);
|
|
1678
|
+
}
|
|
1679
|
+
#endif
|
|
1680
|
+
|
|
1681
|
+
double rhs = 1;
|
|
1682
|
+
runcliquesubsumption = cliques.size() > 2;
|
|
1683
|
+
inds.clear();
|
|
1684
|
+
vals.clear();
|
|
1685
|
+
|
|
1686
|
+
for (CliqueVar v : clique) {
|
|
1687
|
+
inds.push_back(v.col);
|
|
1688
|
+
if (v.val == 0) {
|
|
1689
|
+
vals.push_back(-1);
|
|
1690
|
+
rhs -= 1;
|
|
1691
|
+
} else
|
|
1692
|
+
vals.push_back(1);
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
rhs = std::floor(rhs + 0.5);
|
|
1696
|
+
|
|
1697
|
+
cutpool.addCut(mipsolver, inds.data(), vals.data(), inds.size(), rhs, true,
|
|
1698
|
+
false, false);
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
numNeighbourhoodQueries += data.numNeighbourhoodQueries;
|
|
1702
|
+
|
|
1703
|
+
if (runcliquesubsumption) {
|
|
1704
|
+
for (std::vector<CliqueVar>& clique : data.cliques) {
|
|
1705
|
+
HighsInt nremoved = runCliqueSubsumption(globaldom, clique);
|
|
1706
|
+
|
|
1707
|
+
if (clique.empty()) continue;
|
|
1708
|
+
if (nremoved != 0) doAddClique(clique.data(), clique.size(), false, -1);
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
std::vector<std::vector<HighsCliqueTable::CliqueVar>>
|
|
1714
|
+
HighsCliqueTable::separateCliques(const std::vector<double>& sol,
|
|
1715
|
+
const HighsDomain& globaldom,
|
|
1716
|
+
double feastol) {
|
|
1717
|
+
exit(0);
|
|
1718
|
+
#if 0
|
|
1719
|
+
BronKerboschData data(sol);
|
|
1720
|
+
data.feastol = feastol;
|
|
1721
|
+
|
|
1722
|
+
HighsInt numcols = globaldom.col_lower_.size();
|
|
1723
|
+
assert(int(numcliquesvar.size()) == 2 * numcols);
|
|
1724
|
+
for (HighsInt i = 0; i != numcols; ++i) {
|
|
1725
|
+
if (colsubstituted[i]) continue;
|
|
1726
|
+
|
|
1727
|
+
if (numcliquesvar[CliqueVar(i, 0).index()] != 0 &&
|
|
1728
|
+
CliqueVar(i, 0).weight(sol) > feastol)
|
|
1729
|
+
data.P.emplace_back(i, 0);
|
|
1730
|
+
if (numcliquesvar[CliqueVar(i, 1).index()] != 0 &&
|
|
1731
|
+
CliqueVar(i, 1).weight(sol) > feastol)
|
|
1732
|
+
data.P.emplace_back(i, 1);
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
bronKerboschRecurse(data, data.P.size(), nullptr, 0);
|
|
1736
|
+
|
|
1737
|
+
return std::move(data.cliques);
|
|
1738
|
+
#endif
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
std::vector<std::vector<HighsCliqueTable::CliqueVar>>
|
|
1742
|
+
HighsCliqueTable::computeMaximalCliques(const std::vector<CliqueVar>& vars,
|
|
1743
|
+
double feastol) {
|
|
1744
|
+
// return if there are no variables
|
|
1745
|
+
if (vars.empty())
|
|
1746
|
+
return std::vector<std::vector<HighsCliqueTable::CliqueVar>>{};
|
|
1747
|
+
|
|
1748
|
+
// find max column index in clique variables
|
|
1749
|
+
size_t maxcolindex = 0;
|
|
1750
|
+
for (const auto& var : vars)
|
|
1751
|
+
maxcolindex = std::max(static_cast<size_t>(var.col), maxcolindex);
|
|
1752
|
+
|
|
1753
|
+
// set up data
|
|
1754
|
+
std::vector<double> sol;
|
|
1755
|
+
sol.resize(maxcolindex + 1);
|
|
1756
|
+
for (const auto& var : vars) sol[var.col] = var.val;
|
|
1757
|
+
BronKerboschData data(sol);
|
|
1758
|
+
data.feastol = feastol;
|
|
1759
|
+
|
|
1760
|
+
for (const auto& var : vars) {
|
|
1761
|
+
if (colsubstituted[var.col] || colDeleted[var.col]) continue;
|
|
1762
|
+
if (numCliques(var) != 0) data.P.emplace_back(var);
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
bronKerboschRecurse(data, data.P.size(), nullptr, 0);
|
|
1766
|
+
|
|
1767
|
+
return std::move(data.cliques);
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
void HighsCliqueTable::addImplications(HighsDomain& domain, HighsInt col,
|
|
1771
|
+
HighsInt val) {
|
|
1772
|
+
CliqueVar v(col, val);
|
|
1773
|
+
|
|
1774
|
+
while (colsubstituted[v.col]) {
|
|
1775
|
+
assert(static_cast<HighsInt>(substitutions.size()) >
|
|
1776
|
+
colsubstituted[v.col] - 1);
|
|
1777
|
+
Substitution subst = substitutions[colsubstituted[v.col] - 1];
|
|
1778
|
+
v = v.val == 1 ? subst.replace : subst.replace.complement();
|
|
1779
|
+
if (v.val == 1) {
|
|
1780
|
+
if (domain.col_lower_[v.col] == 1.0) continue;
|
|
1781
|
+
|
|
1782
|
+
domain.changeBound(HighsBoundType::kLower, v.col, 1.0,
|
|
1783
|
+
HighsDomain::Reason::cliqueTable(col, val));
|
|
1784
|
+
if (domain.infeasible()) return;
|
|
1785
|
+
} else {
|
|
1786
|
+
if (domain.col_upper_[v.col] == 0.0) continue;
|
|
1787
|
+
|
|
1788
|
+
domain.changeBound(HighsBoundType::kUpper, v.col, 0.0,
|
|
1789
|
+
HighsDomain::Reason::cliqueTable(col, val));
|
|
1790
|
+
if (domain.infeasible()) return;
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
auto doFixings = [&](HighsInt cliqueid) {
|
|
1795
|
+
HighsInt start = cliques[cliqueid].start;
|
|
1796
|
+
HighsInt end = cliques[cliqueid].end;
|
|
1797
|
+
|
|
1798
|
+
for (HighsInt i = start; i != end; ++i) {
|
|
1799
|
+
if (cliqueentries[i].col == v.col) continue;
|
|
1800
|
+
|
|
1801
|
+
if (cliqueentries[i].val == 1) {
|
|
1802
|
+
if (domain.col_upper_[cliqueentries[i].col] == 0.0) continue;
|
|
1803
|
+
|
|
1804
|
+
domain.changeBound(HighsBoundType::kUpper, cliqueentries[i].col, 0.0,
|
|
1805
|
+
HighsDomain::Reason::cliqueTable(col, val));
|
|
1806
|
+
if (domain.infeasible()) return true;
|
|
1807
|
+
} else {
|
|
1808
|
+
if (domain.col_lower_[cliqueentries[i].col] == 1.0) continue;
|
|
1809
|
+
|
|
1810
|
+
domain.changeBound(HighsBoundType::kLower, cliqueentries[i].col, 1.0,
|
|
1811
|
+
HighsDomain::Reason::cliqueTable(col, val));
|
|
1812
|
+
if (domain.infeasible()) return true;
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
return false;
|
|
1817
|
+
};
|
|
1818
|
+
|
|
1819
|
+
bool infeas = invertedHashList[v.index()].for_each(doFixings);
|
|
1820
|
+
|
|
1821
|
+
if (infeas) return;
|
|
1822
|
+
|
|
1823
|
+
invertedHashListSizeTwo[v.index()].for_each(doFixings);
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
void HighsCliqueTable::cleanupFixed(HighsDomain& globaldom) {
|
|
1827
|
+
HighsInt numcol = globaldom.col_upper_.size();
|
|
1828
|
+
HighsInt oldnfixings = nfixings;
|
|
1829
|
+
for (HighsInt i = 0; i != numcol; ++i) {
|
|
1830
|
+
if (colDeleted[i] || !globaldom.isFixed(i)) continue;
|
|
1831
|
+
if (globaldom.col_lower_[i] != 1.0 && globaldom.col_lower_[i] != 0.0)
|
|
1832
|
+
continue;
|
|
1833
|
+
|
|
1834
|
+
HighsInt fixval = static_cast<HighsInt>(globaldom.col_lower_[i]);
|
|
1835
|
+
CliqueVar v(i, 1 - fixval);
|
|
1836
|
+
|
|
1837
|
+
vertexInfeasible(globaldom, v.col, v.val);
|
|
1838
|
+
if (globaldom.infeasible()) return;
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
if (nfixings != oldnfixings) propagateAndCleanup(globaldom);
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
HighsInt HighsCliqueTable::getNumImplications(HighsInt col) {
|
|
1845
|
+
// first count all cliques as one implication, so that cliques of size two
|
|
1846
|
+
// are accounted for already
|
|
1847
|
+
HighsInt i0 = CliqueVar(col, 0).index();
|
|
1848
|
+
HighsInt i1 = CliqueVar(col, 1).index();
|
|
1849
|
+
HighsInt numimplics = numcliquesvar[i0] + numcliquesvar[i1];
|
|
1850
|
+
|
|
1851
|
+
// now loop over cliques larger than size two and add the cliquelength - 1 as
|
|
1852
|
+
// additional implications
|
|
1853
|
+
auto countImplics = [&](HighsInt cliqueid) {
|
|
1854
|
+
HighsInt nimplics = cliques[cliqueid].end - cliques[cliqueid].start - 1;
|
|
1855
|
+
nimplics *= (1 + cliques[cliqueid].equality);
|
|
1856
|
+
numimplics += nimplics - 1;
|
|
1857
|
+
};
|
|
1858
|
+
invertedHashList[i0].for_each(countImplics);
|
|
1859
|
+
invertedHashList[i1].for_each(countImplics);
|
|
1860
|
+
return numimplics;
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
HighsInt HighsCliqueTable::getNumImplications(HighsInt col, bool val) {
|
|
1864
|
+
HighsInt iVal = CliqueVar(col, val).index();
|
|
1865
|
+
|
|
1866
|
+
// each size two clique is one implication
|
|
1867
|
+
HighsInt numimplics = numcliquesvar[iVal];
|
|
1868
|
+
|
|
1869
|
+
// now loop over cliques larger than size two and add the cliquelength - 1 as
|
|
1870
|
+
// additional implications
|
|
1871
|
+
invertedHashList[iVal].for_each([&](HighsInt cliqueid) {
|
|
1872
|
+
HighsInt nimplics = cliques[cliqueid].end - cliques[cliqueid].start - 1;
|
|
1873
|
+
nimplics *= (1 + cliques[cliqueid].equality);
|
|
1874
|
+
numimplics += nimplics - 1;
|
|
1875
|
+
});
|
|
1876
|
+
|
|
1877
|
+
return numimplics;
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
void HighsCliqueTable::runCliqueMerging(HighsDomain& globaldomain,
|
|
1881
|
+
std::vector<CliqueVar>& clique,
|
|
1882
|
+
bool equation) {
|
|
1883
|
+
CliqueVar extensionstart;
|
|
1884
|
+
HighsInt numcliques = kHighsIInf;
|
|
1885
|
+
iscandidate.resize(invertedHashList.size());
|
|
1886
|
+
std::vector<HighsInt> neighbourhoodInds;
|
|
1887
|
+
neighbourhoodInds.reserve(invertedHashList.size());
|
|
1888
|
+
|
|
1889
|
+
HighsInt initialCliqueSize = clique.size();
|
|
1890
|
+
for (HighsInt i = 0; i != initialCliqueSize; ++i) {
|
|
1891
|
+
if (globaldomain.isFixed(clique[i].col)) continue;
|
|
1892
|
+
|
|
1893
|
+
HighsInt thisNumClqs = numCliques(clique[i]);
|
|
1894
|
+
if (thisNumClqs < numcliques) {
|
|
1895
|
+
numcliques = thisNumClqs;
|
|
1896
|
+
extensionstart = clique[i];
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
if (numcliques == kHighsIInf) {
|
|
1901
|
+
clique.clear();
|
|
1902
|
+
return;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
for (HighsInt i = 0; i != initialCliqueSize; ++i)
|
|
1906
|
+
iscandidate[clique[i].index()] = true;
|
|
1907
|
+
|
|
1908
|
+
auto addCands = [&](HighsInt cliqueid) {
|
|
1909
|
+
HighsInt start = cliques[cliqueid].start;
|
|
1910
|
+
HighsInt end = cliques[cliqueid].end;
|
|
1911
|
+
|
|
1912
|
+
for (HighsInt i = start; i != end; ++i) {
|
|
1913
|
+
if (iscandidate[cliqueentries[i].index()] ||
|
|
1914
|
+
globaldomain.isFixed(cliqueentries[i].col))
|
|
1915
|
+
continue;
|
|
1916
|
+
|
|
1917
|
+
iscandidate[cliqueentries[i].index()] = true;
|
|
1918
|
+
clique.push_back(cliqueentries[i]);
|
|
1919
|
+
}
|
|
1920
|
+
};
|
|
1921
|
+
|
|
1922
|
+
invertedHashList[extensionstart.index()].for_each(
|
|
1923
|
+
[&](HighsInt cliqueid) { addCands(cliqueid); });
|
|
1924
|
+
|
|
1925
|
+
invertedHashListSizeTwo[extensionstart.index()].for_each(
|
|
1926
|
+
[&](HighsInt cliqueid) { addCands(cliqueid); });
|
|
1927
|
+
|
|
1928
|
+
HighsInt sizeWithCandidates = clique.size();
|
|
1929
|
+
for (HighsInt i = 0; i != sizeWithCandidates; ++i)
|
|
1930
|
+
iscandidate[clique[i].index()] = false;
|
|
1931
|
+
|
|
1932
|
+
for (HighsInt i = 0; i != initialCliqueSize &&
|
|
1933
|
+
initialCliqueSize < static_cast<HighsInt>(clique.size());
|
|
1934
|
+
++i) {
|
|
1935
|
+
if (clique[i] == extensionstart) continue;
|
|
1936
|
+
|
|
1937
|
+
HighsInt newSize =
|
|
1938
|
+
initialCliqueSize +
|
|
1939
|
+
shrinkToNeighbourhood(neighbourhoodInds, numNeighbourhoodQueries,
|
|
1940
|
+
clique[i], clique.data() + initialCliqueSize,
|
|
1941
|
+
clique.size() - initialCliqueSize);
|
|
1942
|
+
clique.erase(clique.begin() + newSize, clique.end());
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
if (static_cast<size_t>(initialCliqueSize) < clique.size()) {
|
|
1946
|
+
// todo, shuffle extension vars?
|
|
1947
|
+
randgen.shuffle(clique.data() + initialCliqueSize,
|
|
1948
|
+
clique.size() - initialCliqueSize);
|
|
1949
|
+
HighsInt i = initialCliqueSize;
|
|
1950
|
+
while (i < static_cast<HighsInt>(clique.size())) {
|
|
1951
|
+
CliqueVar extvar = clique[i];
|
|
1952
|
+
i += 1;
|
|
1953
|
+
|
|
1954
|
+
HighsInt newSize = i + shrinkToNeighbourhood(
|
|
1955
|
+
neighbourhoodInds, numNeighbourhoodQueries,
|
|
1956
|
+
extvar, clique.data() + i, clique.size() - i);
|
|
1957
|
+
clique.erase(clique.begin() + newSize, clique.end());
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
if (equation) {
|
|
1962
|
+
for (HighsInt i = initialCliqueSize;
|
|
1963
|
+
i < static_cast<HighsInt>(clique.size()); ++i)
|
|
1964
|
+
vertexInfeasible(globaldomain, clique[i].col, clique[i].val);
|
|
1965
|
+
} else {
|
|
1966
|
+
runCliqueSubsumption(globaldomain, clique);
|
|
1967
|
+
|
|
1968
|
+
if (!clique.empty()) {
|
|
1969
|
+
clique.erase(
|
|
1970
|
+
std::remove_if(clique.begin(), clique.end(),
|
|
1971
|
+
[&](CliqueVar v) {
|
|
1972
|
+
return globaldomain.isFixed(v.col) &&
|
|
1973
|
+
static_cast<int>(
|
|
1974
|
+
globaldomain.col_lower_[v.col]) ==
|
|
1975
|
+
static_cast<int>(1 - v.val);
|
|
1976
|
+
}),
|
|
1977
|
+
clique.end());
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
processInfeasibleVertices(globaldomain);
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
void HighsCliqueTable::runCliqueMerging(HighsDomain& globaldomain) {
|
|
1985
|
+
std::vector<CliqueVar> extensionvars;
|
|
1986
|
+
iscandidate.resize(invertedHashList.size());
|
|
1987
|
+
std::vector<HighsInt> neighbourhoodInds;
|
|
1988
|
+
neighbourhoodInds.reserve(invertedHashList.size());
|
|
1989
|
+
|
|
1990
|
+
HighsInt numcliqueslots = static_cast<HighsInt>(cliques.size());
|
|
1991
|
+
const HighsInt maxNewEntries = numEntries + globaldomain.numModelNonzeros();
|
|
1992
|
+
bool haveNonModelCliquesToMerge = false;
|
|
1993
|
+
for (HighsInt k = 0; k != numcliqueslots; ++k) {
|
|
1994
|
+
if (cliques[k].start == -1) continue;
|
|
1995
|
+
if (!cliques[k].equality && cliques[k].origin == kHighsIInf) continue;
|
|
1996
|
+
if (cliques[k].origin == -1) {
|
|
1997
|
+
haveNonModelCliquesToMerge = true;
|
|
1998
|
+
continue;
|
|
1999
|
+
}
|
|
2000
|
+
HighsInt numclqvars = cliques[k].end - cliques[k].start;
|
|
2001
|
+
assert(numclqvars != 0);
|
|
2002
|
+
if (numclqvars == 0) continue;
|
|
2003
|
+
|
|
2004
|
+
CliqueVar* clqvars = &cliqueentries[cliques[k].start];
|
|
2005
|
+
|
|
2006
|
+
CliqueVar extensionstart = clqvars[0];
|
|
2007
|
+
HighsInt numcliques = numCliques(clqvars[0]);
|
|
2008
|
+
for (HighsInt i = 1; i != numclqvars; ++i) {
|
|
2009
|
+
HighsInt thisNumClqs = numCliques(clqvars[i]);
|
|
2010
|
+
if (thisNumClqs < numcliques) {
|
|
2011
|
+
numcliques = thisNumClqs;
|
|
2012
|
+
extensionstart = clqvars[i];
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
for (HighsInt i = 0; i != numclqvars; ++i)
|
|
2017
|
+
iscandidate[clqvars[i].index()] = true;
|
|
2018
|
+
|
|
2019
|
+
auto addCands = [&](HighsInt cliqueid) {
|
|
2020
|
+
HighsInt start = cliques[cliqueid].start;
|
|
2021
|
+
HighsInt end = cliques[cliqueid].end;
|
|
2022
|
+
|
|
2023
|
+
for (HighsInt i = start; i != end; ++i) {
|
|
2024
|
+
if (iscandidate[cliqueentries[i].index()] ||
|
|
2025
|
+
globaldomain.isFixed(cliqueentries[i].col))
|
|
2026
|
+
continue;
|
|
2027
|
+
|
|
2028
|
+
iscandidate[cliqueentries[i].index()] = true;
|
|
2029
|
+
extensionvars.push_back(cliqueentries[i]);
|
|
2030
|
+
}
|
|
2031
|
+
};
|
|
2032
|
+
|
|
2033
|
+
invertedHashList[extensionstart.index()].for_each(
|
|
2034
|
+
[&](HighsInt cliqueid) { addCands(cliqueid); });
|
|
2035
|
+
|
|
2036
|
+
invertedHashListSizeTwo[extensionstart.index()].for_each(
|
|
2037
|
+
[&](HighsInt cliqueid) { addCands(cliqueid); });
|
|
2038
|
+
|
|
2039
|
+
for (HighsInt i = 0; i != numclqvars; ++i)
|
|
2040
|
+
iscandidate[clqvars[i].index()] = false;
|
|
2041
|
+
for (CliqueVar v : extensionvars) iscandidate[v.index()] = false;
|
|
2042
|
+
|
|
2043
|
+
for (HighsInt i = 0; i != numclqvars && !extensionvars.empty(); ++i) {
|
|
2044
|
+
if (clqvars[i] == extensionstart) continue;
|
|
2045
|
+
|
|
2046
|
+
HighsInt newSize = shrinkToNeighbourhood(
|
|
2047
|
+
neighbourhoodInds, numNeighbourhoodQueries, clqvars[i],
|
|
2048
|
+
extensionvars.data(), static_cast<HighsInt>(extensionvars.size()));
|
|
2049
|
+
extensionvars.erase(extensionvars.begin() + newSize, extensionvars.end());
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
if (!extensionvars.empty()) {
|
|
2053
|
+
// todo, shuffle extension vars?
|
|
2054
|
+
randgen.shuffle(extensionvars.data(),
|
|
2055
|
+
static_cast<HighsInt>(extensionvars.size()));
|
|
2056
|
+
HighsInt i = 0;
|
|
2057
|
+
while (i < static_cast<HighsInt>(extensionvars.size())) {
|
|
2058
|
+
CliqueVar extvar = extensionvars[i];
|
|
2059
|
+
i += 1;
|
|
2060
|
+
|
|
2061
|
+
HighsInt newSize =
|
|
2062
|
+
i + shrinkToNeighbourhood(
|
|
2063
|
+
neighbourhoodInds, numNeighbourhoodQueries, extvar,
|
|
2064
|
+
extensionvars.data() + i,
|
|
2065
|
+
static_cast<HighsInt>(extensionvars.size()) - i);
|
|
2066
|
+
extensionvars.erase(extensionvars.begin() + newSize,
|
|
2067
|
+
extensionvars.end());
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
if (cliques[k].equality) {
|
|
2072
|
+
for (CliqueVar v : extensionvars)
|
|
2073
|
+
vertexInfeasible(globaldomain, v.col, v.val);
|
|
2074
|
+
} else {
|
|
2075
|
+
HighsInt originrow = cliques[k].origin;
|
|
2076
|
+
cliques[k].origin = kHighsIInf;
|
|
2077
|
+
|
|
2078
|
+
size_t numExtensions = extensionvars.size();
|
|
2079
|
+
extensionvars.insert(extensionvars.end(),
|
|
2080
|
+
cliqueentries.begin() + cliques[k].start,
|
|
2081
|
+
cliqueentries.begin() + cliques[k].end);
|
|
2082
|
+
extensionvars.erase(
|
|
2083
|
+
std::remove_if(
|
|
2084
|
+
extensionvars.begin() + numExtensions, extensionvars.end(),
|
|
2085
|
+
[&](CliqueVar clqvar) { return colDeleted[clqvar.col]; }),
|
|
2086
|
+
extensionvars.end());
|
|
2087
|
+
removeClique(k);
|
|
2088
|
+
|
|
2089
|
+
// callback for removing cliques
|
|
2090
|
+
auto removeCliques = [&](HighsInt cliqueid) { removeClique(cliqueid); };
|
|
2091
|
+
|
|
2092
|
+
// check extension
|
|
2093
|
+
bool redundant;
|
|
2094
|
+
HighsInt dominatingOrigin;
|
|
2095
|
+
cliqueSubsumption(extensionvars, redundant, dominatingOrigin,
|
|
2096
|
+
removeCliques);
|
|
2097
|
+
|
|
2098
|
+
if (!redundant) {
|
|
2099
|
+
for (size_t i = 0; i < numExtensions; ++i)
|
|
2100
|
+
cliqueextensions.emplace_back(originrow, extensionvars[i]);
|
|
2101
|
+
|
|
2102
|
+
extensionvars.erase(
|
|
2103
|
+
std::remove_if(extensionvars.begin(), extensionvars.end(),
|
|
2104
|
+
[&](CliqueVar v) {
|
|
2105
|
+
return globaldomain.isFixed(v.col) &&
|
|
2106
|
+
static_cast<int>(
|
|
2107
|
+
globaldomain.col_lower_[v.col]) ==
|
|
2108
|
+
static_cast<int>(1 - v.val);
|
|
2109
|
+
}),
|
|
2110
|
+
extensionvars.end());
|
|
2111
|
+
|
|
2112
|
+
if (extensionvars.size() > 1)
|
|
2113
|
+
doAddClique(extensionvars.data(),
|
|
2114
|
+
static_cast<HighsInt>(extensionvars.size()), false,
|
|
2115
|
+
originrow);
|
|
2116
|
+
} else {
|
|
2117
|
+
// the extended clique is redundant, check if the row can be removed
|
|
2118
|
+
if (dominatingOrigin != kHighsIInf)
|
|
2119
|
+
deletedrows.push_back(originrow);
|
|
2120
|
+
else {
|
|
2121
|
+
// this clique is redundant in the cliquetable but its row is not
|
|
2122
|
+
// necessarily. Also there might be rows that have been deleted due to
|
|
2123
|
+
// being dominated by this row after adding the lifted entries so they
|
|
2124
|
+
// must be added to the cliqueextension vector
|
|
2125
|
+
for (size_t i = 0; i < numExtensions; ++i)
|
|
2126
|
+
cliqueextensions.emplace_back(originrow, extensionvars[i]);
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
extensionvars.clear();
|
|
2132
|
+
processInfeasibleVertices(globaldomain);
|
|
2133
|
+
|
|
2134
|
+
if (numEntries >= maxNewEntries) break;
|
|
2135
|
+
// printf("nonzeroDelta: %d, maxNonzeroDelta: %d\n", nonzeroDelta,
|
|
2136
|
+
// maxNonzeroDelta);
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
if (haveNonModelCliquesToMerge) {
|
|
2140
|
+
for (HighsInt k = 0; k != numcliqueslots; ++k) {
|
|
2141
|
+
if (cliques[k].start == -1) continue;
|
|
2142
|
+
if (cliques[k].origin != -1) continue;
|
|
2143
|
+
// if (cliques[k].end - cliques[k].start <= 1000) continue;
|
|
2144
|
+
|
|
2145
|
+
// printf("numEntries before: %d\n", numEntries);
|
|
2146
|
+
extensionvars.clear();
|
|
2147
|
+
extensionvars.insert(extensionvars.end(),
|
|
2148
|
+
cliqueentries.begin() + cliques[k].start,
|
|
2149
|
+
cliqueentries.begin() + cliques[k].end);
|
|
2150
|
+
removeClique(k);
|
|
2151
|
+
runCliqueMerging(globaldomain, extensionvars);
|
|
2152
|
+
|
|
2153
|
+
if (extensionvars.size() > 1)
|
|
2154
|
+
doAddClique(extensionvars.data(),
|
|
2155
|
+
static_cast<HighsInt>(extensionvars.size()));
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
void HighsCliqueTable::rebuild(
|
|
2161
|
+
HighsInt ncols, const presolve::HighsPostsolveStack& postSolveStack,
|
|
2162
|
+
const HighsDomain& globaldomain,
|
|
2163
|
+
const std::vector<HighsInt>& orig2reducedcol,
|
|
2164
|
+
const std::vector<HighsInt>& orig2reducedrow) {
|
|
2165
|
+
HighsCliqueTable newCliqueTable(ncols);
|
|
2166
|
+
newCliqueTable.setPresolveFlag(inPresolve);
|
|
2167
|
+
newCliqueTable.setMinEntriesForParallelism(minEntriesForParallelism);
|
|
2168
|
+
for (size_t i = 0; i != cliques.size(); ++i) {
|
|
2169
|
+
if (cliques[i].start == -1) continue;
|
|
2170
|
+
HighsInt oldnumvars = cliques[i].end - cliques[i].start;
|
|
2171
|
+
|
|
2172
|
+
for (HighsInt k = cliques[i].start; k != cliques[i].end; ++k) {
|
|
2173
|
+
HighsInt col = orig2reducedcol[cliqueentries[k].col];
|
|
2174
|
+
|
|
2175
|
+
if (col == -1 || !globaldomain.isBinary(col) ||
|
|
2176
|
+
!postSolveStack.isColLinearlyTransformable(col))
|
|
2177
|
+
cliqueentries[k].col = kHighsIInf;
|
|
2178
|
+
else
|
|
2179
|
+
cliqueentries[k].col = col;
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
auto newend =
|
|
2183
|
+
std::remove_if(cliqueentries.begin() + cliques[i].start,
|
|
2184
|
+
cliqueentries.begin() + cliques[i].end,
|
|
2185
|
+
[](CliqueVar v) { return v.col == kHighsIInf; });
|
|
2186
|
+
HighsInt numvars = static_cast<HighsInt>(
|
|
2187
|
+
newend - (cliqueentries.begin() + cliques[i].start));
|
|
2188
|
+
// since we do not know how variables in the clique that have been deleted
|
|
2189
|
+
// are replaced (i.e. are they fixed to 0 or 1, or substituted) we relax
|
|
2190
|
+
// them out which means the equality status needs to be set to false
|
|
2191
|
+
if (numvars <= 1) continue;
|
|
2192
|
+
|
|
2193
|
+
HighsInt origin = cliques[i].origin != kHighsIInf ? -1 : kHighsIInf;
|
|
2194
|
+
newCliqueTable.doAddClique(
|
|
2195
|
+
&cliqueentries[cliques[i].start], numvars,
|
|
2196
|
+
numvars != oldnumvars ? false : cliques[i].equality, origin);
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
*this = std::move(newCliqueTable);
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
void HighsCliqueTable::buildFrom(const HighsLp* origModel,
|
|
2203
|
+
const HighsCliqueTable& init) {
|
|
2204
|
+
assert(init.colsubstituted.size() == colsubstituted.size());
|
|
2205
|
+
HighsInt ncols = init.colsubstituted.size();
|
|
2206
|
+
HighsCliqueTable newCliqueTable(ncols);
|
|
2207
|
+
newCliqueTable.setPresolveFlag(inPresolve);
|
|
2208
|
+
newCliqueTable.setPresolveFlag(minEntriesForParallelism);
|
|
2209
|
+
HighsInt ncliques = init.cliques.size();
|
|
2210
|
+
std::vector<CliqueVar> clqBuffer;
|
|
2211
|
+
clqBuffer.reserve(2 * static_cast<size_t>(origModel->num_col_));
|
|
2212
|
+
for (HighsInt i = 0; i != ncliques; ++i) {
|
|
2213
|
+
if (init.cliques[i].start == -1) continue;
|
|
2214
|
+
if (init.cliques[i].numActive() <= 1) continue;
|
|
2215
|
+
|
|
2216
|
+
clqBuffer.assign(init.cliqueentries.begin() + init.cliques[i].start,
|
|
2217
|
+
init.cliqueentries.begin() + init.cliques[i].end);
|
|
2218
|
+
clqBuffer.erase(std::remove_if(clqBuffer.begin(), clqBuffer.end(),
|
|
2219
|
+
[origModel](CliqueVar v) {
|
|
2220
|
+
return origModel->col_lower_[v.col] !=
|
|
2221
|
+
0.0 ||
|
|
2222
|
+
origModel->col_upper_[v.col] != 1.0;
|
|
2223
|
+
}),
|
|
2224
|
+
clqBuffer.end());
|
|
2225
|
+
if (clqBuffer.size() <= 1) continue;
|
|
2226
|
+
|
|
2227
|
+
HighsInt origin = init.cliques[i].origin != kHighsIInf ? -1 : kHighsIInf;
|
|
2228
|
+
newCliqueTable.doAddClique(clqBuffer.data(),
|
|
2229
|
+
static_cast<HighsInt>(clqBuffer.size()), false,
|
|
2230
|
+
origin);
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
newCliqueTable.colsubstituted = init.colsubstituted;
|
|
2234
|
+
newCliqueTable.substitutions = init.substitutions;
|
|
2235
|
+
*this = std::move(newCliqueTable);
|
|
2236
|
+
}
|