Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Meson highs 1.7.0 #1850

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4a09183
Compute bound differences using HighsCDouble
fwesselm Jun 30, 2024
3681efa
Use tolerances when rounding in postsolve
fwesselm Jun 30, 2024
0f52c80
Merge branch 'latest' of https://github.com/ERGO-Code/HiGHS into fixN…
fwesselm Jul 1, 2024
a231075
Merge branch 'latest' of https://github.com/ERGO-Code/HiGHS into roun…
fwesselm Jul 1, 2024
9a98a6f
Minor change
fwesselm Jul 1, 2024
97f27cb
Merge branch 'latest' of https://github.com/ERGO-Code/HiGHS into fixN…
fwesselm Jul 1, 2024
60d2328
Merge pull request #1829 from fwesselm/fixNeos4
jajhall Jul 1, 2024
564e722
Merge branch 'latest' of https://github.com/ERGO-Code/HiGHS into roun…
fwesselm Jul 1, 2024
6e2fc7d
Merge pull request #1832 from fwesselm/roundWithTolsPostsolve
jajhall Jul 9, 2024
600b069
Added int64_t mip_total_lp_iterations to HighsCallbackDataOut and mod…
jajhall Jul 9, 2024
66849ca
Reset FEATURES.md and added comment on fix-1814
jajhall Jul 9, 2024
3ccae38
Merge pull request #1839 from ERGO-Code/fix-1814
jajhall Jul 9, 2024
2d078b0
Introduced highsFprintfString to replace fprintf(file so that solutio…
jajhall Jul 9, 2024
0c6b253
Replaced fprintf(file in HighsModelUtils.cpp by stringstreams and cal…
jajhall Jul 10, 2024
502f0ac
Merge pull request #1840 from ERGO-Code/fix-1811
jajhall Jul 10, 2024
abcce09
Identified that HighsMipSolverData::checkLimits is not called for a l…
jajhall Jul 10, 2024
6096006
Added some time reporting to HighsMipSolver::run() when not submip
jajhall Jul 10, 2024
11e5385
Merge pull request #1841 from ERGO-Code/fix-1813
jajhall Jul 10, 2024
8d269a2
Added setSolution for sparse primal solution and test to check-set-mi…
jajhall Jul 11, 2024
7fd28a1
Now clearing solution when completeSolutionFromDiscreteAssignment dec…
jajhall Jul 14, 2024
39569be
Added highs_setSolution and highs_setSparseSolution to highs_bindings
jajhall Jul 14, 2024
faeb3f3
Formatted HighsSolution::hasUndefined()
jajhall Jul 14, 2024
6e9f9bd
Added Highs_setSparseSolution to C API
jajhall Jul 14, 2024
3c34353
Now using solution_.hasUndefined(); updated FEATURES.md and silenced …
jajhall Jul 14, 2024
08646bc
Merge pull request #1843 from ERGO-Code/fix-1808
jajhall Jul 14, 2024
cf3b536
MAINT: Silence -Wsign-compare
HaoZeke May 4, 2024
cb2556d
MAINT: Silence -Wmaybe-uninitialized
HaoZeke May 4, 2024
d226a6d
MAINT: Silence -Wcomment
HaoZeke May 4, 2024
e724f52
BLD: Reduce the silenced warnings
HaoZeke May 4, 2024
9407f71
BLD: Rework to harmonize with CMake
HaoZeke May 4, 2024
324f5c1
BLD: Rework and sort-lines in meson
HaoZeke May 4, 2024
749309b
BLD: Setup the newer python library in meson
HaoZeke May 5, 2024
d8fef70
MAINT: Switch back to meson-python
HaoZeke May 5, 2024
8ef97cb
MAINT: Lint and cleanup excess enum exports
HaoZeke May 5, 2024
c51941f
MAINT,BLD: Finish removing -Dwith_c for meson
HaoZeke May 5, 2024
fbf7d73
CI: Rework to have dependencies when building
HaoZeke May 5, 2024
0a4ed1e
BLD: Add pack cibuildwheel config
HaoZeke May 5, 2024
56a4335
BLD: Link with highs explicitly
HaoZeke May 5, 2024
f5c14c5
CI: Test only highs/tests/
HaoZeke May 5, 2024
62ab499
BLD: Fix C_API test
HaoZeke May 5, 2024
251590a
MAINT: Try to rebuild correctly on WIN
HaoZeke May 19, 2024
c01795e
MAINT: Remove unused build date
HaoZeke May 19, 2024
a0390a5
BLD,TMP: Try windows again
HaoZeke May 19, 2024
12ba85a
BLD: Rework meson slightly
HaoZeke Jul 14, 2024
7ed8ca2
BLD: Revert back to scikit-build
HaoZeke Jul 14, 2024
1ca6719
BLD: Export python sources via variable
HaoZeke Jul 20, 2024
8dc335e
BIND: Use module local scope for exports
HaoZeke Jul 20, 2024
cc65280
MAINT: Rework options for scipy
HaoZeke Jul 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 28 additions & 26 deletions .github/workflows/build-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ jobs:

- name: Build sdist
run: |
python3 -m pip install build
python3 -m pip install build --user
python3 -m build --sdist

- name: Install sdist
run: |
ls dist
python3 -m pip install meson-python meson pybind11 ninja --user
python3 -m pip install dist/*.tar.gz

- name: Test highspy
run: |
python3 -m pip install pytest
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pip install pytest --user
python3 -m pytest $GITHUB_WORKSPACE/tests

build_sdist_mac:
runs-on: macos-latest
Expand All @@ -34,18 +35,19 @@ jobs:

- name: Build sdist
run: |
python3 -m pip install build --break-system-packages
python3 -m pip install build --user --break-system-packages
python3 -m build --sdist

- name: Install sdist
run: |
ls dist
python3 -m pip install dist/*.tar.gz --break-system-packages
python3 -m pip install meson-python meson pybind11 ninja --user --break-system-packages
python3 -m pip install dist/*.tar.gz --user --break-system-packages

- name: Test highspy
run: |
python3 -m pip install pytest --break-system-packages
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pip install pytest --user --break-system-packages
python3 -m pytest $GITHUB_WORKSPACE/tests

build_sdist_win:
runs-on: windows-2019
Expand All @@ -59,19 +61,20 @@ jobs:

- name: Build sdist
run: |
python -m pip install build
python -m pip install build --user
python -m build --sdist

- name: Install sdist
run: |
python3 -m pip install meson-python meson pybind11 ninja --user
$item = Get-ChildItem dist
python -m pip install "$item"
python -m pip install "$item" --user
python -c "import highspy; print(dir(highspy))"

- name: Test highspy
run: |
python -m pip install pytest
python -m pytest
python -m pip install pytest --user
python -m pytest tests

build_wheel_linux:
# ubuntu 22 has a latest version of cmake, but setup-python
Expand Down Expand Up @@ -103,7 +106,7 @@ jobs:
- name: Test highspy
run: |
python3 -m pip install pytest
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pytest $GITHUB_WORKSPACE/tests


# macos 12 is Intel
Expand All @@ -122,20 +125,20 @@ jobs:

- name: Build wheel
run: |
python3 -m pip install cibuildwheel
python3 -m pip install cibuildwheel --break-system-packages
python3 -m cibuildwheel --only cp311-macosx_x86_64 $GITHUB_WORKSPACE

- name: Install wheel
run: |
ls wheelhouse
python3 --version
python3 -m pip install wheelhouse/*.whl
python3 -m pip install wheelhouse/*.whl --break-system-packages
python3 -c "import highspy; print(dir(highspy))"

- name: Test highspy
run: |
python3 -m pip install pytest
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pip install pytest --break-system-packages
python3 -m pytest $GITHUB_WORKSPACE/tests

# macos 13 is Intel
build_wheel_macos_13:
Expand All @@ -153,20 +156,20 @@ jobs:

- name: Build wheel
run: |
python3 -m pip install cibuildwheel
python3 -m pip install cibuildwheel --break-system-packages
python3 -m cibuildwheel --only cp311-macosx_x86_64 $GITHUB_WORKSPACE

- name: Install wheel
run: |
ls wheelhouse
python3 --version
python3 -m pip install wheelhouse/*.whl
python3 -m pip install wheelhouse/*.whl --break-system-packages
python3 -c "import highspy; print(dir(highspy))"

- name: Test highspy
run: |
python3 -m pip install pytest
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pip install pytest --break-system-packages
python3 -m pytest $GITHUB_WORKSPACE/tests

# macos 14 is M1 (beta)
build_wheel_macos_14:
Expand All @@ -184,20 +187,20 @@ jobs:

- name: Build wheel
run: |
python3 -m pip install cibuildwheel
python3 -m pip install cibuildwheel --break-system-packages
python3 -m cibuildwheel --only cp311-macosx_arm64 $GITHUB_WORKSPACE

- name: Install wheel
run: |
ls wheelhouse
python3 --version
python3 -m pip install wheelhouse/*.whl
python3 -m pip install wheelhouse/*.whl --break-system-packages
python3 -c "import highspy; print(dir(highspy))"

- name: Test highspy
run: |
python3 -m pip install pytest
python3 -m pytest $GITHUB_WORKSPACE
python3 -m pip install pytest --break-system-packages
python3 -m pytest $GITHUB_WORKSPACE/tests

build_wheel_windows:
runs-on: windows-2019
Expand All @@ -224,5 +227,4 @@ jobs:
- name: Test highspy
run: |
python -m pip install pytest
python -m pytest

python -m pytest tests
32 changes: 27 additions & 5 deletions .github/workflows/test-python-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,34 @@ jobs:
python-version: ${{ matrix.python }}

- name: Install build dependencies
run: python -m pip install numpy setuptools wheel pytest

- name: Test python install
run: python -m pip install numpy setuptools wheel pytest meson ninja delvewheel build
- name: Build project
run: |
python -m pip install .
pytest
meson setup bbdir --prefix=${{ github.workspace }}/local_install
meson compile -C bbdir

- name: Install project to custom directory
run: meson install -C bbdir

- name: Build Python package
run: python -m build

- name: Repair the wheel
shell: pwsh
run: |
$installedPath = "${{ github.workspace }}/local_install"
$wheels = Get-ChildItem -Path dist -Filter *.whl
foreach ($wheel in $wheels) {
delvewheel repair $wheel.FullName --add-path "$installedPath/bin;$installedPath/lib" -w repaired_wheels
}

- name: Install the repaired wheel
run: |
$wheels = Get-ChildItem -Path repaired_wheels -Filter *.whl
foreach ($wheel in $wheels){
pip install $wheel.FullName
}

- name: Test Python Examples
run: |
Expand Down
19 changes: 5 additions & 14 deletions FEATURES.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
## Build changes

The python wrapper highspy is now available for aarch64 on manylinux
This allows highs to be run through Python on AWS arm64

Bug fix for fortran on macOS

## Code changes

The accessor function Highs_getCallbackDataOutItem in the C API means
that `pdlp_iteration_count` can be moved back to where it was inserted
into the `HighsCallbackDataOut` struct in v1.7.0, which broke the C
API. This fixes #1812
Added `int64_t mip_total_lp_iterations` to `HighsCallbackDataOut` and modified accessor function

`Highs::writeSolution` and `Highs::writeBasis` now being done via `HighsIO` logging, so can be redirected to logging callback.

Some duplicate code has been eliminated from the MIP solver, and
modifications made to eliminate compiler warnings
Introduced `const double kHighsUndefined` as value of undefined values in a user solution. It's equal to `kHighsInf`

Declaration of the (deprecated) method `char* highsCompilationDate()`
has been corrected
Added `Highs::setSolution(const HighsInt num_entries, const HighsInt* index, const double* value);` to allow a sparse primal solution to be defined.

Fixed bug when describing integrality status during the human-readable solution write

31 changes: 24 additions & 7 deletions check/TestCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ HighsCallbackFunctionType userInterruptCallback =
REQUIRE(local_callback_data == kUserCallbackNoData);
}
if (callback_type == kCallbackLogging) {
if (dev_run)
printf("userInterruptCallback(type %2d; data %2d): %s",
callback_type, local_callback_data, message.c_str());
if (dev_run) printf("Callback: %s", message.c_str());
// printf("userInterruptCallback(type %2d; data %2d): %s",
// callback_type, local_callback_data,
// message.c_str());
} else if (callback_type == kCallbackSimplexInterrupt) {
if (dev_run)
printf(
Expand Down Expand Up @@ -190,12 +191,13 @@ std::function<void(int, const std::string&, const HighsCallbackDataOut*,
if (dev_run)
printf(
"userDataCallback: Node count = %" PRId64
"; LP total iterations = %" PRId64
"; Time = %6.2f; "
"Bounds (%11.4g, %11.4g); Gap = %11.4g; Objective = %11.4g: %s\n",
data_out->mip_node_count, data_out->running_time,
data_out->mip_dual_bound, data_out->mip_primal_bound,
data_out->mip_gap, data_out->objective_function_value,
message.c_str());
data_out->mip_node_count, data_out->mip_total_lp_iterations,
data_out->running_time, data_out->mip_dual_bound,
data_out->mip_primal_bound, data_out->mip_gap,
data_out->objective_function_value, message.c_str());
};

TEST_CASE("my-callback-logging", "[highs-callback]") {
Expand Down Expand Up @@ -264,6 +266,21 @@ TEST_CASE("highs-callback-logging", "[highs-callback]") {
highs.run();
}

TEST_CASE("highs-callback-solution-basis-logging", "[highs-callback]") {
std::string filename = std::string(HIGHS_DIR) + "/check/instances/avgas.mps";
int user_callback_data = kUserCallbackData;
void* p_user_callback_data =
reinterpret_cast<void*>(static_cast<intptr_t>(user_callback_data));
Highs highs;
highs.setOptionValue("output_flag", dev_run);
highs.readModel(filename);
highs.run();
highs.setCallback(userInterruptCallback, p_user_callback_data);
highs.startCallback(kCallbackLogging);
if (dev_run) highs.writeSolution("", kSolutionStylePretty);
if (dev_run) highs.writeBasis("");
}

TEST_CASE("highs-callback-simplex-interrupt", "[highs-callback]") {
std::string filename =
std::string(HIGHS_DIR) + "/check/instances/adlittle.mps";
Expand Down
51 changes: 51 additions & 0 deletions check/TestCheckSolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,57 @@ TEST_CASE("check-set-mip-solution", "[highs_check_solution]") {
highs.clear();
}

const bool test6 = other_tests;
if (test6) {
if (dev_run)
printf(
"\n***************************\nSolving from sparse integer "
"solution\n");
HighsInt num_integer_variable = 0;
for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++)
if (lp.integrality_[iCol] == HighsVarType::kInteger)
num_integer_variable++;

highs.setOptionValue("output_flag", dev_run);
highs.readModel(model_file);
std::vector<HighsInt> index;
std::vector<double> value;
// Check that duplicate values are spotted
index.push_back(0);
value.push_back(0);
index.push_back(1);
value.push_back(1);
index.push_back(0);
value.push_back(2);
HighsInt num_entries = index.size();
return_status = highs.setSolution(num_entries, index.data(), value.data());
REQUIRE(return_status == HighsStatus::kWarning);

index.clear();
value.clear();
std::vector<bool> is_set;
is_set.assign(lp.num_col_, false);
HighsInt num_to_set = 2;
assert(num_to_set > 0);
HighsRandom random;
for (HighsInt iSet = 0; iSet < num_to_set;) {
HighsInt iCol = random.integer(lp.num_col_);
if (lp.integrality_[iCol] != HighsVarType::kInteger) continue;
if (is_set[iCol]) continue;
is_set[iCol] = true;
index.push_back(iCol);
value.push_back(optimal_solution.col_value[iCol]);
iSet++;
}
num_entries = index.size();
assert(num_entries == num_to_set);
return_status = highs.setSolution(num_entries, index.data(), value.data());
REQUIRE(return_status == HighsStatus::kOk);
highs.run();
REQUIRE(info.mip_node_count < scratch_num_nodes);
highs.clear();
}
assert(other_tests);
std::remove(solution_file.c_str());
}

Expand Down
14 changes: 7 additions & 7 deletions check/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ 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,
)
)
Loading
Loading