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,2513 @@
|
|
|
1
|
+
#include <stdio.h>
|
|
2
|
+
#include <stdlib.h>
|
|
3
|
+
|
|
4
|
+
#include "HCheckConfig.h"
|
|
5
|
+
#include "interfaces/highs_c_api.h"
|
|
6
|
+
// Force asserts to be checked always.
|
|
7
|
+
#undef NDEBUG
|
|
8
|
+
#include <assert.h>
|
|
9
|
+
#include <math.h>
|
|
10
|
+
#include <string.h>
|
|
11
|
+
|
|
12
|
+
const HighsInt dev_run = 0;
|
|
13
|
+
const double double_equal_tolerance = 1e-5;
|
|
14
|
+
|
|
15
|
+
void checkGetCallbackDataOutPointer(const HighsCallbackDataOut* data_out,
|
|
16
|
+
const char* name, HighsInt valid) {
|
|
17
|
+
const void* name_p = Highs_getCallbackDataOutItem(data_out, name);
|
|
18
|
+
if (valid) {
|
|
19
|
+
if (!name_p)
|
|
20
|
+
printf("checkGetCallbackDataOutItem fail for %s (valid = %d)\n", name,
|
|
21
|
+
(int)valid);
|
|
22
|
+
assert(name_p);
|
|
23
|
+
} else {
|
|
24
|
+
if (name_p)
|
|
25
|
+
printf("checkGetCallbackDataOutItem fail for %s (valid = %d)\n", name,
|
|
26
|
+
(int)valid);
|
|
27
|
+
assert(!name_p);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
void checkGetCallbackDataOutHighsInt(const HighsCallbackDataOut* data_out,
|
|
32
|
+
const char* name, HighsInt value) {
|
|
33
|
+
const void* name_p = Highs_getCallbackDataOutItem(data_out, name);
|
|
34
|
+
if (!name_p) {
|
|
35
|
+
printf("checkGetCallbackDataOutItem fail for %s\n", name);
|
|
36
|
+
assert(name_p);
|
|
37
|
+
} else {
|
|
38
|
+
HighsInt check_value = *(HighsInt*)(name_p);
|
|
39
|
+
HighsInt value_ok = check_value == value;
|
|
40
|
+
if (!value_ok)
|
|
41
|
+
printf(
|
|
42
|
+
"checkGetCallbackDataOutItem fail for %s (%d = check_value != value "
|
|
43
|
+
"= %d)\n",
|
|
44
|
+
name, (int)check_value, (int)value);
|
|
45
|
+
assert(value_ok);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
void checkGetCallbackDataOutInt(const HighsCallbackDataOut* data_out,
|
|
50
|
+
const char* name, int value) {
|
|
51
|
+
const void* name_p = Highs_getCallbackDataOutItem(data_out, name);
|
|
52
|
+
if (!name_p) {
|
|
53
|
+
printf("checkGetCallbackDataOutInt fail for %s\n", name);
|
|
54
|
+
assert(name_p);
|
|
55
|
+
} else {
|
|
56
|
+
int check_value = *(int*)(name_p);
|
|
57
|
+
int value_ok = check_value == value;
|
|
58
|
+
if (!value_ok)
|
|
59
|
+
printf(
|
|
60
|
+
"checkGetCallbackDataOutInt fail for %s (%d = check_value != value = "
|
|
61
|
+
"%d)\n",
|
|
62
|
+
name, check_value, value);
|
|
63
|
+
assert(value_ok);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void checkGetCallbackDataOutInt64(const HighsCallbackDataOut* data_out,
|
|
68
|
+
const char* name, int64_t value) {
|
|
69
|
+
const void* name_p = Highs_getCallbackDataOutItem(data_out, name);
|
|
70
|
+
if (!name_p) {
|
|
71
|
+
printf("checkGetCallbackDataOutInt64 fail for %s\n", name);
|
|
72
|
+
assert(name_p);
|
|
73
|
+
} else {
|
|
74
|
+
int64_t check_value = *(int*)(name_p);
|
|
75
|
+
int value_ok = check_value == value;
|
|
76
|
+
if (!value_ok)
|
|
77
|
+
printf(
|
|
78
|
+
"checkGetCallbackDataOutInt64 fail for %s (%d = check_value != value "
|
|
79
|
+
"= %d)\n",
|
|
80
|
+
name, (int)check_value, (int)value);
|
|
81
|
+
assert(value_ok);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
void checkGetCallbackDataOutDouble(const HighsCallbackDataOut* data_out,
|
|
86
|
+
const char* name, double value) {
|
|
87
|
+
const void* name_p = Highs_getCallbackDataOutItem(data_out, name);
|
|
88
|
+
if (!name_p) {
|
|
89
|
+
printf("checkGetCallbackDataOutDouble fail for %s\n", name);
|
|
90
|
+
assert(name_p);
|
|
91
|
+
} else {
|
|
92
|
+
double check_value = *(double*)(name_p);
|
|
93
|
+
double value_ok = check_value == value;
|
|
94
|
+
if (!value_ok)
|
|
95
|
+
printf(
|
|
96
|
+
"checkGetCallbackDataOutDouble fail for %s (%g = check_value != "
|
|
97
|
+
"value = %g)\n",
|
|
98
|
+
name, check_value, value);
|
|
99
|
+
assert(value_ok);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static void userCallback(const int callback_type, const char* message,
|
|
104
|
+
const HighsCallbackDataOut* data_out,
|
|
105
|
+
HighsCallbackDataIn* data_in,
|
|
106
|
+
void* user_callback_data) {
|
|
107
|
+
// Extract the double value pointed to from void* user_callback_data
|
|
108
|
+
const double local_callback_data =
|
|
109
|
+
user_callback_data == NULL ? -1 : *(double*)user_callback_data;
|
|
110
|
+
|
|
111
|
+
if (callback_type == kHighsCallbackLogging) {
|
|
112
|
+
if (dev_run)
|
|
113
|
+
printf("userCallback(%11.4g): %s\n", local_callback_data, message);
|
|
114
|
+
} else if (callback_type == kHighsCallbackMipImprovingSolution) {
|
|
115
|
+
// Test the accessor function for data_out
|
|
116
|
+
//
|
|
117
|
+
// Check that passing an valid name returns a non-null pointer,
|
|
118
|
+
// and that the corresponding value is the same as obtained using
|
|
119
|
+
// the struct
|
|
120
|
+
const void* objective_function_value_p = Highs_getCallbackDataOutItem(
|
|
121
|
+
data_out, kHighsCallbackDataOutObjectiveFunctionValueName);
|
|
122
|
+
assert(objective_function_value_p);
|
|
123
|
+
double objective_function_value = *(double*)(objective_function_value_p);
|
|
124
|
+
assert(objective_function_value == data_out->objective_function_value);
|
|
125
|
+
if (dev_run)
|
|
126
|
+
printf("userCallback(%11.4g): improving solution with objective = %g\n",
|
|
127
|
+
local_callback_data, objective_function_value);
|
|
128
|
+
// Now test all more simply
|
|
129
|
+
checkGetCallbackDataOutInt(data_out, kHighsCallbackDataOutLogTypeName, 1);
|
|
130
|
+
checkGetCallbackDataOutDouble(
|
|
131
|
+
data_out, kHighsCallbackDataOutRunningTimeName, data_out->running_time);
|
|
132
|
+
checkGetCallbackDataOutHighsInt(
|
|
133
|
+
data_out, kHighsCallbackDataOutSimplexIterationCountName,
|
|
134
|
+
data_out->simplex_iteration_count);
|
|
135
|
+
checkGetCallbackDataOutHighsInt(data_out,
|
|
136
|
+
kHighsCallbackDataOutIpmIterationCountName,
|
|
137
|
+
data_out->ipm_iteration_count);
|
|
138
|
+
checkGetCallbackDataOutHighsInt(data_out,
|
|
139
|
+
kHighsCallbackDataOutPdlpIterationCountName,
|
|
140
|
+
data_out->pdlp_iteration_count);
|
|
141
|
+
checkGetCallbackDataOutDouble(
|
|
142
|
+
data_out, kHighsCallbackDataOutObjectiveFunctionValueName,
|
|
143
|
+
data_out->objective_function_value);
|
|
144
|
+
checkGetCallbackDataOutInt64(data_out,
|
|
145
|
+
kHighsCallbackDataOutMipNodeCountName,
|
|
146
|
+
data_out->mip_node_count);
|
|
147
|
+
checkGetCallbackDataOutDouble(data_out,
|
|
148
|
+
kHighsCallbackDataOutMipPrimalBoundName,
|
|
149
|
+
data_out->mip_primal_bound);
|
|
150
|
+
checkGetCallbackDataOutDouble(data_out,
|
|
151
|
+
kHighsCallbackDataOutMipDualBoundName,
|
|
152
|
+
data_out->mip_dual_bound);
|
|
153
|
+
checkGetCallbackDataOutDouble(data_out, kHighsCallbackDataOutMipGapName,
|
|
154
|
+
data_out->mip_gap);
|
|
155
|
+
// Cutpool data structure is not assigned, so num_col, num_cut and
|
|
156
|
+
// num_nz are unassigned
|
|
157
|
+
// checkGetCallbackDataOutHighsInt(data_out,
|
|
158
|
+
// kHighsCallbackDataOutCutpoolNumColName, 0);
|
|
159
|
+
// checkGetCallbackDataOutHighsInt(data_out,
|
|
160
|
+
// kHighsCallbackDataOutCutpoolNumCutName, 0);
|
|
161
|
+
// checkGetCallbackDataOutHighsInt(data_out,
|
|
162
|
+
// kHighsCallbackDataOutCutpoolNumNzName, 0);
|
|
163
|
+
|
|
164
|
+
// Check that passing an unrecognised name returns NULL
|
|
165
|
+
const void* foo_p = Highs_getCallbackDataOutItem(data_out, "foo");
|
|
166
|
+
assert(!foo_p);
|
|
167
|
+
// Check that passing the name of an assigned vector returns
|
|
168
|
+
// non-NULL, and that the corresponding value is the same as
|
|
169
|
+
// obtained using the struct
|
|
170
|
+
const void* mip_solution_void_p = Highs_getCallbackDataOutItem(
|
|
171
|
+
data_out, kHighsCallbackDataOutMipSolutionName);
|
|
172
|
+
assert(mip_solution_void_p);
|
|
173
|
+
double mip_solution0 = *(double*)(mip_solution_void_p);
|
|
174
|
+
assert(mip_solution0 == *(data_out->mip_solution));
|
|
175
|
+
if (dev_run)
|
|
176
|
+
printf("userCallback(%11.4g): improving solution with value[0] = %g\n",
|
|
177
|
+
local_callback_data, mip_solution0);
|
|
178
|
+
// Cutpool data structure is not assigned, so cannot check that
|
|
179
|
+
// passing names of the unassigned vectors returns NULL
|
|
180
|
+
// assert(!Highs_getCallbackDataOutItem(data_out,
|
|
181
|
+
// kHighsCallbackDataOutCutpoolStartName));
|
|
182
|
+
// assert(!Highs_getCallbackDataOutItem(data_out,
|
|
183
|
+
// kHighsCallbackDataOutCutpoolIndexName));
|
|
184
|
+
// assert(!Highs_getCallbackDataOutItem(data_out,
|
|
185
|
+
// kHighsCallbackDataOutCutpoolValueName));
|
|
186
|
+
// assert(!Highs_getCallbackDataOutItem(data_out,
|
|
187
|
+
// kHighsCallbackDataOutCutpoolLowerName));
|
|
188
|
+
// assert(!Highs_getCallbackDataOutItem(data_out,
|
|
189
|
+
// kHighsCallbackDataOutCutpoolUpperName));
|
|
190
|
+
} else if (callback_type == kHighsCallbackMipLogging) {
|
|
191
|
+
if (dev_run)
|
|
192
|
+
printf("userCallback(%11.4g): MIP logging\n", local_callback_data);
|
|
193
|
+
data_in->user_interrupt = 1;
|
|
194
|
+
} else if (callback_type == kHighsCallbackMipInterrupt) {
|
|
195
|
+
if (dev_run)
|
|
196
|
+
printf("userCallback(%11.4g): MIP interrupt\n", local_callback_data);
|
|
197
|
+
data_in->user_interrupt = 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
HighsInt highsIntArraysEqual(const HighsInt dim, const HighsInt* array0,
|
|
202
|
+
const HighsInt* array1) {
|
|
203
|
+
for (HighsInt ix = 0; ix < dim; ix++)
|
|
204
|
+
if (array0[ix] != array1[ix]) return 0;
|
|
205
|
+
return 1;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
HighsInt doubleArraysEqual(const double dim, const double* array0,
|
|
209
|
+
const double* array1) {
|
|
210
|
+
for (HighsInt ix = 0; ix < dim; ix++)
|
|
211
|
+
if (array0[ix] != array1[ix]) return 0;
|
|
212
|
+
return 1;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
void assertDoubleValuesEqual(const char* name, const double is,
|
|
216
|
+
const double should_be) {
|
|
217
|
+
const double dl = fabs(is - should_be);
|
|
218
|
+
if (dl > double_equal_tolerance) {
|
|
219
|
+
printf("Value %s = %g differs from %g by %g but should be equal\n", name,
|
|
220
|
+
is, should_be, dl);
|
|
221
|
+
assert(1 == 0);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
void assertIntValuesEqual(const char* name, const HighsInt is,
|
|
226
|
+
const HighsInt should_be) {
|
|
227
|
+
if (is != should_be) {
|
|
228
|
+
printf("Value %s = %" HIGHSINT_FORMAT " should be %" HIGHSINT_FORMAT "\n",
|
|
229
|
+
name, is, should_be);
|
|
230
|
+
assert(1 == 0);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
void assertLogical(const char* name, const HighsInt is) {
|
|
235
|
+
if (is == 0) {
|
|
236
|
+
printf("Value %s = %" HIGHSINT_FORMAT " should not be 0\n", name, is);
|
|
237
|
+
assert(1 == 0);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
void createBlendingLp(void* highs) {
|
|
242
|
+
// Special variant of the blending LP, with redundant constraint so
|
|
243
|
+
// that LP is reduced by presolve - but not to empty!
|
|
244
|
+
const double inf = Highs_getInfinity(highs);
|
|
245
|
+
|
|
246
|
+
HighsInt num_col = 2;
|
|
247
|
+
HighsInt num_row = 3;
|
|
248
|
+
HighsInt num_nz = 6;
|
|
249
|
+
HighsInt sense = -1;
|
|
250
|
+
double col_cost[2] = {8, 10};
|
|
251
|
+
double col_lower[2] = {0, 0};
|
|
252
|
+
double col_upper[2] = {inf, inf};
|
|
253
|
+
double row_lower[3] = {-inf, -inf, -inf};
|
|
254
|
+
double row_upper[3] = {500, 120, 210};
|
|
255
|
+
HighsInt a_index[6] = {0, 1, 0, 1, 0, 1};
|
|
256
|
+
double a_value[6] = {0.5, 0.5, 0.3, 0.5, 0.7, 0.5};
|
|
257
|
+
HighsInt a_start[3] = {0, 2, 4};
|
|
258
|
+
Highs_addVars(highs, num_col, col_lower, col_upper);
|
|
259
|
+
Highs_changeColsCostByRange(highs, 0, num_col - 1, col_cost);
|
|
260
|
+
Highs_addRows(highs, num_row, row_lower, row_upper, num_nz, a_start, a_index,
|
|
261
|
+
a_value);
|
|
262
|
+
Highs_changeObjectiveSense(highs, sense);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Test methods
|
|
266
|
+
void versionApi() {
|
|
267
|
+
if (dev_run) {
|
|
268
|
+
printf("HiGHS version %s\n", Highs_version());
|
|
269
|
+
printf("HiGHS version major %" HIGHSINT_FORMAT "\n", Highs_versionMajor());
|
|
270
|
+
printf("HiGHS version minor %" HIGHSINT_FORMAT "\n", Highs_versionMinor());
|
|
271
|
+
printf("HiGHS version patch %" HIGHSINT_FORMAT "\n", Highs_versionPatch());
|
|
272
|
+
printf("HiGHS githash: %s\n", Highs_githash());
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
void minimalApiLp() {
|
|
277
|
+
// This illustrates the use of Highs_call, the simple C interface to
|
|
278
|
+
// HiGHS. It's designed to solve the general LP problem
|
|
279
|
+
//
|
|
280
|
+
// Min c^Tx subject to L <= Ax <= U; l <= x <= u
|
|
281
|
+
//
|
|
282
|
+
// where A is a matrix with m rows and n columns
|
|
283
|
+
//
|
|
284
|
+
// The scalar n is num_col
|
|
285
|
+
// The scalar m is num_row
|
|
286
|
+
//
|
|
287
|
+
// The vector c is col_cost
|
|
288
|
+
// The vector l is col_lower
|
|
289
|
+
// The vector u is col_upper
|
|
290
|
+
// The vector L is row_lower
|
|
291
|
+
// The vector U is row_upper
|
|
292
|
+
//
|
|
293
|
+
// The matrix A is represented in packed column-wise form: only its
|
|
294
|
+
// nonzeros are stored
|
|
295
|
+
//
|
|
296
|
+
// * The number of nonzeros in A is num_nz
|
|
297
|
+
//
|
|
298
|
+
// * The row indices of the nonnzeros in A are stored column-by-column
|
|
299
|
+
// in a_index
|
|
300
|
+
//
|
|
301
|
+
// * The values of the nonnzeros in A are stored column-by-column in
|
|
302
|
+
// a_value
|
|
303
|
+
//
|
|
304
|
+
// * The position in a_index/a_value of the index/value of the first
|
|
305
|
+
// nonzero in each column is stored in a_start
|
|
306
|
+
//
|
|
307
|
+
// Note that a_start[0] must be zero
|
|
308
|
+
//
|
|
309
|
+
// After a successful call to Highs_call, the primal and dual
|
|
310
|
+
// solution, and the simplex basis are returned as follows
|
|
311
|
+
//
|
|
312
|
+
// The vector x is col_value
|
|
313
|
+
// The vector Ax is row_value
|
|
314
|
+
// The vector of dual values for the variables x is col_dual
|
|
315
|
+
// The vector of dual values for the variables Ax is row_dual
|
|
316
|
+
// The basic/nonbasic status of the variables x is col_basis_status
|
|
317
|
+
// The basic/nonbasic status of the variables Ax is row_basis_status
|
|
318
|
+
//
|
|
319
|
+
// The status of the solution obtained is model_status
|
|
320
|
+
//
|
|
321
|
+
// To solve maximization problems, the values in c must be negated
|
|
322
|
+
//
|
|
323
|
+
// The use of Highs_lpCall is illustrated for the LP
|
|
324
|
+
//
|
|
325
|
+
// Min f = 2x_0 + 3x_1
|
|
326
|
+
// s.t. x_1 <= 6
|
|
327
|
+
// 10 <= x_0 + 2x_1 <= 14
|
|
328
|
+
// 8 <= 2x_0 + x_1
|
|
329
|
+
// 0 <= x_0 <= 3; 1 <= x_1
|
|
330
|
+
|
|
331
|
+
const HighsInt num_col = 2;
|
|
332
|
+
const HighsInt num_row = 3;
|
|
333
|
+
const HighsInt num_nz = 5;
|
|
334
|
+
HighsInt a_format = kHighsMatrixFormatColwise;
|
|
335
|
+
HighsInt sense = kHighsObjSenseMinimize;
|
|
336
|
+
double offset = 0;
|
|
337
|
+
|
|
338
|
+
// Define the column costs, lower bounds and upper bounds
|
|
339
|
+
double col_cost[2] = {2.0, 3.0};
|
|
340
|
+
double col_lower[2] = {0.0, 1.0};
|
|
341
|
+
double col_upper[2] = {3.0, 1.0e30};
|
|
342
|
+
// Define the row lower bounds and upper bounds
|
|
343
|
+
double row_lower[3] = {-1.0e30, 10.0, 8.0};
|
|
344
|
+
double row_upper[3] = {6.0, 14.0, 1.0e30};
|
|
345
|
+
// Define the constraint matrix column-wise
|
|
346
|
+
HighsInt a_start[2] = {0, 2};
|
|
347
|
+
HighsInt a_index[5] = {1, 2, 0, 1, 2};
|
|
348
|
+
double a_value[5] = {1.0, 2.0, 1.0, 2.0, 1.0};
|
|
349
|
+
|
|
350
|
+
double* col_value = (double*)malloc(sizeof(double) * num_col);
|
|
351
|
+
double* col_dual = (double*)malloc(sizeof(double) * num_col);
|
|
352
|
+
double* row_value = (double*)malloc(sizeof(double) * num_row);
|
|
353
|
+
double* row_dual = (double*)malloc(sizeof(double) * num_row);
|
|
354
|
+
|
|
355
|
+
HighsInt* col_basis_status = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
356
|
+
HighsInt* row_basis_status = (HighsInt*)malloc(sizeof(HighsInt) * num_row);
|
|
357
|
+
|
|
358
|
+
HighsInt model_status;
|
|
359
|
+
|
|
360
|
+
HighsInt return_status =
|
|
361
|
+
Highs_lpCall(num_col, num_row, num_nz, a_format, sense, offset, col_cost,
|
|
362
|
+
col_lower, col_upper, row_lower, row_upper, a_start, a_index,
|
|
363
|
+
a_value, col_value, col_dual, row_value, row_dual,
|
|
364
|
+
col_basis_status, row_basis_status, &model_status);
|
|
365
|
+
|
|
366
|
+
assert(return_status == kHighsStatusOk);
|
|
367
|
+
|
|
368
|
+
if (dev_run) {
|
|
369
|
+
printf("Run status = %" HIGHSINT_FORMAT "; Model status = %" HIGHSINT_FORMAT
|
|
370
|
+
"\n",
|
|
371
|
+
return_status, model_status);
|
|
372
|
+
|
|
373
|
+
HighsInt i;
|
|
374
|
+
if (model_status == kHighsModelStatusOptimal) {
|
|
375
|
+
double objective_value = 0;
|
|
376
|
+
// Report the column primal and dual values, and basis status
|
|
377
|
+
for (i = 0; i < num_col; i++) {
|
|
378
|
+
printf("Col%" HIGHSINT_FORMAT
|
|
379
|
+
" = %lf; dual = %lf; status = %" HIGHSINT_FORMAT "; \n",
|
|
380
|
+
i, col_value[i], col_dual[i], col_basis_status[i]);
|
|
381
|
+
objective_value += col_value[i] * col_cost[i];
|
|
382
|
+
}
|
|
383
|
+
// Report the row primal and dual values, and basis status
|
|
384
|
+
for (i = 0; i < num_row; i++) {
|
|
385
|
+
printf("Row%" HIGHSINT_FORMAT
|
|
386
|
+
" = %lf; dual = %lf; status = %" HIGHSINT_FORMAT "; \n",
|
|
387
|
+
i, row_value[i], row_dual[i], row_basis_status[i]);
|
|
388
|
+
}
|
|
389
|
+
printf("Optimal objective value = %g\n", objective_value);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
free(col_value);
|
|
394
|
+
free(col_dual);
|
|
395
|
+
free(row_value);
|
|
396
|
+
free(row_dual);
|
|
397
|
+
free(col_basis_status);
|
|
398
|
+
free(row_basis_status);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
void minimalApiMip() {
|
|
402
|
+
// The use of Highs_mipCall is illustrated for the MIP
|
|
403
|
+
//
|
|
404
|
+
// Min f = -3x_0 - 2x_1 - x_2
|
|
405
|
+
// s.t. x_0 + x_1 + x_2 <= 7
|
|
406
|
+
// 4x_0 + 2x_1 + x_2 = 12
|
|
407
|
+
// x_0 >=0; x_1 >= 0; x_2 binary
|
|
408
|
+
|
|
409
|
+
const HighsInt num_col = 3;
|
|
410
|
+
const HighsInt num_row = 2;
|
|
411
|
+
const HighsInt num_nz = 6;
|
|
412
|
+
HighsInt a_format = kHighsMatrixFormatColwise;
|
|
413
|
+
HighsInt sense = kHighsObjSenseMinimize;
|
|
414
|
+
double offset = 0;
|
|
415
|
+
|
|
416
|
+
// Define the column costs, lower bounds and upper bounds
|
|
417
|
+
double col_cost[3] = {-3.0, -2.0, -1.0};
|
|
418
|
+
double col_lower[3] = {0.0, 0.0, 0.0};
|
|
419
|
+
double col_upper[3] = {1.0e30, 1.0e30, 1.0};
|
|
420
|
+
// Define the row lower bounds and upper bounds
|
|
421
|
+
double row_lower[2] = {-1.0e30, 12.0};
|
|
422
|
+
double row_upper[2] = {7.0, 12.0};
|
|
423
|
+
// Define the constraint matrix column-wise
|
|
424
|
+
HighsInt a_start[3] = {0, 2, 4};
|
|
425
|
+
HighsInt a_index[6] = {0, 1, 0, 1, 0, 1};
|
|
426
|
+
double a_value[6] = {1.0, 4.0, 1.0, 2.0, 1.0, 1.0};
|
|
427
|
+
|
|
428
|
+
// Give an illegal value to an entry in integrality
|
|
429
|
+
HighsInt integrality[3] = {kHighsVarTypeContinuous, kHighsVarTypeContinuous,
|
|
430
|
+
-1};
|
|
431
|
+
|
|
432
|
+
double* col_value = (double*)malloc(sizeof(double) * num_col);
|
|
433
|
+
double* row_value = (double*)malloc(sizeof(double) * num_row);
|
|
434
|
+
|
|
435
|
+
HighsInt model_status;
|
|
436
|
+
HighsInt return_status;
|
|
437
|
+
|
|
438
|
+
return_status = Highs_mipCall(
|
|
439
|
+
num_col, num_row, num_nz, a_format, sense, offset, col_cost, col_lower,
|
|
440
|
+
col_upper, row_lower, row_upper, a_start, a_index, a_value, integrality,
|
|
441
|
+
col_value, row_value, &model_status);
|
|
442
|
+
// Should return error, with model status not set
|
|
443
|
+
assert(return_status == kHighsStatusError);
|
|
444
|
+
assert(model_status == kHighsModelStatusNotset);
|
|
445
|
+
|
|
446
|
+
// Correct integrality
|
|
447
|
+
integrality[num_col - 1] = kHighsVarTypeInteger;
|
|
448
|
+
|
|
449
|
+
return_status = Highs_mipCall(
|
|
450
|
+
num_col, num_row, num_nz, a_format, sense, offset, col_cost, col_lower,
|
|
451
|
+
col_upper, row_lower, row_upper, a_start, a_index, a_value, integrality,
|
|
452
|
+
col_value, row_value, &model_status);
|
|
453
|
+
// Should return OK
|
|
454
|
+
assert(return_status == kHighsStatusOk);
|
|
455
|
+
|
|
456
|
+
if (dev_run) {
|
|
457
|
+
printf("Run status = %" HIGHSINT_FORMAT "; Model status = %" HIGHSINT_FORMAT
|
|
458
|
+
"\n",
|
|
459
|
+
return_status, model_status);
|
|
460
|
+
|
|
461
|
+
HighsInt i;
|
|
462
|
+
if (model_status == kHighsModelStatusOptimal) {
|
|
463
|
+
double objective_value = 0;
|
|
464
|
+
// Report the column primal values
|
|
465
|
+
for (i = 0; i < num_col; i++) {
|
|
466
|
+
printf("Col%" HIGHSINT_FORMAT " = %lf; \n", i, col_value[i]);
|
|
467
|
+
objective_value += col_value[i] * col_cost[i];
|
|
468
|
+
}
|
|
469
|
+
// Report the row primal values
|
|
470
|
+
for (i = 0; i < num_row; i++) {
|
|
471
|
+
printf("Row%" HIGHSINT_FORMAT " = %lf; \n", i, row_value[i]);
|
|
472
|
+
}
|
|
473
|
+
printf("Optimal objective value = %g\n", objective_value);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
free(col_value);
|
|
478
|
+
free(row_value);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
void minimalApiQp() {
|
|
482
|
+
// Test solving the problem qjh
|
|
483
|
+
//
|
|
484
|
+
// minimize -x_2 - 3x_3 + (1/2)(2x_1^2 - 2x_1x_3 + 0.2x_2^2 + 2x_3^2)
|
|
485
|
+
//
|
|
486
|
+
// subject to x_1 + x_3 <= 2; x>=0
|
|
487
|
+
const double inf = 1e30;
|
|
488
|
+
HighsInt num_col = 3;
|
|
489
|
+
HighsInt num_row = 1;
|
|
490
|
+
HighsInt num_nz = 2;
|
|
491
|
+
HighsInt q_num_nz = 4;
|
|
492
|
+
HighsInt a_format = kHighsMatrixFormatColwise;
|
|
493
|
+
HighsInt q_format = kHighsHessianFormatTriangular;
|
|
494
|
+
HighsInt sense = kHighsObjSenseMinimize;
|
|
495
|
+
double offset = 0;
|
|
496
|
+
double col_cost[3] = {0.0, -1.0, -3.0};
|
|
497
|
+
double col_lower[3] = {-inf, -inf, -inf};
|
|
498
|
+
double col_upper[3] = {inf, inf, inf};
|
|
499
|
+
double row_lower[1] = {-inf};
|
|
500
|
+
double row_upper[1] = {2};
|
|
501
|
+
HighsInt a_start[3] = {0, 1, 1};
|
|
502
|
+
HighsInt a_index[2] = {0, 0};
|
|
503
|
+
double a_value[2] = {1.0, 1.0};
|
|
504
|
+
HighsInt q_start[3] = {0, 2, 3};
|
|
505
|
+
HighsInt q_index[4] = {0, 2, 1, 2};
|
|
506
|
+
double q_value[4] = {2.0, -1.0, 0.2, 2.0};
|
|
507
|
+
|
|
508
|
+
double* col_value = (double*)malloc(sizeof(double) * num_col);
|
|
509
|
+
HighsInt model_status;
|
|
510
|
+
HighsInt return_status = Highs_qpCall(
|
|
511
|
+
num_col, num_row, num_nz, q_num_nz, a_format, q_format, sense, offset,
|
|
512
|
+
col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index,
|
|
513
|
+
a_value, q_start, q_index, q_value, col_value, NULL, NULL, NULL, NULL,
|
|
514
|
+
NULL, &model_status);
|
|
515
|
+
assert(return_status == kHighsStatusOk);
|
|
516
|
+
assertIntValuesEqual("Model status for QP qph", model_status,
|
|
517
|
+
kHighsModelStatusOptimal);
|
|
518
|
+
double required_x[3] = {0.5, 5.0, 1.5};
|
|
519
|
+
if (dev_run) {
|
|
520
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
521
|
+
printf("x%d1 = %g\n", (int)iCol, col_value[iCol]);
|
|
522
|
+
assertDoubleValuesEqual("Solution value for QP qph", col_value[iCol],
|
|
523
|
+
required_x[iCol]);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
free(col_value);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
void minimalApiIllegalLp() {
|
|
530
|
+
const double inf = 1e30;
|
|
531
|
+
HighsInt num_col = 2;
|
|
532
|
+
HighsInt num_row = 1;
|
|
533
|
+
HighsInt num_nz = 2;
|
|
534
|
+
HighsInt a_format = kHighsMatrixFormatRowwise;
|
|
535
|
+
HighsInt sense = kHighsObjSenseMinimize;
|
|
536
|
+
double offset = 0;
|
|
537
|
+
double col_cost[2] = {0.0, -1.0};
|
|
538
|
+
double col_lower[2] = {-inf, -inf};
|
|
539
|
+
double col_upper[2] = {inf, inf};
|
|
540
|
+
double row_lower[1] = {-inf};
|
|
541
|
+
double row_upper[1] = {2};
|
|
542
|
+
HighsInt a_start[1] = {0};
|
|
543
|
+
HighsInt a_index[2] = {0, -1}; // Illegal index
|
|
544
|
+
double a_value[2] = {1.0, 1.0};
|
|
545
|
+
|
|
546
|
+
HighsInt model_status;
|
|
547
|
+
HighsInt return_status =
|
|
548
|
+
Highs_lpCall(num_col, num_row, num_nz, a_format, sense, offset, col_cost,
|
|
549
|
+
col_lower, col_upper, row_lower, row_upper, a_start, a_index,
|
|
550
|
+
a_value, NULL, NULL, NULL, NULL, NULL, NULL, &model_status);
|
|
551
|
+
// Should return error, with model status not set
|
|
552
|
+
assert(return_status == kHighsStatusError);
|
|
553
|
+
assert(model_status == kHighsModelStatusNotset);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
void testNames() {
|
|
557
|
+
void* highs = Highs_create();
|
|
558
|
+
|
|
559
|
+
if (!dev_run) Highs_setBoolOptionValue(highs, "output_flag", 0);
|
|
560
|
+
|
|
561
|
+
createBlendingLp(highs);
|
|
562
|
+
|
|
563
|
+
HighsInt return_status;
|
|
564
|
+
|
|
565
|
+
const HighsInt num_col = 2;
|
|
566
|
+
const HighsInt num_row = 3;
|
|
567
|
+
assert(num_col == Highs_getNumCols(highs));
|
|
568
|
+
assert(num_row == Highs_getNumRows(highs));
|
|
569
|
+
|
|
570
|
+
char* col_prefix = "Col";
|
|
571
|
+
char* row_prefix = "Row";
|
|
572
|
+
// Check index out of bounds
|
|
573
|
+
|
|
574
|
+
return_status = Highs_passColName(highs, -1, col_prefix);
|
|
575
|
+
assert(return_status == kHighsStatusError);
|
|
576
|
+
return_status = Highs_passRowName(highs, -1, row_prefix);
|
|
577
|
+
assert(return_status == kHighsStatusError);
|
|
578
|
+
return_status = Highs_passColName(highs, num_col, col_prefix);
|
|
579
|
+
assert(return_status == kHighsStatusError);
|
|
580
|
+
return_status = Highs_passRowName(highs, num_row, row_prefix);
|
|
581
|
+
assert(return_status == kHighsStatusError);
|
|
582
|
+
|
|
583
|
+
// Define all column names to be the same
|
|
584
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
585
|
+
return_status = Highs_passColName(highs, iCol, col_prefix);
|
|
586
|
+
assert(return_status == kHighsStatusOk);
|
|
587
|
+
}
|
|
588
|
+
return_status = Highs_writeModel(highs, "");
|
|
589
|
+
assert(return_status == kHighsStatusWarning);
|
|
590
|
+
|
|
591
|
+
char name[5]; // 3 chars prefix, 1 char iCol, 1 char 0-terminator
|
|
592
|
+
|
|
593
|
+
// Define all column names to be different
|
|
594
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
595
|
+
sprintf(name, "%s%" HIGHSINT_FORMAT "", col_prefix, iCol);
|
|
596
|
+
return_status = Highs_passColName(highs, iCol, name);
|
|
597
|
+
assert(return_status == kHighsStatusOk);
|
|
598
|
+
}
|
|
599
|
+
return_status = Highs_writeModel(highs, "");
|
|
600
|
+
assert(return_status == kHighsStatusOk);
|
|
601
|
+
|
|
602
|
+
// Check that the columns can be found by name
|
|
603
|
+
HighsInt ck_iCol;
|
|
604
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
605
|
+
return_status = Highs_getColName(highs, iCol, name);
|
|
606
|
+
assert(return_status == kHighsStatusOk);
|
|
607
|
+
return_status = Highs_getColByName(highs, name, &ck_iCol);
|
|
608
|
+
assert(return_status == kHighsStatusOk);
|
|
609
|
+
assert(ck_iCol == iCol);
|
|
610
|
+
}
|
|
611
|
+
return_status = Highs_getColByName(highs, "FRED", &ck_iCol);
|
|
612
|
+
assert(return_status == kHighsStatusError);
|
|
613
|
+
|
|
614
|
+
// Define all row names to be the same
|
|
615
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++) {
|
|
616
|
+
return_status = Highs_passRowName(highs, iRow, row_prefix);
|
|
617
|
+
assert(return_status == kHighsStatusOk);
|
|
618
|
+
}
|
|
619
|
+
return_status = Highs_writeModel(highs, "");
|
|
620
|
+
assert(return_status == kHighsStatusWarning);
|
|
621
|
+
|
|
622
|
+
// Define all row names to be different
|
|
623
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++) {
|
|
624
|
+
sprintf(name, "%s%" HIGHSINT_FORMAT, row_prefix, iRow);
|
|
625
|
+
return_status = Highs_passRowName(highs, iRow, name);
|
|
626
|
+
assert(return_status == kHighsStatusOk);
|
|
627
|
+
}
|
|
628
|
+
return_status = Highs_writeModel(highs, "");
|
|
629
|
+
assert(return_status == kHighsStatusOk);
|
|
630
|
+
|
|
631
|
+
// Check that the rows can be found by name
|
|
632
|
+
HighsInt ck_iRow;
|
|
633
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++) {
|
|
634
|
+
char name[5];
|
|
635
|
+
return_status = Highs_getRowName(highs, iRow, name);
|
|
636
|
+
assert(return_status == kHighsStatusOk);
|
|
637
|
+
return_status = Highs_getRowByName(highs, name, &ck_iRow);
|
|
638
|
+
assert(return_status == kHighsStatusOk);
|
|
639
|
+
assert(ck_iRow == iRow);
|
|
640
|
+
}
|
|
641
|
+
return_status = Highs_getRowByName(highs, "FRED", &ck_iRow);
|
|
642
|
+
assert(return_status == kHighsStatusError);
|
|
643
|
+
|
|
644
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
645
|
+
return_status = Highs_getColName(highs, iCol, name);
|
|
646
|
+
assert(return_status == kHighsStatusOk);
|
|
647
|
+
if (dev_run)
|
|
648
|
+
printf("Column %" HIGHSINT_FORMAT " has name %s\n", iCol, name);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++) {
|
|
652
|
+
return_status = Highs_getRowName(highs, iRow, name);
|
|
653
|
+
assert(return_status == kHighsStatusOk);
|
|
654
|
+
if (dev_run)
|
|
655
|
+
printf("Row %" HIGHSINT_FORMAT " has name %s\n", iRow, name);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// Check extraction of names for the presolved LP, in which the
|
|
659
|
+
// first row is removed
|
|
660
|
+
Highs_presolve(highs);
|
|
661
|
+
if (dev_run) Highs_writePresolvedModel(highs, "");
|
|
662
|
+
|
|
663
|
+
HighsInt presolved_num_col = Highs_getPresolvedNumCol(highs);
|
|
664
|
+
HighsInt presolved_num_row = Highs_getPresolvedNumRow(highs);
|
|
665
|
+
assert(presolved_num_col == num_col);
|
|
666
|
+
assert(presolved_num_row == num_row-1);
|
|
667
|
+
|
|
668
|
+
char presolved_name[5];
|
|
669
|
+
|
|
670
|
+
return_status = Highs_getPresolvedColName(highs, -1, presolved_name);
|
|
671
|
+
assert(return_status == kHighsStatusError);
|
|
672
|
+
return_status = Highs_getPresolvedRowName(highs, -1, presolved_name);
|
|
673
|
+
assert(return_status == kHighsStatusError);
|
|
674
|
+
return_status = Highs_getPresolvedColName(highs, presolved_num_col, presolved_name);
|
|
675
|
+
assert(return_status == kHighsStatusError);
|
|
676
|
+
return_status = Highs_getPresolvedRowName(highs, presolved_num_row, presolved_name);
|
|
677
|
+
assert(return_status == kHighsStatusError);
|
|
678
|
+
|
|
679
|
+
for (HighsInt iCol = 0; iCol < presolved_num_col; iCol++) {
|
|
680
|
+
return_status = Highs_getPresolvedColName(highs, iCol, presolved_name);
|
|
681
|
+
assert(return_status == kHighsStatusOk);
|
|
682
|
+
if (dev_run)
|
|
683
|
+
printf("Presolved column %" HIGHSINT_FORMAT " has name %s\n", iCol, presolved_name);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
for (HighsInt iRow = 0; iRow < presolved_num_row; iRow++) {
|
|
687
|
+
return_status = Highs_getPresolvedRowName(highs, iRow, presolved_name);
|
|
688
|
+
assert(return_status == kHighsStatusOk);
|
|
689
|
+
if (dev_run)
|
|
690
|
+
printf("Presolved row %" HIGHSINT_FORMAT " has name %s\n", iRow, presolved_name);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
Highs_destroy(highs);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
void fullApiOptions() {
|
|
697
|
+
void* highs;
|
|
698
|
+
|
|
699
|
+
highs = Highs_create();
|
|
700
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
701
|
+
|
|
702
|
+
const double kHighsInf = Highs_getInfinity(highs);
|
|
703
|
+
HighsInt simplex_scale_strategy;
|
|
704
|
+
HighsInt return_status;
|
|
705
|
+
return_status = Highs_getIntOptionValue(highs, "simplex_scale_strategy",
|
|
706
|
+
&simplex_scale_strategy);
|
|
707
|
+
assert(return_status == kHighsStatusOk);
|
|
708
|
+
if (dev_run)
|
|
709
|
+
printf("simplex_scale_strategy = %" HIGHSINT_FORMAT ": setting it to 3\n",
|
|
710
|
+
simplex_scale_strategy);
|
|
711
|
+
simplex_scale_strategy = 3;
|
|
712
|
+
return_status = Highs_setIntOptionValue(highs, "simplex_scale_strategy",
|
|
713
|
+
simplex_scale_strategy);
|
|
714
|
+
|
|
715
|
+
const HighsInt presolve_index = 0;
|
|
716
|
+
char* name = NULL;
|
|
717
|
+
return_status = Highs_getOptionName(highs, presolve_index, &name);
|
|
718
|
+
if (dev_run)
|
|
719
|
+
printf("option %" HIGHSINT_FORMAT " has name %s\n", presolve_index, name);
|
|
720
|
+
const char* presolve = "presolve";
|
|
721
|
+
assert(*name == *presolve);
|
|
722
|
+
free(name);
|
|
723
|
+
|
|
724
|
+
HighsInt check_simplex_scale_strategy;
|
|
725
|
+
HighsInt min_simplex_scale_strategy;
|
|
726
|
+
HighsInt max_simplex_scale_strategy;
|
|
727
|
+
HighsInt default_simplex_scale_strategy;
|
|
728
|
+
return_status =
|
|
729
|
+
Highs_getIntOptionValues(highs, "scale_strategy", NULL, NULL, NULL, NULL);
|
|
730
|
+
assert(return_status == kHighsStatusError);
|
|
731
|
+
return_status = Highs_getDoubleOptionValues(highs, "simplex_scale_strategy",
|
|
732
|
+
NULL, NULL, NULL, NULL);
|
|
733
|
+
assert(return_status == kHighsStatusError);
|
|
734
|
+
return_status = Highs_getIntOptionValues(
|
|
735
|
+
highs, "simplex_scale_strategy", &check_simplex_scale_strategy,
|
|
736
|
+
&min_simplex_scale_strategy, &max_simplex_scale_strategy,
|
|
737
|
+
&default_simplex_scale_strategy);
|
|
738
|
+
assert(return_status == kHighsStatusOk);
|
|
739
|
+
assert(check_simplex_scale_strategy == simplex_scale_strategy);
|
|
740
|
+
assert(min_simplex_scale_strategy == 0);
|
|
741
|
+
assert(max_simplex_scale_strategy == 4);
|
|
742
|
+
assert(default_simplex_scale_strategy == 2);
|
|
743
|
+
|
|
744
|
+
// There are some functions to check what type of option value you should
|
|
745
|
+
// provide.
|
|
746
|
+
HighsInt option_type;
|
|
747
|
+
return_status =
|
|
748
|
+
Highs_getOptionType(highs, "simplex_scale_strategy", &option_type);
|
|
749
|
+
assert(return_status == kHighsStatusOk);
|
|
750
|
+
assert(option_type == kHighsOptionTypeInt);
|
|
751
|
+
return_status = Highs_getOptionType(highs, "bad_option", &option_type);
|
|
752
|
+
assert(return_status == kHighsStatusError);
|
|
753
|
+
|
|
754
|
+
double primal_feasibility_tolerance;
|
|
755
|
+
return_status = Highs_getDoubleOptionValue(
|
|
756
|
+
highs, "primal_feasibility_tolerance", &primal_feasibility_tolerance);
|
|
757
|
+
assert(return_status == kHighsStatusOk);
|
|
758
|
+
if (dev_run)
|
|
759
|
+
printf("primal_feasibility_tolerance = %g: setting it to 1e-6\n",
|
|
760
|
+
primal_feasibility_tolerance);
|
|
761
|
+
primal_feasibility_tolerance = 1e-6;
|
|
762
|
+
return_status = Highs_setDoubleOptionValue(
|
|
763
|
+
highs, "primal_feasibility_tolerance", primal_feasibility_tolerance);
|
|
764
|
+
assert(return_status == kHighsStatusOk);
|
|
765
|
+
|
|
766
|
+
double check_primal_feasibility_tolerance;
|
|
767
|
+
return_status = Highs_getDoubleOptionValues(
|
|
768
|
+
highs, "primal_feasibility_tolerance",
|
|
769
|
+
&check_primal_feasibility_tolerance, NULL, NULL, NULL);
|
|
770
|
+
assert(return_status == kHighsStatusOk);
|
|
771
|
+
assert(check_primal_feasibility_tolerance == primal_feasibility_tolerance);
|
|
772
|
+
double default_primal_feasibility_tolerance;
|
|
773
|
+
double min_primal_feasibility_tolerance;
|
|
774
|
+
double max_primal_feasibility_tolerance;
|
|
775
|
+
return_status = Highs_getDoubleOptionValues(
|
|
776
|
+
highs, "primal_feasibility_tolerance",
|
|
777
|
+
&check_primal_feasibility_tolerance, &min_primal_feasibility_tolerance,
|
|
778
|
+
&max_primal_feasibility_tolerance, &default_primal_feasibility_tolerance);
|
|
779
|
+
assert(min_primal_feasibility_tolerance == 1e-10);
|
|
780
|
+
assert(max_primal_feasibility_tolerance == kHighsInf);
|
|
781
|
+
assert(default_primal_feasibility_tolerance == 1e-7);
|
|
782
|
+
|
|
783
|
+
Highs_setStringOptionValue(highs, "presolve", "off");
|
|
784
|
+
|
|
785
|
+
return_status = Highs_getStringOptionValues(highs, "pre-solve", NULL, NULL);
|
|
786
|
+
assert(return_status == kHighsStatusError);
|
|
787
|
+
// char check_presolve_value[kHighsMaximumStringLength];
|
|
788
|
+
char check_presolve_value[512];
|
|
789
|
+
return_status = Highs_getStringOptionValues(highs, "presolve",
|
|
790
|
+
check_presolve_value, NULL);
|
|
791
|
+
assert(return_status == kHighsStatusOk);
|
|
792
|
+
|
|
793
|
+
// const HighsInt output_flag = 1;
|
|
794
|
+
// return_status = Highs_setBoolOptionValue(highs, "output_flag",
|
|
795
|
+
// output_flag);
|
|
796
|
+
return_status = Highs_setBoolOptionValue(highs, "output_flag", 1);
|
|
797
|
+
|
|
798
|
+
assert(return_status == kHighsStatusOk);
|
|
799
|
+
|
|
800
|
+
HighsInt check_output_flag, default_output_flag;
|
|
801
|
+
return_status = Highs_getBoolOptionValues(highs, "output_flag", NULL, NULL);
|
|
802
|
+
assert(return_status == kHighsStatusOk);
|
|
803
|
+
return_status =
|
|
804
|
+
Highs_getBoolOptionValues(highs, "output_flag", &check_output_flag, NULL);
|
|
805
|
+
assert(return_status == kHighsStatusOk);
|
|
806
|
+
// assert( check_output_flag == output_flag );
|
|
807
|
+
assert(check_output_flag == 1);
|
|
808
|
+
return_status = Highs_getBoolOptionValues(
|
|
809
|
+
highs, "output_flag", &check_output_flag, &default_output_flag);
|
|
810
|
+
assert(return_status == kHighsStatusOk);
|
|
811
|
+
// assert( default_output_flag == output_flag );
|
|
812
|
+
assert(default_output_flag == 1);
|
|
813
|
+
|
|
814
|
+
HighsInt num_string_option = 0;
|
|
815
|
+
char* option = NULL;
|
|
816
|
+
HighsInt type;
|
|
817
|
+
HighsInt num_options = Highs_getNumOptions(highs);
|
|
818
|
+
char current_string_value[512];
|
|
819
|
+
|
|
820
|
+
if (dev_run) printf("\nString options are:\n");
|
|
821
|
+
for (HighsInt index = 0; index < num_options; index++) {
|
|
822
|
+
Highs_getOptionName(highs, index, &option);
|
|
823
|
+
Highs_getOptionType(highs, option, &type);
|
|
824
|
+
if (type != kHighsOptionTypeString) {
|
|
825
|
+
free(option);
|
|
826
|
+
continue;
|
|
827
|
+
}
|
|
828
|
+
Highs_getStringOptionValues(highs, option, current_string_value, NULL);
|
|
829
|
+
num_string_option++;
|
|
830
|
+
if (dev_run)
|
|
831
|
+
printf("%" HIGHSINT_FORMAT ": %-24s \"%s\"\n", num_string_option, option,
|
|
832
|
+
current_string_value);
|
|
833
|
+
free(option);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
Highs_destroy(highs);
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
void fullApiLp() {
|
|
840
|
+
// Form and solve the LP
|
|
841
|
+
// Min f = 2x_0 + 3x_1
|
|
842
|
+
// s.t. x_1 <= 6
|
|
843
|
+
// 10 <= x_0 + 2x_1 <= 14
|
|
844
|
+
// 8 <= 2x_0 + x_1
|
|
845
|
+
// 0 <= x_0 <= 3; 1 <= x_1
|
|
846
|
+
|
|
847
|
+
void* highs;
|
|
848
|
+
|
|
849
|
+
highs = Highs_create();
|
|
850
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
851
|
+
|
|
852
|
+
const HighsInt num_col = 2;
|
|
853
|
+
const HighsInt num_row = 3;
|
|
854
|
+
const HighsInt num_nz = 5;
|
|
855
|
+
|
|
856
|
+
// Define the column costs, lower bounds and upper bounds
|
|
857
|
+
double col_cost[2] = {2.0, 3.0};
|
|
858
|
+
double col_lower[2] = {0.0, 1.0};
|
|
859
|
+
double col_upper[2] = {3.0, 1.0e30};
|
|
860
|
+
// Define the row lower bounds and upper bounds
|
|
861
|
+
double row_lower[3] = {-1.0e30, 10.0, 8.0};
|
|
862
|
+
double row_upper[3] = {6.0, 14.0, 1.0e30};
|
|
863
|
+
// Define the constraint matrix row-wise, as it is added to the LP
|
|
864
|
+
// with the rows
|
|
865
|
+
HighsInt arstart[3] = {0, 1, 3};
|
|
866
|
+
HighsInt arindex[5] = {1, 0, 1, 0, 1};
|
|
867
|
+
double arvalue[5] = {1.0, 1.0, 2.0, 2.0, 1.0};
|
|
868
|
+
|
|
869
|
+
double* col_value = (double*)malloc(sizeof(double) * num_col);
|
|
870
|
+
double* col_dual = (double*)malloc(sizeof(double) * num_col);
|
|
871
|
+
double* row_value = (double*)malloc(sizeof(double) * num_row);
|
|
872
|
+
double* row_dual = (double*)malloc(sizeof(double) * num_row);
|
|
873
|
+
|
|
874
|
+
HighsInt* col_basis_status = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
875
|
+
HighsInt* row_basis_status = (HighsInt*)malloc(sizeof(HighsInt) * num_row);
|
|
876
|
+
|
|
877
|
+
// Add two columns to the empty LP
|
|
878
|
+
assert(Highs_addCols(highs, num_col, col_cost, col_lower, col_upper, 0, NULL,
|
|
879
|
+
NULL, NULL) == 0);
|
|
880
|
+
// Add three rows to the 2-column LP
|
|
881
|
+
assert(Highs_addRows(highs, num_row, row_lower, row_upper, num_nz, arstart,
|
|
882
|
+
arindex, arvalue) == 0);
|
|
883
|
+
|
|
884
|
+
HighsInt sense;
|
|
885
|
+
HighsInt return_status;
|
|
886
|
+
return_status = Highs_getObjectiveSense(highs, &sense);
|
|
887
|
+
assert(return_status == kHighsStatusOk);
|
|
888
|
+
if (dev_run)
|
|
889
|
+
printf("LP problem has objective sense = %" HIGHSINT_FORMAT "\n", sense);
|
|
890
|
+
assert(sense == kHighsObjSenseMinimize);
|
|
891
|
+
|
|
892
|
+
sense *= -1;
|
|
893
|
+
return_status = Highs_changeObjectiveSense(highs, sense);
|
|
894
|
+
assert(return_status == kHighsStatusOk);
|
|
895
|
+
assert(sense == kHighsObjSenseMaximize);
|
|
896
|
+
|
|
897
|
+
sense *= -1;
|
|
898
|
+
return_status = Highs_changeObjectiveSense(highs, sense);
|
|
899
|
+
assert(return_status == kHighsStatusOk);
|
|
900
|
+
|
|
901
|
+
return_status = Highs_getObjectiveSense(highs, &sense);
|
|
902
|
+
assert(return_status == kHighsStatusOk);
|
|
903
|
+
if (dev_run)
|
|
904
|
+
printf("LP problem has old objective sense = %" HIGHSINT_FORMAT "\n",
|
|
905
|
+
sense);
|
|
906
|
+
assert(sense == kHighsObjSenseMinimize);
|
|
907
|
+
|
|
908
|
+
// fetch column data (just first column)
|
|
909
|
+
{
|
|
910
|
+
const HighsInt get_col = 0;
|
|
911
|
+
const HighsInt num_get_col = 1;
|
|
912
|
+
HighsInt get_num_col = 0;
|
|
913
|
+
double* get_costs = (double*)malloc(sizeof(double) * num_get_col);
|
|
914
|
+
double* get_lower = (double*)malloc(sizeof(double) * num_get_col);
|
|
915
|
+
double* get_upper = (double*)malloc(sizeof(double) * num_get_col);
|
|
916
|
+
HighsInt get_num_nz = 0;
|
|
917
|
+
|
|
918
|
+
return_status = Highs_getColsByRange(highs, get_col, get_col, &get_num_col,
|
|
919
|
+
get_costs, get_lower, get_upper,
|
|
920
|
+
&get_num_nz, NULL, NULL, NULL);
|
|
921
|
+
assert(return_status == kHighsStatusOk);
|
|
922
|
+
|
|
923
|
+
assertIntValuesEqual("getCols get_num_col", get_num_col, num_get_col);
|
|
924
|
+
assertDoubleValuesEqual("getCols get_costs", get_costs[0],
|
|
925
|
+
col_cost[get_col]);
|
|
926
|
+
assertDoubleValuesEqual("getCols get_lower", get_lower[0],
|
|
927
|
+
col_lower[get_col]);
|
|
928
|
+
assertDoubleValuesEqual("getCols get_upper", get_upper[0],
|
|
929
|
+
col_upper[get_col]);
|
|
930
|
+
assertIntValuesEqual("getCols get_num_nz", get_num_nz, 2);
|
|
931
|
+
|
|
932
|
+
// could also check coefficients by calling again...
|
|
933
|
+
|
|
934
|
+
free(get_upper);
|
|
935
|
+
free(get_lower);
|
|
936
|
+
free(get_costs);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// fetch row data (just 2nd row: 10 <= x_0 + 2x_1 <= 14)
|
|
940
|
+
{
|
|
941
|
+
const HighsInt get_row = 1;
|
|
942
|
+
const HighsInt num_get_row = 1;
|
|
943
|
+
HighsInt get_num_row = 0;
|
|
944
|
+
double* get_lower = (double*)malloc(sizeof(double) * num_get_row);
|
|
945
|
+
double* get_upper = (double*)malloc(sizeof(double) * num_get_row);
|
|
946
|
+
HighsInt get_num_nz = 0;
|
|
947
|
+
|
|
948
|
+
assertIntValuesEqual("getNumRows", Highs_getNumRows(highs), num_row);
|
|
949
|
+
|
|
950
|
+
return_status =
|
|
951
|
+
Highs_getRowsByRange(highs, get_row, get_row, &get_num_row, get_lower,
|
|
952
|
+
get_upper, &get_num_nz, NULL, NULL, NULL);
|
|
953
|
+
assert(return_status == kHighsStatusOk);
|
|
954
|
+
|
|
955
|
+
assertIntValuesEqual("getRows get_num_row", get_num_row, num_get_row);
|
|
956
|
+
assertDoubleValuesEqual("getRows get_lower", get_lower[0],
|
|
957
|
+
row_lower[get_row]);
|
|
958
|
+
assertDoubleValuesEqual("getRows get_upper", get_upper[0],
|
|
959
|
+
row_upper[get_row]);
|
|
960
|
+
assertIntValuesEqual("getRows get_num_nz", get_num_nz, 2);
|
|
961
|
+
|
|
962
|
+
// could also check coefficients by calling again...
|
|
963
|
+
|
|
964
|
+
free(get_upper);
|
|
965
|
+
free(get_lower);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
return_status = Highs_setBoolOptionValue(highs, "output_flag", 0);
|
|
969
|
+
assert(return_status == kHighsStatusOk);
|
|
970
|
+
if (dev_run) printf("Running quietly...\n");
|
|
971
|
+
return_status = Highs_run(highs);
|
|
972
|
+
assert(return_status == kHighsStatusOk);
|
|
973
|
+
if (dev_run) printf("Running loudly...\n");
|
|
974
|
+
|
|
975
|
+
// Get the model status
|
|
976
|
+
HighsInt model_status = Highs_getModelStatus(highs);
|
|
977
|
+
|
|
978
|
+
if (dev_run)
|
|
979
|
+
printf("Run status = %" HIGHSINT_FORMAT "; Model status = %" HIGHSINT_FORMAT
|
|
980
|
+
"\n",
|
|
981
|
+
return_status, model_status);
|
|
982
|
+
|
|
983
|
+
double objective_function_value;
|
|
984
|
+
return_status = Highs_getDoubleInfoValue(highs, "objective_function_value",
|
|
985
|
+
&objective_function_value);
|
|
986
|
+
assert(return_status == kHighsStatusOk);
|
|
987
|
+
HighsInt simplex_iteration_count;
|
|
988
|
+
return_status = Highs_getIntInfoValue(highs, "simplex_iteration_count",
|
|
989
|
+
&simplex_iteration_count);
|
|
990
|
+
assert(return_status == kHighsStatusOk);
|
|
991
|
+
HighsInt primal_solution_status;
|
|
992
|
+
return_status = Highs_getIntInfoValue(highs, "primal_solution_status",
|
|
993
|
+
&primal_solution_status);
|
|
994
|
+
assert(return_status == kHighsStatusOk);
|
|
995
|
+
HighsInt dual_solution_status;
|
|
996
|
+
return_status = Highs_getIntInfoValue(highs, "dual_solution_status",
|
|
997
|
+
&dual_solution_status);
|
|
998
|
+
assert(return_status == kHighsStatusOk);
|
|
999
|
+
|
|
1000
|
+
if (dev_run) {
|
|
1001
|
+
printf("Objective value = %g; Iteration count = %" HIGHSINT_FORMAT "\n",
|
|
1002
|
+
objective_function_value, simplex_iteration_count);
|
|
1003
|
+
if (model_status == kHighsModelStatusOptimal) {
|
|
1004
|
+
// Get the primal and dual solution
|
|
1005
|
+
return_status =
|
|
1006
|
+
Highs_getSolution(highs, col_value, col_dual, row_value, row_dual);
|
|
1007
|
+
assert(return_status == kHighsStatusOk);
|
|
1008
|
+
// Get the basis
|
|
1009
|
+
return_status = Highs_getBasis(highs, col_basis_status, row_basis_status);
|
|
1010
|
+
assert(return_status == kHighsStatusOk);
|
|
1011
|
+
// Report the column primal and dual values, and basis status
|
|
1012
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++)
|
|
1013
|
+
printf("Col%" HIGHSINT_FORMAT
|
|
1014
|
+
" = %lf; dual = %lf; status = %" HIGHSINT_FORMAT "; \n",
|
|
1015
|
+
iCol, col_value[iCol], col_dual[iCol], col_basis_status[iCol]);
|
|
1016
|
+
// Report the row primal and dual values, and basis status
|
|
1017
|
+
for (HighsInt iRow = 0; iRow < num_row; iRow++)
|
|
1018
|
+
printf("Row%" HIGHSINT_FORMAT
|
|
1019
|
+
" = %lf; dual = %lf; status = %" HIGHSINT_FORMAT "; \n",
|
|
1020
|
+
iRow, row_value[iRow], row_dual[iRow], row_basis_status[iRow]);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
free(col_value);
|
|
1024
|
+
free(col_dual);
|
|
1025
|
+
free(row_value);
|
|
1026
|
+
free(row_dual);
|
|
1027
|
+
free(col_basis_status);
|
|
1028
|
+
free(row_basis_status);
|
|
1029
|
+
|
|
1030
|
+
Highs_destroy(highs);
|
|
1031
|
+
|
|
1032
|
+
// Define the constraint matrix to pass to the LP
|
|
1033
|
+
HighsInt a_format = kHighsMatrixFormatColwise;
|
|
1034
|
+
sense = kHighsObjSenseMinimize;
|
|
1035
|
+
double offset = 0;
|
|
1036
|
+
HighsInt a_start[2] = {0, 2};
|
|
1037
|
+
HighsInt a_index[5] = {1, 2, 0, 1, 2};
|
|
1038
|
+
double a_value[5] = {1.0, 2.0, 1.0, 2.0, 1.0};
|
|
1039
|
+
highs = Highs_create();
|
|
1040
|
+
if (!dev_run) Highs_setBoolOptionValue(highs, "output_flag", 0);
|
|
1041
|
+
return_status = Highs_passLp(highs, num_col, num_row, num_nz, a_format, sense,
|
|
1042
|
+
offset, col_cost, col_lower, col_upper,
|
|
1043
|
+
row_lower, row_upper, a_start, a_index, a_value);
|
|
1044
|
+
assert(return_status == kHighsStatusOk);
|
|
1045
|
+
return_status = Highs_run(highs);
|
|
1046
|
+
assert(return_status == kHighsStatusOk);
|
|
1047
|
+
model_status = Highs_getModelStatus(highs);
|
|
1048
|
+
assert(model_status == kHighsModelStatusOptimal);
|
|
1049
|
+
if (dev_run)
|
|
1050
|
+
printf("Run status = %" HIGHSINT_FORMAT "; Model status = %" HIGHSINT_FORMAT
|
|
1051
|
+
"\n",
|
|
1052
|
+
return_status, model_status);
|
|
1053
|
+
|
|
1054
|
+
Highs_destroy(highs);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
void fullApiMip() {
|
|
1058
|
+
// The use of the full HiGHS API is illustrated for the MIP
|
|
1059
|
+
//
|
|
1060
|
+
// Min f = -3x_0 - 2x_1 - x_2
|
|
1061
|
+
// s.t. x_0 + x_1 + x_2 <= 7
|
|
1062
|
+
// 4x_0 + 2x_1 + x_2 = 12
|
|
1063
|
+
// x_0 >=0; x_1 >= 0; x_2 binary
|
|
1064
|
+
|
|
1065
|
+
const HighsInt num_col = 3;
|
|
1066
|
+
const HighsInt num_row = 2;
|
|
1067
|
+
const HighsInt num_nz = 6;
|
|
1068
|
+
HighsInt a_format = kHighsMatrixFormatColwise;
|
|
1069
|
+
HighsInt sense = kHighsObjSenseMinimize;
|
|
1070
|
+
double offset = 0;
|
|
1071
|
+
|
|
1072
|
+
// Define the column costs, lower bounds and upper bounds
|
|
1073
|
+
double col_cost[3] = {-3.0, -2.0, -1.0};
|
|
1074
|
+
double col_lower[3] = {0.0, 0.0, 0.0};
|
|
1075
|
+
double col_upper[3] = {1.0e30, 1.0e30, 1.0};
|
|
1076
|
+
// Define the row lower bounds and upper bounds
|
|
1077
|
+
double row_lower[2] = {-1.0e30, 12.0};
|
|
1078
|
+
double row_upper[2] = {7.0, 12.0};
|
|
1079
|
+
// Define the constraint matrix column-wise
|
|
1080
|
+
HighsInt a_start[3] = {0, 2, 4};
|
|
1081
|
+
HighsInt a_index[6] = {0, 1, 0, 1, 0, 1};
|
|
1082
|
+
double a_value[6] = {1.0, 4.0, 1.0, 2.0, 1.0, 1.0};
|
|
1083
|
+
|
|
1084
|
+
HighsInt integrality[3] = {kHighsVarTypeInteger, kHighsVarTypeInteger,
|
|
1085
|
+
kHighsVarTypeInteger};
|
|
1086
|
+
|
|
1087
|
+
double* col_value = (double*)malloc(sizeof(double) * num_col);
|
|
1088
|
+
double* row_value = (double*)malloc(sizeof(double) * num_row);
|
|
1089
|
+
|
|
1090
|
+
HighsInt return_status;
|
|
1091
|
+
|
|
1092
|
+
void* highs = Highs_create();
|
|
1093
|
+
if (!dev_run) Highs_setBoolOptionValue(highs, "output_flag", 0);
|
|
1094
|
+
return_status =
|
|
1095
|
+
Highs_passMip(highs, num_col, num_row, num_nz, a_format, sense, offset,
|
|
1096
|
+
col_cost, col_lower, col_upper, row_lower, row_upper,
|
|
1097
|
+
a_start, a_index, a_value, integrality);
|
|
1098
|
+
assert(return_status == kHighsStatusOk);
|
|
1099
|
+
Highs_setStringOptionValue(highs, "presolve", "off");
|
|
1100
|
+
return_status = Highs_run(highs);
|
|
1101
|
+
// mip_node_count is always int64_t, so the following should be an
|
|
1102
|
+
// error depending on whether HIGHSINT64 is set
|
|
1103
|
+
HighsInt mip_node_count_int;
|
|
1104
|
+
HighsInt required_return_status = kHighsStatusError;
|
|
1105
|
+
#ifdef HIGHSINT64
|
|
1106
|
+
required_return_status = kHighsStatusOk;
|
|
1107
|
+
#endif
|
|
1108
|
+
return_status =
|
|
1109
|
+
Highs_getIntInfoValue(highs, "mip_node_count", &mip_node_count_int);
|
|
1110
|
+
assert(return_status == required_return_status);
|
|
1111
|
+
int64_t mip_node_count;
|
|
1112
|
+
return_status =
|
|
1113
|
+
Highs_getInt64InfoValue(highs, "mip_node_count", &mip_node_count);
|
|
1114
|
+
assert(return_status == kHighsStatusOk);
|
|
1115
|
+
assert(mip_node_count == 1);
|
|
1116
|
+
|
|
1117
|
+
// Test Highs_getColIntegrality
|
|
1118
|
+
HighsInt col_integrality;
|
|
1119
|
+
return_status = Highs_getColIntegrality(highs, -1, &col_integrality);
|
|
1120
|
+
assert(return_status == kHighsStatusError);
|
|
1121
|
+
return_status = Highs_getColIntegrality(highs, num_col, &col_integrality);
|
|
1122
|
+
assert(return_status == kHighsStatusError);
|
|
1123
|
+
for (HighsInt iCol = 0; iCol < num_col; iCol++) {
|
|
1124
|
+
return_status = Highs_getColIntegrality(highs, iCol, &col_integrality);
|
|
1125
|
+
assert(return_status == kHighsStatusOk);
|
|
1126
|
+
assert(col_integrality == 1);
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
Highs_destroy(highs);
|
|
1130
|
+
|
|
1131
|
+
free(col_value);
|
|
1132
|
+
free(row_value);
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
void fullApiQp() {
|
|
1136
|
+
double required_objective_function_value;
|
|
1137
|
+
double required_x0;
|
|
1138
|
+
double required_x1;
|
|
1139
|
+
double objective_function_value;
|
|
1140
|
+
HighsInt model_status;
|
|
1141
|
+
HighsInt return_status;
|
|
1142
|
+
void* highs = Highs_create();
|
|
1143
|
+
const double inf = Highs_getInfinity(highs);
|
|
1144
|
+
if (!dev_run) Highs_setBoolOptionValue(highs, "output_flag", 0);
|
|
1145
|
+
|
|
1146
|
+
// Oscar's edge case
|
|
1147
|
+
//
|
|
1148
|
+
// min x^2 + x = x(x + 1)
|
|
1149
|
+
|
|
1150
|
+
HighsInt num_col = 0;
|
|
1151
|
+
return_status = Highs_addCol(highs, 1.0, -inf, inf, 0, NULL, NULL);
|
|
1152
|
+
assert(return_status == kHighsStatusOk);
|
|
1153
|
+
num_col++;
|
|
1154
|
+
|
|
1155
|
+
double offset = 0.25;
|
|
1156
|
+
return_status = Highs_changeObjectiveOffset(highs, offset);
|
|
1157
|
+
assert(return_status == kHighsStatusOk);
|
|
1158
|
+
|
|
1159
|
+
HighsInt q_dim = 1;
|
|
1160
|
+
HighsInt q_num_nz = 1;
|
|
1161
|
+
HighsInt q_format = kHighsHessianFormatTriangular;
|
|
1162
|
+
HighsInt* q_start = (HighsInt*)malloc(sizeof(HighsInt) * q_dim);
|
|
1163
|
+
HighsInt* q_index = (HighsInt*)malloc(sizeof(HighsInt) * q_num_nz);
|
|
1164
|
+
double* q_value = (double*)malloc(sizeof(double) * q_num_nz);
|
|
1165
|
+
q_start[0] = 0;
|
|
1166
|
+
q_index[0] = 0;
|
|
1167
|
+
q_value[0] = 2.0;
|
|
1168
|
+
return_status = Highs_passHessian(highs, q_dim, q_num_nz, q_format, q_start,
|
|
1169
|
+
q_index, q_value);
|
|
1170
|
+
assert(return_status == kHighsStatusOk);
|
|
1171
|
+
if (dev_run) Highs_writeModel(highs, "");
|
|
1172
|
+
return_status = Highs_run(highs);
|
|
1173
|
+
assert(return_status == kHighsStatusOk);
|
|
1174
|
+
model_status = Highs_getModelStatus(highs);
|
|
1175
|
+
assertIntValuesEqual("Model status for 1-d QP", model_status,
|
|
1176
|
+
kHighsModelStatusOptimal);
|
|
1177
|
+
|
|
1178
|
+
required_objective_function_value = 0;
|
|
1179
|
+
required_x0 = -0.5;
|
|
1180
|
+
objective_function_value = Highs_getObjectiveValue(highs);
|
|
1181
|
+
assertDoubleValuesEqual("Objective", objective_function_value,
|
|
1182
|
+
required_objective_function_value);
|
|
1183
|
+
|
|
1184
|
+
double* col_solution = (double*)malloc(sizeof(double) * num_col);
|
|
1185
|
+
|
|
1186
|
+
return_status = Highs_getSolution(highs, col_solution, NULL, NULL, NULL);
|
|
1187
|
+
assert(return_status == kHighsStatusOk);
|
|
1188
|
+
assertDoubleValuesEqual("x0", col_solution[0], required_x0);
|
|
1189
|
+
|
|
1190
|
+
if (dev_run) Highs_writeSolutionPretty(highs, "");
|
|
1191
|
+
// Add a variable x1 with objective x1^2 - x1
|
|
1192
|
+
//
|
|
1193
|
+
// Add the variable
|
|
1194
|
+
return_status = Highs_addCol(highs, -1.0, -inf, inf, 0, NULL, NULL);
|
|
1195
|
+
assert(return_status == kHighsStatusOk);
|
|
1196
|
+
num_col++;
|
|
1197
|
+
// Can solve the model before the Hessian has been replaced
|
|
1198
|
+
return_status = Highs_run(highs);
|
|
1199
|
+
assert(return_status == kHighsStatusOk);
|
|
1200
|
+
assertIntValuesEqual("Run status for 2-d QP with OK Hessian", return_status,
|
|
1201
|
+
0);
|
|
1202
|
+
|
|
1203
|
+
model_status = Highs_getModelStatus(highs);
|
|
1204
|
+
assertIntValuesEqual("Model status for this 2-d QP with OK Hessian",
|
|
1205
|
+
model_status, kHighsModelStatusUnbounded);
|
|
1206
|
+
|
|
1207
|
+
free(q_start);
|
|
1208
|
+
free(q_index);
|
|
1209
|
+
free(q_value);
|
|
1210
|
+
|
|
1211
|
+
// Pass the new Hessian
|
|
1212
|
+
q_dim = 2;
|
|
1213
|
+
q_num_nz = 2;
|
|
1214
|
+
q_start = (HighsInt*)malloc(sizeof(HighsInt) * q_dim);
|
|
1215
|
+
q_index = (HighsInt*)malloc(sizeof(HighsInt) * q_num_nz);
|
|
1216
|
+
q_value = (double*)malloc(sizeof(double) * q_num_nz);
|
|
1217
|
+
q_start[0] = 0;
|
|
1218
|
+
q_index[0] = 0;
|
|
1219
|
+
q_value[0] = 2.0;
|
|
1220
|
+
q_start[1] = 1;
|
|
1221
|
+
q_index[1] = 1;
|
|
1222
|
+
q_value[1] = 2.0;
|
|
1223
|
+
return_status = Highs_passHessian(highs, q_dim, q_num_nz, q_format, q_start,
|
|
1224
|
+
q_index, q_value);
|
|
1225
|
+
assert(return_status == kHighsStatusOk);
|
|
1226
|
+
if (dev_run) Highs_writeModel(highs, "");
|
|
1227
|
+
|
|
1228
|
+
return_status = Highs_run(highs);
|
|
1229
|
+
assert(return_status == kHighsStatusOk);
|
|
1230
|
+
|
|
1231
|
+
model_status = Highs_getModelStatus(highs);
|
|
1232
|
+
assertIntValuesEqual("Model status for 2-d QP", model_status,
|
|
1233
|
+
kHighsModelStatusOptimal);
|
|
1234
|
+
|
|
1235
|
+
required_objective_function_value = -0.25;
|
|
1236
|
+
required_x1 = 0.5;
|
|
1237
|
+
objective_function_value = Highs_getObjectiveValue(highs);
|
|
1238
|
+
assertDoubleValuesEqual("Objective", objective_function_value,
|
|
1239
|
+
required_objective_function_value);
|
|
1240
|
+
|
|
1241
|
+
free(col_solution);
|
|
1242
|
+
col_solution = (double*)malloc(sizeof(double) * num_col);
|
|
1243
|
+
|
|
1244
|
+
return_status = Highs_getSolution(highs, col_solution, NULL, NULL, NULL);
|
|
1245
|
+
assert(return_status == kHighsStatusOk);
|
|
1246
|
+
assertDoubleValuesEqual("x0", col_solution[0], required_x0);
|
|
1247
|
+
assertDoubleValuesEqual("x1", col_solution[1], required_x1);
|
|
1248
|
+
|
|
1249
|
+
// Illustrate methods for getting and changing the offset by getting
|
|
1250
|
+
// the current offset, shifting it by the current objective and
|
|
1251
|
+
// checking that the objective value is changed accordingly
|
|
1252
|
+
|
|
1253
|
+
double check_offset;
|
|
1254
|
+
return_status = Highs_getObjectiveOffset(highs, &check_offset);
|
|
1255
|
+
assert(return_status == kHighsStatusOk);
|
|
1256
|
+
assertDoubleValuesEqual("Offset", check_offset, offset);
|
|
1257
|
+
|
|
1258
|
+
double dl_offset = -objective_function_value;
|
|
1259
|
+
offset += dl_offset;
|
|
1260
|
+
|
|
1261
|
+
return_status = Highs_changeObjectiveOffset(highs, offset);
|
|
1262
|
+
assert(return_status == kHighsStatusOk);
|
|
1263
|
+
required_objective_function_value += dl_offset;
|
|
1264
|
+
objective_function_value = Highs_getObjectiveValue(highs);
|
|
1265
|
+
assertDoubleValuesEqual("Objective with new offset", objective_function_value,
|
|
1266
|
+
required_objective_function_value);
|
|
1267
|
+
|
|
1268
|
+
// Add the constraint 0.5 <= x0 + x1
|
|
1269
|
+
HighsInt a_index[2] = {0, 1};
|
|
1270
|
+
double a_value[2] = {1, 1};
|
|
1271
|
+
return_status = Highs_addRow(highs, 0.5, inf, 2, a_index, a_value);
|
|
1272
|
+
assert(return_status == kHighsStatusOk);
|
|
1273
|
+
if (dev_run) Highs_writeModel(highs, "");
|
|
1274
|
+
|
|
1275
|
+
return_status = Highs_run(highs);
|
|
1276
|
+
assert(return_status == kHighsStatusOk);
|
|
1277
|
+
assertIntValuesEqual("Run status for 2-d QP with constraint", return_status,
|
|
1278
|
+
kHighsStatusOk);
|
|
1279
|
+
|
|
1280
|
+
model_status = Highs_getModelStatus(highs);
|
|
1281
|
+
assertIntValuesEqual("Model status for 2-d QP with constraint", model_status,
|
|
1282
|
+
kHighsModelStatusOptimal);
|
|
1283
|
+
|
|
1284
|
+
required_objective_function_value = 0.125;
|
|
1285
|
+
required_x0 = -0.25;
|
|
1286
|
+
required_x1 = 0.75;
|
|
1287
|
+
|
|
1288
|
+
objective_function_value = Highs_getObjectiveValue(highs);
|
|
1289
|
+
assertDoubleValuesEqual("Objective", objective_function_value,
|
|
1290
|
+
required_objective_function_value);
|
|
1291
|
+
|
|
1292
|
+
return_status = Highs_getSolution(highs, col_solution, NULL, NULL, NULL);
|
|
1293
|
+
assert(return_status == kHighsStatusOk);
|
|
1294
|
+
assertDoubleValuesEqual("x0", col_solution[0], required_x0);
|
|
1295
|
+
assertDoubleValuesEqual("x1", col_solution[1], required_x1);
|
|
1296
|
+
|
|
1297
|
+
// Add bounds to make the QP infeasible
|
|
1298
|
+
return_status = Highs_changeColBounds(highs, 0, -inf, 0);
|
|
1299
|
+
assert(return_status == kHighsStatusOk);
|
|
1300
|
+
return_status = Highs_changeColBounds(highs, 1, -inf, 0);
|
|
1301
|
+
assert(return_status == kHighsStatusOk);
|
|
1302
|
+
|
|
1303
|
+
if (dev_run) Highs_writeModel(highs, "");
|
|
1304
|
+
|
|
1305
|
+
return_status = Highs_run(highs);
|
|
1306
|
+
assert(return_status == kHighsStatusOk);
|
|
1307
|
+
assertIntValuesEqual("Run status for infeasible 2-d QP", return_status, 0);
|
|
1308
|
+
|
|
1309
|
+
model_status = Highs_getModelStatus(highs);
|
|
1310
|
+
assertIntValuesEqual("Model status for infeasible 2-d QP", model_status, 8);
|
|
1311
|
+
assert(model_status == kHighsModelStatusInfeasible);
|
|
1312
|
+
|
|
1313
|
+
Highs_destroy(highs);
|
|
1314
|
+
|
|
1315
|
+
free(q_start);
|
|
1316
|
+
free(q_index);
|
|
1317
|
+
free(q_value);
|
|
1318
|
+
free(col_solution);
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
void passPresolveGetLp() {
|
|
1322
|
+
// Form and solve the LP
|
|
1323
|
+
// Min f = 2x_0 + 3x_1
|
|
1324
|
+
// s.t. x_1 <= 6
|
|
1325
|
+
// 10 <= x_0 + 2x_1 <= 14
|
|
1326
|
+
// 8 <= 2x_0 + x_1
|
|
1327
|
+
// 0 <= x_0 <= 3; 1 <= x_1
|
|
1328
|
+
|
|
1329
|
+
void* highs;
|
|
1330
|
+
|
|
1331
|
+
highs = Highs_create();
|
|
1332
|
+
const double kHighsInf = Highs_getInfinity(highs);
|
|
1333
|
+
HighsInt model_status;
|
|
1334
|
+
HighsInt return_status;
|
|
1335
|
+
|
|
1336
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
1337
|
+
HighsInt a_format = kHighsMatrixFormatColwise;
|
|
1338
|
+
HighsInt sense = kHighsObjSenseMinimize;
|
|
1339
|
+
double offset = 0;
|
|
1340
|
+
// Define the column costs, lower bounds and upper bounds
|
|
1341
|
+
|
|
1342
|
+
const HighsInt num_col = 2;
|
|
1343
|
+
const HighsInt num_row = 3;
|
|
1344
|
+
const HighsInt num_nz = 5;
|
|
1345
|
+
|
|
1346
|
+
double col_cost[2] = {2.0, 3.0};
|
|
1347
|
+
double col_lower[2] = {0.0, 1.0};
|
|
1348
|
+
double col_upper[2] = {3.0, kHighsInf};
|
|
1349
|
+
// Define the row lower bounds and upper bounds
|
|
1350
|
+
double row_lower[3] = {-kHighsInf, 10.0, 8.0};
|
|
1351
|
+
double row_upper[3] = {6.0, 14.0, kHighsInf};
|
|
1352
|
+
HighsInt a_start[2] = {0, 2};
|
|
1353
|
+
HighsInt a_index[5] = {1, 2, 0, 1, 2};
|
|
1354
|
+
double a_value[5] = {1.0, 2.0, 1.0, 2.0, 1.0};
|
|
1355
|
+
|
|
1356
|
+
return_status = Highs_passLp(highs, num_col, num_row, num_nz, a_format, sense,
|
|
1357
|
+
offset, col_cost, col_lower, col_upper,
|
|
1358
|
+
row_lower, row_upper, a_start, a_index, a_value);
|
|
1359
|
+
assert(return_status == kHighsStatusOk);
|
|
1360
|
+
|
|
1361
|
+
return_status = Highs_presolve(highs);
|
|
1362
|
+
assert(return_status == kHighsStatusOk);
|
|
1363
|
+
for (HighsInt k = 0; k < 2; k++) {
|
|
1364
|
+
// Loop twice: once for col-wise; once for row-wise
|
|
1365
|
+
HighsInt presolved_num_col = Highs_getPresolvedNumCol(highs);
|
|
1366
|
+
HighsInt presolved_num_row = Highs_getPresolvedNumRow(highs);
|
|
1367
|
+
HighsInt presolved_num_nz = Highs_getPresolvedNumNz(highs);
|
|
1368
|
+
HighsInt presolved_a_format =
|
|
1369
|
+
k == 0 ? kHighsMatrixFormatColwise : kHighsMatrixFormatRowwise;
|
|
1370
|
+
HighsInt presolved_sense;
|
|
1371
|
+
double presolved_offset;
|
|
1372
|
+
double* presolved_col_cost =
|
|
1373
|
+
(double*)malloc(sizeof(double) * presolved_num_col);
|
|
1374
|
+
double* presolved_col_lower =
|
|
1375
|
+
(double*)malloc(sizeof(double) * presolved_num_col);
|
|
1376
|
+
double* presolved_col_upper =
|
|
1377
|
+
(double*)malloc(sizeof(double) * presolved_num_col);
|
|
1378
|
+
double* presolved_row_lower =
|
|
1379
|
+
(double*)malloc(sizeof(double) * presolved_num_row);
|
|
1380
|
+
double* presolved_row_upper =
|
|
1381
|
+
(double*)malloc(sizeof(double) * presolved_num_row);
|
|
1382
|
+
HighsInt* presolved_a_start =
|
|
1383
|
+
(HighsInt*)malloc(sizeof(HighsInt) * (presolved_num_col + 1));
|
|
1384
|
+
HighsInt* presolved_a_index =
|
|
1385
|
+
(HighsInt*)malloc(sizeof(HighsInt) * presolved_num_nz);
|
|
1386
|
+
double* presolved_a_value =
|
|
1387
|
+
(double*)malloc(sizeof(double) * presolved_num_nz);
|
|
1388
|
+
|
|
1389
|
+
return_status = Highs_getPresolvedLp(
|
|
1390
|
+
highs, presolved_a_format, &presolved_num_col, &presolved_num_row,
|
|
1391
|
+
&presolved_num_nz, &presolved_sense, &presolved_offset,
|
|
1392
|
+
presolved_col_cost, presolved_col_lower, presolved_col_upper,
|
|
1393
|
+
presolved_row_lower, presolved_row_upper, presolved_a_start,
|
|
1394
|
+
presolved_a_index, presolved_a_value, NULL);
|
|
1395
|
+
assert(return_status == kHighsStatusOk);
|
|
1396
|
+
// Solve the presolved LP within a local version of HiGHS
|
|
1397
|
+
void* local_highs;
|
|
1398
|
+
local_highs = Highs_create();
|
|
1399
|
+
Highs_setBoolOptionValue(local_highs, "output_flag", dev_run);
|
|
1400
|
+
Highs_setStringOptionValue(local_highs, "presolve", "off");
|
|
1401
|
+
return_status = Highs_passLp(
|
|
1402
|
+
local_highs, presolved_num_col, presolved_num_row, presolved_num_nz,
|
|
1403
|
+
presolved_a_format, presolved_sense, presolved_offset,
|
|
1404
|
+
presolved_col_cost, presolved_col_lower, presolved_col_upper,
|
|
1405
|
+
presolved_row_lower, presolved_row_upper, presolved_a_start,
|
|
1406
|
+
presolved_a_index, presolved_a_value);
|
|
1407
|
+
assert(return_status == kHighsStatusOk);
|
|
1408
|
+
return_status = Highs_run(local_highs);
|
|
1409
|
+
|
|
1410
|
+
double* col_value = (double*)malloc(sizeof(double) * num_col);
|
|
1411
|
+
double* col_dual = (double*)malloc(sizeof(double) * num_col);
|
|
1412
|
+
double* row_dual = (double*)malloc(sizeof(double) * num_row);
|
|
1413
|
+
|
|
1414
|
+
return_status =
|
|
1415
|
+
Highs_getSolution(local_highs, col_value, col_dual, NULL, row_dual);
|
|
1416
|
+
assert(return_status == kHighsStatusOk);
|
|
1417
|
+
|
|
1418
|
+
return_status = Highs_postsolve(highs, col_value, col_dual, row_dual);
|
|
1419
|
+
assert(return_status == kHighsStatusOk);
|
|
1420
|
+
|
|
1421
|
+
model_status = Highs_getModelStatus(highs);
|
|
1422
|
+
assert(model_status == kHighsModelStatusOptimal);
|
|
1423
|
+
|
|
1424
|
+
// With just the primal solution, optimality cannot be determined
|
|
1425
|
+
|
|
1426
|
+
return_status = Highs_postsolve(highs, col_value, NULL, NULL);
|
|
1427
|
+
assert(return_status == kHighsStatusWarning);
|
|
1428
|
+
|
|
1429
|
+
model_status = Highs_getModelStatus(highs);
|
|
1430
|
+
assert(model_status == kHighsModelStatusUnknown);
|
|
1431
|
+
|
|
1432
|
+
free(presolved_col_cost);
|
|
1433
|
+
free(presolved_col_lower);
|
|
1434
|
+
free(presolved_col_upper);
|
|
1435
|
+
free(presolved_row_lower);
|
|
1436
|
+
free(presolved_row_upper);
|
|
1437
|
+
free(presolved_a_start);
|
|
1438
|
+
free(presolved_a_index);
|
|
1439
|
+
free(presolved_a_value);
|
|
1440
|
+
free(col_value);
|
|
1441
|
+
free(col_dual);
|
|
1442
|
+
free(row_dual);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
void options() {
|
|
1447
|
+
void* highs = Highs_create();
|
|
1448
|
+
if (!dev_run) Highs_setBoolOptionValue(highs, "output_flag", 0);
|
|
1449
|
+
|
|
1450
|
+
HighsInt simplex_scale_strategy;
|
|
1451
|
+
HighsInt return_status;
|
|
1452
|
+
return_status = Highs_setIntOptionValue(highs, "simplex_scale_strategy", 0);
|
|
1453
|
+
assert(return_status == kHighsStatusOk);
|
|
1454
|
+
return_status = Highs_getIntOptionValue(highs, "simplex_scale_strategy",
|
|
1455
|
+
&simplex_scale_strategy);
|
|
1456
|
+
assert(return_status == kHighsStatusOk);
|
|
1457
|
+
assert(simplex_scale_strategy == 0);
|
|
1458
|
+
|
|
1459
|
+
double primal_feasibility_tolerance;
|
|
1460
|
+
return_status =
|
|
1461
|
+
Highs_setDoubleOptionValue(highs, "primal_feasibility_tolerance", 2.0);
|
|
1462
|
+
assert(return_status == kHighsStatusOk);
|
|
1463
|
+
return_status = Highs_getDoubleOptionValue(
|
|
1464
|
+
highs, "primal_feasibility_tolerance", &primal_feasibility_tolerance);
|
|
1465
|
+
assert(return_status == kHighsStatusOk);
|
|
1466
|
+
assert(primal_feasibility_tolerance == 2.0);
|
|
1467
|
+
|
|
1468
|
+
Highs_destroy(highs);
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
void testGetColsByRange() {
|
|
1472
|
+
void* highs = Highs_create();
|
|
1473
|
+
if (!dev_run) Highs_setBoolOptionValue(highs, "output_flag", 0);
|
|
1474
|
+
HighsInt return_status;
|
|
1475
|
+
return_status = Highs_addCol(highs, -1.0, 0.0, 1.0, 0, NULL, NULL);
|
|
1476
|
+
assert(return_status == kHighsStatusOk);
|
|
1477
|
+
return_status = Highs_addCol(highs, -1.0, 0.0, 1.0, 0, NULL, NULL);
|
|
1478
|
+
assert(return_status == kHighsStatusOk);
|
|
1479
|
+
HighsInt a_index[2] = {0, 1};
|
|
1480
|
+
double a_value[2] = {1.0, -1.0};
|
|
1481
|
+
return_status = Highs_addRow(highs, 0.0, 0.0, 2, a_index, a_value);
|
|
1482
|
+
assert(return_status == kHighsStatusOk);
|
|
1483
|
+
HighsInt num_cols;
|
|
1484
|
+
HighsInt num_nz;
|
|
1485
|
+
HighsInt matrix_start[2] = {-1, -1};
|
|
1486
|
+
return_status = Highs_getColsByRange(highs, 0, 1, &num_cols, NULL, NULL, NULL,
|
|
1487
|
+
&num_nz, matrix_start, NULL, NULL);
|
|
1488
|
+
assert(return_status == kHighsStatusOk);
|
|
1489
|
+
assert(num_cols == 2);
|
|
1490
|
+
assert(num_nz == 2);
|
|
1491
|
+
assert(matrix_start[0] == 0);
|
|
1492
|
+
assert(matrix_start[1] == 1);
|
|
1493
|
+
HighsInt matrix_index[2] = {-1, -1};
|
|
1494
|
+
double matrix_value[2] = {0.0, 0.0};
|
|
1495
|
+
return_status =
|
|
1496
|
+
Highs_getColsByRange(highs, 0, 1, &num_cols, NULL, NULL, NULL, &num_nz,
|
|
1497
|
+
matrix_start, matrix_index, matrix_value);
|
|
1498
|
+
assert(return_status == kHighsStatusOk);
|
|
1499
|
+
assert(matrix_index[0] == 0);
|
|
1500
|
+
assert(matrix_index[1] == 0);
|
|
1501
|
+
assert(matrix_value[0] == 1.0);
|
|
1502
|
+
assert(matrix_value[1] == -1.0);
|
|
1503
|
+
|
|
1504
|
+
Highs_destroy(highs);
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
void testPassHessian() {
|
|
1508
|
+
void* highs = Highs_create();
|
|
1509
|
+
if (!dev_run) Highs_setBoolOptionValue(highs, "output_flag", 0);
|
|
1510
|
+
Highs_addCol(highs, 2.0, 0.0, 2.0, 0, NULL, NULL);
|
|
1511
|
+
Highs_changeObjectiveSense(highs, kHighsObjSenseMaximize);
|
|
1512
|
+
HighsInt start[1] = {0};
|
|
1513
|
+
HighsInt index[1] = {0};
|
|
1514
|
+
double value[1] = {-2.0};
|
|
1515
|
+
HighsInt return_status;
|
|
1516
|
+
return_status = Highs_passHessian(highs, 1, 1, 1, start, index, value);
|
|
1517
|
+
assertIntValuesEqual("Return of passHessian", return_status, kHighsStatusOk);
|
|
1518
|
+
Highs_run(highs);
|
|
1519
|
+
// Solving max -x^2 + 2x
|
|
1520
|
+
const double optimal_objective_value = 1;
|
|
1521
|
+
const double primal = 1;
|
|
1522
|
+
const double dual = 0;
|
|
1523
|
+
assertIntValuesEqual("Status", Highs_getModelStatus(highs),
|
|
1524
|
+
kHighsModelStatusOptimal); // kOptimal
|
|
1525
|
+
double col_value[1] = {-123.0};
|
|
1526
|
+
double col_dual[1] = {0.0};
|
|
1527
|
+
Highs_getSolution(highs, col_value, col_dual, NULL, NULL);
|
|
1528
|
+
double objective_value = Highs_getObjectiveValue(highs);
|
|
1529
|
+
assertDoubleValuesEqual("Objective", objective_value,
|
|
1530
|
+
optimal_objective_value);
|
|
1531
|
+
assertDoubleValuesEqual("Primal", col_value[0], primal);
|
|
1532
|
+
assertDoubleValuesEqual("Dual", col_dual[0], dual);
|
|
1533
|
+
|
|
1534
|
+
Highs_destroy(highs);
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
void testRanging() {
|
|
1538
|
+
void* highs = Highs_create();
|
|
1539
|
+
if (!dev_run) Highs_setBoolOptionValue(highs, "output_flag", 0);
|
|
1540
|
+
//
|
|
1541
|
+
// Set up
|
|
1542
|
+
// min y
|
|
1543
|
+
// s.t.
|
|
1544
|
+
// -x + y >= 2
|
|
1545
|
+
// x + y >= 0
|
|
1546
|
+
//
|
|
1547
|
+
double inf = Highs_getInfinity(highs);
|
|
1548
|
+
Highs_addVar(highs, -inf, inf);
|
|
1549
|
+
Highs_addVar(highs, -inf, inf);
|
|
1550
|
+
Highs_changeColCost(highs, 0, 0);
|
|
1551
|
+
Highs_changeColCost(highs, 1, 1);
|
|
1552
|
+
HighsInt index[2] = {0.0, 1.0};
|
|
1553
|
+
double value[2] = {-1, 1};
|
|
1554
|
+
Highs_addRow(highs, 2, inf, 2, index, value);
|
|
1555
|
+
value[0] = 1.0;
|
|
1556
|
+
Highs_addRow(highs, 0, inf, 2, index, value);
|
|
1557
|
+
// Cost ranging
|
|
1558
|
+
// c0 2 -1 1 0
|
|
1559
|
+
// c1 0 0 inf inf
|
|
1560
|
+
//
|
|
1561
|
+
// Bound ranging
|
|
1562
|
+
// Columns
|
|
1563
|
+
// c0 1 -inf inf 1
|
|
1564
|
+
// c1 1 1 inf 1
|
|
1565
|
+
// Rows
|
|
1566
|
+
// r0 -inf -inf inf inf
|
|
1567
|
+
// r1 -inf -inf inf inf
|
|
1568
|
+
Highs_run(highs);
|
|
1569
|
+
HighsInt num_col = Highs_getNumCol(highs);
|
|
1570
|
+
HighsInt num_row = Highs_getNumRow(highs);
|
|
1571
|
+
double* col_cost_up_value = (double*)malloc(sizeof(double) * num_col);
|
|
1572
|
+
double* col_cost_up_objective = (double*)malloc(sizeof(double) * num_col);
|
|
1573
|
+
HighsInt* col_cost_up_in_var = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
1574
|
+
HighsInt* col_cost_up_ou_var = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
1575
|
+
double* col_cost_dn_value = (double*)malloc(sizeof(double) * num_col);
|
|
1576
|
+
double* col_cost_dn_objective = (double*)malloc(sizeof(double) * num_col);
|
|
1577
|
+
HighsInt* col_cost_dn_in_var = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
1578
|
+
HighsInt* col_cost_dn_ou_var = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
1579
|
+
double* col_bound_up_value = (double*)malloc(sizeof(double) * num_col);
|
|
1580
|
+
double* col_bound_up_objective = (double*)malloc(sizeof(double) * num_col);
|
|
1581
|
+
HighsInt* col_bound_up_in_var = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
1582
|
+
HighsInt* col_bound_up_ou_var = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
1583
|
+
double* col_bound_dn_value = (double*)malloc(sizeof(double) * num_col);
|
|
1584
|
+
double* col_bound_dn_objective = (double*)malloc(sizeof(double) * num_col);
|
|
1585
|
+
HighsInt* col_bound_dn_in_var = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
1586
|
+
HighsInt* col_bound_dn_ou_var = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
1587
|
+
double* row_bound_up_value = (double*)malloc(sizeof(double) * num_row);
|
|
1588
|
+
double* row_bound_up_objective = (double*)malloc(sizeof(double) * num_row);
|
|
1589
|
+
HighsInt* row_bound_up_in_var = (HighsInt*)malloc(sizeof(HighsInt) * num_row);
|
|
1590
|
+
HighsInt* row_bound_up_ou_var = (HighsInt*)malloc(sizeof(HighsInt) * num_row);
|
|
1591
|
+
double* row_bound_dn_value = (double*)malloc(sizeof(double) * num_row);
|
|
1592
|
+
double* row_bound_dn_objective = (double*)malloc(sizeof(double) * num_row);
|
|
1593
|
+
HighsInt* row_bound_dn_in_var = (HighsInt*)malloc(sizeof(HighsInt) * num_row);
|
|
1594
|
+
HighsInt* row_bound_dn_ou_var = (HighsInt*)malloc(sizeof(HighsInt) * num_row);
|
|
1595
|
+
HighsInt status = Highs_getRanging(
|
|
1596
|
+
highs,
|
|
1597
|
+
//
|
|
1598
|
+
col_cost_up_value, col_cost_up_objective, col_cost_up_in_var,
|
|
1599
|
+
col_cost_up_ou_var, col_cost_dn_value, col_cost_dn_objective,
|
|
1600
|
+
col_cost_dn_in_var, col_cost_dn_ou_var, col_bound_up_value,
|
|
1601
|
+
col_bound_up_objective, col_bound_up_in_var, col_bound_up_ou_var,
|
|
1602
|
+
col_bound_dn_value, col_bound_dn_objective, col_bound_dn_in_var,
|
|
1603
|
+
col_bound_dn_ou_var, row_bound_up_value, row_bound_up_objective,
|
|
1604
|
+
row_bound_up_in_var, row_bound_up_ou_var, row_bound_dn_value,
|
|
1605
|
+
row_bound_dn_objective, row_bound_dn_in_var, row_bound_dn_ou_var);
|
|
1606
|
+
assert(status == kHighsStatusOk);
|
|
1607
|
+
|
|
1608
|
+
assertDoubleValuesEqual("col_cost_dn_objective[0]", col_cost_dn_objective[0],
|
|
1609
|
+
2);
|
|
1610
|
+
assertDoubleValuesEqual("col_cost_dn_value[0]", col_cost_dn_value[0], -1);
|
|
1611
|
+
assertDoubleValuesEqual("col_cost_up_value[0]", col_cost_up_value[0], 1);
|
|
1612
|
+
assertDoubleValuesEqual("col_cost_up_objective[0]", col_cost_up_objective[0],
|
|
1613
|
+
0);
|
|
1614
|
+
assertDoubleValuesEqual("col_cost_dn_objective[1]", col_cost_dn_objective[1],
|
|
1615
|
+
0);
|
|
1616
|
+
assertDoubleValuesEqual("col_cost_dn_value[1]", col_cost_dn_value[1], 0);
|
|
1617
|
+
assertDoubleValuesEqual("col_cost_up_value[1]", col_cost_up_value[1], inf);
|
|
1618
|
+
assertDoubleValuesEqual("col_cost_up_objective[1]", col_cost_up_objective[1],
|
|
1619
|
+
inf);
|
|
1620
|
+
|
|
1621
|
+
assertDoubleValuesEqual("col_bound_dn_objective[0]",
|
|
1622
|
+
col_bound_dn_objective[0], 1);
|
|
1623
|
+
assertDoubleValuesEqual("col_bound_dn_value[0]", col_bound_dn_value[0], -inf);
|
|
1624
|
+
assertDoubleValuesEqual("col_bound_up_value[0]", col_bound_up_value[0], inf);
|
|
1625
|
+
assertDoubleValuesEqual("col_bound_up_objective[0]",
|
|
1626
|
+
col_bound_up_objective[0], 1);
|
|
1627
|
+
assertDoubleValuesEqual("col_bound_dn_objective[1]",
|
|
1628
|
+
col_bound_dn_objective[1], 1);
|
|
1629
|
+
assertDoubleValuesEqual("col_bound_dn_value[1]", col_bound_dn_value[1], 1);
|
|
1630
|
+
assertDoubleValuesEqual("col_bound_up_value[1]", col_bound_up_value[1], inf);
|
|
1631
|
+
assertDoubleValuesEqual("col_bound_up_objective[1]",
|
|
1632
|
+
col_bound_up_objective[1], 1);
|
|
1633
|
+
|
|
1634
|
+
assertDoubleValuesEqual("row_bound_dn_objective[0]",
|
|
1635
|
+
row_bound_dn_objective[0], -inf);
|
|
1636
|
+
assertDoubleValuesEqual("row_bound_dn_value[0]", row_bound_dn_value[0], -inf);
|
|
1637
|
+
assertDoubleValuesEqual("row_bound_up_value[0]", row_bound_up_value[0], inf);
|
|
1638
|
+
assertDoubleValuesEqual("row_bound_up_objective[0]",
|
|
1639
|
+
row_bound_up_objective[0], inf);
|
|
1640
|
+
assertDoubleValuesEqual("row_bound_dn_objective[1]",
|
|
1641
|
+
row_bound_dn_objective[1], -inf);
|
|
1642
|
+
assertDoubleValuesEqual("row_bound_dn_value[1]", row_bound_dn_value[1], -inf);
|
|
1643
|
+
assertDoubleValuesEqual("row_bound_up_value[1]", row_bound_up_value[1], inf);
|
|
1644
|
+
assertDoubleValuesEqual("row_bound_up_objective[1]",
|
|
1645
|
+
row_bound_up_objective[1], inf);
|
|
1646
|
+
|
|
1647
|
+
free(col_cost_up_value);
|
|
1648
|
+
free(col_cost_up_objective);
|
|
1649
|
+
free(col_cost_up_in_var);
|
|
1650
|
+
free(col_cost_up_ou_var);
|
|
1651
|
+
free(col_cost_dn_value);
|
|
1652
|
+
free(col_cost_dn_objective);
|
|
1653
|
+
free(col_cost_dn_in_var);
|
|
1654
|
+
free(col_cost_dn_ou_var);
|
|
1655
|
+
free(col_bound_up_value);
|
|
1656
|
+
free(col_bound_up_objective);
|
|
1657
|
+
free(col_bound_up_in_var);
|
|
1658
|
+
free(col_bound_up_ou_var);
|
|
1659
|
+
free(col_bound_dn_value);
|
|
1660
|
+
free(col_bound_dn_objective);
|
|
1661
|
+
free(col_bound_dn_in_var);
|
|
1662
|
+
free(col_bound_dn_ou_var);
|
|
1663
|
+
free(row_bound_up_value);
|
|
1664
|
+
free(row_bound_up_objective);
|
|
1665
|
+
free(row_bound_up_in_var);
|
|
1666
|
+
free(row_bound_up_ou_var);
|
|
1667
|
+
free(row_bound_dn_value);
|
|
1668
|
+
free(row_bound_dn_objective);
|
|
1669
|
+
free(row_bound_dn_in_var);
|
|
1670
|
+
free(row_bound_dn_ou_var);
|
|
1671
|
+
|
|
1672
|
+
Highs_destroy(highs);
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
void testFeasibilityRelaxation() {
|
|
1676
|
+
void* highs;
|
|
1677
|
+
highs = Highs_create();
|
|
1678
|
+
const double kHighsInf = Highs_getInfinity(highs);
|
|
1679
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
1680
|
+
HighsInt return_status;
|
|
1681
|
+
|
|
1682
|
+
HighsInt num_col = 2;
|
|
1683
|
+
HighsInt num_row = 3;
|
|
1684
|
+
HighsInt num_nz = 6;
|
|
1685
|
+
HighsInt a_format = kHighsMatrixFormatColwise;
|
|
1686
|
+
HighsInt sense = kHighsObjSenseMinimize;
|
|
1687
|
+
double offset = 0;
|
|
1688
|
+
double col_cost[2] = {1, -2};
|
|
1689
|
+
double col_lower[2] = {5, -kHighsInf};
|
|
1690
|
+
double col_upper[2] = {kHighsInf, kHighsInf};
|
|
1691
|
+
double row_lower[3] = {2, -kHighsInf, -kHighsInf};
|
|
1692
|
+
double row_upper[3] = {kHighsInf, 1, 20};
|
|
1693
|
+
HighsInt a_start[2] = {0, 3};
|
|
1694
|
+
HighsInt a_index[6] = {0, 1, 2, 0, 1, 2};
|
|
1695
|
+
double a_value[6] = {-1, -3, 20, 21, 2, 1};
|
|
1696
|
+
HighsInt integrality[2] = {kHighsVarTypeInteger, kHighsVarTypeInteger};
|
|
1697
|
+
|
|
1698
|
+
Highs_passMip(highs, num_col, num_row, num_nz, a_format, sense, offset,
|
|
1699
|
+
col_cost, col_lower, col_upper, row_lower, row_upper, a_start,
|
|
1700
|
+
a_index, a_value, integrality);
|
|
1701
|
+
Highs_feasibilityRelaxation(highs, 1, 1, 1, NULL, NULL, NULL);
|
|
1702
|
+
double objective_function_value;
|
|
1703
|
+
Highs_getDoubleInfoValue(highs, "objective_function_value",
|
|
1704
|
+
&objective_function_value);
|
|
1705
|
+
double* col_value = (double*)malloc(sizeof(double) * num_col);
|
|
1706
|
+
double* col_dual = (double*)malloc(sizeof(double) * num_col);
|
|
1707
|
+
double* row_value = (double*)malloc(sizeof(double) * num_row);
|
|
1708
|
+
double* row_dual = (double*)malloc(sizeof(double) * num_row);
|
|
1709
|
+
return_status =
|
|
1710
|
+
Highs_getSolution(highs, col_value, col_dual, row_value, row_dual);
|
|
1711
|
+
assert(return_status == kHighsStatusOk);
|
|
1712
|
+
assertDoubleValuesEqual("objective_function_value", objective_function_value,
|
|
1713
|
+
5);
|
|
1714
|
+
assertDoubleValuesEqual("solution_value[0]", col_value[0], 1);
|
|
1715
|
+
assertDoubleValuesEqual("solution_value[1]", col_value[1], 1);
|
|
1716
|
+
|
|
1717
|
+
free(col_value);
|
|
1718
|
+
free(col_dual);
|
|
1719
|
+
free(row_value);
|
|
1720
|
+
free(row_dual);
|
|
1721
|
+
|
|
1722
|
+
Highs_destroy(highs);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
void testCallback() {
|
|
1726
|
+
HighsInt num_col = 7;
|
|
1727
|
+
HighsInt num_row = 1;
|
|
1728
|
+
HighsInt num_nz = num_col;
|
|
1729
|
+
HighsInt a_format = kHighsMatrixFormatRowwise;
|
|
1730
|
+
HighsInt sense = kHighsObjSenseMaximize;
|
|
1731
|
+
double offset = 0;
|
|
1732
|
+
double col_cost[7] = {8, 1, 7, 2, 1, 2, 1};
|
|
1733
|
+
double col_lower[7] = {0, 0, 0, 0, 0, 0, 0};
|
|
1734
|
+
double col_upper[7] = {1, 1, 1, 1, 1, 1, 1};
|
|
1735
|
+
double row_lower[1] = {0};
|
|
1736
|
+
double row_upper[1] = {28};
|
|
1737
|
+
HighsInt a_start[2] = {0, 7};
|
|
1738
|
+
HighsInt a_index[7] = {0, 1, 2, 3, 4, 5, 6};
|
|
1739
|
+
double a_value[7] = {9, 6, 7, 9, 7, 9, 9};
|
|
1740
|
+
HighsInt integrality[7] = {kHighsVarTypeInteger, kHighsVarTypeInteger,
|
|
1741
|
+
kHighsVarTypeInteger, kHighsVarTypeInteger,
|
|
1742
|
+
kHighsVarTypeInteger, kHighsVarTypeInteger,
|
|
1743
|
+
kHighsVarTypeInteger};
|
|
1744
|
+
|
|
1745
|
+
void* highs;
|
|
1746
|
+
highs = Highs_create();
|
|
1747
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
1748
|
+
Highs_passMip(highs, num_col, num_row, num_nz, a_format, sense, offset,
|
|
1749
|
+
col_cost, col_lower, col_upper, row_lower, row_upper, a_start,
|
|
1750
|
+
a_index, a_value, integrality);
|
|
1751
|
+
|
|
1752
|
+
Highs_setCallback(highs, userCallback, NULL);
|
|
1753
|
+
Highs_startCallback(highs, kHighsCallbackLogging);
|
|
1754
|
+
Highs_startCallback(highs, kHighsCallbackMipInterrupt);
|
|
1755
|
+
Highs_run(highs);
|
|
1756
|
+
double objective_function_value;
|
|
1757
|
+
Highs_getDoubleInfoValue(highs, "objective_function_value",
|
|
1758
|
+
&objective_function_value);
|
|
1759
|
+
double inf = Highs_getInfinity(highs);
|
|
1760
|
+
assertDoubleValuesEqual("objective_function_value", objective_function_value,
|
|
1761
|
+
inf);
|
|
1762
|
+
Highs_stopCallback(highs, kHighsCallbackMipInterrupt);
|
|
1763
|
+
Highs_run(highs);
|
|
1764
|
+
Highs_getDoubleInfoValue(highs, "objective_function_value",
|
|
1765
|
+
&objective_function_value);
|
|
1766
|
+
assertDoubleValuesEqual("objective_function_value", objective_function_value,
|
|
1767
|
+
17);
|
|
1768
|
+
|
|
1769
|
+
double user_callback_data = inf;
|
|
1770
|
+
void* p_user_callback_data = (void*)(&user_callback_data);
|
|
1771
|
+
|
|
1772
|
+
Highs_setCallback(highs, userCallback, p_user_callback_data);
|
|
1773
|
+
Highs_clearSolver(highs);
|
|
1774
|
+
Highs_startCallback(highs, kHighsCallbackMipImprovingSolution);
|
|
1775
|
+
Highs_run(highs);
|
|
1776
|
+
|
|
1777
|
+
Highs_destroy(highs);
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
void testGetModel() {
|
|
1781
|
+
void* highs;
|
|
1782
|
+
highs = Highs_create();
|
|
1783
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
1784
|
+
const double inf = Highs_getInfinity(highs);
|
|
1785
|
+
|
|
1786
|
+
HighsInt num_col = 2;
|
|
1787
|
+
HighsInt num_row = 2;
|
|
1788
|
+
HighsInt num_nz = 4;
|
|
1789
|
+
HighsInt sense = -1;
|
|
1790
|
+
double col_cost[2] = {8, 10};
|
|
1791
|
+
double col_lower[2] = {0, 0};
|
|
1792
|
+
double col_upper[2] = {inf, inf};
|
|
1793
|
+
double row_lower[2] = {-inf, -inf};
|
|
1794
|
+
double row_upper[2] = {120, 210};
|
|
1795
|
+
HighsInt a_index[4] = {0, 1, 0, 1};
|
|
1796
|
+
double a_value[4] = {0.3, 0.5, 0.7, 0.5};
|
|
1797
|
+
HighsInt a_start[2] = {0, 2};
|
|
1798
|
+
Highs_addVars(highs, num_col, col_lower, col_upper);
|
|
1799
|
+
Highs_changeColsCostByRange(highs, 0, num_col - 1, col_cost);
|
|
1800
|
+
Highs_addRows(highs, num_row, row_lower, row_upper, num_nz, a_start, a_index,
|
|
1801
|
+
a_value);
|
|
1802
|
+
Highs_changeObjectiveSense(highs, sense);
|
|
1803
|
+
|
|
1804
|
+
assert(Highs_getNumCols(highs) == num_col);
|
|
1805
|
+
assert(Highs_getNumRows(highs) == num_row);
|
|
1806
|
+
assert(Highs_getNumNz(highs) == num_nz);
|
|
1807
|
+
assert(Highs_getHessianNumNz(highs) == 0);
|
|
1808
|
+
|
|
1809
|
+
HighsInt ck_num_col;
|
|
1810
|
+
HighsInt ck_num_row;
|
|
1811
|
+
HighsInt ck_num_nz;
|
|
1812
|
+
HighsInt ck_sense;
|
|
1813
|
+
double ck_offset;
|
|
1814
|
+
HighsInt a_format = kHighsMatrixFormatRowwise;
|
|
1815
|
+
|
|
1816
|
+
// Get the model dimensions by passing array pointers as NULL
|
|
1817
|
+
HighsInt return_status;
|
|
1818
|
+
return_status = Highs_getLp(highs, a_format, &ck_num_col, &ck_num_row,
|
|
1819
|
+
&ck_num_nz, &ck_sense, &ck_offset, NULL, NULL, NULL, NULL, NULL,
|
|
1820
|
+
NULL, NULL, NULL, NULL);
|
|
1821
|
+
assert(return_status == kHighsStatusOk);
|
|
1822
|
+
|
|
1823
|
+
assert(ck_num_col == num_col);
|
|
1824
|
+
assert(ck_num_row == num_row);
|
|
1825
|
+
assert(ck_num_nz == num_nz);
|
|
1826
|
+
// Motivated by #1712, ensure that the correct sense is returned when
|
|
1827
|
+
// maximizing
|
|
1828
|
+
assert(ck_sense == sense);
|
|
1829
|
+
|
|
1830
|
+
double* ck_col_cost = (double*)malloc(sizeof(double) * ck_num_col);
|
|
1831
|
+
double* ck_col_lower = (double*)malloc(sizeof(double) * ck_num_col);
|
|
1832
|
+
double* ck_col_upper = (double*)malloc(sizeof(double) * ck_num_col);
|
|
1833
|
+
double* ck_row_lower = (double*)malloc(sizeof(double) * ck_num_row);
|
|
1834
|
+
double* ck_row_upper = (double*)malloc(sizeof(double) * ck_num_row);
|
|
1835
|
+
HighsInt* ck_a_start = (HighsInt*)malloc(sizeof(HighsInt) * ck_num_col);
|
|
1836
|
+
HighsInt* ck_a_index = (HighsInt*)malloc(sizeof(HighsInt) * ck_num_nz);
|
|
1837
|
+
double* ck_a_value = (double*)malloc(sizeof(double) * num_nz);
|
|
1838
|
+
|
|
1839
|
+
// Get the arrays
|
|
1840
|
+
return_status = Highs_getLp(highs, a_format, &ck_num_col, &ck_num_row,
|
|
1841
|
+
&ck_num_nz, &ck_sense, &ck_offset, ck_col_cost, ck_col_lower,
|
|
1842
|
+
ck_col_upper, ck_row_lower, ck_row_upper, ck_a_start, ck_a_index,
|
|
1843
|
+
ck_a_value, NULL);
|
|
1844
|
+
assert(return_status == kHighsStatusOk);
|
|
1845
|
+
|
|
1846
|
+
assert(doubleArraysEqual(num_col, ck_col_cost, col_cost));
|
|
1847
|
+
assert(doubleArraysEqual(num_col, ck_col_lower, col_lower));
|
|
1848
|
+
assert(doubleArraysEqual(num_col, ck_col_upper, col_upper));
|
|
1849
|
+
assert(doubleArraysEqual(num_row, ck_row_lower, row_lower));
|
|
1850
|
+
assert(doubleArraysEqual(num_row, ck_row_upper, row_upper));
|
|
1851
|
+
assert(highsIntArraysEqual(num_col, ck_a_start, a_start));
|
|
1852
|
+
assert(highsIntArraysEqual(num_nz, ck_a_index, a_index));
|
|
1853
|
+
assert(doubleArraysEqual(num_nz, ck_a_value, a_value));
|
|
1854
|
+
|
|
1855
|
+
return_status = Highs_getModel(
|
|
1856
|
+
highs, a_format, 0, &ck_num_col, &ck_num_row, &ck_num_nz, NULL, &ck_sense,
|
|
1857
|
+
&ck_offset, ck_col_cost, ck_col_lower,
|
|
1858
|
+
ck_col_upper, ck_row_lower, ck_row_upper, ck_a_start, ck_a_index,
|
|
1859
|
+
ck_a_value, NULL, NULL, NULL, NULL);
|
|
1860
|
+
assert(return_status == kHighsStatusOk);
|
|
1861
|
+
|
|
1862
|
+
assert(ck_num_col == num_col);
|
|
1863
|
+
assert(ck_num_row == num_row);
|
|
1864
|
+
assert(ck_num_nz == num_nz);
|
|
1865
|
+
assert(ck_sense == sense);
|
|
1866
|
+
assert(doubleArraysEqual(num_col, ck_col_cost, col_cost));
|
|
1867
|
+
assert(doubleArraysEqual(num_col, ck_col_lower, col_lower));
|
|
1868
|
+
assert(doubleArraysEqual(num_col, ck_col_upper, col_upper));
|
|
1869
|
+
assert(doubleArraysEqual(num_row, ck_row_lower, row_lower));
|
|
1870
|
+
assert(doubleArraysEqual(num_row, ck_row_upper, row_upper));
|
|
1871
|
+
assert(highsIntArraysEqual(num_col, ck_a_start, a_start));
|
|
1872
|
+
assert(highsIntArraysEqual(num_nz, ck_a_index, a_index));
|
|
1873
|
+
assert(doubleArraysEqual(num_nz, ck_a_value, a_value));
|
|
1874
|
+
|
|
1875
|
+
Highs_destroy(highs);
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
void testMultiObjective() {
|
|
1879
|
+
void* highs;
|
|
1880
|
+
highs = Highs_create();
|
|
1881
|
+
const double inf = Highs_getInfinity(highs);
|
|
1882
|
+
|
|
1883
|
+
HighsInt num_col = 2;
|
|
1884
|
+
HighsInt num_row = 3;
|
|
1885
|
+
HighsInt num_nz = num_col * num_row;
|
|
1886
|
+
HighsInt a_format = kHighsMatrixFormatColwise;
|
|
1887
|
+
HighsInt sense = kHighsObjSenseMaximize;
|
|
1888
|
+
double offset = -1;
|
|
1889
|
+
double col_cost[2] = {1, 1};
|
|
1890
|
+
double col_lower[2] = {0, 0};
|
|
1891
|
+
double col_upper[2] = {inf, inf};
|
|
1892
|
+
double row_lower[3] = {-inf, -inf, -inf};
|
|
1893
|
+
double row_upper[3] = {18, 8, 14};
|
|
1894
|
+
HighsInt a_start[3] = {0, 3, 6};
|
|
1895
|
+
HighsInt a_index[6] = {0, 1, 2, 0, 1, 2};
|
|
1896
|
+
double a_value[6] = {3, 1, 1, 1, 1, 2};
|
|
1897
|
+
|
|
1898
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
1899
|
+
HighsInt return_status = Highs_passLp(
|
|
1900
|
+
highs, num_col, num_row, num_nz, a_format, sense, offset, col_cost,
|
|
1901
|
+
col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value);
|
|
1902
|
+
assert(return_status == kHighsStatusOk);
|
|
1903
|
+
|
|
1904
|
+
return_status = Highs_clearLinearObjectives(highs);
|
|
1905
|
+
assert(return_status == kHighsStatusOk);
|
|
1906
|
+
|
|
1907
|
+
double weight = -1;
|
|
1908
|
+
double linear_objective_offset = -1;
|
|
1909
|
+
double coefficients[2] = {1, 1};
|
|
1910
|
+
double abs_tolerance = 0;
|
|
1911
|
+
double rel_tolerance = 0;
|
|
1912
|
+
HighsInt priority = 10;
|
|
1913
|
+
return_status = Highs_addLinearObjective(
|
|
1914
|
+
highs, weight, linear_objective_offset, coefficients, abs_tolerance,
|
|
1915
|
+
rel_tolerance, priority);
|
|
1916
|
+
assert(return_status == kHighsStatusOk);
|
|
1917
|
+
|
|
1918
|
+
weight = 1e-4;
|
|
1919
|
+
linear_objective_offset = 0;
|
|
1920
|
+
coefficients[0] = 1;
|
|
1921
|
+
coefficients[1] = 0;
|
|
1922
|
+
priority = 0;
|
|
1923
|
+
return_status = Highs_addLinearObjective(
|
|
1924
|
+
highs, weight, linear_objective_offset, coefficients, abs_tolerance,
|
|
1925
|
+
rel_tolerance, priority);
|
|
1926
|
+
assert(return_status == kHighsStatusOk);
|
|
1927
|
+
|
|
1928
|
+
return_status = Highs_run(highs);
|
|
1929
|
+
assert(return_status == kHighsStatusOk);
|
|
1930
|
+
HighsInt model_status = Highs_getModelStatus(highs);
|
|
1931
|
+
assert(model_status == kHighsModelStatusOptimal);
|
|
1932
|
+
|
|
1933
|
+
Highs_writeSolutionPretty(highs, "");
|
|
1934
|
+
double* col_value = (double*)malloc(sizeof(double) * num_col);
|
|
1935
|
+
return_status = Highs_getSolution(highs, col_value, NULL, NULL, NULL);
|
|
1936
|
+
assertDoubleValuesEqual("col_value[0]", col_value[0], 2);
|
|
1937
|
+
assertDoubleValuesEqual("col_value[1]", col_value[1], 6);
|
|
1938
|
+
|
|
1939
|
+
Highs_setBoolOptionValue(highs, "blend_multi_objectives", 0);
|
|
1940
|
+
|
|
1941
|
+
if (dev_run) printf("\n***************\nLexicographic 1\n***************\n");
|
|
1942
|
+
double weight2[2] = {-1, 1e-4};
|
|
1943
|
+
double linear_objective_offset2[2] = {-1, 0};
|
|
1944
|
+
double coefficients2[4] = {1, 1, 1, 0};
|
|
1945
|
+
double abs_tolerance2[2] = {0, -1};
|
|
1946
|
+
double rel_tolerance2[2] = {0, -1};
|
|
1947
|
+
HighsInt priority2[2] = {10, 0};
|
|
1948
|
+
return_status = Highs_passLinearObjectives(
|
|
1949
|
+
highs, 2, weight2, linear_objective_offset2, coefficients2,
|
|
1950
|
+
abs_tolerance2, rel_tolerance2, priority2);
|
|
1951
|
+
return_status = Highs_run(highs);
|
|
1952
|
+
assert(return_status == kHighsStatusOk);
|
|
1953
|
+
model_status = Highs_getModelStatus(highs);
|
|
1954
|
+
assert(model_status == kHighsModelStatusOptimal);
|
|
1955
|
+
Highs_writeSolutionPretty(highs, "");
|
|
1956
|
+
return_status = Highs_getSolution(highs, col_value, NULL, NULL, NULL);
|
|
1957
|
+
assertDoubleValuesEqual("col_value[0]", col_value[0], 2);
|
|
1958
|
+
assertDoubleValuesEqual("col_value[1]", col_value[1], 6);
|
|
1959
|
+
|
|
1960
|
+
// weight2[1] = 1e-5;
|
|
1961
|
+
coefficients2[0] = 1.0001;
|
|
1962
|
+
abs_tolerance2[0] = 1e-5;
|
|
1963
|
+
rel_tolerance2[0] = 0.05;
|
|
1964
|
+
return_status = Highs_passLinearObjectives(
|
|
1965
|
+
highs, 2, weight2, linear_objective_offset2, coefficients2,
|
|
1966
|
+
abs_tolerance2, rel_tolerance2, priority2);
|
|
1967
|
+
return_status = Highs_run(highs);
|
|
1968
|
+
assert(return_status == kHighsStatusOk);
|
|
1969
|
+
model_status = Highs_getModelStatus(highs);
|
|
1970
|
+
assert(model_status == kHighsModelStatusOptimal);
|
|
1971
|
+
Highs_writeSolutionPretty(highs, "");
|
|
1972
|
+
return_status = Highs_getSolution(highs, col_value, NULL, NULL, NULL);
|
|
1973
|
+
assertDoubleValuesEqual("col_value[0]", col_value[0], 4.9);
|
|
1974
|
+
assertDoubleValuesEqual("col_value[1]", col_value[1], 3.1);
|
|
1975
|
+
|
|
1976
|
+
if (dev_run) printf("\n***************\nLexicographic 2\n***************\n");
|
|
1977
|
+
abs_tolerance2[0] = -1;
|
|
1978
|
+
|
|
1979
|
+
return_status = Highs_passLinearObjectives(
|
|
1980
|
+
highs, 2, weight2, linear_objective_offset2, coefficients2,
|
|
1981
|
+
abs_tolerance2, rel_tolerance2, priority2);
|
|
1982
|
+
return_status = Highs_run(highs);
|
|
1983
|
+
assert(return_status == kHighsStatusOk);
|
|
1984
|
+
model_status = Highs_getModelStatus(highs);
|
|
1985
|
+
assert(model_status == kHighsModelStatusOptimal);
|
|
1986
|
+
Highs_writeSolutionPretty(highs, "");
|
|
1987
|
+
return_status = Highs_getSolution(highs, col_value, NULL, NULL, NULL);
|
|
1988
|
+
assertDoubleValuesEqual("col_value[0]", col_value[0], 1.30069);
|
|
1989
|
+
assertDoubleValuesEqual("col_value[1]", col_value[1], 6.34966);
|
|
1990
|
+
|
|
1991
|
+
Highs_destroy(highs);
|
|
1992
|
+
free(col_value);
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
void testQpIndefiniteFailure() {
|
|
1996
|
+
void* highs = Highs_create();
|
|
1997
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
1998
|
+
HighsInt ret;
|
|
1999
|
+
const double inf = Highs_getInfinity(highs);
|
|
2000
|
+
ret = Highs_addCol(highs, 0.0, 1.0, inf, 0, NULL, NULL);
|
|
2001
|
+
assert(ret == 0);
|
|
2002
|
+
ret = Highs_addCol(highs, 0.0, 1.0, 1.0, 0, NULL, NULL);
|
|
2003
|
+
HighsInt start[2] = {0, 1};
|
|
2004
|
+
HighsInt index[1] = {1};
|
|
2005
|
+
double value[1] = {1.0};
|
|
2006
|
+
ret = Highs_passHessian(highs, 2, 1, kHighsHessianFormatTriangular, start,
|
|
2007
|
+
index, value);
|
|
2008
|
+
assert(ret == 0);
|
|
2009
|
+
HighsInt run_status = Highs_run(highs);
|
|
2010
|
+
HighsInt model_status = Highs_getModelStatus(highs);
|
|
2011
|
+
assert(run_status == kHighsStatusError);
|
|
2012
|
+
assert(model_status == kHighsModelStatusSolveError);
|
|
2013
|
+
Highs_destroy(highs);
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
void testDualRayTwice() {
|
|
2017
|
+
void* highs = Highs_create();
|
|
2018
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
2019
|
+
int ret;
|
|
2020
|
+
double inf = Highs_getInfinity(highs);
|
|
2021
|
+
ret = Highs_changeObjectiveOffset(highs, 0.0);
|
|
2022
|
+
assert(ret == 0);
|
|
2023
|
+
ret = Highs_setStringOptionValue(highs, "presolve", "off");
|
|
2024
|
+
assert(ret == 0);
|
|
2025
|
+
ret = Highs_addCol(highs, 0.0, 0.0, 0.0, 0, NULL, NULL);
|
|
2026
|
+
assert(ret == 0);
|
|
2027
|
+
ret = Highs_addCol(highs, 0.0, 0.0, 0.0, 0, NULL, NULL);
|
|
2028
|
+
assert(ret == 0);
|
|
2029
|
+
ret = Highs_addCol(highs, -1.0, 0.0, inf, 0, NULL, NULL);
|
|
2030
|
+
assert(ret == 0);
|
|
2031
|
+
ret = Highs_addCol(highs, -1.0, 0.0, inf, 0, NULL, NULL);
|
|
2032
|
+
assert(ret == 0);
|
|
2033
|
+
HighsInt index[2] = {2, 3};
|
|
2034
|
+
double value[2] = {1.0, -1.0};
|
|
2035
|
+
ret = Highs_addRow(highs, 0.0, 0.0, 2, index, value);
|
|
2036
|
+
assert(ret == 0);
|
|
2037
|
+
index[0] = 2;
|
|
2038
|
+
index[1] = 3;
|
|
2039
|
+
value[0] = 1.0;
|
|
2040
|
+
value[1] = 1.0;
|
|
2041
|
+
ret = Highs_addRow(highs, 1.0, inf, 2, index, value);
|
|
2042
|
+
assert(ret == 0);
|
|
2043
|
+
index[0] = 0;
|
|
2044
|
+
index[1] = 2;
|
|
2045
|
+
value[0] = -2.0;
|
|
2046
|
+
value[1] = 1.0;
|
|
2047
|
+
ret = Highs_addRow(highs, -inf, 0.0, 2, index, value);
|
|
2048
|
+
assert(ret == 0);
|
|
2049
|
+
index[0] = 1;
|
|
2050
|
+
index[1] = 3;
|
|
2051
|
+
value[0] = -3.0;
|
|
2052
|
+
value[1] = 1.0;
|
|
2053
|
+
ret = Highs_addRow(highs, -inf, 0.0, 2, index, value);
|
|
2054
|
+
assert(ret == 0);
|
|
2055
|
+
ret = Highs_run(highs);
|
|
2056
|
+
assert(ret == 0);
|
|
2057
|
+
HighsInt has_dual_ray = 0;
|
|
2058
|
+
double dual_ray_value[4] = {0.0, 0.0, 0.0, 0.0};
|
|
2059
|
+
ret = Highs_getDualRay(highs, &has_dual_ray, dual_ray_value);
|
|
2060
|
+
assert(ret == 0);
|
|
2061
|
+
assertIntValuesEqual("has_dual_ray", has_dual_ray, 1);
|
|
2062
|
+
assertDoubleValuesEqual("dual_ray_value[0]", dual_ray_value[0], 0.0);
|
|
2063
|
+
assertDoubleValuesEqual("dual_ray_value[1]", dual_ray_value[1], 1.0);
|
|
2064
|
+
assertDoubleValuesEqual("dual_ray_value[2]", dual_ray_value[2], -1.0);
|
|
2065
|
+
assertDoubleValuesEqual("dual_ray_value[3]", dual_ray_value[3], -1.0);
|
|
2066
|
+
ret = Highs_changeColBounds(highs, 1, 1.0, 1.0);
|
|
2067
|
+
assert(ret == 0);
|
|
2068
|
+
ret = Highs_run(highs);
|
|
2069
|
+
assert(ret == 0);
|
|
2070
|
+
ret = Highs_getDualRay(highs, &has_dual_ray, dual_ray_value);
|
|
2071
|
+
assert(ret == 0);
|
|
2072
|
+
assertIntValuesEqual("has_dual_ray", has_dual_ray, 1);
|
|
2073
|
+
assertDoubleValuesEqual("dual_ray_value[0]", dual_ray_value[0], 1.0);
|
|
2074
|
+
assertDoubleValuesEqual("dual_ray_value[1]", dual_ray_value[1], 1.0);
|
|
2075
|
+
assertDoubleValuesEqual("dual_ray_value[2]", dual_ray_value[2], -2.0);
|
|
2076
|
+
assertDoubleValuesEqual("dual_ray_value[3]", dual_ray_value[3], 0.0);
|
|
2077
|
+
Highs_destroy(highs);
|
|
2078
|
+
return;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
/*
|
|
2082
|
+
The horrible C in this causes problems in some of the CI tests,
|
|
2083
|
+
so suppress thius test until the C has been improved
|
|
2084
|
+
|
|
2085
|
+
void testSetSolution() {
|
|
2086
|
+
void* highs = Highs_create();
|
|
2087
|
+
// Perform in C the equivalent of std::string model_file =
|
|
2088
|
+
// std::string(HIGHS_DIR) + "/check/instances/shell.mps";
|
|
2089
|
+
|
|
2090
|
+
char* dir = HIGHS_DIR;
|
|
2091
|
+
char model_file0[100];
|
|
2092
|
+
strcat(model_file0, dir);
|
|
2093
|
+
strcat(model_file0, "/check/instances/shell.mps");
|
|
2094
|
+
strcat(model_file0, "\0");
|
|
2095
|
+
char* substr = model_file0 + 1;
|
|
2096
|
+
memmove(model_file0, substr, strlen(substr) + 1);
|
|
2097
|
+
HighsInt length = strlen(model_file0) + 1;
|
|
2098
|
+
char model_file[length];
|
|
2099
|
+
strcpy(model_file, model_file0);
|
|
2100
|
+
|
|
2101
|
+
if (dev_run) printf("\nSolving from scratch\n");
|
|
2102
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
2103
|
+
|
|
2104
|
+
Highs_readModel(highs, model_file);
|
|
2105
|
+
Highs_run(highs);
|
|
2106
|
+
HighsInt iteration_count0;
|
|
2107
|
+
Highs_getIntInfoValue(highs, "simplex_iteration_count", &iteration_count0);
|
|
2108
|
+
HighsInt num_col = Highs_getNumCol(highs);
|
|
2109
|
+
double* col_value = (double*)malloc(sizeof(double) * num_col);
|
|
2110
|
+
Highs_getSolution(highs, col_value, NULL, NULL, NULL);
|
|
2111
|
+
Highs_clear(highs);
|
|
2112
|
+
if (dev_run) printf("\nSolving from saved solution\n");
|
|
2113
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
2114
|
+
Highs_readModel(highs, model_file);
|
|
2115
|
+
Highs_setSolution(highs, col_value, NULL, NULL, NULL);
|
|
2116
|
+
Highs_run(highs);
|
|
2117
|
+
HighsInt iteration_count1;
|
|
2118
|
+
Highs_getIntInfoValue(highs, "simplex_iteration_count", &iteration_count1);
|
|
2119
|
+
HighsInt logic = iteration_count0 > iteration_count1;
|
|
2120
|
+
printf("Iteration counts are %d and %d\n", iteration_count0,
|
|
2121
|
+
iteration_count1); assertLogical("Dual", logic);
|
|
2122
|
+
|
|
2123
|
+
Highs_destroy(highs);
|
|
2124
|
+
}
|
|
2125
|
+
*/
|
|
2126
|
+
void testDeleteRowResolveWithBasis() {
|
|
2127
|
+
// Created to expose bug in #2267, but also illustrates case where
|
|
2128
|
+
// scaling was performed on the original problem - due to the 6 in
|
|
2129
|
+
// row 1, but would not be performed on the problem after row 1 has
|
|
2130
|
+
// been removed
|
|
2131
|
+
void* highs = Highs_create();
|
|
2132
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
2133
|
+
HighsInt ret;
|
|
2134
|
+
double inf = Highs_getInfinity(highs);
|
|
2135
|
+
ret = Highs_addCol(highs, 0.0, 2.0, 2.0, 0, NULL, NULL);
|
|
2136
|
+
ret = Highs_addCol(highs, 0.0, -inf, inf, 0, NULL, NULL);
|
|
2137
|
+
ret = Highs_addCol(highs, 0.0, -inf, inf, 0, NULL, NULL);
|
|
2138
|
+
HighsInt index_1[2] = {0, 2};
|
|
2139
|
+
double value_1[2] = {2.0, -1.0};
|
|
2140
|
+
ret = Highs_addRow(highs, 0.0, 0.0, 2, index_1, value_1);
|
|
2141
|
+
HighsInt index_2[1] = {1};
|
|
2142
|
+
double value_2[1] = {6.0};
|
|
2143
|
+
ret = Highs_addRow(highs, 10.0, inf, 1, index_2, value_2);
|
|
2144
|
+
Highs_run(highs);
|
|
2145
|
+
double col_value[3] = {0.0, 0.0, 0.0};
|
|
2146
|
+
Highs_getSolution(highs, col_value, NULL, NULL, NULL);
|
|
2147
|
+
assertDoubleValuesEqual("col_value[0]", col_value[0], 2.0);
|
|
2148
|
+
ret = Highs_deleteRowsByRange(highs, 1, 1);
|
|
2149
|
+
assert(ret == 0);
|
|
2150
|
+
ret = Highs_run(highs);
|
|
2151
|
+
assert(ret == 0);
|
|
2152
|
+
ret = Highs_getSolution(highs, col_value, NULL, NULL, NULL);
|
|
2153
|
+
assert(ret == 0);
|
|
2154
|
+
assertDoubleValuesEqual("col_value[0]", col_value[0], 2.0);
|
|
2155
|
+
Highs_destroy(highs);
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
void testIis() {
|
|
2159
|
+
void* highs = Highs_create();
|
|
2160
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
2161
|
+
HighsInt ret;
|
|
2162
|
+
double inf = Highs_getInfinity(highs);
|
|
2163
|
+
// For the constraints
|
|
2164
|
+
//
|
|
2165
|
+
// x + y - z = 2
|
|
2166
|
+
//
|
|
2167
|
+
// x + y + z <= 5
|
|
2168
|
+
//
|
|
2169
|
+
// x + 2y + z <= 1
|
|
2170
|
+
//
|
|
2171
|
+
// with variables in [0, 1], constraints 0 and 2 form an IIS with
|
|
2172
|
+
//
|
|
2173
|
+
// x free; 0 <= y; 0 <= z
|
|
2174
|
+
//
|
|
2175
|
+
// x + y - z >= 2; x + 2y + z <= 1
|
|
2176
|
+
//
|
|
2177
|
+
// x may be free, but can't immediately be removed, otherwise
|
|
2178
|
+
// removing y >= 0 yields an infeasible LP
|
|
2179
|
+
//
|
|
2180
|
+
ret = Highs_addCol(highs, 0.0, 0.0, 1.0, 0, NULL, NULL);
|
|
2181
|
+
assert(ret == 0);
|
|
2182
|
+
ret = Highs_addCol(highs, 0.0, 0.0, 1.0, 0, NULL, NULL);
|
|
2183
|
+
assert(ret == 0);
|
|
2184
|
+
ret = Highs_addCol(highs, 0.0, 0.0, 1.0, 0, NULL, NULL);
|
|
2185
|
+
assert(ret == 0);
|
|
2186
|
+
HighsInt index[3] = {0, 1, 2};
|
|
2187
|
+
double value_1[3] = {1, 1, -1};
|
|
2188
|
+
double value_2[3] = {1, 1, 1};
|
|
2189
|
+
double value_3[3] = {1, 2, 1};
|
|
2190
|
+
ret = Highs_addRow(highs, 2.0, 2.0, 3, index, value_1);
|
|
2191
|
+
assert(ret == 0);
|
|
2192
|
+
ret = Highs_addRow(highs, -inf, 5.0, 3, index, value_2);
|
|
2193
|
+
assert(ret == 0);
|
|
2194
|
+
ret = Highs_addRow(highs, -inf, 1.0, 3, index, value_3);
|
|
2195
|
+
assert(ret == 0);
|
|
2196
|
+
|
|
2197
|
+
HighsInt num_col;
|
|
2198
|
+
HighsInt num_row;
|
|
2199
|
+
HighsInt num_nz;
|
|
2200
|
+
HighsInt sense;
|
|
2201
|
+
double offset;
|
|
2202
|
+
ret = Highs_getLp(highs, kHighsMatrixFormatRowwise,
|
|
2203
|
+
&num_col, &num_row, &num_nz,
|
|
2204
|
+
&sense, &offset,
|
|
2205
|
+
NULL, NULL, NULL,
|
|
2206
|
+
NULL, NULL,
|
|
2207
|
+
NULL, NULL, NULL,
|
|
2208
|
+
NULL);
|
|
2209
|
+
|
|
2210
|
+
for (int k = 0 ; k < 2; k++) {
|
|
2211
|
+
HighsInt iis_num_col;
|
|
2212
|
+
HighsInt iis_num_row;
|
|
2213
|
+
ret = Highs_getIis(highs,
|
|
2214
|
+
&iis_num_col, &iis_num_row,
|
|
2215
|
+
NULL, NULL,
|
|
2216
|
+
NULL, NULL,
|
|
2217
|
+
NULL, NULL);
|
|
2218
|
+
assert(ret == 0);
|
|
2219
|
+
|
|
2220
|
+
if (k == 0) {
|
|
2221
|
+
// No IIS from kHighsIisStrategyLight
|
|
2222
|
+
assert(iis_num_col == 0);
|
|
2223
|
+
assert(iis_num_row == 0);
|
|
2224
|
+
Highs_setIntOptionValue(highs, "iis_strategy",
|
|
2225
|
+
kHighsIisStrategyFromLpRowPriority);
|
|
2226
|
+
} else {
|
|
2227
|
+
assert(iis_num_col == 3);
|
|
2228
|
+
assert(iis_num_row == 2);
|
|
2229
|
+
HighsInt* col_index = (HighsInt*)malloc(sizeof(HighsInt) * iis_num_col);
|
|
2230
|
+
HighsInt* row_index = (HighsInt*)malloc(sizeof(HighsInt) * iis_num_row);
|
|
2231
|
+
HighsInt* col_bound = (HighsInt*)malloc(sizeof(HighsInt) * iis_num_col);
|
|
2232
|
+
HighsInt* row_bound = (HighsInt*)malloc(sizeof(HighsInt) * iis_num_row);
|
|
2233
|
+
HighsInt* col_status = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
2234
|
+
HighsInt* row_status = (HighsInt*)malloc(sizeof(HighsInt) * num_row);
|
|
2235
|
+
ret = Highs_getIis(highs,
|
|
2236
|
+
&iis_num_col, &iis_num_row,
|
|
2237
|
+
col_index, row_index,
|
|
2238
|
+
col_bound, row_bound,
|
|
2239
|
+
col_status, row_status);
|
|
2240
|
+
assert(ret == 0);
|
|
2241
|
+
|
|
2242
|
+
assert(col_index[0] == 0);
|
|
2243
|
+
assert(col_index[1] == 1);
|
|
2244
|
+
assert(col_index[2] == 2);
|
|
2245
|
+
|
|
2246
|
+
assert(row_index[0] == 0);
|
|
2247
|
+
assert(row_index[1] == 2);
|
|
2248
|
+
|
|
2249
|
+
assert(col_bound[0] == kHighsIisBoundFree);
|
|
2250
|
+
assert(col_bound[1] == kHighsIisBoundLower);
|
|
2251
|
+
assert(col_bound[2] == kHighsIisBoundLower);
|
|
2252
|
+
|
|
2253
|
+
assert(row_bound[0] == kHighsIisBoundLower);
|
|
2254
|
+
assert(row_bound[1] == kHighsIisBoundUpper);
|
|
2255
|
+
|
|
2256
|
+
assert(col_status[0] == kHighsIisStatusInConflict);
|
|
2257
|
+
assert(col_status[1] == kHighsIisStatusInConflict);
|
|
2258
|
+
assert(col_status[2] == kHighsIisStatusInConflict);
|
|
2259
|
+
|
|
2260
|
+
assert(row_status[0] == kHighsIisStatusInConflict);
|
|
2261
|
+
assert(row_status[1] == kHighsIisStatusNotInConflict);
|
|
2262
|
+
assert(row_status[2] == kHighsIisStatusInConflict);
|
|
2263
|
+
|
|
2264
|
+
free(col_index);
|
|
2265
|
+
free(row_index);
|
|
2266
|
+
free(col_bound);
|
|
2267
|
+
free(row_bound);
|
|
2268
|
+
free(col_status);
|
|
2269
|
+
free(row_status);
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
// Re #2635 check with feasible LP
|
|
2274
|
+
Highs_clearModel(highs);
|
|
2275
|
+
|
|
2276
|
+
ret = Highs_addCol(highs, 0.0, 0.0, inf, 0, NULL, NULL);
|
|
2277
|
+
assert(ret == 0);
|
|
2278
|
+
ret = Highs_addCol(highs, 0.0, 0.0, inf, 0, NULL, NULL);
|
|
2279
|
+
assert(ret == 0);
|
|
2280
|
+
index[0] = 0;
|
|
2281
|
+
index[1] = 1;
|
|
2282
|
+
value_1[0] = 1;
|
|
2283
|
+
value_1[1] = 2;
|
|
2284
|
+
value_2[0] = 1;
|
|
2285
|
+
value_2[1] = 4;
|
|
2286
|
+
ret = Highs_addRow(highs, -inf, 80, 2, index, value_1);
|
|
2287
|
+
assert(ret == 0);
|
|
2288
|
+
ret = Highs_addRow(highs, -inf, 120, 2, index, value_2);
|
|
2289
|
+
assert(ret == 0);
|
|
2290
|
+
|
|
2291
|
+
ret = Highs_getLp(highs, kHighsMatrixFormatRowwise,
|
|
2292
|
+
&num_col, &num_row, &num_nz,
|
|
2293
|
+
&sense, &offset,
|
|
2294
|
+
NULL, NULL, NULL,
|
|
2295
|
+
NULL, NULL,
|
|
2296
|
+
NULL, NULL, NULL,
|
|
2297
|
+
NULL);
|
|
2298
|
+
|
|
2299
|
+
HighsInt* col_index = NULL;
|
|
2300
|
+
HighsInt* row_index = NULL;
|
|
2301
|
+
HighsInt* col_bound = NULL;
|
|
2302
|
+
HighsInt* row_bound = NULL;
|
|
2303
|
+
HighsInt* col_status = (HighsInt*)malloc(sizeof(HighsInt) * num_col);
|
|
2304
|
+
HighsInt* row_status = (HighsInt*)malloc(sizeof(HighsInt) * num_row);
|
|
2305
|
+
|
|
2306
|
+
// First try with kIisStrategyLight
|
|
2307
|
+
Highs_setIntOptionValue(highs, "iis_strategy", kHighsIisStrategyLight);
|
|
2308
|
+
|
|
2309
|
+
for (int k = 0 ; k < 2; k++) {
|
|
2310
|
+
HighsInt iis_num_col;
|
|
2311
|
+
HighsInt iis_num_row;
|
|
2312
|
+
ret = Highs_getIis(highs,
|
|
2313
|
+
&iis_num_col, &iis_num_row,
|
|
2314
|
+
NULL, NULL,
|
|
2315
|
+
NULL, NULL,
|
|
2316
|
+
NULL, NULL);
|
|
2317
|
+
assert(ret == 0);
|
|
2318
|
+
|
|
2319
|
+
assert(iis_num_col == 0);
|
|
2320
|
+
assert(iis_num_row == 0);
|
|
2321
|
+
ret = Highs_getIis(highs,
|
|
2322
|
+
&iis_num_col, &iis_num_row,
|
|
2323
|
+
col_index, row_index,
|
|
2324
|
+
col_bound, row_bound,
|
|
2325
|
+
col_status, row_status);
|
|
2326
|
+
assert(ret == 0);
|
|
2327
|
+
if (k == 0) {
|
|
2328
|
+
// Before running HiGHS, model status is unknown
|
|
2329
|
+
assert(col_status[0] == kHighsIisStatusMaybeInConflict);
|
|
2330
|
+
assert(col_status[1] == kHighsIisStatusMaybeInConflict);
|
|
2331
|
+
assert(row_status[0] == kHighsIisStatusMaybeInConflict);
|
|
2332
|
+
assert(row_status[1] == kHighsIisStatusMaybeInConflict);
|
|
2333
|
+
} else {
|
|
2334
|
+
// After running HiGHS, model status is known to be optimal
|
|
2335
|
+
assert(col_status[0] == kHighsIisStatusNotInConflict);
|
|
2336
|
+
assert(col_status[1] == kHighsIisStatusNotInConflict);
|
|
2337
|
+
assert(row_status[0] == kHighsIisStatusNotInConflict);
|
|
2338
|
+
assert(row_status[1] == kHighsIisStatusNotInConflict);
|
|
2339
|
+
}
|
|
2340
|
+
Highs_run(highs);
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
// Now try with kHighsIisStrategyFromLpRowPriority
|
|
2344
|
+
Highs_clearSolver(highs);
|
|
2345
|
+
Highs_setIntOptionValue(highs, "iis_strategy",
|
|
2346
|
+
kHighsIisStrategyFromLpRowPriority);
|
|
2347
|
+
HighsInt iis_num_col;
|
|
2348
|
+
HighsInt iis_num_row;
|
|
2349
|
+
ret = Highs_getIis(highs,
|
|
2350
|
+
&iis_num_col, &iis_num_row,
|
|
2351
|
+
NULL, NULL,
|
|
2352
|
+
NULL, NULL,
|
|
2353
|
+
NULL, NULL);
|
|
2354
|
+
assert(ret == 0);
|
|
2355
|
+
|
|
2356
|
+
assert(iis_num_col == 0);
|
|
2357
|
+
assert(iis_num_row == 0);
|
|
2358
|
+
ret = Highs_getIis(highs,
|
|
2359
|
+
&iis_num_col, &iis_num_row,
|
|
2360
|
+
col_index, row_index,
|
|
2361
|
+
col_bound, row_bound,
|
|
2362
|
+
col_status, row_status);
|
|
2363
|
+
assert(ret == 0);
|
|
2364
|
+
// With kHighsIisStrategyFromLpRowPriority, model status is found to
|
|
2365
|
+
// be feasible
|
|
2366
|
+
assert(col_status[0] == kHighsIisStatusNotInConflict);
|
|
2367
|
+
assert(col_status[1] == kHighsIisStatusNotInConflict);
|
|
2368
|
+
assert(row_status[0] == kHighsIisStatusNotInConflict);
|
|
2369
|
+
assert(row_status[1] == kHighsIisStatusNotInConflict);
|
|
2370
|
+
|
|
2371
|
+
free(col_status);
|
|
2372
|
+
free(row_status);
|
|
2373
|
+
|
|
2374
|
+
Highs_destroy(highs);
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
void testFixedLp() {
|
|
2378
|
+
// The use of Highs_getFixedLp is illustrated for the MIP
|
|
2379
|
+
//
|
|
2380
|
+
// Min f = -3x_0 - 2x_1 - x_2
|
|
2381
|
+
// s.t. x_0 + x_1 + x_2 <= 7
|
|
2382
|
+
// 4x_0 + 2x_1 + x_2 = 12
|
|
2383
|
+
// x_0 >=0; x_1 >= 0; x_2 binary
|
|
2384
|
+
|
|
2385
|
+
const HighsInt num_col = 3;
|
|
2386
|
+
const HighsInt num_row = 2;
|
|
2387
|
+
const HighsInt num_nz = 6;
|
|
2388
|
+
HighsInt a_format = kHighsMatrixFormatColwise;
|
|
2389
|
+
HighsInt sense = kHighsObjSenseMinimize;
|
|
2390
|
+
double offset = 0;
|
|
2391
|
+
|
|
2392
|
+
// Define the column costs, lower bounds and upper bounds
|
|
2393
|
+
double col_cost[3] = {-3.0, -2.0, -1.0};
|
|
2394
|
+
double col_lower[3] = {0.0, 0.0, 0.0};
|
|
2395
|
+
double col_upper[3] = {1.0e30, 1.0e30, 1.0};
|
|
2396
|
+
// Define the row lower bounds and upper bounds
|
|
2397
|
+
double row_lower[2] = {-1.0e30, 12.0};
|
|
2398
|
+
double row_upper[2] = {7.0, 12.0};
|
|
2399
|
+
// Define the constraint matrix column-wise
|
|
2400
|
+
HighsInt a_start[3] = {0, 2, 4};
|
|
2401
|
+
HighsInt a_index[6] = {0, 1, 0, 1, 0, 1};
|
|
2402
|
+
double a_value[6] = {1.0, 4.0, 1.0, 2.0, 1.0, 1.0};
|
|
2403
|
+
HighsInt integrality[3] = {kHighsVarTypeContinuous, kHighsVarTypeContinuous,
|
|
2404
|
+
kHighsVarTypeInteger};
|
|
2405
|
+
|
|
2406
|
+
void* highs = Highs_create();
|
|
2407
|
+
Highs_setBoolOptionValue(highs, "output_flag", dev_run);
|
|
2408
|
+
Highs_setStringOptionValue(highs, "presolve", "off");
|
|
2409
|
+
HighsInt return_status =
|
|
2410
|
+
Highs_passMip(highs, num_col, num_row, num_nz, a_format, sense, offset,
|
|
2411
|
+
col_cost, col_lower, col_upper, row_lower, row_upper,
|
|
2412
|
+
a_start, a_index, a_value, integrality);
|
|
2413
|
+
assert(return_status == kHighsStatusOk);
|
|
2414
|
+
return_status = Highs_run(highs);
|
|
2415
|
+
double mip_objective_function_value;
|
|
2416
|
+
return_status = Highs_getDoubleInfoValue(highs, "objective_function_value",
|
|
2417
|
+
&mip_objective_function_value);
|
|
2418
|
+
assert(return_status == kHighsStatusOk);
|
|
2419
|
+
|
|
2420
|
+
double* col_value = (double*)malloc(sizeof(double) * num_col);
|
|
2421
|
+
return_status = Highs_getSolution(highs, col_value, NULL, NULL, NULL);
|
|
2422
|
+
assert(return_status == kHighsStatusOk);
|
|
2423
|
+
|
|
2424
|
+
HighsInt fixed_lp_num_col;
|
|
2425
|
+
HighsInt fixed_lp_num_row;
|
|
2426
|
+
HighsInt fixed_lp_num_nz;
|
|
2427
|
+
HighsInt fixed_lp_sense;
|
|
2428
|
+
double fixed_lp_offset;
|
|
2429
|
+
Highs_getFixedLp(highs, kHighsMatrixFormatColwise, &fixed_lp_num_col, &fixed_lp_num_row,
|
|
2430
|
+
&fixed_lp_num_nz, &fixed_lp_sense, &fixed_lp_offset, NULL, NULL, NULL, NULL, NULL,
|
|
2431
|
+
NULL, NULL, NULL);
|
|
2432
|
+
|
|
2433
|
+
assert(fixed_lp_num_col == num_col);
|
|
2434
|
+
assert(fixed_lp_num_row == num_row);
|
|
2435
|
+
assert(fixed_lp_num_nz == num_nz);
|
|
2436
|
+
assert(fixed_lp_sense == sense);
|
|
2437
|
+
|
|
2438
|
+
double* fixed_lp_col_cost = (double*)malloc(sizeof(double) * fixed_lp_num_col);
|
|
2439
|
+
double* fixed_lp_col_lower = (double*)malloc(sizeof(double) * fixed_lp_num_col);
|
|
2440
|
+
double* fixed_lp_col_upper = (double*)malloc(sizeof(double) * fixed_lp_num_col);
|
|
2441
|
+
double* fixed_lp_row_lower = (double*)malloc(sizeof(double) * fixed_lp_num_row);
|
|
2442
|
+
double* fixed_lp_row_upper = (double*)malloc(sizeof(double) * fixed_lp_num_row);
|
|
2443
|
+
HighsInt* fixed_lp_a_start = (HighsInt*)malloc(sizeof(HighsInt) * fixed_lp_num_col);
|
|
2444
|
+
HighsInt* fixed_lp_a_index = (HighsInt*)malloc(sizeof(HighsInt) * fixed_lp_num_nz);
|
|
2445
|
+
double* fixed_lp_a_value = (double*)malloc(sizeof(double) * num_nz);
|
|
2446
|
+
|
|
2447
|
+
// Get the arrays
|
|
2448
|
+
Highs_getFixedLp(highs, kHighsMatrixFormatColwise, &fixed_lp_num_col, &fixed_lp_num_row,
|
|
2449
|
+
&fixed_lp_num_nz, &fixed_lp_sense, &fixed_lp_offset, fixed_lp_col_cost, fixed_lp_col_lower,
|
|
2450
|
+
fixed_lp_col_upper, fixed_lp_row_lower, fixed_lp_row_upper, fixed_lp_a_start, fixed_lp_a_index,
|
|
2451
|
+
fixed_lp_a_value);
|
|
2452
|
+
|
|
2453
|
+
return_status = Highs_passLp(highs,
|
|
2454
|
+
fixed_lp_num_col, fixed_lp_num_row, fixed_lp_num_nz,
|
|
2455
|
+
kHighsMatrixFormatColwise,
|
|
2456
|
+
fixed_lp_sense, fixed_lp_offset,
|
|
2457
|
+
fixed_lp_col_cost, fixed_lp_col_lower, fixed_lp_col_upper,
|
|
2458
|
+
fixed_lp_row_lower, fixed_lp_row_upper,
|
|
2459
|
+
fixed_lp_a_start, fixed_lp_a_index, fixed_lp_a_value);
|
|
2460
|
+
assert(return_status == kHighsStatusOk);
|
|
2461
|
+
|
|
2462
|
+
return_status = Highs_setSolution(highs, col_value, NULL, NULL, NULL);
|
|
2463
|
+
assert(return_status == kHighsStatusOk);
|
|
2464
|
+
|
|
2465
|
+
return_status = Highs_run(highs);
|
|
2466
|
+
double objective_function_value;
|
|
2467
|
+
return_status = Highs_getDoubleInfoValue(highs, "objective_function_value",
|
|
2468
|
+
&objective_function_value);
|
|
2469
|
+
assert(return_status == kHighsStatusOk);
|
|
2470
|
+
assert(objective_function_value == mip_objective_function_value);
|
|
2471
|
+
|
|
2472
|
+
|
|
2473
|
+
free(col_value);
|
|
2474
|
+
free(fixed_lp_col_cost);
|
|
2475
|
+
free(fixed_lp_col_lower);
|
|
2476
|
+
free(fixed_lp_col_upper);
|
|
2477
|
+
free(fixed_lp_row_lower);
|
|
2478
|
+
free(fixed_lp_row_upper);
|
|
2479
|
+
free(fixed_lp_a_start);
|
|
2480
|
+
free(fixed_lp_a_index);
|
|
2481
|
+
free(fixed_lp_a_value);
|
|
2482
|
+
|
|
2483
|
+
Highs_destroy(highs);
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
int main() {
|
|
2487
|
+
minimalApiIllegalLp();
|
|
2488
|
+
testCallback();
|
|
2489
|
+
versionApi();
|
|
2490
|
+
minimalApiLp();
|
|
2491
|
+
minimalApiMip();
|
|
2492
|
+
minimalApiQp();
|
|
2493
|
+
fullApiOptions();
|
|
2494
|
+
fullApiLp();
|
|
2495
|
+
fullApiMip();
|
|
2496
|
+
fullApiQp();
|
|
2497
|
+
passPresolveGetLp();
|
|
2498
|
+
options();
|
|
2499
|
+
testGetColsByRange();
|
|
2500
|
+
testPassHessian();
|
|
2501
|
+
testRanging();
|
|
2502
|
+
testFeasibilityRelaxation();
|
|
2503
|
+
testNames();
|
|
2504
|
+
testGetModel();
|
|
2505
|
+
testMultiObjective();
|
|
2506
|
+
testQpIndefiniteFailure();
|
|
2507
|
+
testDualRayTwice();
|
|
2508
|
+
testDeleteRowResolveWithBasis();
|
|
2509
|
+
testIis();
|
|
2510
|
+
testFixedLp();
|
|
2511
|
+
return 0;
|
|
2512
|
+
}
|
|
2513
|
+
// testSetSolution();
|