From 4be1d4efa1928a6aefec10bd83da2e617df2aae4 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Mon, 28 Oct 2024 01:14:16 +0000 Subject: [PATCH 1/6] MAINT: Remove scipy-only file --- src/highs_options.cpp | 94 ------------------------------------------- src/meson.build | 14 ------- 2 files changed, 108 deletions(-) delete mode 100644 src/highs_options.cpp diff --git a/src/highs_options.cpp b/src/highs_options.cpp deleted file mode 100644 index c043b0d697..0000000000 --- a/src/highs_options.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include -#include - -#include -#include - -#include "lp_data/HighsOptions.h" - -namespace py = pybind11; - -bool log_to_console = false; -bool output_flag = true; - -// HighsLogOptions highs_log_options = {nullptr, &output_flag, &log_to_console, -// nullptr}; -HighsLogOptions highs_log_options = {}; - -class HighsOptionsManager { - public: - HighsOptionsManager() { - for (const auto& record : highs_options_.records) { - record_type_lookup_.emplace(record->name, record->type); - } - } - - const HighsOptions& get_highs_options() const { return highs_options_; } - - const std::map& get_record_type_lookup() const { - return record_type_lookup_; - } - - template - bool check_option(const std::string& name, const T value) { - std::lock_guard guard(highs_options_mutex); - HighsInt idx = 0; - const OptionStatus idx_status = getOptionIndex( - highs_log_options, name.c_str(), highs_options_.records, idx); - - if (OptionStatus::kOk != idx_status) { - return false; - } - - OptionRecordType& record = - static_cast(*highs_options_.records.at(idx)); - const OptionStatus check_status = - checkOptionValue(highs_log_options, record, value); - if (OptionStatus::kIllegalValue == check_status) { - return false; - } - - return true; - } - - private: - HighsOptions highs_options_; - std::mutex highs_options_mutex; - std::map record_type_lookup_; -}; - -PYBIND11_MODULE(_highs_options, m) { - py::class_(m, "HighsOptionsManager") - .def(py::init<>()) - .def("get_option_type", - [](const HighsOptionsManager& manager, const std::string& name) { - const auto& lookup = manager.get_record_type_lookup().find(name); - if (manager.get_record_type_lookup().end() == lookup) { - return -1; - } - return static_cast(lookup->second); - }) - .def("get_all_option_types", &HighsOptionsManager::get_record_type_lookup) - .def("get_highs_options_records", - [](const HighsOptionsManager& manager) { - std::vector records_names; - for (const auto& record : manager.get_highs_options().records) { - records_names.push_back(record->name); - } - return records_names; - }) - .def("check_int_option", - [](HighsOptionsManager& self, const std::string& name, int value) { - return self.check_option(name, value); - }) - .def( - "check_double_option", - [](HighsOptionsManager& self, const std::string& name, double value) { - return self.check_option(name, value); - }) - .def("check_string_option", [](HighsOptionsManager& self, - const std::string& name, - const std::string& value) { - return self.check_option(name, value); - }); -} diff --git a/src/meson.build b/src/meson.build index 56b83517ea..151690e952 100644 --- a/src/meson.build +++ b/src/meson.build @@ -399,9 +399,6 @@ if get_option('with_pybind11') highspy_cpp = files([ 'highs_bindings.cpp' ]) - highsoptions_cpp = files([ - 'highs_options.cpp' - ]) py.extension_module( '_highs', @@ -412,15 +409,4 @@ if get_option('with_pybind11') subdir: 'highspy', include_directories: _incdirs, ) - - py.extension_module( - '_highs_options', - sources : highsoptions_cpp, - dependencies: [pyb11_dep, highs_dep], - cpp_args: _args, - install: true, - subdir: 'highspy', - include_directories: _incdirs, - ) - endif From 209fe7c6c0a653be92ed03f384bc9ef5d28154c3 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Mon, 28 Oct 2024 01:29:20 +0000 Subject: [PATCH 2/6] MAINT: Cleanup unused vars and fix export enums --- src/highs_bindings.cpp | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/highs_bindings.cpp b/src/highs_bindings.cpp index 625ae68d2f..d2268106c0 100644 --- a/src/highs_bindings.cpp +++ b/src/highs_bindings.cpp @@ -8,6 +8,7 @@ #include "Highs.h" #include "lp_data/HighsCallback.h" +#include "simplex/SimplexConst.h" namespace py = pybind11; using namespace pybind11::literals; @@ -442,7 +443,6 @@ std::tuple highs_getCol( std::tuple, dense_array_t> highs_getColEntries(Highs* h, HighsInt col) { - double cost, lower, upper; HighsInt get_num_col; HighsInt get_num_nz; HighsInt col_ = static_cast(col); @@ -462,7 +462,7 @@ highs_getColEntries(Highs* h, HighsInt col) { std::tuple highs_getRow(Highs* h, HighsInt row) { - double cost, lower, upper; + double lower, upper; HighsInt get_num_row; HighsInt get_num_nz; HighsInt row_ = static_cast(row); @@ -473,7 +473,6 @@ std::tuple highs_getRow(Highs* h, std::tuple, dense_array_t> highs_getRowEntries(Highs* h, HighsInt row) { - double cost, lower, upper; HighsInt get_num_row; HighsInt get_num_nz; HighsInt row_ = static_cast(row); @@ -624,7 +623,7 @@ HighsStatus highs_setCallback( return h->setCallback((HighsCallbackFunctionType) nullptr, nullptr); else return h->setCallback( - [fn, data](int callbackType, const std::string& msg, + [fn](int callbackType, const std::string& msg, const HighsCallbackDataOut* dataOut, HighsCallbackDataIn* dataIn, void* d) { return fn(callbackType, msg, dataOut, dataIn, py::handle(reinterpret_cast(d))); @@ -633,20 +632,25 @@ HighsStatus highs_setCallback( } PYBIND11_MODULE(_core, m) { - // enum classes + // To keep a smaller diff, for reviewers, the declarations are not moved, but + // keep in mind: + // C++ enum classes :: don't need .export_values() + // C++ enums, need .export_values() + // Quoting [1]: + // "The enum_::export_values() function exports the enum entries into the + // parent scope, which should be skipped for newer C++11-style strongly typed + // enums." + // [1]: https://pybind11.readthedocs.io/en/stable/classes.html py::enum_(m, "ObjSense") .value("kMinimize", ObjSense::kMinimize) .value("kMaximize", ObjSense::kMaximize); - // // .export_values(); py::enum_(m, "MatrixFormat") .value("kColwise", MatrixFormat::kColwise) .value("kRowwise", MatrixFormat::kRowwise) .value("kRowwisePartitioned", MatrixFormat::kRowwisePartitioned); - // // .export_values(); py::enum_(m, "HessianFormat") .value("kTriangular", HessianFormat::kTriangular) .value("kSquare", HessianFormat::kSquare); - // .export_values(); py::enum_(m, "SolutionStatus") .value("kSolutionStatusNone", SolutionStatus::kSolutionStatusNone) .value("kSolutionStatusInfeasible", @@ -677,7 +681,6 @@ PYBIND11_MODULE(_core, m) { .value("kSolutionLimit", HighsModelStatus::kSolutionLimit) .value("kInterrupt", HighsModelStatus::kInterrupt) .value("kMemoryLimit", HighsModelStatus::kMemoryLimit); - // .export_values(); py::enum_(m, "HighsPresolveStatus") .value("kNotPresolved", HighsPresolveStatus::kNotPresolved) .value("kNotReduced", HighsPresolveStatus::kNotReduced) @@ -689,59 +692,52 @@ PYBIND11_MODULE(_core, m) { .value("kTimeout", HighsPresolveStatus::kTimeout) .value("kNullError", HighsPresolveStatus::kNullError) .value("kOptionsError", HighsPresolveStatus::kOptionsError); - // .export_values(); py::enum_(m, "HighsBasisStatus") .value("kLower", HighsBasisStatus::kLower) .value("kBasic", HighsBasisStatus::kBasic) .value("kUpper", HighsBasisStatus::kUpper) .value("kZero", HighsBasisStatus::kZero) .value("kNonbasic", HighsBasisStatus::kNonbasic); - // .export_values(); py::enum_(m, "HighsVarType") .value("kContinuous", HighsVarType::kContinuous) .value("kInteger", HighsVarType::kInteger) .value("kSemiContinuous", HighsVarType::kSemiContinuous) .value("kSemiInteger", HighsVarType::kSemiInteger); - // .export_values(); py::enum_(m, "HighsOptionType") .value("kBool", HighsOptionType::kBool) .value("kInt", HighsOptionType::kInt) .value("kDouble", HighsOptionType::kDouble) .value("kString", HighsOptionType::kString); - // .export_values(); py::enum_(m, "HighsInfoType") .value("kInt64", HighsInfoType::kInt64) .value("kInt", HighsInfoType::kInt) .value("kDouble", HighsInfoType::kDouble); - // .export_values(); py::enum_(m, "HighsStatus") .value("kError", HighsStatus::kError) .value("kOk", HighsStatus::kOk) .value("kWarning", HighsStatus::kWarning); - // .export_values(); py::enum_(m, "HighsLogType") .value("kInfo", HighsLogType::kInfo) .value("kDetailed", HighsLogType::kDetailed) .value("kVerbose", HighsLogType::kVerbose) .value("kWarning", HighsLogType::kWarning) .value("kError", HighsLogType::kError); - // .export_values(); py::enum_(m, "IisStrategy") .value("kIisStrategyMin", IisStrategy::kIisStrategyMin) .value("kIisStrategyFromLpRowPriority", IisStrategy::kIisStrategyFromLpRowPriority) .value("kIisStrategyFromLpColPriority", IisStrategy::kIisStrategyFromLpColPriority) - .value("kIisStrategyMax", IisStrategy::kIisStrategyMax); - // .export_values(); + .value("kIisStrategyMax", IisStrategy::kIisStrategyMax) + .export_values(); py::enum_(m, "IisBoundStatus") .value("kIisBoundStatusDropped", IisBoundStatus::kIisBoundStatusDropped) .value("kIisBoundStatusNull", IisBoundStatus::kIisBoundStatusNull) .value("kIisBoundStatusFree", IisBoundStatus::kIisBoundStatusFree) .value("kIisBoundStatusLower", IisBoundStatus::kIisBoundStatusLower) .value("kIisBoundStatusUpper", IisBoundStatus::kIisBoundStatusUpper) - .value("kIisBoundStatusBoxed", IisBoundStatus::kIisBoundStatusBoxed); - // .export_values(); + .value("kIisBoundStatusBoxed", IisBoundStatus::kIisBoundStatusBoxed) + .export_values(); // Classes py::class_(m, "HighsSparseMatrix") .def(py::init<>()) @@ -1158,7 +1154,7 @@ PYBIND11_MODULE(_core, m) { .value("kSimplexStrategyPrimal", SimplexStrategy::kSimplexStrategyPrimal) .value("kSimplexStrategyMax", SimplexStrategy::kSimplexStrategyMax) .value("kSimplexStrategyNum", SimplexStrategy::kSimplexStrategyNum) - .export_values(); // needed since it isn't an enum class + .export_values(); py::enum_(simplex_constants, "SimplexUnscaledSolutionStrategy") .value( From 646cd56278af397b169e13eb60942e1ca92ae60b Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Mon, 28 Oct 2024 01:44:59 +0000 Subject: [PATCH 3/6] BLD: Rework with do_install for meson --- meson_options.txt | 3 +++ src/meson.build | 52 +++++++++++++++++++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index 9f763abd82..d7e7d13dc2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -29,3 +29,6 @@ option('with_tests', option('with_pybind11', type : 'boolean', value : false) +option('do_install', + type : 'boolean', + value : true) diff --git a/src/meson.build b/src/meson.build index 151690e952..f7e99e510a 100644 --- a/src/meson.build +++ b/src/meson.build @@ -317,6 +317,9 @@ if get_option('default_library') == 'static' symbol_visibility = 'inlineshidden' endif +do_install = get_option('do_install') + +if not get_option('with_pybind11') highslib = library('highs', highslib_srcs, dependencies: _deps, @@ -325,7 +328,13 @@ highslib = library('highs', include_directories: _incdirs, gnu_symbol_visibility: symbol_visibility, pic: true, - install: true) + install: do_install) + +highs_dep = declare_dependency(link_with: highslib, + dependencies: _deps, + include_directories: _incdirs, + ) +endif # --------------- Interfaces @@ -342,7 +351,7 @@ if get_option('with_fortran') link_with: highslib, include_directories: _incdirs, pic: true, - install: true) + install: do_install) endif # C# @@ -358,7 +367,7 @@ if get_option('with_csharp') link_with: highslib, include_directories: _incdirs, pic: true, - install: true) + install: do_install) endif # C @@ -378,35 +387,56 @@ if get_option('with_c') link_with: highslib, include_directories: _incdirs, pic: true, - install: true) + install: do_install) endif -highs_dep = declare_dependency(link_with: highslib, - dependencies: _deps, - include_directories: _incdirs, - ) - if get_option('with_pybind11') py = import('python').find_installation(pure: false) + highslib = library('highs', + highslib_srcs, + dependencies: _deps, + cpp_args: _args, + c_args: _args, + include_directories: _incdirs, + gnu_symbol_visibility: symbol_visibility, + pic: true, + install: do_install, + install_dir: py.get_install_dir() / 'highspy') + + highs_dep = declare_dependency(link_with: highslib, + dependencies: _deps, + include_directories: _incdirs, + ) + _deps += highs_dep pyb11_dep = [ # py_dep is auto-added for Python >= 3.9, so it can be dropped here when # that is the minimum supported Python version py.dependency(), dependency('pybind11') ] + _deps += pyb11_dep highspy_cpp = files([ 'highs_bindings.cpp' ]) py.extension_module( - '_highs', + '_core', sources : highspy_cpp, dependencies: [pyb11_dep, highs_dep], cpp_args: _args, - install: true, + install: do_install, subdir: 'highspy', include_directories: _incdirs, ) + + highs_py_srcs = files( + 'highspy/__init__.py', + 'highspy/highs.py',) + + py.install_sources(highs_py_srcs, + pure: false, + subdir: 'highspy' + ) endif From 0a6766ca97f40d2fa01f00f9cccfc5db4cda32fe Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Mon, 28 Oct 2024 01:46:13 +0000 Subject: [PATCH 4/6] BLD: Unconditionally use c wrapper --- check/meson.build | 15 ++++++++------- meson_options.txt | 3 --- src/meson.build | 21 +-------------------- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/check/meson.build b/check/meson.build index 1cf8e5663d..95f6d77736 100644 --- a/check/meson.build +++ b/check/meson.build @@ -71,10 +71,11 @@ foreach test : test_array ) endforeach -if get_option('with_c') - test('test_capi', - executable('capi_unit_tests', 'TestCAPI.c', - include_directories: _incdirs, - link_with : highslib, - )) -endif + +test('test_capi', + executable('capi_unit_tests', + sources: ['TestCAPI.c', highs_conf_file], + include_directories: _incdirs, + link_with : highslib, + ) + ) diff --git a/meson_options.txt b/meson_options.txt index d7e7d13dc2..1964eabef6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -13,9 +13,6 @@ option('with_fortran', option('with_csharp', type : 'boolean', value : false) -option('with_c', - type : 'boolean', - value : false) option('debug_sol', type: 'boolean', value: false) diff --git a/src/meson.build b/src/meson.build index f7e99e510a..5b56b4c089 100644 --- a/src/meson.build +++ b/src/meson.build @@ -194,6 +194,7 @@ _ipx_srcs = [ _srcs = [ '../extern/filereaderlp/reader.cpp', + 'interfaces/highs_c_api.cpp', 'io/Filereader.cpp', 'io/FilereaderLp.cpp', 'io/FilereaderEms.cpp', @@ -370,26 +371,6 @@ if get_option('with_csharp') install: do_install) endif -# C -if get_option('with_c') - add_languages('c', required: true) - if not is_windows - m_dep = cppc.find_library('m', required: false) - _deps += m_dep - endif - _c_src = [ - 'interfaces/highs_c_api.cpp', - ] - c_lib = library('HighsC', - _c_src, - dependencies: _deps, - cpp_args: _args, - link_with: highslib, - include_directories: _incdirs, - pic: true, - install: do_install) -endif - if get_option('with_pybind11') py = import('python').find_installation(pure: false) From 9b647a81fd1378073fb837f8cb3894f24384e4af Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Mon, 28 Oct 2024 01:48:19 +0000 Subject: [PATCH 5/6] BLD: Rework and update library files --- src/meson.build | 126 +++++++++++++++++++++++++----------------------- 1 file changed, 65 insertions(+), 61 deletions(-) diff --git a/src/meson.build b/src/meson.build index 5b56b4c089..e61d88af82 100644 --- a/src/meson.build +++ b/src/meson.build @@ -117,45 +117,45 @@ _incdirs += include_directories('.') # --------------------- Libraries _cupdlp_srcs = [ - 'pdlp/cupdlp/cupdlp_solver.c', - 'pdlp/cupdlp/cupdlp_scaling_cuda.c', - 'pdlp/cupdlp/cupdlp_restart.c', - 'pdlp/cupdlp/cupdlp_proj.c', - 'pdlp/cupdlp/cupdlp_linalg.c', 'pdlp/cupdlp/cupdlp_cs.c', - 'pdlp/cupdlp/cupdlp_utils.c', + 'pdlp/cupdlp/cupdlp_linalg.c', + 'pdlp/cupdlp/cupdlp_proj.c', + 'pdlp/cupdlp/cupdlp_restart.c', + 'pdlp/cupdlp/cupdlp_scaling_cuda.c', + 'pdlp/cupdlp/cupdlp_solver.c', 'pdlp/cupdlp/cupdlp_step.c', + 'pdlp/cupdlp/cupdlp_utils.c', ] _basiclu_srcs = [ 'ipm/basiclu/basiclu_factorize.c', - 'ipm/basiclu/basiclu_solve_dense.c', - 'ipm/basiclu/lu_build_factors.c', - 'ipm/basiclu/lu_factorize_bump.c', - 'ipm/basiclu/lu_initialize.c', - 'ipm/basiclu/lu_markowitz.c', - 'ipm/basiclu/lu_setup_bump.c', - 'ipm/basiclu/lu_solve_sparse.c', 'ipm/basiclu/basiclu_get_factors.c', + 'ipm/basiclu/basiclu_initialize.c', + 'ipm/basiclu/basiclu_object.c', + 'ipm/basiclu/basiclu_solve_dense.c', 'ipm/basiclu/basiclu_solve_for_update.c', + 'ipm/basiclu/basiclu_solve_sparse.c', + 'ipm/basiclu/basiclu_update.c', + 'ipm/basiclu/lu_build_factors.c', 'ipm/basiclu/lu_condest.c', + 'ipm/basiclu/lu_dfs.c', + 'ipm/basiclu/lu_factorize_bump.c', 'ipm/basiclu/lu_file.c', + 'ipm/basiclu/lu_garbage_perm.c', + 'ipm/basiclu/lu_initialize.c', 'ipm/basiclu/lu_internal.c', + 'ipm/basiclu/lu_markowitz.c', 'ipm/basiclu/lu_matrix_norm.c', - 'ipm/basiclu/lu_singletons.c', - 'ipm/basiclu/lu_solve_symbolic.c', - 'ipm/basiclu/lu_update.c', - 'ipm/basiclu/basiclu_initialize.c', - 'ipm/basiclu/basiclu_solve_sparse.c', 'ipm/basiclu/lu_pivot.c', - 'ipm/basiclu/lu_solve_dense.c', - 'ipm/basiclu/lu_solve_triangular.c', - 'ipm/basiclu/basiclu_object.c', - 'ipm/basiclu/basiclu_update.c', - 'ipm/basiclu/lu_dfs.c', - 'ipm/basiclu/lu_garbage_perm.c', 'ipm/basiclu/lu_residual_test.c', + 'ipm/basiclu/lu_setup_bump.c', + 'ipm/basiclu/lu_singletons.c', + 'ipm/basiclu/lu_solve_dense.c', 'ipm/basiclu/lu_solve_for_update.c', + 'ipm/basiclu/lu_solve_sparse.c', + 'ipm/basiclu/lu_solve_symbolic.c', + 'ipm/basiclu/lu_solve_triangular.c', + 'ipm/basiclu/lu_update.c', ] _ipx_srcs = [ @@ -196,84 +196,85 @@ _srcs = [ '../extern/filereaderlp/reader.cpp', 'interfaces/highs_c_api.cpp', 'io/Filereader.cpp', - 'io/FilereaderLp.cpp', 'io/FilereaderEms.cpp', + 'io/FilereaderLp.cpp', 'io/FilereaderMps.cpp', - 'io/HighsIO.cpp', 'io/HMPSIO.cpp', 'io/HMpsFF.cpp', + 'io/HighsIO.cpp', 'io/LoadOptions.cpp', + 'ipm/IpxWrapper.cpp', 'lp_data/Highs.cpp', 'lp_data/HighsCallback.cpp', 'lp_data/HighsDebug.cpp', 'lp_data/HighsIis.cpp', + 'lp_data/HighsDeprecated.cpp', 'lp_data/HighsInfo.cpp', 'lp_data/HighsInfoDebug.cpp', - 'lp_data/HighsDeprecated.cpp', 'lp_data/HighsInterface.cpp', 'lp_data/HighsLp.cpp', 'lp_data/HighsLpUtils.cpp', 'lp_data/HighsModelUtils.cpp', + 'lp_data/HighsOptions.cpp', 'lp_data/HighsRanging.cpp', 'lp_data/HighsSolution.cpp', 'lp_data/HighsSolutionDebug.cpp', 'lp_data/HighsSolve.cpp', 'lp_data/HighsStatus.cpp', - 'lp_data/HighsOptions.cpp', - 'mip/HighsMipSolver.cpp', - 'mip/HighsMipSolverData.cpp', + 'mip/HighsCliqueTable.cpp', + 'mip/HighsConflictPool.cpp', + 'mip/HighsCutGeneration.cpp', + 'mip/HighsCutPool.cpp', + 'mip/HighsDebugSol.cpp', 'mip/HighsDomain.cpp', 'mip/HighsDynamicRowMatrix.cpp', + 'mip/HighsGFkSolve.cpp', + 'mip/HighsImplications.cpp', + 'mip/HighsLpAggregator.cpp', 'mip/HighsLpRelaxation.cpp', - 'mip/HighsSeparation.cpp', - 'mip/HighsSeparator.cpp', - 'mip/HighsTableauSeparator.cpp', + 'mip/HighsMipSolver.cpp', + 'mip/HighsMipSolverData.cpp', 'mip/HighsModkSeparator.cpp', + 'mip/HighsNodeQueue.cpp', + 'mip/HighsObjectiveFunction.cpp', 'mip/HighsPathSeparator.cpp', - 'mip/HighsCutGeneration.cpp', - 'mip/HighsSearch.cpp', - 'mip/HighsConflictPool.cpp', - 'mip/HighsCutPool.cpp', - 'mip/HighsCliqueTable.cpp', - 'mip/HighsGFkSolve.cpp', - 'mip/HighsTransformedLp.cpp', - 'mip/HighsLpAggregator.cpp', - 'mip/HighsDebugSol.cpp', - 'mip/HighsImplications.cpp', 'mip/HighsPrimalHeuristics.cpp', 'mip/HighsPseudocost.cpp', 'mip/HighsRedcostFixing.cpp', - 'mip/HighsNodeQueue.cpp', - 'mip/HighsObjectiveFunction.cpp', + 'mip/HighsSearch.cpp', + 'mip/HighsSeparation.cpp', + 'mip/HighsSeparator.cpp', + 'mip/HighsTableauSeparator.cpp', + 'mip/HighsTransformedLp.cpp', 'model/HighsHessian.cpp', 'model/HighsHessianUtils.cpp', 'model/HighsModel.cpp', 'parallel/HighsTaskExecutor.cpp', + 'pdlp/CupdlpWrapper.cpp', + 'presolve/HPresolve.cpp', + 'presolve/HPresolveAnalysis.cpp', + 'presolve/HighsPostsolveStack.cpp', + 'presolve/HighsSymmetry.cpp', 'presolve/ICrash.cpp', 'presolve/ICrashUtil.cpp', 'presolve/ICrashX.cpp', - 'presolve/HighsPostsolveStack.cpp', - 'presolve/HighsSymmetry.cpp', - 'presolve/HPresolve.cpp', - 'presolve/HPresolveAnalysis.cpp', 'presolve/PresolveComponent.cpp', 'qpsolver/a_asm.cpp', 'qpsolver/a_quass.cpp', 'qpsolver/basis.cpp', + 'qpsolver/perturbation.cpp', 'qpsolver/quass.cpp', 'qpsolver/ratiotest.cpp', 'qpsolver/scaling.cpp', - 'qpsolver/perturbation.cpp', 'simplex/HEkk.cpp', 'simplex/HEkkControl.cpp', 'simplex/HEkkDebug.cpp', - 'simplex/HEkkPrimal.cpp', 'simplex/HEkkDual.cpp', + 'simplex/HEkkDualMulti.cpp', 'simplex/HEkkDualRHS.cpp', 'simplex/HEkkDualRow.cpp', - 'simplex/HEkkDualMulti.cpp', 'simplex/HEkkInterface.cpp', - 'simplex/HighsSimplexAnalysis.cpp', + 'simplex/HEkkPrimal.cpp', 'simplex/HSimplex.cpp', 'simplex/HSimplexDebug.cpp', 'simplex/HSimplexNla.cpp', @@ -281,6 +282,7 @@ _srcs = [ 'simplex/HSimplexNlaFreeze.cpp', 'simplex/HSimplexNlaProductForm.cpp', 'simplex/HSimplexReport.cpp', + 'simplex/HighsSimplexAnalysis.cpp', 'test/DevKkt.cpp', 'test/KktCh2.cpp', 'util/HFactor.cpp', @@ -288,6 +290,8 @@ _srcs = [ 'util/HFactorExtend.cpp', 'util/HFactorRefactor.cpp', 'util/HFactorUtils.cpp', + 'util/HSet.cpp', + 'util/HVectorBase.cpp', 'util/HighsHash.cpp', 'util/HighsLinearSumBounds.cpp', 'util/HighsMatrixPic.cpp', @@ -295,19 +299,15 @@ _srcs = [ 'util/HighsSort.cpp', 'util/HighsSparseMatrix.cpp', 'util/HighsUtils.cpp', - 'util/HSet.cpp', - 'util/HVectorBase.cpp', 'util/stringutil.cpp', ] highslib_srcs = [ highs_conf_file, - _srcs, - 'ipm/IpxWrapper.cpp', - 'pdlp/CupdlpWrapper.cpp', - _cupdlp_srcs, - _basiclu_srcs, - _ipx_srcs + files(_srcs), + files(_cupdlp_srcs), + files(_basiclu_srcs), + files(_ipx_srcs), ] @@ -371,6 +371,10 @@ if get_option('with_csharp') install: do_install) endif +highspy_cpp = files([ + 'highs_bindings.cpp' +]) + if get_option('with_pybind11') py = import('python').find_installation(pure: false) From acf190d03b71490501db4d64e36b6e58449cf4a4 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Mon, 28 Oct 2024 02:22:02 +0000 Subject: [PATCH 6/6] ENH: Add missing enums to highspy Following the C++ API naming conventions. --- src/highs_bindings.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/highs_bindings.cpp b/src/highs_bindings.cpp index d2268106c0..e1b01e2f0b 100644 --- a/src/highs_bindings.cpp +++ b/src/highs_bindings.cpp @@ -738,6 +738,14 @@ PYBIND11_MODULE(_core, m) { .value("kIisBoundStatusUpper", IisBoundStatus::kIisBoundStatusUpper) .value("kIisBoundStatusBoxed", IisBoundStatus::kIisBoundStatusBoxed) .export_values(); + py::enum_(m, "HighsDebugLevel") + .value("kHighsDebugLevelNone", HighsDebugLevel::kHighsDebugLevelNone) + .value("kHighsDebugLevelCheap", HighsDebugLevel::kHighsDebugLevelCheap) + .value("kHighsDebugLevelCostly", HighsDebugLevel::kHighsDebugLevelCostly) + .value("kHighsDebugLevelExpensive", HighsDebugLevel::kHighsDebugLevelExpensive) + .value("kHighsDebugLevelMin", HighsDebugLevel::kHighsDebugLevelMin) + .value("kHighsDebugLevelMax", HighsDebugLevel::kHighsDebugLevelMax) + .export_values(); // Classes py::class_(m, "HighsSparseMatrix") .def(py::init<>()) @@ -1155,6 +1163,22 @@ PYBIND11_MODULE(_core, m) { .value("kSimplexStrategyMax", SimplexStrategy::kSimplexStrategyMax) .value("kSimplexStrategyNum", SimplexStrategy::kSimplexStrategyNum) .export_values(); + py::enum_(simplex_constants, "SimplexCrashStrategy") + .value("kSimplexCrashStrategyMin", SimplexCrashStrategy::kSimplexCrashStrategyMin) + .value("kSimplexCrashStrategyOff", SimplexCrashStrategy::kSimplexCrashStrategyOff) + .value("kSimplexCrashStrategyLtssfK", SimplexCrashStrategy::kSimplexCrashStrategyLtssfK) + .value("kSimplexCrashStrategyLtssf", SimplexCrashStrategy::kSimplexCrashStrategyLtssf) + .value("kSimplexCrashStrategyBixby", SimplexCrashStrategy::kSimplexCrashStrategyBixby) + .value("kSimplexCrashStrategyLtssfPri", SimplexCrashStrategy::kSimplexCrashStrategyLtssfPri) + .value("kSimplexCrashStrategyLtsfK", SimplexCrashStrategy::kSimplexCrashStrategyLtsfK) + .value("kSimplexCrashStrategyLtsfPri", SimplexCrashStrategy::kSimplexCrashStrategyLtsfPri) + .value("kSimplexCrashStrategyLtsf", SimplexCrashStrategy::kSimplexCrashStrategyLtsf) + .value("kSimplexCrashStrategyBixbyNoNonzeroColCosts", + SimplexCrashStrategy::kSimplexCrashStrategyBixbyNoNonzeroColCosts) + .value("kSimplexCrashStrategyBasic", SimplexCrashStrategy::kSimplexCrashStrategyBasic) + .value("kSimplexCrashStrategyTestSing", SimplexCrashStrategy::kSimplexCrashStrategyTestSing) + .value("kSimplexCrashStrategyMax", SimplexCrashStrategy::kSimplexCrashStrategyMax) + .export_values(); py::enum_(simplex_constants, "SimplexUnscaledSolutionStrategy") .value(