lpsolver 0.1.0 → 0.2.1
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 +104 -26
- data/ext/lpsolver/Makefile +269 -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 +35 -7
- data/lib/lpsolver/native.so +0 -0
- data/lib/lpsolver/native_model.rb +261 -0
- data/lib/lpsolver/solution.rb +93 -8
- data/lib/lpsolver/version.rb +1 -1
- data/lpsolver.gemspec +4 -1
- metadata +1176 -4
|
@@ -0,0 +1,1375 @@
|
|
|
1
|
+
#include "io/filereaderlp/reader.hpp"
|
|
2
|
+
|
|
3
|
+
#include <algorithm>
|
|
4
|
+
#include <array>
|
|
5
|
+
#include <cassert>
|
|
6
|
+
#include <cctype>
|
|
7
|
+
#include <cstring>
|
|
8
|
+
#include <fstream>
|
|
9
|
+
#include <iostream>
|
|
10
|
+
#include <limits>
|
|
11
|
+
#include <map>
|
|
12
|
+
#include <memory>
|
|
13
|
+
#include <unordered_map>
|
|
14
|
+
#include <vector>
|
|
15
|
+
|
|
16
|
+
#include "HConfig.h" // for ZLIB_FOUND
|
|
17
|
+
#include "builder.hpp"
|
|
18
|
+
#include "def.hpp"
|
|
19
|
+
#ifdef ZLIB_FOUND
|
|
20
|
+
#include "../extern/zstr/zstr.hpp"
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
// Cygwin doesn't come with an implementation for strdup if compiled with
|
|
24
|
+
// std=cxx
|
|
25
|
+
#ifdef __CYGWIN__
|
|
26
|
+
#include <cstdlib>
|
|
27
|
+
char* strdup(const char* s) {
|
|
28
|
+
size_t slen = strlen(s);
|
|
29
|
+
char* result = (char*)malloc(slen + 1);
|
|
30
|
+
if (result == NULL) {
|
|
31
|
+
return NULL;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
memcpy(result, s, slen + 1);
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
enum class RawTokenType {
|
|
40
|
+
NONE,
|
|
41
|
+
STR,
|
|
42
|
+
CONS,
|
|
43
|
+
LESS,
|
|
44
|
+
GREATER,
|
|
45
|
+
EQUAL,
|
|
46
|
+
COLON,
|
|
47
|
+
LNEND,
|
|
48
|
+
FLEND,
|
|
49
|
+
BRKOP,
|
|
50
|
+
BRKCL,
|
|
51
|
+
PLUS,
|
|
52
|
+
MINUS,
|
|
53
|
+
HAT,
|
|
54
|
+
SLASH,
|
|
55
|
+
ASTERISK
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
// Useful for debugging
|
|
60
|
+
static std::string tokenTypeToString(const RawTokenType& type) {
|
|
61
|
+
switch (type) {
|
|
62
|
+
case RawTokenType::NONE:
|
|
63
|
+
return "None";
|
|
64
|
+
case RawTokenType::STR:
|
|
65
|
+
return "String";
|
|
66
|
+
case RawTokenType::CONS:
|
|
67
|
+
return "Constraint ";
|
|
68
|
+
case RawTokenType::LESS:
|
|
69
|
+
return "<=";
|
|
70
|
+
case RawTokenType::GREATER:
|
|
71
|
+
return ">=";
|
|
72
|
+
case RawTokenType::EQUAL:
|
|
73
|
+
return "=";
|
|
74
|
+
case RawTokenType::COLON:
|
|
75
|
+
return ":";
|
|
76
|
+
case RawTokenType::LNEND:
|
|
77
|
+
return "\\n";
|
|
78
|
+
case RawTokenType::FLEND:
|
|
79
|
+
return "EOF";
|
|
80
|
+
case RawTokenType::BRKOP:
|
|
81
|
+
return "(";
|
|
82
|
+
case RawTokenType::BRKCL:
|
|
83
|
+
return ")";
|
|
84
|
+
case RawTokenType::PLUS:
|
|
85
|
+
return "+";
|
|
86
|
+
case RawTokenType::MINUS:
|
|
87
|
+
return "-";
|
|
88
|
+
case RawTokenType::HAT:
|
|
89
|
+
return "^";
|
|
90
|
+
case RawTokenType::SLASH:
|
|
91
|
+
return "/";
|
|
92
|
+
case RawTokenType::ASTERISK:
|
|
93
|
+
return "*";
|
|
94
|
+
default:
|
|
95
|
+
return "Unknown";
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
struct RawToken {
|
|
101
|
+
RawTokenType type = RawTokenType::NONE;
|
|
102
|
+
std::string svalue;
|
|
103
|
+
double dvalue = 0.0;
|
|
104
|
+
|
|
105
|
+
inline bool istype(RawTokenType t) const { return this->type == t; }
|
|
106
|
+
|
|
107
|
+
RawToken& operator=(RawTokenType t) {
|
|
108
|
+
type = t;
|
|
109
|
+
return *this;
|
|
110
|
+
}
|
|
111
|
+
RawToken& operator=(const std::string& v) {
|
|
112
|
+
svalue = v;
|
|
113
|
+
type = RawTokenType::STR;
|
|
114
|
+
return *this;
|
|
115
|
+
}
|
|
116
|
+
RawToken& operator=(const std::pair<double, std::string> vs) {
|
|
117
|
+
dvalue = vs.first;
|
|
118
|
+
svalue = vs.second;
|
|
119
|
+
type = RawTokenType::CONS;
|
|
120
|
+
return *this;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
enum class ProcessedTokenType {
|
|
125
|
+
NONE,
|
|
126
|
+
SECID,
|
|
127
|
+
VARID,
|
|
128
|
+
CONID,
|
|
129
|
+
CONST,
|
|
130
|
+
FREE,
|
|
131
|
+
BRKOP,
|
|
132
|
+
BRKCL,
|
|
133
|
+
COMP,
|
|
134
|
+
LNEND,
|
|
135
|
+
SLASH,
|
|
136
|
+
ASTERISK,
|
|
137
|
+
HAT,
|
|
138
|
+
SOSTYPE
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
enum class LpSectionKeyword {
|
|
142
|
+
NONE,
|
|
143
|
+
OBJMIN,
|
|
144
|
+
OBJMAX,
|
|
145
|
+
CON,
|
|
146
|
+
BOUNDS,
|
|
147
|
+
GEN,
|
|
148
|
+
BIN,
|
|
149
|
+
SEMI,
|
|
150
|
+
SOS,
|
|
151
|
+
END
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
static const std::unordered_map<std::string, LpSectionKeyword>
|
|
155
|
+
sectionkeywordmap{{"minimize", LpSectionKeyword::OBJMIN},
|
|
156
|
+
{"min", LpSectionKeyword::OBJMIN},
|
|
157
|
+
{"minimum", LpSectionKeyword::OBJMIN},
|
|
158
|
+
{"maximize", LpSectionKeyword::OBJMAX},
|
|
159
|
+
{"max", LpSectionKeyword::OBJMAX},
|
|
160
|
+
{"maximum", LpSectionKeyword::OBJMAX},
|
|
161
|
+
{"subject to", LpSectionKeyword::CON},
|
|
162
|
+
{"such that", LpSectionKeyword::CON},
|
|
163
|
+
{"st", LpSectionKeyword::CON},
|
|
164
|
+
{"s.t.", LpSectionKeyword::CON},
|
|
165
|
+
{"bounds", LpSectionKeyword::BOUNDS},
|
|
166
|
+
{"bound", LpSectionKeyword::BOUNDS},
|
|
167
|
+
{"binary", LpSectionKeyword::BIN},
|
|
168
|
+
{"binaries", LpSectionKeyword::BIN},
|
|
169
|
+
{"bin", LpSectionKeyword::BIN},
|
|
170
|
+
{"general", LpSectionKeyword::GEN},
|
|
171
|
+
{"generals", LpSectionKeyword::GEN},
|
|
172
|
+
{"gen", LpSectionKeyword::GEN},
|
|
173
|
+
{"integer", LpSectionKeyword::GEN},
|
|
174
|
+
{"integers", LpSectionKeyword::GEN},
|
|
175
|
+
{"semi-continuous", LpSectionKeyword::SEMI},
|
|
176
|
+
{"semi", LpSectionKeyword::SEMI},
|
|
177
|
+
{"semis", LpSectionKeyword::SEMI},
|
|
178
|
+
{"sos", LpSectionKeyword::SOS},
|
|
179
|
+
{"end", LpSectionKeyword::END}};
|
|
180
|
+
|
|
181
|
+
enum class SosType { SOS1, SOS2 };
|
|
182
|
+
|
|
183
|
+
enum class LpComparisonType { LEQ, L, EQ, G, GEQ };
|
|
184
|
+
|
|
185
|
+
struct ProcessedToken {
|
|
186
|
+
ProcessedTokenType type;
|
|
187
|
+
union {
|
|
188
|
+
LpSectionKeyword keyword;
|
|
189
|
+
SosType sostype;
|
|
190
|
+
char* name;
|
|
191
|
+
double value;
|
|
192
|
+
LpComparisonType dir;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
ProcessedToken(const ProcessedToken&) = delete;
|
|
196
|
+
ProcessedToken(ProcessedToken&& t) : type(t.type) {
|
|
197
|
+
switch (type) {
|
|
198
|
+
case ProcessedTokenType::SECID:
|
|
199
|
+
keyword = t.keyword;
|
|
200
|
+
break;
|
|
201
|
+
case ProcessedTokenType::SOSTYPE:
|
|
202
|
+
sostype = t.sostype;
|
|
203
|
+
break;
|
|
204
|
+
case ProcessedTokenType::CONID:
|
|
205
|
+
case ProcessedTokenType::VARID:
|
|
206
|
+
name = t.name;
|
|
207
|
+
break;
|
|
208
|
+
case ProcessedTokenType::CONST:
|
|
209
|
+
value = t.value;
|
|
210
|
+
break;
|
|
211
|
+
case ProcessedTokenType::COMP:
|
|
212
|
+
dir = t.dir;
|
|
213
|
+
break;
|
|
214
|
+
default:;
|
|
215
|
+
}
|
|
216
|
+
t.type = ProcessedTokenType::NONE;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
ProcessedToken(ProcessedTokenType t) : type(t){};
|
|
220
|
+
|
|
221
|
+
ProcessedToken(LpSectionKeyword kw)
|
|
222
|
+
: type(ProcessedTokenType::SECID), keyword(kw){};
|
|
223
|
+
|
|
224
|
+
ProcessedToken(SosType sos)
|
|
225
|
+
: type(ProcessedTokenType::SOSTYPE), sostype(sos){};
|
|
226
|
+
|
|
227
|
+
ProcessedToken(ProcessedTokenType t, const std::string& s) : type(t) {
|
|
228
|
+
assert(t == ProcessedTokenType::CONID || t == ProcessedTokenType::VARID);
|
|
229
|
+
#ifndef _WIN32
|
|
230
|
+
name = strdup(s.c_str());
|
|
231
|
+
#else
|
|
232
|
+
name = _strdup(s.c_str());
|
|
233
|
+
#endif
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
ProcessedToken(double v) : type(ProcessedTokenType::CONST), value(v){};
|
|
237
|
+
|
|
238
|
+
ProcessedToken(LpComparisonType comp)
|
|
239
|
+
: type(ProcessedTokenType::COMP), dir(comp){};
|
|
240
|
+
|
|
241
|
+
~ProcessedToken() {
|
|
242
|
+
if (type == ProcessedTokenType::CONID || type == ProcessedTokenType::VARID)
|
|
243
|
+
free(name);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
// how many raw tokens to cache
|
|
248
|
+
// set to how many tokens we may need to look ahead
|
|
249
|
+
#define NRAWTOKEN 3
|
|
250
|
+
|
|
251
|
+
const double kHighsInf = std::numeric_limits<double>::infinity();
|
|
252
|
+
class Reader {
|
|
253
|
+
private:
|
|
254
|
+
#ifdef ZLIB_FOUND
|
|
255
|
+
zstr::ifstream file;
|
|
256
|
+
#else
|
|
257
|
+
std::ifstream file;
|
|
258
|
+
#endif
|
|
259
|
+
std::string linebuffer;
|
|
260
|
+
std::size_t linebufferpos;
|
|
261
|
+
std::array<RawToken, NRAWTOKEN> rawtokens;
|
|
262
|
+
std::vector<ProcessedToken> processedtokens;
|
|
263
|
+
// store for each section a pointer to its begin and end (pointer to element
|
|
264
|
+
// after last)
|
|
265
|
+
std::map<LpSectionKeyword, std::pair<std::vector<ProcessedToken>::iterator,
|
|
266
|
+
std::vector<ProcessedToken>::iterator> >
|
|
267
|
+
sectiontokens;
|
|
268
|
+
|
|
269
|
+
Builder builder;
|
|
270
|
+
|
|
271
|
+
bool readnexttoken(RawToken&);
|
|
272
|
+
void nextrawtoken(size_t howmany = 1);
|
|
273
|
+
void processtokens();
|
|
274
|
+
void splittokens();
|
|
275
|
+
void processsections();
|
|
276
|
+
void processnonesec();
|
|
277
|
+
void processobjsec();
|
|
278
|
+
void processconsec();
|
|
279
|
+
void processboundssec();
|
|
280
|
+
void processbinsec();
|
|
281
|
+
void processgensec();
|
|
282
|
+
void processsemisec();
|
|
283
|
+
void processsossec();
|
|
284
|
+
void processendsec();
|
|
285
|
+
void parseexpression(std::vector<ProcessedToken>::iterator& it,
|
|
286
|
+
std::vector<ProcessedToken>::iterator end,
|
|
287
|
+
std::shared_ptr<Expression> expr, bool isobj);
|
|
288
|
+
|
|
289
|
+
// void printRawTokens();
|
|
290
|
+
public:
|
|
291
|
+
Reader(std::string filename) {
|
|
292
|
+
#ifdef ZLIB_FOUND
|
|
293
|
+
try {
|
|
294
|
+
file.open(filename);
|
|
295
|
+
} catch (const strict_fstream::Exception& e) {
|
|
296
|
+
}
|
|
297
|
+
#else
|
|
298
|
+
file.open(filename);
|
|
299
|
+
#endif
|
|
300
|
+
lpassert(file.is_open());
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
~Reader() { file.close(); }
|
|
304
|
+
|
|
305
|
+
Model read();
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
Model readinstance(std::string filename) {
|
|
309
|
+
Reader reader(filename);
|
|
310
|
+
return reader.read();
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// convert string to lower-case, modifies string
|
|
314
|
+
static inline void tolower(std::string& s) {
|
|
315
|
+
std::transform(s.begin(), s.end(), s.begin(),
|
|
316
|
+
[](unsigned char c) { return std::tolower(c); });
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
static inline bool iskeyword(const std::string& str,
|
|
320
|
+
const std::string* keywords, const int nkeywords) {
|
|
321
|
+
for (int i = 0; i < nkeywords; i++) {
|
|
322
|
+
if (str == keywords[i]) {
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
static inline LpSectionKeyword parsesectionkeyword(const std::string& str) {
|
|
330
|
+
// look up lower case
|
|
331
|
+
auto it(sectionkeywordmap.find(str));
|
|
332
|
+
if (it != sectionkeywordmap.end()) return it->second;
|
|
333
|
+
|
|
334
|
+
return LpSectionKeyword::NONE;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
Model Reader::read() {
|
|
338
|
+
// std::clog << "Reading input, tokenizing..." << std::endl;
|
|
339
|
+
this->linebufferpos = 0;
|
|
340
|
+
// read first NRAWTOKEN token
|
|
341
|
+
// if file ends early, then all remaining tokens are set to FLEND
|
|
342
|
+
for (size_t i = 0; i < NRAWTOKEN; ++i)
|
|
343
|
+
while (!readnexttoken(rawtokens[i]))
|
|
344
|
+
;
|
|
345
|
+
|
|
346
|
+
processtokens();
|
|
347
|
+
|
|
348
|
+
linebuffer.clear();
|
|
349
|
+
linebuffer.shrink_to_fit();
|
|
350
|
+
|
|
351
|
+
// std::clog << "Splitting tokens..." << std::endl;
|
|
352
|
+
splittokens();
|
|
353
|
+
|
|
354
|
+
// std::clog << "Setting up model..." << std::endl;
|
|
355
|
+
processsections();
|
|
356
|
+
processedtokens.clear();
|
|
357
|
+
processedtokens.shrink_to_fit();
|
|
358
|
+
|
|
359
|
+
return builder.model;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
void Reader::processnonesec() {
|
|
363
|
+
lpassert(sectiontokens.count(LpSectionKeyword::NONE) == 0);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
void Reader::parseexpression(std::vector<ProcessedToken>::iterator& it,
|
|
367
|
+
std::vector<ProcessedToken>::iterator end,
|
|
368
|
+
std::shared_ptr<Expression> expr, bool isobj) {
|
|
369
|
+
if (it != end && it->type == ProcessedTokenType::CONID) {
|
|
370
|
+
expr->name = it->name;
|
|
371
|
+
++it;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
while (it != end) {
|
|
375
|
+
std::vector<ProcessedToken>::iterator next = it;
|
|
376
|
+
++next;
|
|
377
|
+
// const var
|
|
378
|
+
if (next != end && it->type == ProcessedTokenType::CONST &&
|
|
379
|
+
next->type == ProcessedTokenType::VARID) {
|
|
380
|
+
std::string name = next->name;
|
|
381
|
+
|
|
382
|
+
std::shared_ptr<LinTerm> linterm =
|
|
383
|
+
std::shared_ptr<LinTerm>(new LinTerm());
|
|
384
|
+
linterm->coef = it->value;
|
|
385
|
+
linterm->var = builder.getvarbyname(name);
|
|
386
|
+
expr->linterms.push_back(linterm);
|
|
387
|
+
|
|
388
|
+
++it;
|
|
389
|
+
++it;
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// const
|
|
394
|
+
if (it->type == ProcessedTokenType::CONST) {
|
|
395
|
+
expr->offset += it->value;
|
|
396
|
+
++it;
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// var
|
|
401
|
+
if (it->type == ProcessedTokenType::VARID) {
|
|
402
|
+
std::string name = it->name;
|
|
403
|
+
|
|
404
|
+
std::shared_ptr<LinTerm> linterm =
|
|
405
|
+
std::shared_ptr<LinTerm>(new LinTerm());
|
|
406
|
+
linterm->coef = 1.0;
|
|
407
|
+
linterm->var = builder.getvarbyname(name);
|
|
408
|
+
expr->linterms.push_back(linterm);
|
|
409
|
+
|
|
410
|
+
++it;
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// quadratic expression
|
|
415
|
+
if (next != end && it->type == ProcessedTokenType::BRKOP) {
|
|
416
|
+
++it;
|
|
417
|
+
while (it != end && it->type != ProcessedTokenType::BRKCL) {
|
|
418
|
+
// const var hat const
|
|
419
|
+
std::vector<ProcessedToken>::iterator next1 = it; // token after it
|
|
420
|
+
std::vector<ProcessedToken>::iterator next2 = it; // token 2nd-after it
|
|
421
|
+
std::vector<ProcessedToken>::iterator next3 = it; // token 3rd-after it
|
|
422
|
+
++next1;
|
|
423
|
+
++next2;
|
|
424
|
+
++next3;
|
|
425
|
+
if (next1 != end) {
|
|
426
|
+
++next2;
|
|
427
|
+
++next3;
|
|
428
|
+
}
|
|
429
|
+
if (next2 != end) ++next3;
|
|
430
|
+
|
|
431
|
+
if (next3 != end && it->type == ProcessedTokenType::CONST &&
|
|
432
|
+
next1->type == ProcessedTokenType::VARID &&
|
|
433
|
+
next2->type == ProcessedTokenType::HAT &&
|
|
434
|
+
next3->type == ProcessedTokenType::CONST) {
|
|
435
|
+
std::string name = next1->name;
|
|
436
|
+
|
|
437
|
+
lpassert(next3->value == 2.0);
|
|
438
|
+
|
|
439
|
+
std::shared_ptr<QuadTerm> quadterm =
|
|
440
|
+
std::shared_ptr<QuadTerm>(new QuadTerm());
|
|
441
|
+
quadterm->coef = it->value;
|
|
442
|
+
quadterm->var1 = builder.getvarbyname(name);
|
|
443
|
+
quadterm->var2 = builder.getvarbyname(name);
|
|
444
|
+
expr->quadterms.push_back(quadterm);
|
|
445
|
+
|
|
446
|
+
it = ++next3;
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// var hat const
|
|
451
|
+
if (next2 != end && it->type == ProcessedTokenType::VARID &&
|
|
452
|
+
next1->type == ProcessedTokenType::HAT &&
|
|
453
|
+
next2->type == ProcessedTokenType::CONST) {
|
|
454
|
+
std::string name = it->name;
|
|
455
|
+
|
|
456
|
+
lpassert(next2->value == 2.0);
|
|
457
|
+
|
|
458
|
+
std::shared_ptr<QuadTerm> quadterm =
|
|
459
|
+
std::shared_ptr<QuadTerm>(new QuadTerm());
|
|
460
|
+
quadterm->coef = 1.0;
|
|
461
|
+
quadterm->var1 = builder.getvarbyname(name);
|
|
462
|
+
quadterm->var2 = builder.getvarbyname(name);
|
|
463
|
+
expr->quadterms.push_back(quadterm);
|
|
464
|
+
|
|
465
|
+
it = next3;
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// const var asterisk var
|
|
470
|
+
if (next3 != end && it->type == ProcessedTokenType::CONST &&
|
|
471
|
+
next1->type == ProcessedTokenType::VARID &&
|
|
472
|
+
next2->type == ProcessedTokenType::ASTERISK &&
|
|
473
|
+
next3->type == ProcessedTokenType::VARID) {
|
|
474
|
+
std::string name1 = next1->name;
|
|
475
|
+
std::string name2 = next3->name;
|
|
476
|
+
|
|
477
|
+
std::shared_ptr<QuadTerm> quadterm =
|
|
478
|
+
std::shared_ptr<QuadTerm>(new QuadTerm());
|
|
479
|
+
quadterm->coef = it->value;
|
|
480
|
+
quadterm->var1 = builder.getvarbyname(name1);
|
|
481
|
+
quadterm->var2 = builder.getvarbyname(name2);
|
|
482
|
+
expr->quadterms.push_back(quadterm);
|
|
483
|
+
|
|
484
|
+
it = ++next3;
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// var asterisk var
|
|
489
|
+
if (next2 != end && it->type == ProcessedTokenType::VARID &&
|
|
490
|
+
next1->type == ProcessedTokenType::ASTERISK &&
|
|
491
|
+
next2->type == ProcessedTokenType::VARID) {
|
|
492
|
+
std::string name1 = it->name;
|
|
493
|
+
std::string name2 = next2->name;
|
|
494
|
+
|
|
495
|
+
std::shared_ptr<QuadTerm> quadterm =
|
|
496
|
+
std::shared_ptr<QuadTerm>(new QuadTerm());
|
|
497
|
+
quadterm->coef = 1.0;
|
|
498
|
+
quadterm->var1 = builder.getvarbyname(name1);
|
|
499
|
+
quadterm->var2 = builder.getvarbyname(name2);
|
|
500
|
+
expr->quadterms.push_back(quadterm);
|
|
501
|
+
|
|
502
|
+
it = next3;
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
507
|
+
if (isobj) {
|
|
508
|
+
// only in the objective function, a quadratic term is followed by
|
|
509
|
+
// "/2.0"
|
|
510
|
+
std::vector<ProcessedToken>::iterator next1 = it; // token after it
|
|
511
|
+
std::vector<ProcessedToken>::iterator next2 = it; // token 2nd-after it
|
|
512
|
+
++next1;
|
|
513
|
+
++next2;
|
|
514
|
+
if (next1 != end) ++next2;
|
|
515
|
+
|
|
516
|
+
lpassert(next2 != end);
|
|
517
|
+
lpassert(it->type == ProcessedTokenType::BRKCL);
|
|
518
|
+
lpassert(next1->type == ProcessedTokenType::SLASH);
|
|
519
|
+
lpassert(next2->type == ProcessedTokenType::CONST);
|
|
520
|
+
lpassert(next2->value == 2.0);
|
|
521
|
+
it = ++next2;
|
|
522
|
+
} else {
|
|
523
|
+
lpassert(it != end);
|
|
524
|
+
lpassert(it->type == ProcessedTokenType::BRKCL);
|
|
525
|
+
++it;
|
|
526
|
+
}
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
break;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
void Reader::processobjsec() {
|
|
535
|
+
builder.model.objective = std::shared_ptr<Expression>(new Expression);
|
|
536
|
+
if (sectiontokens.count(LpSectionKeyword::OBJMIN)) {
|
|
537
|
+
builder.model.sense = ObjectiveSense::MIN;
|
|
538
|
+
parseexpression(sectiontokens[LpSectionKeyword::OBJMIN].first,
|
|
539
|
+
sectiontokens[LpSectionKeyword::OBJMIN].second,
|
|
540
|
+
builder.model.objective, true);
|
|
541
|
+
lpassert(sectiontokens[LpSectionKeyword::OBJMIN].first ==
|
|
542
|
+
sectiontokens[LpSectionKeyword::OBJMIN]
|
|
543
|
+
.second); // all section tokens should have been processed
|
|
544
|
+
} else if (sectiontokens.count(LpSectionKeyword::OBJMAX)) {
|
|
545
|
+
builder.model.sense = ObjectiveSense::MAX;
|
|
546
|
+
parseexpression(sectiontokens[LpSectionKeyword::OBJMAX].first,
|
|
547
|
+
sectiontokens[LpSectionKeyword::OBJMAX].second,
|
|
548
|
+
builder.model.objective, true);
|
|
549
|
+
lpassert(sectiontokens[LpSectionKeyword::OBJMAX].first ==
|
|
550
|
+
sectiontokens[LpSectionKeyword::OBJMAX]
|
|
551
|
+
.second); // all section tokens should have been processed
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
void Reader::processconsec() {
|
|
556
|
+
if (!sectiontokens.count(LpSectionKeyword::CON)) return;
|
|
557
|
+
std::vector<ProcessedToken>::iterator& begin(
|
|
558
|
+
sectiontokens[LpSectionKeyword::CON].first);
|
|
559
|
+
std::vector<ProcessedToken>::iterator& end(
|
|
560
|
+
sectiontokens[LpSectionKeyword::CON].second);
|
|
561
|
+
while (begin != end) {
|
|
562
|
+
std::shared_ptr<Constraint> con =
|
|
563
|
+
std::shared_ptr<Constraint>(new Constraint);
|
|
564
|
+
parseexpression(begin, end, con->expr, false);
|
|
565
|
+
// should not be at end of section yet, but a comparison operator should be
|
|
566
|
+
// next
|
|
567
|
+
lpassert(begin != sectiontokens[LpSectionKeyword::CON].second);
|
|
568
|
+
lpassert(begin->type == ProcessedTokenType::COMP);
|
|
569
|
+
LpComparisonType dir = begin->dir;
|
|
570
|
+
++begin;
|
|
571
|
+
|
|
572
|
+
// should still not be at end of section yet, but a right-hand-side value
|
|
573
|
+
// should be next
|
|
574
|
+
lpassert(begin != sectiontokens[LpSectionKeyword::CON].second);
|
|
575
|
+
lpassert(begin->type == ProcessedTokenType::CONST);
|
|
576
|
+
switch (dir) {
|
|
577
|
+
case LpComparisonType::EQ:
|
|
578
|
+
con->lowerbound = con->upperbound = begin->value;
|
|
579
|
+
break;
|
|
580
|
+
case LpComparisonType::LEQ:
|
|
581
|
+
con->upperbound = begin->value;
|
|
582
|
+
break;
|
|
583
|
+
case LpComparisonType::GEQ:
|
|
584
|
+
con->lowerbound = begin->value;
|
|
585
|
+
break;
|
|
586
|
+
default:
|
|
587
|
+
lpassert(false);
|
|
588
|
+
}
|
|
589
|
+
builder.model.constraints.push_back(con);
|
|
590
|
+
++begin;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
void Reader::processboundssec() {
|
|
595
|
+
if (!sectiontokens.count(LpSectionKeyword::BOUNDS)) return;
|
|
596
|
+
std::vector<ProcessedToken>::iterator& begin(
|
|
597
|
+
sectiontokens[LpSectionKeyword::BOUNDS].first);
|
|
598
|
+
std::vector<ProcessedToken>::iterator& end(
|
|
599
|
+
sectiontokens[LpSectionKeyword::BOUNDS].second);
|
|
600
|
+
while (begin != end) {
|
|
601
|
+
std::vector<ProcessedToken>::iterator next1 = begin; // token after begin
|
|
602
|
+
++next1;
|
|
603
|
+
|
|
604
|
+
// VAR free
|
|
605
|
+
if (next1 != end && begin->type == ProcessedTokenType::VARID &&
|
|
606
|
+
next1->type == ProcessedTokenType::FREE) {
|
|
607
|
+
std::string name = begin->name;
|
|
608
|
+
std::shared_ptr<Variable> var = builder.getvarbyname(name);
|
|
609
|
+
var->lowerbound = -kHighsInf;
|
|
610
|
+
var->upperbound = kHighsInf;
|
|
611
|
+
begin = ++next1;
|
|
612
|
+
continue;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
std::vector<ProcessedToken>::iterator next2 =
|
|
616
|
+
next1; // token 2nd-after begin
|
|
617
|
+
std::vector<ProcessedToken>::iterator next3 =
|
|
618
|
+
next1; // token 3rd-after begin
|
|
619
|
+
std::vector<ProcessedToken>::iterator next4 =
|
|
620
|
+
next1; // token 4th-after begin
|
|
621
|
+
if (next1 != end) {
|
|
622
|
+
++next2;
|
|
623
|
+
++next3;
|
|
624
|
+
++next4;
|
|
625
|
+
}
|
|
626
|
+
if (next2 != end) {
|
|
627
|
+
++next3;
|
|
628
|
+
++next4;
|
|
629
|
+
}
|
|
630
|
+
if (next3 != end) ++next4;
|
|
631
|
+
|
|
632
|
+
// CONST COMP VAR COMP CONST
|
|
633
|
+
if (next4 != end && begin->type == ProcessedTokenType::CONST &&
|
|
634
|
+
next1->type == ProcessedTokenType::COMP &&
|
|
635
|
+
next2->type == ProcessedTokenType::VARID &&
|
|
636
|
+
next3->type == ProcessedTokenType::COMP &&
|
|
637
|
+
next4->type == ProcessedTokenType::CONST) {
|
|
638
|
+
lpassert(next1->dir == LpComparisonType::LEQ);
|
|
639
|
+
lpassert(next3->dir == LpComparisonType::LEQ);
|
|
640
|
+
|
|
641
|
+
double lb = begin->value;
|
|
642
|
+
double ub = next4->value;
|
|
643
|
+
|
|
644
|
+
std::string name = next2->name;
|
|
645
|
+
std::shared_ptr<Variable> var = builder.getvarbyname(name);
|
|
646
|
+
|
|
647
|
+
var->lowerbound = lb;
|
|
648
|
+
var->upperbound = ub;
|
|
649
|
+
|
|
650
|
+
begin = ++next4;
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// CONST COMP VAR
|
|
655
|
+
if (next2 != end && begin->type == ProcessedTokenType::CONST &&
|
|
656
|
+
next1->type == ProcessedTokenType::COMP &&
|
|
657
|
+
next2->type == ProcessedTokenType::VARID) {
|
|
658
|
+
double value = begin->value;
|
|
659
|
+
std::string name = next2->name;
|
|
660
|
+
std::shared_ptr<Variable> var = builder.getvarbyname(name);
|
|
661
|
+
LpComparisonType dir = next1->dir;
|
|
662
|
+
|
|
663
|
+
lpassert(dir != LpComparisonType::L && dir != LpComparisonType::G);
|
|
664
|
+
|
|
665
|
+
switch (dir) {
|
|
666
|
+
case LpComparisonType::LEQ:
|
|
667
|
+
var->lowerbound = value;
|
|
668
|
+
break;
|
|
669
|
+
case LpComparisonType::GEQ:
|
|
670
|
+
var->upperbound = value;
|
|
671
|
+
break;
|
|
672
|
+
case LpComparisonType::EQ:
|
|
673
|
+
var->lowerbound = var->upperbound = value;
|
|
674
|
+
break;
|
|
675
|
+
default:
|
|
676
|
+
lpassert(false);
|
|
677
|
+
}
|
|
678
|
+
begin = next3;
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
// VAR COMP CONST
|
|
683
|
+
if (next2 != end && begin->type == ProcessedTokenType::VARID &&
|
|
684
|
+
next1->type == ProcessedTokenType::COMP &&
|
|
685
|
+
next2->type == ProcessedTokenType::CONST) {
|
|
686
|
+
double value = next2->value;
|
|
687
|
+
std::string name = begin->name;
|
|
688
|
+
std::shared_ptr<Variable> var = builder.getvarbyname(name);
|
|
689
|
+
LpComparisonType dir = next1->dir;
|
|
690
|
+
|
|
691
|
+
lpassert(dir != LpComparisonType::L && dir != LpComparisonType::G);
|
|
692
|
+
|
|
693
|
+
switch (dir) {
|
|
694
|
+
case LpComparisonType::LEQ:
|
|
695
|
+
var->upperbound = value;
|
|
696
|
+
break;
|
|
697
|
+
case LpComparisonType::GEQ:
|
|
698
|
+
var->lowerbound = value;
|
|
699
|
+
break;
|
|
700
|
+
case LpComparisonType::EQ:
|
|
701
|
+
var->lowerbound = var->upperbound = value;
|
|
702
|
+
break;
|
|
703
|
+
default:
|
|
704
|
+
lpassert(false);
|
|
705
|
+
}
|
|
706
|
+
begin = next3;
|
|
707
|
+
continue;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
lpassert(false);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
void Reader::processbinsec() {
|
|
715
|
+
const LpSectionKeyword this_section_keyword = LpSectionKeyword::BIN;
|
|
716
|
+
if (!sectiontokens.count(this_section_keyword)) return;
|
|
717
|
+
std::vector<ProcessedToken>::iterator& begin(
|
|
718
|
+
sectiontokens[this_section_keyword].first);
|
|
719
|
+
std::vector<ProcessedToken>::iterator& end(
|
|
720
|
+
sectiontokens[this_section_keyword].second);
|
|
721
|
+
for (; begin != end; ++begin) {
|
|
722
|
+
if (begin->type == ProcessedTokenType::SECID) {
|
|
723
|
+
// Possible to have repeat of keyword for this section type
|
|
724
|
+
lpassert(begin->keyword == this_section_keyword);
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
lpassert(begin->type == ProcessedTokenType::VARID);
|
|
728
|
+
std::string name = begin->name;
|
|
729
|
+
std::shared_ptr<Variable> var = builder.getvarbyname(name);
|
|
730
|
+
var->type = VariableType::BINARY;
|
|
731
|
+
// Respect any bounds already declared
|
|
732
|
+
if (var->upperbound == kHighsInf) var->upperbound = 1.0;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
void Reader::processgensec() {
|
|
737
|
+
const LpSectionKeyword this_section_keyword = LpSectionKeyword::GEN;
|
|
738
|
+
if (!sectiontokens.count(this_section_keyword)) return;
|
|
739
|
+
std::vector<ProcessedToken>::iterator& begin(
|
|
740
|
+
sectiontokens[this_section_keyword].first);
|
|
741
|
+
std::vector<ProcessedToken>::iterator& end(
|
|
742
|
+
sectiontokens[this_section_keyword].second);
|
|
743
|
+
for (; begin != end; ++begin) {
|
|
744
|
+
if (begin->type == ProcessedTokenType::SECID) {
|
|
745
|
+
// Possible to have repeat of keyword for this section type
|
|
746
|
+
lpassert(begin->keyword == this_section_keyword);
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
lpassert(begin->type == ProcessedTokenType::VARID);
|
|
750
|
+
std::string name = begin->name;
|
|
751
|
+
std::shared_ptr<Variable> var = builder.getvarbyname(name);
|
|
752
|
+
if (var->type == VariableType::SEMICONTINUOUS) {
|
|
753
|
+
var->type = VariableType::SEMIINTEGER;
|
|
754
|
+
} else {
|
|
755
|
+
var->type = VariableType::GENERAL;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
void Reader::processsemisec() {
|
|
761
|
+
const LpSectionKeyword this_section_keyword = LpSectionKeyword::SEMI;
|
|
762
|
+
if (!sectiontokens.count(this_section_keyword)) return;
|
|
763
|
+
std::vector<ProcessedToken>::iterator& begin(
|
|
764
|
+
sectiontokens[this_section_keyword].first);
|
|
765
|
+
std::vector<ProcessedToken>::iterator& end(
|
|
766
|
+
sectiontokens[this_section_keyword].second);
|
|
767
|
+
for (; begin != end; ++begin) {
|
|
768
|
+
if (begin->type == ProcessedTokenType::SECID) {
|
|
769
|
+
// Possible to have repeat of keyword for this section type
|
|
770
|
+
lpassert(begin->keyword == this_section_keyword);
|
|
771
|
+
continue;
|
|
772
|
+
}
|
|
773
|
+
lpassert(begin->type == ProcessedTokenType::VARID);
|
|
774
|
+
std::string name = begin->name;
|
|
775
|
+
std::shared_ptr<Variable> var = builder.getvarbyname(name);
|
|
776
|
+
if (var->type == VariableType::GENERAL) {
|
|
777
|
+
var->type = VariableType::SEMIINTEGER;
|
|
778
|
+
} else {
|
|
779
|
+
var->type = VariableType::SEMICONTINUOUS;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
void Reader::processsossec() {
|
|
785
|
+
const LpSectionKeyword this_section_keyword = LpSectionKeyword::SOS;
|
|
786
|
+
if (!sectiontokens.count(this_section_keyword)) return;
|
|
787
|
+
std::vector<ProcessedToken>::iterator& begin(
|
|
788
|
+
sectiontokens[this_section_keyword].first);
|
|
789
|
+
std::vector<ProcessedToken>::iterator& end(
|
|
790
|
+
sectiontokens[this_section_keyword].second);
|
|
791
|
+
while (begin != end) {
|
|
792
|
+
std::shared_ptr<SOS> sos = std::shared_ptr<SOS>(new SOS);
|
|
793
|
+
|
|
794
|
+
// sos1: S1 :: x1 : 1 x2 : 2 x3 : 3
|
|
795
|
+
|
|
796
|
+
// name of SOS is mandatory
|
|
797
|
+
lpassert(begin->type == ProcessedTokenType::CONID);
|
|
798
|
+
sos->name = begin->name;
|
|
799
|
+
++begin;
|
|
800
|
+
|
|
801
|
+
// SOS type
|
|
802
|
+
lpassert(begin != end);
|
|
803
|
+
lpassert(begin->type == ProcessedTokenType::SOSTYPE);
|
|
804
|
+
sos->type = begin->sostype == SosType::SOS1 ? 1 : 2;
|
|
805
|
+
++begin;
|
|
806
|
+
|
|
807
|
+
while (begin != end) {
|
|
808
|
+
// process all "var : weight" entries
|
|
809
|
+
// when processtokens() sees a string followed by a colon, it classifies
|
|
810
|
+
// this as a CONID but in a SOS section, this is actually a variable
|
|
811
|
+
// identifier
|
|
812
|
+
if (begin->type != ProcessedTokenType::CONID) break;
|
|
813
|
+
std::string name = begin->name;
|
|
814
|
+
std::vector<ProcessedToken>::iterator next = begin;
|
|
815
|
+
++next;
|
|
816
|
+
if (next != end && next->type == ProcessedTokenType::CONST) {
|
|
817
|
+
auto var = builder.getvarbyname(name);
|
|
818
|
+
double weight = next->value;
|
|
819
|
+
|
|
820
|
+
sos->entries.push_back({var, weight});
|
|
821
|
+
|
|
822
|
+
begin = ++next;
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
break;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
builder.model.soss.push_back(sos);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
void Reader::processendsec() {
|
|
834
|
+
lpassert(sectiontokens.count(LpSectionKeyword::END) == 0);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
void Reader::processsections() {
|
|
838
|
+
processnonesec();
|
|
839
|
+
processobjsec();
|
|
840
|
+
processconsec();
|
|
841
|
+
processboundssec();
|
|
842
|
+
processgensec();
|
|
843
|
+
processbinsec();
|
|
844
|
+
processsemisec();
|
|
845
|
+
processsossec();
|
|
846
|
+
processendsec();
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
void Reader::splittokens() {
|
|
850
|
+
LpSectionKeyword currentsection = LpSectionKeyword::NONE;
|
|
851
|
+
|
|
852
|
+
bool debug_open_section = false;
|
|
853
|
+
for (std::vector<ProcessedToken>::iterator it(processedtokens.begin());
|
|
854
|
+
it != processedtokens.end(); ++it) {
|
|
855
|
+
// Look for section keywords
|
|
856
|
+
if (it->type != ProcessedTokenType::SECID) continue;
|
|
857
|
+
// currentsection is initially LpSectionKeyword::NONE, so the
|
|
858
|
+
// first section ID will be a new section type
|
|
859
|
+
//
|
|
860
|
+
// Only record change of section and check for repeated
|
|
861
|
+
// section if the keyword is for a different section. Allows
|
|
862
|
+
// repetition of Integers and General (cf #1299) for example
|
|
863
|
+
const bool new_section_type = currentsection != it->keyword;
|
|
864
|
+
if (new_section_type) {
|
|
865
|
+
if (currentsection != LpSectionKeyword::NONE) {
|
|
866
|
+
// Current section is non-trivial, so mark its end, using the
|
|
867
|
+
// value of currentsection to indicate that there is no open
|
|
868
|
+
// section
|
|
869
|
+
lpassert(debug_open_section);
|
|
870
|
+
sectiontokens[currentsection].second = it;
|
|
871
|
+
debug_open_section = false;
|
|
872
|
+
currentsection = LpSectionKeyword::NONE;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
std::vector<ProcessedToken>::iterator next = it;
|
|
876
|
+
++next;
|
|
877
|
+
if (next == processedtokens.end() ||
|
|
878
|
+
next->type == ProcessedTokenType::SECID) {
|
|
879
|
+
// Reached the end of the tokens or the new section is empty
|
|
880
|
+
//
|
|
881
|
+
// currentsection will be LpSectionKeyword::NONE unless the
|
|
882
|
+
// second of two sections of the same type is empty and the
|
|
883
|
+
// next section is of a new type, in which case mark the end of
|
|
884
|
+
// the current section
|
|
885
|
+
if (currentsection != LpSectionKeyword::NONE &&
|
|
886
|
+
currentsection != next->keyword) {
|
|
887
|
+
lpassert(debug_open_section);
|
|
888
|
+
sectiontokens[currentsection].second = it;
|
|
889
|
+
debug_open_section = false;
|
|
890
|
+
}
|
|
891
|
+
currentsection = LpSectionKeyword::NONE;
|
|
892
|
+
lpassert(!debug_open_section);
|
|
893
|
+
continue;
|
|
894
|
+
}
|
|
895
|
+
// Next section is non-empty
|
|
896
|
+
if (new_section_type) {
|
|
897
|
+
// Section type change
|
|
898
|
+
currentsection = it->keyword;
|
|
899
|
+
// Make sure the new section type has not occurred previously
|
|
900
|
+
lpassert(sectiontokens.count(currentsection) == 0);
|
|
901
|
+
// Remember the beginning of the new section: its the token
|
|
902
|
+
// following the current one
|
|
903
|
+
lpassert(!debug_open_section);
|
|
904
|
+
sectiontokens[currentsection].first = next;
|
|
905
|
+
debug_open_section = true;
|
|
906
|
+
}
|
|
907
|
+
// Always ends with either an open section or a section type of
|
|
908
|
+
// LpSectionKeyword::NONE
|
|
909
|
+
lpassert(debug_open_section != (currentsection == LpSectionKeyword::NONE));
|
|
910
|
+
}
|
|
911
|
+
// Check that the last section has been closed
|
|
912
|
+
lpassert(currentsection == LpSectionKeyword::NONE);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
void Reader::processtokens() {
|
|
916
|
+
std::string svalue_lc;
|
|
917
|
+
while (!rawtokens[0].istype(RawTokenType::FLEND)) {
|
|
918
|
+
if (rawtokens[0].type == RawTokenType::STR) {
|
|
919
|
+
if (parsesectionkeyword(rawtokens[0].svalue) != LpSectionKeyword::NONE) {
|
|
920
|
+
// Found an LP section keyword so check it's not a constraint name!
|
|
921
|
+
if (rawtokens[1].type == RawTokenType::COLON)
|
|
922
|
+
rawtokens[0].type = RawTokenType::CONS;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
// Slash + asterisk: comment, skip everything up to next asterisk + slash
|
|
926
|
+
if (rawtokens[0].istype(RawTokenType::SLASH) &&
|
|
927
|
+
rawtokens[1].istype(RawTokenType::ASTERISK)) {
|
|
928
|
+
do {
|
|
929
|
+
nextrawtoken(2);
|
|
930
|
+
} while (!(rawtokens[0].istype(RawTokenType::ASTERISK) &&
|
|
931
|
+
rawtokens[1].istype(RawTokenType::SLASH)) &&
|
|
932
|
+
!rawtokens[0].istype(RawTokenType::FLEND));
|
|
933
|
+
nextrawtoken(2);
|
|
934
|
+
continue;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
if (rawtokens[0].istype(RawTokenType::STR)) {
|
|
938
|
+
svalue_lc = rawtokens[0].svalue;
|
|
939
|
+
tolower(svalue_lc);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// long section keyword semi-continuous
|
|
943
|
+
if (rawtokens[0].istype(RawTokenType::STR) &&
|
|
944
|
+
rawtokens[1].istype(RawTokenType::MINUS) &&
|
|
945
|
+
rawtokens[2].istype(RawTokenType::STR)) {
|
|
946
|
+
std::string temp = rawtokens[2].svalue;
|
|
947
|
+
tolower(temp);
|
|
948
|
+
LpSectionKeyword keyword = parsesectionkeyword(svalue_lc + "-" + temp);
|
|
949
|
+
if (keyword != LpSectionKeyword::NONE) {
|
|
950
|
+
processedtokens.emplace_back(keyword);
|
|
951
|
+
nextrawtoken(3);
|
|
952
|
+
continue;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
// long section keyword subject to/such that
|
|
957
|
+
if (rawtokens[0].istype(RawTokenType::STR) &&
|
|
958
|
+
rawtokens[1].istype(RawTokenType::STR)) {
|
|
959
|
+
std::string temp = rawtokens[1].svalue;
|
|
960
|
+
tolower(temp);
|
|
961
|
+
LpSectionKeyword keyword = parsesectionkeyword(svalue_lc + " " + temp);
|
|
962
|
+
if (keyword != LpSectionKeyword::NONE) {
|
|
963
|
+
processedtokens.emplace_back(keyword);
|
|
964
|
+
nextrawtoken(2);
|
|
965
|
+
continue;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
// other section keyword
|
|
970
|
+
if (rawtokens[0].istype(RawTokenType::STR)) {
|
|
971
|
+
LpSectionKeyword keyword = parsesectionkeyword(svalue_lc);
|
|
972
|
+
if (keyword != LpSectionKeyword::NONE) {
|
|
973
|
+
processedtokens.emplace_back(keyword);
|
|
974
|
+
nextrawtoken();
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// sos type identifier? "S1 ::" or "S2 ::"
|
|
980
|
+
if (rawtokens[0].istype(RawTokenType::STR) &&
|
|
981
|
+
rawtokens[1].istype(RawTokenType::COLON) &&
|
|
982
|
+
rawtokens[2].istype(RawTokenType::COLON)) {
|
|
983
|
+
lpassert(rawtokens[0].svalue.length() == 2);
|
|
984
|
+
lpassert(rawtokens[0].svalue[0] == 'S' || rawtokens[0].svalue[0] == 's');
|
|
985
|
+
lpassert(rawtokens[0].svalue[1] == '1' || rawtokens[0].svalue[1] == '2');
|
|
986
|
+
processedtokens.emplace_back(
|
|
987
|
+
rawtokens[0].svalue[1] == '1' ? SosType::SOS1 : SosType::SOS2);
|
|
988
|
+
nextrawtoken(3);
|
|
989
|
+
continue;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
// constraint identifier?
|
|
993
|
+
if (rawtokens[0].istype(RawTokenType::STR) &&
|
|
994
|
+
rawtokens[1].istype(RawTokenType::COLON)) {
|
|
995
|
+
processedtokens.emplace_back(ProcessedTokenType::CONID,
|
|
996
|
+
rawtokens[0].svalue);
|
|
997
|
+
nextrawtoken(2);
|
|
998
|
+
continue;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// constraint identifier - with numeric constant value as name?
|
|
1002
|
+
if (rawtokens[0].istype(RawTokenType::CONS) &&
|
|
1003
|
+
rawtokens[1].istype(RawTokenType::COLON)) {
|
|
1004
|
+
processedtokens.emplace_back(ProcessedTokenType::CONID,
|
|
1005
|
+
rawtokens[0].svalue);
|
|
1006
|
+
nextrawtoken(2);
|
|
1007
|
+
continue;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
// check if free
|
|
1011
|
+
if (rawtokens[0].istype(RawTokenType::STR) &&
|
|
1012
|
+
iskeyword(svalue_lc, LP_KEYWORD_FREE, LP_KEYWORD_FREE_N)) {
|
|
1013
|
+
processedtokens.emplace_back(ProcessedTokenType::FREE);
|
|
1014
|
+
nextrawtoken();
|
|
1015
|
+
continue;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
// check if infinity
|
|
1019
|
+
if (rawtokens[0].istype(RawTokenType::STR) &&
|
|
1020
|
+
iskeyword(svalue_lc, LP_KEYWORD_INF, LP_KEYWORD_INF_N)) {
|
|
1021
|
+
processedtokens.emplace_back(kHighsInf);
|
|
1022
|
+
nextrawtoken();
|
|
1023
|
+
continue;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
// assume var identifier
|
|
1027
|
+
if (rawtokens[0].istype(RawTokenType::STR)) {
|
|
1028
|
+
processedtokens.emplace_back(ProcessedTokenType::VARID,
|
|
1029
|
+
rawtokens[0].svalue);
|
|
1030
|
+
nextrawtoken();
|
|
1031
|
+
continue;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
// + or -
|
|
1035
|
+
if (rawtokens[0].istype(RawTokenType::PLUS) ||
|
|
1036
|
+
rawtokens[0].istype(RawTokenType::MINUS)) {
|
|
1037
|
+
double sign = rawtokens[0].istype(RawTokenType::PLUS) ? 1.0 : -1.0;
|
|
1038
|
+
nextrawtoken();
|
|
1039
|
+
|
|
1040
|
+
// another + or - for #948, #950
|
|
1041
|
+
if (rawtokens[0].istype(RawTokenType::PLUS) ||
|
|
1042
|
+
rawtokens[0].istype(RawTokenType::MINUS)) {
|
|
1043
|
+
sign *= rawtokens[0].istype(RawTokenType::PLUS) ? 1.0 : -1.0;
|
|
1044
|
+
nextrawtoken();
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
// +/- Constant
|
|
1048
|
+
if (rawtokens[0].istype(RawTokenType::CONS)) {
|
|
1049
|
+
processedtokens.emplace_back(sign * rawtokens[0].dvalue);
|
|
1050
|
+
nextrawtoken();
|
|
1051
|
+
continue;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
// + [, + + [, - - [
|
|
1055
|
+
if (rawtokens[0].istype(RawTokenType::BRKOP) && sign == 1.0) {
|
|
1056
|
+
processedtokens.emplace_back(ProcessedTokenType::BRKOP);
|
|
1057
|
+
nextrawtoken();
|
|
1058
|
+
continue;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
// - [, + - [, - + [
|
|
1062
|
+
if (rawtokens[0].istype(RawTokenType::BRKOP)) lpassert(false);
|
|
1063
|
+
|
|
1064
|
+
// +/- variable name
|
|
1065
|
+
if (rawtokens[0].istype(RawTokenType::STR)) {
|
|
1066
|
+
processedtokens.emplace_back(sign);
|
|
1067
|
+
continue;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
// +/- (possibly twice) followed by something that isn't a constant,
|
|
1071
|
+
// opening bracket, or string (variable name)
|
|
1072
|
+
if (rawtokens[0].istype(RawTokenType::GREATER)) {
|
|
1073
|
+
// ">" suggests that the file contains indicator constraints
|
|
1074
|
+
printf(
|
|
1075
|
+
"File appears to contain indicator constraints: cannot currently "
|
|
1076
|
+
"be handled by HiGHS\n");
|
|
1077
|
+
}
|
|
1078
|
+
lpassert(false);
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
// constant [
|
|
1082
|
+
if (rawtokens[0].istype(RawTokenType::CONS) &&
|
|
1083
|
+
rawtokens[1].istype(RawTokenType::BRKOP)) {
|
|
1084
|
+
lpassert(false);
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// constant
|
|
1088
|
+
if (rawtokens[0].istype(RawTokenType::CONS)) {
|
|
1089
|
+
processedtokens.emplace_back(rawtokens[0].dvalue);
|
|
1090
|
+
nextrawtoken();
|
|
1091
|
+
continue;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// [
|
|
1095
|
+
if (rawtokens[0].istype(RawTokenType::BRKOP)) {
|
|
1096
|
+
processedtokens.emplace_back(ProcessedTokenType::BRKOP);
|
|
1097
|
+
nextrawtoken();
|
|
1098
|
+
continue;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
// ]
|
|
1102
|
+
if (rawtokens[0].istype(RawTokenType::BRKCL)) {
|
|
1103
|
+
processedtokens.emplace_back(ProcessedTokenType::BRKCL);
|
|
1104
|
+
nextrawtoken();
|
|
1105
|
+
continue;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
// /
|
|
1109
|
+
if (rawtokens[0].istype(RawTokenType::SLASH)) {
|
|
1110
|
+
processedtokens.emplace_back(ProcessedTokenType::SLASH);
|
|
1111
|
+
nextrawtoken();
|
|
1112
|
+
continue;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
// *
|
|
1116
|
+
if (rawtokens[0].istype(RawTokenType::ASTERISK)) {
|
|
1117
|
+
processedtokens.emplace_back(ProcessedTokenType::ASTERISK);
|
|
1118
|
+
nextrawtoken();
|
|
1119
|
+
continue;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
// ^
|
|
1123
|
+
if (rawtokens[0].istype(RawTokenType::HAT)) {
|
|
1124
|
+
processedtokens.emplace_back(ProcessedTokenType::HAT);
|
|
1125
|
+
nextrawtoken();
|
|
1126
|
+
continue;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
// <=
|
|
1130
|
+
if (rawtokens[0].istype(RawTokenType::LESS) &&
|
|
1131
|
+
rawtokens[1].istype(RawTokenType::EQUAL)) {
|
|
1132
|
+
processedtokens.emplace_back(LpComparisonType::LEQ);
|
|
1133
|
+
nextrawtoken(2);
|
|
1134
|
+
continue;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// <
|
|
1138
|
+
if (rawtokens[0].istype(RawTokenType::LESS)) {
|
|
1139
|
+
processedtokens.emplace_back(LpComparisonType::L);
|
|
1140
|
+
nextrawtoken();
|
|
1141
|
+
continue;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
// >=
|
|
1145
|
+
if (rawtokens[0].istype(RawTokenType::GREATER) &&
|
|
1146
|
+
rawtokens[1].istype(RawTokenType::EQUAL)) {
|
|
1147
|
+
processedtokens.emplace_back(LpComparisonType::GEQ);
|
|
1148
|
+
nextrawtoken(2);
|
|
1149
|
+
continue;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
// >
|
|
1153
|
+
if (rawtokens[0].istype(RawTokenType::GREATER)) {
|
|
1154
|
+
processedtokens.emplace_back(LpComparisonType::G);
|
|
1155
|
+
nextrawtoken();
|
|
1156
|
+
continue;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
// =
|
|
1160
|
+
if (rawtokens[0].istype(RawTokenType::EQUAL)) {
|
|
1161
|
+
processedtokens.emplace_back(LpComparisonType::EQ);
|
|
1162
|
+
nextrawtoken();
|
|
1163
|
+
continue;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
// FILEEND should have been handled in condition of while()
|
|
1167
|
+
assert(!rawtokens[0].istype(RawTokenType::FLEND));
|
|
1168
|
+
|
|
1169
|
+
// catch all unknown symbols
|
|
1170
|
+
//
|
|
1171
|
+
// printRawTokens();
|
|
1172
|
+
lpassert(false);
|
|
1173
|
+
break;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
void Reader::nextrawtoken(size_t howmany) {
|
|
1178
|
+
assert(howmany > 0);
|
|
1179
|
+
assert(howmany <= NRAWTOKEN);
|
|
1180
|
+
static_assert(NRAWTOKEN == 3,
|
|
1181
|
+
"code below need to be adjusted if NRAWTOKEN changes");
|
|
1182
|
+
switch (howmany) {
|
|
1183
|
+
case 1: {
|
|
1184
|
+
rawtokens[0] = std::move(rawtokens[1]);
|
|
1185
|
+
rawtokens[1] = std::move(rawtokens[2]);
|
|
1186
|
+
while (!readnexttoken(rawtokens[2]))
|
|
1187
|
+
;
|
|
1188
|
+
break;
|
|
1189
|
+
}
|
|
1190
|
+
case 2: {
|
|
1191
|
+
rawtokens[0] = std::move(rawtokens[2]);
|
|
1192
|
+
while (!readnexttoken(rawtokens[1]))
|
|
1193
|
+
;
|
|
1194
|
+
while (!readnexttoken(rawtokens[2]))
|
|
1195
|
+
;
|
|
1196
|
+
break;
|
|
1197
|
+
}
|
|
1198
|
+
case 3: {
|
|
1199
|
+
while (!readnexttoken(rawtokens[0]))
|
|
1200
|
+
;
|
|
1201
|
+
while (!readnexttoken(rawtokens[1]))
|
|
1202
|
+
;
|
|
1203
|
+
while (!readnexttoken(rawtokens[2]))
|
|
1204
|
+
;
|
|
1205
|
+
break;
|
|
1206
|
+
}
|
|
1207
|
+
default: {
|
|
1208
|
+
size_t i = 0;
|
|
1209
|
+
// move tokens up
|
|
1210
|
+
for (; i < NRAWTOKEN - howmany; ++i)
|
|
1211
|
+
rawtokens[i] = std::move(rawtokens[i + howmany]);
|
|
1212
|
+
// read new tokens at end positions
|
|
1213
|
+
for (; i < NRAWTOKEN; ++i)
|
|
1214
|
+
// call readnexttoken() to overwrite current token
|
|
1215
|
+
// if it didn't actually read a token (returns false), then call again
|
|
1216
|
+
while (!readnexttoken(rawtokens[i]))
|
|
1217
|
+
;
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
// return true, if token has been set; return false if skipped over whitespace
|
|
1223
|
+
// only
|
|
1224
|
+
bool Reader::readnexttoken(RawToken& t) {
|
|
1225
|
+
if (this->linebufferpos == this->linebuffer.size()) {
|
|
1226
|
+
// read next line if any are left.
|
|
1227
|
+
if (this->file.eof()) {
|
|
1228
|
+
t = RawTokenType::FLEND;
|
|
1229
|
+
return true;
|
|
1230
|
+
}
|
|
1231
|
+
std::getline(this->file, linebuffer);
|
|
1232
|
+
|
|
1233
|
+
// drop \r
|
|
1234
|
+
if (!linebuffer.empty() && linebuffer.back() == '\r') linebuffer.pop_back();
|
|
1235
|
+
|
|
1236
|
+
// reset linebufferpos
|
|
1237
|
+
this->linebufferpos = 0;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
// check single character tokens
|
|
1241
|
+
char nextchar = this->linebuffer[this->linebufferpos];
|
|
1242
|
+
switch (nextchar) {
|
|
1243
|
+
// check for comment
|
|
1244
|
+
case '\\':
|
|
1245
|
+
// skip rest of line
|
|
1246
|
+
this->linebufferpos = this->linebuffer.size();
|
|
1247
|
+
return false;
|
|
1248
|
+
|
|
1249
|
+
// check for bracket opening
|
|
1250
|
+
case '[':
|
|
1251
|
+
t = RawTokenType::BRKOP;
|
|
1252
|
+
this->linebufferpos++;
|
|
1253
|
+
return true;
|
|
1254
|
+
|
|
1255
|
+
// check for bracket closing
|
|
1256
|
+
case ']':
|
|
1257
|
+
t = RawTokenType::BRKCL;
|
|
1258
|
+
this->linebufferpos++;
|
|
1259
|
+
return true;
|
|
1260
|
+
|
|
1261
|
+
// check for less sign
|
|
1262
|
+
case '<':
|
|
1263
|
+
t = RawTokenType::LESS;
|
|
1264
|
+
this->linebufferpos++;
|
|
1265
|
+
return true;
|
|
1266
|
+
|
|
1267
|
+
// check for greater sign
|
|
1268
|
+
case '>':
|
|
1269
|
+
t = RawTokenType::GREATER;
|
|
1270
|
+
this->linebufferpos++;
|
|
1271
|
+
return true;
|
|
1272
|
+
|
|
1273
|
+
// check for equal sign
|
|
1274
|
+
case '=':
|
|
1275
|
+
t = RawTokenType::EQUAL;
|
|
1276
|
+
this->linebufferpos++;
|
|
1277
|
+
return true;
|
|
1278
|
+
|
|
1279
|
+
// check for colon
|
|
1280
|
+
case ':':
|
|
1281
|
+
t = RawTokenType::COLON;
|
|
1282
|
+
this->linebufferpos++;
|
|
1283
|
+
return true;
|
|
1284
|
+
|
|
1285
|
+
// check for plus
|
|
1286
|
+
case '+':
|
|
1287
|
+
t = RawTokenType::PLUS;
|
|
1288
|
+
this->linebufferpos++;
|
|
1289
|
+
return true;
|
|
1290
|
+
|
|
1291
|
+
// check for hat
|
|
1292
|
+
case '^':
|
|
1293
|
+
t = RawTokenType::HAT;
|
|
1294
|
+
this->linebufferpos++;
|
|
1295
|
+
return true;
|
|
1296
|
+
|
|
1297
|
+
// check for slash
|
|
1298
|
+
case '/':
|
|
1299
|
+
t = RawTokenType::SLASH;
|
|
1300
|
+
this->linebufferpos++;
|
|
1301
|
+
return true;
|
|
1302
|
+
|
|
1303
|
+
// check for asterisk
|
|
1304
|
+
case '*':
|
|
1305
|
+
t = RawTokenType::ASTERISK;
|
|
1306
|
+
this->linebufferpos++;
|
|
1307
|
+
return true;
|
|
1308
|
+
|
|
1309
|
+
// check for minus
|
|
1310
|
+
case '-':
|
|
1311
|
+
t = RawTokenType::MINUS;
|
|
1312
|
+
this->linebufferpos++;
|
|
1313
|
+
return true;
|
|
1314
|
+
|
|
1315
|
+
// check for whitespace
|
|
1316
|
+
case ' ':
|
|
1317
|
+
case '\t':
|
|
1318
|
+
this->linebufferpos++;
|
|
1319
|
+
return false;
|
|
1320
|
+
|
|
1321
|
+
// check for line end
|
|
1322
|
+
case ';':
|
|
1323
|
+
case '\n': // \n should not happen due to using getline()
|
|
1324
|
+
this->linebufferpos = this->linebuffer.size();
|
|
1325
|
+
return false;
|
|
1326
|
+
|
|
1327
|
+
case '\0': // empty line
|
|
1328
|
+
lpassert(this->linebufferpos == this->linebuffer.size());
|
|
1329
|
+
return false;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
// check for double value
|
|
1333
|
+
const char* startptr = this->linebuffer.data() + this->linebufferpos;
|
|
1334
|
+
char* endptr;
|
|
1335
|
+
double constant = strtod(startptr, &endptr);
|
|
1336
|
+
if (endptr != startptr) {
|
|
1337
|
+
// Extract the string corresponding to the double, in case the
|
|
1338
|
+
// double is a constraint name
|
|
1339
|
+
size_t double_len = endptr - startptr;
|
|
1340
|
+
std::string double_name = this->linebuffer.substr(this->linebufferpos, double_len);
|
|
1341
|
+
// t = constant;
|
|
1342
|
+
t = std::make_pair(constant, double_name);
|
|
1343
|
+
this->linebufferpos += endptr - startptr;
|
|
1344
|
+
return true;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
// assume it's an (section/variable/constraint) identifier
|
|
1348
|
+
auto endpos =
|
|
1349
|
+
this->linebuffer.find_first_of("\t\n\\:+<>^= /-*[]", this->linebufferpos);
|
|
1350
|
+
if (endpos == std::string::npos)
|
|
1351
|
+
endpos = this->linebuffer.size(); // take complete rest of string
|
|
1352
|
+
if (endpos > this->linebufferpos) {
|
|
1353
|
+
t = std::string(this->linebuffer, this->linebufferpos,
|
|
1354
|
+
endpos - this->linebufferpos);
|
|
1355
|
+
this->linebufferpos = endpos;
|
|
1356
|
+
return true;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
lpassert(false);
|
|
1360
|
+
return false;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
/*
|
|
1364
|
+
// Useful for debugging
|
|
1365
|
+
void Reader::printRawTokens() {
|
|
1366
|
+
for(int iToken=0; iToken < NRAWTOKEN; iToken++) {
|
|
1367
|
+
const RawToken& rawtoken = rawtokens[iToken];
|
|
1368
|
+
printf("rawtokens[%d]: ", int(iToken));
|
|
1369
|
+
printf("type = %-12s", tokenTypeToString(rawtoken.type).c_str());
|
|
1370
|
+
printf("; svalue = %8s: ", rawtoken.svalue.c_str());
|
|
1371
|
+
if (iToken < NRAWTOKEN-1) printf("; ");
|
|
1372
|
+
}
|
|
1373
|
+
printf("\n");
|
|
1374
|
+
}
|
|
1375
|
+
*/
|