casadi 3.6.5__cp37-none-manylinux2014_i686.whl → 3.6.7__cp37-none-manylinux2014_i686.whl
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.
- casadi/_casadi.so +0 -0
- casadi/casadi.py +739 -308
- casadi/cbc +0 -0
- casadi/clp +0 -0
- casadi/cmake/casadi-config-version.cmake +1 -1
- casadi/cmake/highs/highs-config.cmake +6 -13
- casadi/cmake/highs/highs-targets-release.cmake +13 -13
- casadi/cmake/highs/highs-targets.cmake +13 -10
- casadi/highs +0 -0
- casadi/include/casadi/casadi.i +3 -0
- casadi/include/casadi/casadi_c.h +2 -0
- casadi/include/casadi/config.h +8 -8
- casadi/include/casadi/core/casadi_common.hpp +1 -0
- casadi/include/casadi/core/casadi_misc.hpp +52 -0
- casadi/include/casadi/core/casadi_types.hpp +3 -2
- casadi/include/casadi/core/code_generator.hpp +30 -1
- casadi/include/casadi/core/global_options.hpp +2 -0
- casadi/include/casadi/core/mx.hpp +18 -3
- casadi/include/casadi/core/optistack.hpp +23 -0
- casadi/include/casadi/core/runtime/casadi_nlp.hpp +19 -4
- casadi/include/casadi/core/runtime/casadi_ocp_block.hpp +55 -0
- casadi/include/casadi/core/runtime/casadi_oracle.hpp +44 -0
- casadi/include/casadi/core/runtime/casadi_oracle_callback.hpp +39 -0
- casadi/include/casadi/core/runtime/casadi_runtime.hpp +4 -1
- casadi/include/casadi/core/runtime/casadi_scaled_copy.hpp +31 -0
- casadi/include/casadi/core/serializing_stream.hpp +2 -2
- casadi/include/casadi/core/sparsity.hpp +7 -0
- casadi/include/casadi/doc.i +1513 -1016
- casadi/include/casadi/doc_merged.i +965 -719
- casadi/include/casadi/mem.h +1 -0
- casadi/include/daqp/api.h +46 -0
- casadi/include/daqp/auxiliary.h +29 -0
- casadi/include/daqp/bnb.h +32 -0
- casadi/include/daqp/codegen.h +18 -0
- casadi/include/daqp/constants.h +92 -0
- casadi/include/daqp/daqp.h +22 -0
- casadi/include/daqp/daqp_prox.h +18 -0
- casadi/include/daqp/factorization.h +18 -0
- casadi/include/daqp/types.h +161 -0
- casadi/include/daqp/utils.h +44 -0
- casadi/include/highs/HConfig.h +6 -5
- casadi/include/highs/Highs.h +93 -23
- casadi/include/highs/filereaderlp/def.hpp +19 -0
- casadi/include/highs/interfaces/highs_c_api.h +200 -24
- casadi/include/highs/io/Filereader.h +1 -1
- casadi/include/highs/io/FilereaderEms.h +1 -1
- casadi/include/highs/io/FilereaderLp.h +1 -1
- casadi/include/highs/io/FilereaderMps.h +1 -1
- casadi/include/highs/io/HMPSIO.h +1 -1
- casadi/include/highs/io/HMpsFF.h +5 -3
- casadi/include/highs/io/HighsIO.h +18 -8
- casadi/include/highs/io/LoadOptions.h +1 -1
- casadi/include/highs/ipm/IpxSolution.h +35 -0
- casadi/include/highs/ipm/IpxWrapper.h +1 -1
- casadi/include/highs/ipm/basiclu/basiclu.h +161 -0
- casadi/include/highs/ipm/basiclu/basiclu_factorize.h +247 -0
- casadi/include/highs/ipm/basiclu/basiclu_get_factors.h +108 -0
- casadi/include/highs/ipm/basiclu/basiclu_initialize.h +119 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_factorize.h +34 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_free.h +19 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_get_factors.h +34 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_initialize.h +46 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_solve_dense.h +29 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_solve_for_update.h +42 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_solve_sparse.h +32 -0
- casadi/include/highs/ipm/basiclu/basiclu_obj_update.h +31 -0
- casadi/include/highs/ipm/basiclu/basiclu_object.h +30 -0
- casadi/include/highs/ipm/basiclu/basiclu_solve_dense.h +75 -0
- casadi/include/highs/ipm/basiclu/basiclu_solve_for_update.h +169 -0
- casadi/include/highs/ipm/basiclu/basiclu_solve_sparse.h +112 -0
- casadi/include/highs/ipm/basiclu/basiclu_update.h +125 -0
- casadi/include/highs/ipm/basiclu/lu_def.h +39 -0
- casadi/include/highs/ipm/basiclu/lu_file.h +21 -0
- casadi/include/highs/ipm/basiclu/lu_internal.h +220 -0
- casadi/include/highs/ipm/basiclu/lu_list.h +168 -0
- casadi/include/highs/ipm/ipx/basiclu_kernel.h +20 -0
- casadi/include/highs/ipm/ipx/basiclu_wrapper.h +47 -0
- casadi/include/highs/ipm/ipx/basis.h +351 -0
- casadi/include/highs/ipm/ipx/conjugate_residuals.h +74 -0
- casadi/include/highs/ipm/ipx/control.h +163 -0
- casadi/include/highs/ipm/ipx/crossover.h +157 -0
- casadi/include/highs/ipm/ipx/diagonal_precond.h +45 -0
- casadi/include/highs/ipm/ipx/forrest_tomlin.h +102 -0
- casadi/include/highs/ipm/ipx/guess_basis.h +21 -0
- casadi/include/highs/ipm/ipx/indexed_vector.h +113 -0
- casadi/include/highs/ipm/ipx/info.h +27 -0
- casadi/include/highs/ipm/ipx/ipm.h +94 -0
- casadi/include/highs/ipm/ipx/ipx_c.h +47 -0
- casadi/include/highs/ipm/ipx/ipx_config.h +9 -0
- casadi/include/highs/ipm/ipx/ipx_info.h +111 -0
- casadi/include/highs/ipm/ipx/ipx_internal.h +88 -0
- casadi/include/highs/ipm/ipx/ipx_parameters.h +75 -0
- casadi/include/highs/ipm/ipx/ipx_status.h +57 -0
- casadi/include/highs/ipm/ipx/iterate.h +328 -0
- casadi/include/highs/ipm/ipx/kkt_solver.h +70 -0
- casadi/include/highs/ipm/ipx/kkt_solver_basis.h +66 -0
- casadi/include/highs/ipm/ipx/kkt_solver_diag.h +48 -0
- casadi/include/highs/ipm/ipx/linear_operator.h +26 -0
- casadi/include/highs/ipm/ipx/lp_solver.h +201 -0
- casadi/include/highs/ipm/ipx/lu_factorization.h +79 -0
- casadi/include/highs/ipm/ipx/lu_update.h +129 -0
- casadi/include/highs/ipm/ipx/maxvolume.h +54 -0
- casadi/include/highs/ipm/ipx/model.h +409 -0
- casadi/include/highs/ipm/ipx/multistream.h +52 -0
- casadi/include/highs/ipm/ipx/normal_matrix.h +44 -0
- casadi/include/highs/ipm/ipx/power_method.h +44 -0
- casadi/include/highs/ipm/ipx/sparse_matrix.h +195 -0
- casadi/include/highs/ipm/ipx/sparse_utils.h +58 -0
- casadi/include/highs/ipm/ipx/splitted_normal_matrix.h +63 -0
- casadi/include/highs/ipm/ipx/starting_basis.h +39 -0
- casadi/include/highs/ipm/ipx/symbolic_invert.h +29 -0
- casadi/include/highs/ipm/ipx/timer.h +24 -0
- casadi/include/highs/ipm/ipx/utils.h +39 -0
- casadi/include/highs/lp_data/HConst.h +20 -10
- casadi/include/highs/lp_data/HStruct.h +23 -1
- casadi/include/highs/lp_data/HighsAnalysis.h +1 -1
- casadi/include/highs/lp_data/HighsCallback.h +10 -3
- casadi/include/highs/lp_data/HighsCallbackStruct.h +31 -5
- casadi/include/highs/lp_data/HighsDebug.h +1 -1
- casadi/include/highs/lp_data/HighsInfo.h +20 -2
- casadi/include/highs/lp_data/HighsInfoDebug.h +1 -1
- casadi/include/highs/lp_data/HighsLp.h +17 -1
- casadi/include/highs/lp_data/HighsLpSolverObject.h +1 -1
- casadi/include/highs/lp_data/HighsLpUtils.h +19 -19
- casadi/include/highs/lp_data/HighsModelUtils.h +1 -1
- casadi/include/highs/lp_data/HighsOptions.h +237 -10
- casadi/include/highs/lp_data/HighsRanging.h +1 -1
- casadi/include/highs/lp_data/HighsRuntimeOptions.h +2 -2
- casadi/include/highs/lp_data/HighsSolution.h +2 -2
- casadi/include/highs/lp_data/HighsSolutionDebug.h +1 -1
- casadi/include/highs/lp_data/HighsSolve.h +3 -1
- casadi/include/highs/lp_data/HighsStatus.h +1 -1
- casadi/include/highs/mip/HighsCliqueTable.h +4 -4
- casadi/include/highs/mip/HighsConflictPool.h +1 -1
- casadi/include/highs/mip/HighsCutGeneration.h +1 -1
- casadi/include/highs/mip/HighsCutPool.h +2 -2
- casadi/include/highs/mip/HighsDebugSol.h +22 -29
- casadi/include/highs/mip/HighsDomain.h +10 -2
- casadi/include/highs/mip/HighsDomainChange.h +1 -1
- casadi/include/highs/mip/HighsDynamicRowMatrix.h +5 -3
- casadi/include/highs/mip/HighsGFkSolve.h +3 -3
- casadi/include/highs/mip/HighsImplications.h +3 -3
- casadi/include/highs/mip/HighsLpAggregator.h +1 -1
- casadi/include/highs/mip/HighsLpRelaxation.h +6 -1
- casadi/include/highs/mip/HighsMipSolver.h +4 -2
- casadi/include/highs/mip/HighsMipSolverData.h +47 -4
- casadi/include/highs/mip/HighsModkSeparator.h +2 -2
- casadi/include/highs/mip/HighsNodeQueue.h +5 -3
- casadi/include/highs/mip/HighsObjectiveFunction.h +1 -1
- casadi/include/highs/mip/HighsPathSeparator.h +2 -2
- casadi/include/highs/mip/HighsPrimalHeuristics.h +1 -1
- casadi/include/highs/mip/HighsPseudocost.h +35 -23
- casadi/include/highs/mip/HighsRedcostFixing.h +1 -1
- casadi/include/highs/mip/HighsSearch.h +2 -1
- casadi/include/highs/mip/HighsSeparation.h +1 -1
- casadi/include/highs/mip/HighsSeparator.h +1 -1
- casadi/include/highs/mip/HighsTableauSeparator.h +1 -1
- casadi/include/highs/mip/HighsTransformedLp.h +1 -1
- casadi/include/highs/model/HighsHessian.h +5 -0
- casadi/include/highs/model/HighsHessianUtils.h +2 -0
- casadi/include/highs/model/HighsModel.h +10 -1
- casadi/include/highs/parallel/HighsMutex.h +2 -1
- casadi/include/highs/parallel/HighsParallel.h +7 -2
- casadi/include/highs/parallel/HighsTask.h +1 -2
- casadi/include/highs/pdlp/CupdlpWrapper.h +93 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_cs.h +41 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_defs.h +423 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_linalg.h +183 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_proj.h +19 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_restart.h +31 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_scaling_cuda.h +28 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_solver.h +98 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_step.h +33 -0
- casadi/include/highs/pdlp/cupdlp/cupdlp_utils.c +1726 -0
- casadi/include/highs/pdqsort/pdqsort.h +532 -0
- casadi/include/highs/presolve/HPresolve.h +27 -14
- casadi/include/highs/presolve/HPresolveAnalysis.h +1 -1
- casadi/include/highs/presolve/HighsPostsolveStack.h +92 -68
- casadi/include/highs/presolve/HighsSymmetry.h +6 -5
- casadi/include/highs/presolve/ICrash.h +8 -2
- casadi/include/highs/presolve/ICrashUtil.h +1 -1
- casadi/include/highs/presolve/ICrashX.h +1 -1
- casadi/include/highs/presolve/PresolveComponent.h +1 -1
- casadi/include/highs/qpsolver/a_asm.hpp +23 -12
- casadi/include/highs/qpsolver/a_quass.hpp +8 -1
- casadi/include/highs/qpsolver/basis.hpp +150 -0
- casadi/include/highs/qpsolver/crashsolution.hpp +12 -0
- casadi/include/highs/qpsolver/dantzigpricing.hpp +72 -0
- casadi/include/highs/qpsolver/devexpricing.hpp +99 -0
- casadi/include/highs/qpsolver/eventhandler.hpp +23 -0
- casadi/include/highs/qpsolver/factor.hpp +400 -0
- casadi/include/highs/qpsolver/feasibility_bounded.hpp +105 -0
- casadi/include/highs/qpsolver/feasibility_highs.hpp +270 -0
- casadi/include/highs/qpsolver/gradient.hpp +39 -0
- casadi/include/highs/qpsolver/instance.hpp +63 -0
- casadi/include/highs/qpsolver/matrix.hpp +335 -0
- casadi/include/highs/qpsolver/pricing.hpp +15 -0
- casadi/include/highs/qpsolver/qpconst.hpp +27 -0
- casadi/include/highs/qpsolver/{vector.hpp → qpvector.hpp} +25 -25
- casadi/include/highs/qpsolver/quass.hpp +1 -1
- casadi/include/highs/qpsolver/ratiotest.hpp +19 -0
- casadi/include/highs/qpsolver/runtime.hpp +38 -0
- casadi/include/highs/qpsolver/settings.hpp +57 -0
- casadi/include/highs/qpsolver/snippets.hpp +29 -0
- casadi/include/highs/qpsolver/statistics.hpp +23 -0
- casadi/include/highs/qpsolver/steepestedgepricing.hpp +167 -0
- casadi/include/highs/simplex/HApp.h +1 -1
- casadi/include/highs/simplex/HEkk.h +52 -18
- casadi/include/highs/simplex/HEkkDual.h +1 -1
- casadi/include/highs/simplex/HEkkDualRHS.h +6 -7
- casadi/include/highs/simplex/HEkkDualRow.h +2 -2
- casadi/include/highs/simplex/HEkkPrimal.h +6 -1
- casadi/include/highs/simplex/HSimplex.h +1 -3
- casadi/include/highs/simplex/HSimplexDebug.h +1 -1
- casadi/include/highs/simplex/HSimplexNla.h +1 -1
- casadi/include/highs/simplex/HSimplexReport.h +1 -1
- casadi/include/highs/simplex/HighsSimplexAnalysis.h +228 -100
- casadi/include/highs/simplex/SimplexConst.h +1 -1
- casadi/include/highs/simplex/SimplexStruct.h +2 -2
- casadi/include/highs/simplex/SimplexTimer.h +1 -1
- casadi/include/highs/test/DevKkt.h +1 -1
- casadi/include/highs/test/KktCh2.h +1 -1
- casadi/include/highs/util/FactorTimer.h +1 -1
- casadi/include/highs/util/HFactor.h +35 -6
- casadi/include/highs/util/HFactorConst.h +1 -1
- casadi/include/highs/util/HFactorDebug.h +1 -1
- casadi/include/highs/util/HSet.h +1 -1
- casadi/include/highs/util/HVector.h +1 -1
- casadi/include/highs/util/HVectorBase.h +1 -1
- casadi/include/highs/util/HighsCDouble.h +3 -3
- casadi/include/highs/util/HighsComponent.h +1 -1
- casadi/include/highs/util/HighsDataStack.h +4 -4
- casadi/include/highs/util/HighsDisjointSets.h +1 -1
- casadi/include/highs/util/HighsHash.h +28 -21
- casadi/include/highs/util/HighsHashTree.h +63 -63
- casadi/include/highs/util/HighsInt.h +1 -1
- casadi/include/highs/util/HighsIntegers.h +8 -9
- casadi/include/highs/util/HighsLinearSumBounds.h +1 -1
- casadi/include/highs/util/HighsMatrixPic.h +1 -1
- casadi/include/highs/util/HighsMatrixSlice.h +9 -6
- casadi/include/highs/util/HighsMatrixUtils.h +1 -1
- casadi/include/highs/util/HighsMemoryAllocation.h +55 -0
- casadi/include/highs/util/HighsRandom.h +27 -15
- casadi/include/highs/util/HighsRbTree.h +2 -2
- casadi/include/highs/util/HighsSort.h +7 -7
- casadi/include/highs/util/HighsSparseMatrix.h +5 -2
- casadi/include/highs/util/HighsSparseVectorSum.h +2 -2
- casadi/include/highs/util/HighsSplay.h +1 -1
- casadi/include/highs/util/HighsTimer.h +18 -9
- casadi/include/highs/util/HighsUtils.h +15 -8
- casadi/include/highs/util/stringutil.h +9 -4
- casadi/include/highs/zstr/strict_fstream.hpp +237 -0
- casadi/include/highs/zstr/zstr.hpp +472 -0
- casadi/include/licenses/daqp-external/LICENSE +21 -0
- casadi/include/licenses/highs-external/{LICENSE → LICENSE.txt} +1 -1
- casadi/include/osqp/constants.h +2 -3
- casadi/include/osqp/version.h +9 -0
- casadi/lib/libtinyxml2.a +0 -0
- casadi/libCbcSolver.so +0 -0
- casadi/libCbcSolver.so.3 +0 -0
- casadi/libCbcSolver.so.3.10.11 +0 -0
- casadi/libClpSolver.so +0 -0
- casadi/libClpSolver.so.1 +0 -0
- casadi/libClpSolver.so.1.14.9 +0 -0
- casadi/libbonmin.so +0 -0
- casadi/libbonmin.so.4 +0 -0
- casadi/libbonmin.so.4.8.9 +0 -0
- casadi/libcasadi.so +0 -0
- casadi/libcasadi.so.3.7 +0 -0
- casadi/libcasadi_conic_cbc.so +0 -0
- casadi/libcasadi_conic_cbc.so.3.7 +0 -0
- casadi/libcasadi_conic_clp.so +0 -0
- casadi/libcasadi_conic_clp.so.3.7 +0 -0
- casadi/libcasadi_conic_daqp.so +0 -0
- casadi/libcasadi_conic_daqp.so.3.7 +0 -0
- casadi/libcasadi_conic_gurobi.so +0 -0
- casadi/libcasadi_conic_gurobi.so.3.7 +0 -0
- casadi/libcasadi_conic_highs.so +0 -0
- casadi/libcasadi_conic_highs.so.3.7 +0 -0
- casadi/libcasadi_conic_ipqp.so +0 -0
- casadi/libcasadi_conic_ipqp.so.3.7 +0 -0
- casadi/libcasadi_conic_nlpsol.so +0 -0
- casadi/libcasadi_conic_nlpsol.so.3.7 +0 -0
- casadi/libcasadi_conic_osqp.so +0 -0
- casadi/libcasadi_conic_osqp.so.3.7 +0 -0
- casadi/libcasadi_conic_proxqp.so +0 -0
- casadi/libcasadi_conic_proxqp.so.3.7 +0 -0
- casadi/libcasadi_conic_qpoases.so +0 -0
- casadi/libcasadi_conic_qpoases.so.3.7 +0 -0
- casadi/libcasadi_conic_qrqp.so +0 -0
- casadi/libcasadi_conic_qrqp.so.3.7 +0 -0
- casadi/libcasadi_conic_superscs.so +0 -0
- casadi/libcasadi_conic_superscs.so.3.7 +0 -0
- casadi/libcasadi_integrator_collocation.so +0 -0
- casadi/libcasadi_integrator_collocation.so.3.7 +0 -0
- casadi/libcasadi_integrator_cvodes.so +0 -0
- casadi/libcasadi_integrator_cvodes.so.3.7 +0 -0
- casadi/libcasadi_integrator_idas.so +0 -0
- casadi/libcasadi_integrator_idas.so.3.7 +0 -0
- casadi/libcasadi_integrator_rk.so +0 -0
- casadi/libcasadi_integrator_rk.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_alpaqa.so +0 -0
- casadi/libcasadi_nlpsol_alpaqa.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_ampl.so +0 -0
- casadi/libcasadi_nlpsol_ampl.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_blocksqp.so +0 -0
- casadi/libcasadi_nlpsol_blocksqp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_bonmin.so +0 -0
- casadi/libcasadi_nlpsol_bonmin.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_feasiblesqpmethod.so +0 -0
- casadi/libcasadi_nlpsol_feasiblesqpmethod.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_ipopt.so +0 -0
- casadi/libcasadi_nlpsol_ipopt.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_knitro.so +0 -0
- casadi/libcasadi_nlpsol_knitro.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_madnlp.so +0 -0
- casadi/libcasadi_nlpsol_madnlp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_qrsqp.so +0 -0
- casadi/libcasadi_nlpsol_qrsqp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_scpgen.so +0 -0
- casadi/libcasadi_nlpsol_scpgen.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_sleqp.so +0 -0
- casadi/libcasadi_nlpsol_sleqp.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_snopt.so +0 -0
- casadi/libcasadi_nlpsol_snopt.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_sqpmethod.so +0 -0
- casadi/libcasadi_nlpsol_sqpmethod.so.3.7 +0 -0
- casadi/libcasadi_nlpsol_worhp.so +0 -0
- casadi/libcasadi_nlpsol_worhp.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_fast_newton.so +0 -0
- casadi/libcasadi_rootfinder_fast_newton.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_kinsol.so +0 -0
- casadi/libcasadi_rootfinder_kinsol.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_newton.so +0 -0
- casadi/libcasadi_rootfinder_newton.so.3.7 +0 -0
- casadi/libcasadi_rootfinder_nlpsol.so +0 -0
- casadi/libcasadi_rootfinder_nlpsol.so.3.7 +0 -0
- casadi/libcasadi_sundials_common.so +0 -0
- casadi/libcasadi_sundials_common.so.3.7 +0 -0
- casadi/libcoinmetis.la +1 -1
- casadi/libcoinmetis.so +0 -0
- casadi/libcoinmetis.so.2 +0 -0
- casadi/libcoinmetis.so.2.0.0 +0 -0
- casadi/libdaqp.so +0 -0
- casadi/libdaqpstat.a +0 -0
- casadi/libhighs.so +0 -0
- casadi/libhighs.so.1 +0 -0
- casadi/libhighs.so.1.7.2 +0 -0
- casadi/libindirect.a +0 -0
- casadi/liblinsys.a +0 -0
- casadi/libmatlab_ipc.so +0 -0
- casadi/libosqp.a +0 -0
- casadi/libosqp.so +0 -0
- casadi/libqdldl.a +0 -0
- casadi/libsleqp.so +0 -0
- casadi/libsleqp.so.1.0.1 +0 -0
- casadi/libspral.a +0 -0
- casadi/libsuperscs.a +0 -0
- casadi/pkgconfig/casadi.pc +1 -1
- casadi/pkgconfig/highs.pc +1 -1
- casadi/tools/__init__.py +4 -0
- casadi/tools/bounds.py +3 -3
- {casadi-3.6.5.dist-info → casadi-3.6.7.dist-info}/METADATA +2 -2
- {casadi-3.6.5.dist-info → casadi-3.6.7.dist-info}/RECORD +365 -250
- casadi/include/highs/fortran/highs_fortran_api.mod +0 -0
- casadi/libFortranHighs.so +0 -0
- casadi/libhighs.so.1.6 +0 -0
- casadi/libhighs.so.1.6.0 +0 -0
- {casadi-3.6.5.dist-info → casadi-3.6.7.dist-info}/WHEEL +0 -0
@@ -0,0 +1,532 @@
|
|
1
|
+
/*
|
2
|
+
pdqsort.h - Pattern-defeating quicksort.
|
3
|
+
|
4
|
+
Copyright (c) 2021 Orson Peters
|
5
|
+
|
6
|
+
This software is provided 'as-is', without any express or implied warranty. In no event will the
|
7
|
+
authors be held liable for any damages arising from the use of this software.
|
8
|
+
|
9
|
+
Permission is granted to anyone to use this software for any purpose, including commercial
|
10
|
+
applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
11
|
+
|
12
|
+
1. The origin of this software must not be misrepresented; you must not claim that you wrote the
|
13
|
+
original software. If you use this software in a product, an acknowledgment in the product
|
14
|
+
documentation would be appreciated but is not required.
|
15
|
+
|
16
|
+
2. Altered source versions must be plainly marked as such, and must not be misrepresented as
|
17
|
+
being the original software.
|
18
|
+
|
19
|
+
3. This notice may not be removed or altered from any source distribution.
|
20
|
+
*/
|
21
|
+
|
22
|
+
|
23
|
+
#ifndef PDQSORT_H
|
24
|
+
#define PDQSORT_H
|
25
|
+
|
26
|
+
#include <algorithm>
|
27
|
+
#include <cstddef>
|
28
|
+
#include <functional>
|
29
|
+
#include <utility>
|
30
|
+
#include <iterator>
|
31
|
+
|
32
|
+
#if __cplusplus >= 201103L
|
33
|
+
#include <cstdint>
|
34
|
+
#include <type_traits>
|
35
|
+
#define PDQSORT_PREFER_MOVE(x) std::move(x)
|
36
|
+
#else
|
37
|
+
#define PDQSORT_PREFER_MOVE(x) (x)
|
38
|
+
#endif
|
39
|
+
|
40
|
+
|
41
|
+
namespace pdqsort_detail {
|
42
|
+
enum {
|
43
|
+
// Partitions below this size are sorted using insertion sort.
|
44
|
+
insertion_sort_threshold = 24,
|
45
|
+
|
46
|
+
// Partitions above this size use Tukey's ninther to select the pivot.
|
47
|
+
ninther_threshold = 128,
|
48
|
+
|
49
|
+
// When we detect an already sorted partition, attempt an insertion sort that allows this
|
50
|
+
// amount of element moves before giving up.
|
51
|
+
partial_insertion_sort_limit = 8,
|
52
|
+
|
53
|
+
// Must be multiple of 8 due to loop unrolling, and < 256 to fit in unsigned char.
|
54
|
+
block_size = 64,
|
55
|
+
|
56
|
+
// Cacheline size, assumes power of two.
|
57
|
+
cacheline_size = 64
|
58
|
+
|
59
|
+
};
|
60
|
+
|
61
|
+
#if __cplusplus >= 201103L
|
62
|
+
template<class T> struct is_default_compare : std::false_type { };
|
63
|
+
template<class T> struct is_default_compare<std::less<T>> : std::true_type { };
|
64
|
+
template<class T> struct is_default_compare<std::greater<T>> : std::true_type { };
|
65
|
+
#endif
|
66
|
+
|
67
|
+
// Returns floor(log2(n)), assumes n > 0.
|
68
|
+
template<class T>
|
69
|
+
inline int log2(T n) {
|
70
|
+
int log = 0;
|
71
|
+
while (n >>= 1) ++log;
|
72
|
+
return log;
|
73
|
+
}
|
74
|
+
|
75
|
+
// Sorts [begin, end) using insertion sort with the given comparison function.
|
76
|
+
template<class Iter, class Compare>
|
77
|
+
inline void insertion_sort(Iter begin, Iter end, Compare comp) {
|
78
|
+
typedef typename std::iterator_traits<Iter>::value_type T;
|
79
|
+
if (begin == end) return;
|
80
|
+
|
81
|
+
for (Iter cur = begin + 1; cur != end; ++cur) {
|
82
|
+
Iter sift = cur;
|
83
|
+
Iter sift_1 = cur - 1;
|
84
|
+
|
85
|
+
// Compare first so we can avoid 2 moves for an element already positioned correctly.
|
86
|
+
if (comp(*sift, *sift_1)) {
|
87
|
+
T tmp = PDQSORT_PREFER_MOVE(*sift);
|
88
|
+
|
89
|
+
do { *sift-- = PDQSORT_PREFER_MOVE(*sift_1); }
|
90
|
+
while (sift != begin && comp(tmp, *--sift_1));
|
91
|
+
|
92
|
+
*sift = PDQSORT_PREFER_MOVE(tmp);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
// Sorts [begin, end) using insertion sort with the given comparison function. Assumes
|
98
|
+
// *(begin - 1) is an element smaller than or equal to any element in [begin, end).
|
99
|
+
template<class Iter, class Compare>
|
100
|
+
inline void unguarded_insertion_sort(Iter begin, Iter end, Compare comp) {
|
101
|
+
typedef typename std::iterator_traits<Iter>::value_type T;
|
102
|
+
if (begin == end) return;
|
103
|
+
|
104
|
+
for (Iter cur = begin + 1; cur != end; ++cur) {
|
105
|
+
Iter sift = cur;
|
106
|
+
Iter sift_1 = cur - 1;
|
107
|
+
|
108
|
+
// Compare first so we can avoid 2 moves for an element already positioned correctly.
|
109
|
+
if (comp(*sift, *sift_1)) {
|
110
|
+
T tmp = PDQSORT_PREFER_MOVE(*sift);
|
111
|
+
|
112
|
+
do { *sift-- = PDQSORT_PREFER_MOVE(*sift_1); }
|
113
|
+
while (comp(tmp, *--sift_1));
|
114
|
+
|
115
|
+
*sift = PDQSORT_PREFER_MOVE(tmp);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
// Attempts to use insertion sort on [begin, end). Will return false if more than
|
121
|
+
// partial_insertion_sort_limit elements were moved, and abort sorting. Otherwise it will
|
122
|
+
// successfully sort and return true.
|
123
|
+
template<class Iter, class Compare>
|
124
|
+
inline bool partial_insertion_sort(Iter begin, Iter end, Compare comp) {
|
125
|
+
typedef typename std::iterator_traits<Iter>::value_type T;
|
126
|
+
if (begin == end) return true;
|
127
|
+
|
128
|
+
std::size_t limit = 0;
|
129
|
+
for (Iter cur = begin + 1; cur != end; ++cur) {
|
130
|
+
Iter sift = cur;
|
131
|
+
Iter sift_1 = cur - 1;
|
132
|
+
|
133
|
+
// Compare first so we can avoid 2 moves for an element already positioned correctly.
|
134
|
+
if (comp(*sift, *sift_1)) {
|
135
|
+
T tmp = PDQSORT_PREFER_MOVE(*sift);
|
136
|
+
|
137
|
+
do { *sift-- = PDQSORT_PREFER_MOVE(*sift_1); }
|
138
|
+
while (sift != begin && comp(tmp, *--sift_1));
|
139
|
+
|
140
|
+
*sift = PDQSORT_PREFER_MOVE(tmp);
|
141
|
+
limit += cur - sift;
|
142
|
+
}
|
143
|
+
|
144
|
+
if (limit > partial_insertion_sort_limit) return false;
|
145
|
+
}
|
146
|
+
|
147
|
+
return true;
|
148
|
+
}
|
149
|
+
|
150
|
+
template<class Iter, class Compare>
|
151
|
+
inline void sort2(Iter a, Iter b, Compare comp) {
|
152
|
+
if (comp(*b, *a)) std::iter_swap(a, b);
|
153
|
+
}
|
154
|
+
|
155
|
+
// Sorts the elements *a, *b and *c using comparison function comp.
|
156
|
+
template<class Iter, class Compare>
|
157
|
+
inline void sort3(Iter a, Iter b, Iter c, Compare comp) {
|
158
|
+
sort2(a, b, comp);
|
159
|
+
sort2(b, c, comp);
|
160
|
+
sort2(a, b, comp);
|
161
|
+
}
|
162
|
+
|
163
|
+
template<class T>
|
164
|
+
inline T* align_cacheline(T* p) {
|
165
|
+
#if defined(UINTPTR_MAX) && __cplusplus >= 201103L
|
166
|
+
std::uintptr_t ip = reinterpret_cast<std::uintptr_t>(p);
|
167
|
+
#else
|
168
|
+
std::size_t ip = reinterpret_cast<std::size_t>(p);
|
169
|
+
#endif
|
170
|
+
ip = (ip + cacheline_size - 1) & -cacheline_size;
|
171
|
+
return reinterpret_cast<T*>(ip);
|
172
|
+
}
|
173
|
+
|
174
|
+
template<class Iter>
|
175
|
+
inline void swap_offsets(Iter first, Iter last,
|
176
|
+
unsigned char* offsets_l, unsigned char* offsets_r,
|
177
|
+
size_t num, bool use_swaps) {
|
178
|
+
typedef typename std::iterator_traits<Iter>::value_type T;
|
179
|
+
if (use_swaps) {
|
180
|
+
// This case is needed for the descending distribution, where we need
|
181
|
+
// to have proper swapping for pdqsort to remain O(n).
|
182
|
+
for (size_t i = 0; i < num; ++i) {
|
183
|
+
std::iter_swap(first + offsets_l[i], last - offsets_r[i]);
|
184
|
+
}
|
185
|
+
} else if (num > 0) {
|
186
|
+
Iter l = first + offsets_l[0]; Iter r = last - offsets_r[0];
|
187
|
+
T tmp(PDQSORT_PREFER_MOVE(*l)); *l = PDQSORT_PREFER_MOVE(*r);
|
188
|
+
for (size_t i = 1; i < num; ++i) {
|
189
|
+
l = first + offsets_l[i]; *r = PDQSORT_PREFER_MOVE(*l);
|
190
|
+
r = last - offsets_r[i]; *l = PDQSORT_PREFER_MOVE(*r);
|
191
|
+
}
|
192
|
+
*r = PDQSORT_PREFER_MOVE(tmp);
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
// Partitions [begin, end) around pivot *begin using comparison function comp. Elements equal
|
197
|
+
// to the pivot are put in the right-hand partition. Returns the position of the pivot after
|
198
|
+
// partitioning and whether the passed sequence already was correctly partitioned. Assumes the
|
199
|
+
// pivot is a median of at least 3 elements and that [begin, end) is at least
|
200
|
+
// insertion_sort_threshold long. Uses branchless partitioning.
|
201
|
+
template<class Iter, class Compare>
|
202
|
+
inline std::pair<Iter, bool> partition_right_branchless(Iter begin, Iter end, Compare comp) {
|
203
|
+
typedef typename std::iterator_traits<Iter>::value_type T;
|
204
|
+
|
205
|
+
// Move pivot into local for speed.
|
206
|
+
T pivot(PDQSORT_PREFER_MOVE(*begin));
|
207
|
+
Iter first = begin;
|
208
|
+
Iter last = end;
|
209
|
+
|
210
|
+
// Find the first element greater than or equal than the pivot (the median of 3 guarantees
|
211
|
+
// this exists).
|
212
|
+
while (comp(*++first, pivot));
|
213
|
+
|
214
|
+
// Find the first element strictly smaller than the pivot. We have to guard this search if
|
215
|
+
// there was no element before *first.
|
216
|
+
if (first - 1 == begin) while (first < last && !comp(*--last, pivot));
|
217
|
+
else while ( !comp(*--last, pivot));
|
218
|
+
|
219
|
+
// If the first pair of elements that should be swapped to partition are the same element,
|
220
|
+
// the passed in sequence already was correctly partitioned.
|
221
|
+
bool already_partitioned = first >= last;
|
222
|
+
if (!already_partitioned) {
|
223
|
+
std::iter_swap(first, last);
|
224
|
+
++first;
|
225
|
+
|
226
|
+
// The following branchless partitioning is derived from "BlockQuicksort: How Branch
|
227
|
+
// Mispredictions don’t affect Quicksort" by Stefan Edelkamp and Armin Weiss, but
|
228
|
+
// heavily micro-optimized.
|
229
|
+
unsigned char offsets_l_storage[block_size + cacheline_size];
|
230
|
+
unsigned char offsets_r_storage[block_size + cacheline_size];
|
231
|
+
unsigned char* offsets_l = align_cacheline(offsets_l_storage);
|
232
|
+
unsigned char* offsets_r = align_cacheline(offsets_r_storage);
|
233
|
+
|
234
|
+
Iter offsets_l_base = first;
|
235
|
+
Iter offsets_r_base = last;
|
236
|
+
size_t num_l, num_r, start_l, start_r;
|
237
|
+
num_l = num_r = start_l = start_r = 0;
|
238
|
+
|
239
|
+
while (first < last) {
|
240
|
+
// Fill up offset blocks with elements that are on the wrong side.
|
241
|
+
// First we determine how much elements are considered for each offset block.
|
242
|
+
size_t num_unknown = last - first;
|
243
|
+
size_t left_split = num_l == 0 ? (num_r == 0 ? num_unknown / 2 : num_unknown) : 0;
|
244
|
+
size_t right_split = num_r == 0 ? (num_unknown - left_split) : 0;
|
245
|
+
|
246
|
+
// Fill the offset blocks.
|
247
|
+
if (left_split >= block_size) {
|
248
|
+
for (size_t i = 0; i < block_size;) {
|
249
|
+
offsets_l[num_l] = i++; num_l += !comp(*first, pivot); ++first;
|
250
|
+
offsets_l[num_l] = i++; num_l += !comp(*first, pivot); ++first;
|
251
|
+
offsets_l[num_l] = i++; num_l += !comp(*first, pivot); ++first;
|
252
|
+
offsets_l[num_l] = i++; num_l += !comp(*first, pivot); ++first;
|
253
|
+
offsets_l[num_l] = i++; num_l += !comp(*first, pivot); ++first;
|
254
|
+
offsets_l[num_l] = i++; num_l += !comp(*first, pivot); ++first;
|
255
|
+
offsets_l[num_l] = i++; num_l += !comp(*first, pivot); ++first;
|
256
|
+
offsets_l[num_l] = i++; num_l += !comp(*first, pivot); ++first;
|
257
|
+
}
|
258
|
+
} else {
|
259
|
+
for (size_t i = 0; i < left_split;) {
|
260
|
+
offsets_l[num_l] = i++; num_l += !comp(*first, pivot); ++first;
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
264
|
+
if (right_split >= block_size) {
|
265
|
+
for (size_t i = 0; i < block_size;) {
|
266
|
+
offsets_r[num_r] = ++i; num_r += comp(*--last, pivot);
|
267
|
+
offsets_r[num_r] = ++i; num_r += comp(*--last, pivot);
|
268
|
+
offsets_r[num_r] = ++i; num_r += comp(*--last, pivot);
|
269
|
+
offsets_r[num_r] = ++i; num_r += comp(*--last, pivot);
|
270
|
+
offsets_r[num_r] = ++i; num_r += comp(*--last, pivot);
|
271
|
+
offsets_r[num_r] = ++i; num_r += comp(*--last, pivot);
|
272
|
+
offsets_r[num_r] = ++i; num_r += comp(*--last, pivot);
|
273
|
+
offsets_r[num_r] = ++i; num_r += comp(*--last, pivot);
|
274
|
+
}
|
275
|
+
} else {
|
276
|
+
for (size_t i = 0; i < right_split;) {
|
277
|
+
offsets_r[num_r] = ++i; num_r += comp(*--last, pivot);
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
281
|
+
// Swap elements and update block sizes and first/last boundaries.
|
282
|
+
size_t num = std::min(num_l, num_r);
|
283
|
+
swap_offsets(offsets_l_base, offsets_r_base,
|
284
|
+
offsets_l + start_l, offsets_r + start_r,
|
285
|
+
num, num_l == num_r);
|
286
|
+
num_l -= num; num_r -= num;
|
287
|
+
start_l += num; start_r += num;
|
288
|
+
|
289
|
+
if (num_l == 0) {
|
290
|
+
start_l = 0;
|
291
|
+
offsets_l_base = first;
|
292
|
+
}
|
293
|
+
|
294
|
+
if (num_r == 0) {
|
295
|
+
start_r = 0;
|
296
|
+
offsets_r_base = last;
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
// We have now fully identified [first, last)'s proper position. Swap the last elements.
|
301
|
+
if (num_l) {
|
302
|
+
offsets_l += start_l;
|
303
|
+
while (num_l--) std::iter_swap(offsets_l_base + offsets_l[num_l], --last);
|
304
|
+
first = last;
|
305
|
+
}
|
306
|
+
if (num_r) {
|
307
|
+
offsets_r += start_r;
|
308
|
+
while (num_r--) std::iter_swap(offsets_r_base - offsets_r[num_r], first), ++first;
|
309
|
+
last = first;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
|
313
|
+
// Put the pivot in the right place.
|
314
|
+
Iter pivot_pos = first - 1;
|
315
|
+
*begin = PDQSORT_PREFER_MOVE(*pivot_pos);
|
316
|
+
*pivot_pos = PDQSORT_PREFER_MOVE(pivot);
|
317
|
+
|
318
|
+
return std::make_pair(pivot_pos, already_partitioned);
|
319
|
+
}
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
// Partitions [begin, end) around pivot *begin using comparison function comp. Elements equal
|
324
|
+
// to the pivot are put in the right-hand partition. Returns the position of the pivot after
|
325
|
+
// partitioning and whether the passed sequence already was correctly partitioned. Assumes the
|
326
|
+
// pivot is a median of at least 3 elements and that [begin, end) is at least
|
327
|
+
// insertion_sort_threshold long.
|
328
|
+
template<class Iter, class Compare>
|
329
|
+
inline std::pair<Iter, bool> partition_right(Iter begin, Iter end, Compare comp) {
|
330
|
+
typedef typename std::iterator_traits<Iter>::value_type T;
|
331
|
+
|
332
|
+
// Move pivot into local for speed.
|
333
|
+
T pivot(PDQSORT_PREFER_MOVE(*begin));
|
334
|
+
|
335
|
+
Iter first = begin;
|
336
|
+
Iter last = end;
|
337
|
+
|
338
|
+
// Find the first element greater than or equal than the pivot (the median of 3 guarantees
|
339
|
+
// this exists).
|
340
|
+
while (comp(*++first, pivot));
|
341
|
+
|
342
|
+
// Find the first element strictly smaller than the pivot. We have to guard this search if
|
343
|
+
// there was no element before *first.
|
344
|
+
if (first - 1 == begin) while (first < last && !comp(*--last, pivot));
|
345
|
+
else while ( !comp(*--last, pivot));
|
346
|
+
|
347
|
+
// If the first pair of elements that should be swapped to partition are the same element,
|
348
|
+
// the passed in sequence already was correctly partitioned.
|
349
|
+
bool already_partitioned = first >= last;
|
350
|
+
|
351
|
+
// Keep swapping pairs of elements that are on the wrong side of the pivot. Previously
|
352
|
+
// swapped pairs guard the searches, which is why the first iteration is special-cased
|
353
|
+
// above.
|
354
|
+
while (first < last) {
|
355
|
+
std::iter_swap(first, last);
|
356
|
+
while (comp(*++first, pivot));
|
357
|
+
while (!comp(*--last, pivot));
|
358
|
+
}
|
359
|
+
|
360
|
+
// Put the pivot in the right place.
|
361
|
+
Iter pivot_pos = first - 1;
|
362
|
+
*begin = PDQSORT_PREFER_MOVE(*pivot_pos);
|
363
|
+
*pivot_pos = PDQSORT_PREFER_MOVE(pivot);
|
364
|
+
|
365
|
+
return std::make_pair(pivot_pos, already_partitioned);
|
366
|
+
}
|
367
|
+
|
368
|
+
// Similar function to the one above, except elements equal to the pivot are put to the left of
|
369
|
+
// the pivot and it doesn't check or return if the passed sequence already was partitioned.
|
370
|
+
// Since this is rarely used (the many equal case), and in that case pdqsort already has O(n)
|
371
|
+
// performance, no block quicksort is applied here for simplicity.
|
372
|
+
template<class Iter, class Compare>
|
373
|
+
inline Iter partition_left(Iter begin, Iter end, Compare comp) {
|
374
|
+
typedef typename std::iterator_traits<Iter>::value_type T;
|
375
|
+
|
376
|
+
T pivot(PDQSORT_PREFER_MOVE(*begin));
|
377
|
+
Iter first = begin;
|
378
|
+
Iter last = end;
|
379
|
+
|
380
|
+
while (comp(pivot, *--last));
|
381
|
+
|
382
|
+
if (last + 1 == end) while (first < last && !comp(pivot, *++first));
|
383
|
+
else while ( !comp(pivot, *++first));
|
384
|
+
|
385
|
+
while (first < last) {
|
386
|
+
std::iter_swap(first, last);
|
387
|
+
while (comp(pivot, *--last));
|
388
|
+
while (!comp(pivot, *++first));
|
389
|
+
}
|
390
|
+
|
391
|
+
Iter pivot_pos = last;
|
392
|
+
*begin = PDQSORT_PREFER_MOVE(*pivot_pos);
|
393
|
+
*pivot_pos = PDQSORT_PREFER_MOVE(pivot);
|
394
|
+
|
395
|
+
return pivot_pos;
|
396
|
+
}
|
397
|
+
|
398
|
+
|
399
|
+
template<class Iter, class Compare, bool Branchless>
|
400
|
+
inline void pdqsort_loop(Iter begin, Iter end, Compare comp, int bad_allowed, bool leftmost = true) {
|
401
|
+
typedef typename std::iterator_traits<Iter>::difference_type diff_t;
|
402
|
+
|
403
|
+
// Use a while loop for tail recursion elimination.
|
404
|
+
while (true) {
|
405
|
+
diff_t size = end - begin;
|
406
|
+
|
407
|
+
// Insertion sort is faster for small arrays.
|
408
|
+
if (size < insertion_sort_threshold) {
|
409
|
+
if (leftmost) insertion_sort(begin, end, comp);
|
410
|
+
else unguarded_insertion_sort(begin, end, comp);
|
411
|
+
return;
|
412
|
+
}
|
413
|
+
|
414
|
+
// Choose pivot as median of 3 or pseudomedian of 9.
|
415
|
+
diff_t s2 = size / 2;
|
416
|
+
if (size > ninther_threshold) {
|
417
|
+
sort3(begin, begin + s2, end - 1, comp);
|
418
|
+
sort3(begin + 1, begin + (s2 - 1), end - 2, comp);
|
419
|
+
sort3(begin + 2, begin + (s2 + 1), end - 3, comp);
|
420
|
+
sort3(begin + (s2 - 1), begin + s2, begin + (s2 + 1), comp);
|
421
|
+
std::iter_swap(begin, begin + s2);
|
422
|
+
} else sort3(begin + s2, begin, end - 1, comp);
|
423
|
+
|
424
|
+
// If *(begin - 1) is the end of the right partition of a previous partition operation
|
425
|
+
// there is no element in [begin, end) that is smaller than *(begin - 1). Then if our
|
426
|
+
// pivot compares equal to *(begin - 1) we change strategy, putting equal elements in
|
427
|
+
// the left partition, greater elements in the right partition. We do not have to
|
428
|
+
// recurse on the left partition, since it's sorted (all equal).
|
429
|
+
if (!leftmost && !comp(*(begin - 1), *begin)) {
|
430
|
+
begin = partition_left(begin, end, comp) + 1;
|
431
|
+
continue;
|
432
|
+
}
|
433
|
+
|
434
|
+
// Partition and get results.
|
435
|
+
std::pair<Iter, bool> part_result =
|
436
|
+
Branchless ? partition_right_branchless(begin, end, comp)
|
437
|
+
: partition_right(begin, end, comp);
|
438
|
+
Iter pivot_pos = part_result.first;
|
439
|
+
bool already_partitioned = part_result.second;
|
440
|
+
|
441
|
+
// Check for a highly unbalanced partition.
|
442
|
+
diff_t l_size = pivot_pos - begin;
|
443
|
+
diff_t r_size = end - (pivot_pos + 1);
|
444
|
+
bool highly_unbalanced = l_size < size / 8 || r_size < size / 8;
|
445
|
+
|
446
|
+
// If we got a highly unbalanced partition we shuffle elements to break many patterns.
|
447
|
+
if (highly_unbalanced) {
|
448
|
+
// If we had too many bad partitions, switch to heapsort to guarantee O(n log n).
|
449
|
+
if (--bad_allowed == 0) {
|
450
|
+
std::make_heap(begin, end, comp);
|
451
|
+
std::sort_heap(begin, end, comp);
|
452
|
+
return;
|
453
|
+
}
|
454
|
+
|
455
|
+
if (l_size >= insertion_sort_threshold) {
|
456
|
+
std::iter_swap(begin, begin + l_size / 4);
|
457
|
+
std::iter_swap(pivot_pos - 1, pivot_pos - l_size / 4);
|
458
|
+
|
459
|
+
if (l_size > ninther_threshold) {
|
460
|
+
std::iter_swap(begin + 1, begin + (l_size / 4 + 1));
|
461
|
+
std::iter_swap(begin + 2, begin + (l_size / 4 + 2));
|
462
|
+
std::iter_swap(pivot_pos - 2, pivot_pos - (l_size / 4 + 1));
|
463
|
+
std::iter_swap(pivot_pos - 3, pivot_pos - (l_size / 4 + 2));
|
464
|
+
}
|
465
|
+
}
|
466
|
+
|
467
|
+
if (r_size >= insertion_sort_threshold) {
|
468
|
+
std::iter_swap(pivot_pos + 1, pivot_pos + (1 + r_size / 4));
|
469
|
+
std::iter_swap(end - 1, end - r_size / 4);
|
470
|
+
|
471
|
+
if (r_size > ninther_threshold) {
|
472
|
+
std::iter_swap(pivot_pos + 2, pivot_pos + (2 + r_size / 4));
|
473
|
+
std::iter_swap(pivot_pos + 3, pivot_pos + (3 + r_size / 4));
|
474
|
+
std::iter_swap(end - 2, end - (1 + r_size / 4));
|
475
|
+
std::iter_swap(end - 3, end - (2 + r_size / 4));
|
476
|
+
}
|
477
|
+
}
|
478
|
+
} else {
|
479
|
+
// If we were decently balanced and we tried to sort an already partitioned
|
480
|
+
// sequence try to use insertion sort.
|
481
|
+
if (already_partitioned && partial_insertion_sort(begin, pivot_pos, comp)
|
482
|
+
&& partial_insertion_sort(pivot_pos + 1, end, comp)) return;
|
483
|
+
}
|
484
|
+
|
485
|
+
// Sort the left partition first using recursion and do tail recursion elimination for
|
486
|
+
// the right-hand partition.
|
487
|
+
pdqsort_loop<Iter, Compare, Branchless>(begin, pivot_pos, comp, bad_allowed, leftmost);
|
488
|
+
begin = pivot_pos + 1;
|
489
|
+
leftmost = false;
|
490
|
+
}
|
491
|
+
}
|
492
|
+
}
|
493
|
+
|
494
|
+
|
495
|
+
template<class Iter, class Compare>
|
496
|
+
inline void pdqsort(Iter begin, Iter end, Compare comp) {
|
497
|
+
if (begin == end) return;
|
498
|
+
|
499
|
+
#if __cplusplus >= 201103L
|
500
|
+
pdqsort_detail::pdqsort_loop<Iter, Compare,
|
501
|
+
pdqsort_detail::is_default_compare<typename std::decay<Compare>::type>::value &&
|
502
|
+
std::is_arithmetic<typename std::iterator_traits<Iter>::value_type>::value>(
|
503
|
+
begin, end, comp, pdqsort_detail::log2(end - begin));
|
504
|
+
#else
|
505
|
+
pdqsort_detail::pdqsort_loop<Iter, Compare, false>(
|
506
|
+
begin, end, comp, pdqsort_detail::log2(end - begin));
|
507
|
+
#endif
|
508
|
+
}
|
509
|
+
|
510
|
+
template<class Iter>
|
511
|
+
inline void pdqsort(Iter begin, Iter end) {
|
512
|
+
typedef typename std::iterator_traits<Iter>::value_type T;
|
513
|
+
pdqsort(begin, end, std::less<T>());
|
514
|
+
}
|
515
|
+
|
516
|
+
template<class Iter, class Compare>
|
517
|
+
inline void pdqsort_branchless(Iter begin, Iter end, Compare comp) {
|
518
|
+
if (begin == end) return;
|
519
|
+
pdqsort_detail::pdqsort_loop<Iter, Compare, true>(
|
520
|
+
begin, end, comp, pdqsort_detail::log2(end - begin));
|
521
|
+
}
|
522
|
+
|
523
|
+
template<class Iter>
|
524
|
+
inline void pdqsort_branchless(Iter begin, Iter end) {
|
525
|
+
typedef typename std::iterator_traits<Iter>::value_type T;
|
526
|
+
pdqsort_branchless(begin, end, std::less<T>());
|
527
|
+
}
|
528
|
+
|
529
|
+
|
530
|
+
#undef PDQSORT_PREFER_MOVE
|
531
|
+
|
532
|
+
#endif
|
@@ -2,7 +2,7 @@
|
|
2
2
|
/* */
|
3
3
|
/* This file is part of the HiGHS linear optimization suite */
|
4
4
|
/* */
|
5
|
-
/* Written and engineered 2008-
|
5
|
+
/* Written and engineered 2008-2024 by Julian Hall, Ivet Galabova, */
|
6
6
|
/* Leona Gottwald and Michael Feldmeier */
|
7
7
|
/* */
|
8
8
|
/* Available as open-source under the MIT License */
|
@@ -43,6 +43,7 @@ class HPresolve {
|
|
43
43
|
HighsTimer* timer;
|
44
44
|
HighsMipSolver* mipsolver = nullptr;
|
45
45
|
double primal_feastol;
|
46
|
+
HighsInt run_clock = -1;
|
46
47
|
|
47
48
|
// triplet storage
|
48
49
|
std::vector<double> Avalue;
|
@@ -83,6 +84,8 @@ class HPresolve {
|
|
83
84
|
std::vector<double> implRowDualUpper;
|
84
85
|
std::vector<HighsInt> rowDualLowerSource;
|
85
86
|
std::vector<HighsInt> rowDualUpperSource;
|
87
|
+
std::vector<std::set<HighsInt>> colImplSourceByRow;
|
88
|
+
std::vector<std::set<HighsInt>> implRowDualSourceByCol;
|
86
89
|
|
87
90
|
// implied bounds on values of primal and dual rows computed from the bounds
|
88
91
|
// of primal and dual variables
|
@@ -155,6 +158,10 @@ class HPresolve {
|
|
155
158
|
|
156
159
|
void updateColImpliedBounds(HighsInt row, HighsInt col, double val);
|
157
160
|
|
161
|
+
void recomputeColImpliedBounds(HighsInt row);
|
162
|
+
|
163
|
+
void recomputeRowDualImpliedBounds(HighsInt col);
|
164
|
+
|
158
165
|
void updateRowDualImpliedBounds(HighsInt row, HighsInt col, double val);
|
159
166
|
|
160
167
|
bool rowCoefficientsIntegral(HighsInt row, double scale) const;
|
@@ -163,6 +170,10 @@ class HPresolve {
|
|
163
170
|
|
164
171
|
bool isDualImpliedFree(HighsInt row) const;
|
165
172
|
|
173
|
+
void dualImpliedFreeGetRhsAndRowType(HighsInt row, double& rhs,
|
174
|
+
HighsPostsolveStack::RowType& rowType,
|
175
|
+
bool relaxRowDualBounds = false);
|
176
|
+
|
166
177
|
bool isImpliedIntegral(HighsInt col);
|
167
178
|
|
168
179
|
bool isImpliedInteger(HighsInt col);
|
@@ -176,19 +187,21 @@ class HPresolve {
|
|
176
187
|
bool checkFillin(HighsHashTable<HighsInt, HighsInt>& fillinCache,
|
177
188
|
HighsInt row, HighsInt col);
|
178
189
|
|
190
|
+
void reinsertEquation(HighsInt row);
|
191
|
+
|
179
192
|
#ifndef NDEBUG
|
180
193
|
void debugPrintRow(HighsPostsolveStack& postsolve_stack, HighsInt row);
|
181
194
|
#endif
|
182
195
|
|
183
196
|
HighsInt findNonzero(HighsInt row, HighsInt col);
|
184
197
|
|
185
|
-
|
186
|
-
|
187
|
-
|
198
|
+
bool okFromCSC(const std::vector<double>& Aval,
|
199
|
+
const std::vector<HighsInt>& Aindex,
|
200
|
+
const std::vector<HighsInt>& Astart);
|
188
201
|
|
189
|
-
|
190
|
-
|
191
|
-
|
202
|
+
bool okFromCSR(const std::vector<double>& ARval,
|
203
|
+
const std::vector<HighsInt>& ARindex,
|
204
|
+
const std::vector<HighsInt>& ARstart);
|
192
205
|
|
193
206
|
void toCSC(std::vector<double>& Aval, std::vector<HighsInt>& Aindex,
|
194
207
|
std::vector<HighsInt>& Astart);
|
@@ -259,11 +272,13 @@ class HPresolve {
|
|
259
272
|
|
260
273
|
public:
|
261
274
|
// for LP presolve
|
262
|
-
|
263
|
-
|
275
|
+
bool okSetInput(HighsLp& model_, const HighsOptions& options_,
|
276
|
+
const HighsInt presolve_reduction_limit,
|
277
|
+
HighsTimer* timer = nullptr);
|
264
278
|
|
265
279
|
// for MIP presolve
|
266
|
-
|
280
|
+
bool okSetInput(HighsMipSolver& mipsolver,
|
281
|
+
const HighsInt presolve_reduction_limit);
|
267
282
|
|
268
283
|
void setReductionLimit(size_t reductionLimit) {
|
269
284
|
this->reductionLimit = reductionLimit;
|
@@ -279,7 +294,8 @@ class HPresolve {
|
|
279
294
|
|
280
295
|
Result dominatedColumns(HighsPostsolveStack& postsolve_stack);
|
281
296
|
|
282
|
-
Result doubletonEq(HighsPostsolveStack& postsolve_stack, HighsInt row
|
297
|
+
Result doubletonEq(HighsPostsolveStack& postsolve_stack, HighsInt row,
|
298
|
+
HighsPostsolveStack::RowType rowType);
|
283
299
|
|
284
300
|
Result singletonRow(HighsPostsolveStack& postsolve_stack, HighsInt row);
|
285
301
|
|
@@ -291,9 +307,6 @@ class HPresolve {
|
|
291
307
|
|
292
308
|
Result colPresolve(HighsPostsolveStack& postsolve_stack, HighsInt col);
|
293
309
|
|
294
|
-
Result solveOneRowComponent(HighsPostsolveStack& postsolve_stack,
|
295
|
-
HighsInt row);
|
296
|
-
|
297
310
|
Result initialRowAndColPresolve(HighsPostsolveStack& postsolve_stack);
|
298
311
|
|
299
312
|
HighsModelStatus run(HighsPostsolveStack& postsolve_stack);
|
@@ -2,7 +2,7 @@
|
|
2
2
|
/* */
|
3
3
|
/* This file is part of the HiGHS linear optimization suite */
|
4
4
|
/* */
|
5
|
-
/* Written and engineered 2008-
|
5
|
+
/* Written and engineered 2008-2024 by Julian Hall, Ivet Galabova, */
|
6
6
|
/* Leona Gottwald and Michael Feldmeier */
|
7
7
|
/* */
|
8
8
|
/* Available as open-source under the MIT License */
|