From bbf8e371a602c69491f2c7474a2ed98e008dc517 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 16:54:54 +0300 Subject: [PATCH 01/44] remove old python api and add cmake instruction file --- cmake/README.md | 1 + src/interfaces/highs_python_api.py | 197 ----------------------------- 2 files changed, 1 insertion(+), 197 deletions(-) create mode 100644 cmake/README.md delete mode 100644 src/interfaces/highs_python_api.py diff --git a/cmake/README.md b/cmake/README.md new file mode 100644 index 0000000000..01d6f1742e --- /dev/null +++ b/cmake/README.md @@ -0,0 +1 @@ +# HiGHS CMake Build Instructions \ No newline at end of file diff --git a/src/interfaces/highs_python_api.py b/src/interfaces/highs_python_api.py deleted file mode 100644 index c174bdc794..0000000000 --- a/src/interfaces/highs_python_api.py +++ /dev/null @@ -1,197 +0,0 @@ -import ctypes -import os -from ctypes.util import find_library - -highslib = ctypes.cdll.LoadLibrary(ctypes.util.find_library("highs")) - -# highs lib folder must be in "LD_LIBRARY_PATH" environment variable -# ============ -# Highs_lpCall -highslib.Highs_lpCall.argtypes = (ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, - ctypes.c_int, ctypes.c_double, -ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)) -highslib.Highs_lpCall.restype = ctypes.c_int - -def Highs_lpCall(col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value): - global highslib - n_col = len(col_cost) - n_row = len(row_lower) - n_nz = len(a_index) - a_format = 1 - sense = 1 - offset = 0 - - # In case a_start has the fictitious start of column n_col - a_start_length = len(a_start) - - dbl_array_type_col = ctypes.c_double * n_col - dbl_array_type_row = ctypes.c_double * n_row - int_array_type_a_start = ctypes.c_int * a_start_length - int_array_type_a_index = ctypes.c_int * n_nz - dbl_array_type_a_value = ctypes.c_double * n_nz - - int_array_type_col = ctypes.c_int * n_col - int_array_type_row = ctypes.c_int * n_row - - col_value = [0] * n_col - col_dual = [0] * n_col - - row_value = [0] * n_row - row_dual = [0] * n_row - - col_basis = [0] * n_col - row_basis = [0] * n_row - - model_status = ctypes.c_int(0) - - col_value = dbl_array_type_col(*col_value) - col_dual = dbl_array_type_col(*col_dual) - row_value = dbl_array_type_row(*row_value) - row_dual = dbl_array_type_row(*row_dual) - col_basis = int_array_type_col(*col_basis) - row_basis = int_array_type_row(*row_basis) - - return_status = highslib.Highs_lpCall( - ctypes.c_int(n_col), ctypes.c_int(n_row), ctypes.c_int(n_nz), ctypes.c_int(a_format), - ctypes.c_int(sense), ctypes.c_double(offset), - dbl_array_type_col(*col_cost), dbl_array_type_col(*col_lower), dbl_array_type_col(*col_upper), - dbl_array_type_row(*row_lower), dbl_array_type_row(*row_upper), - int_array_type_a_start(*a_start), int_array_type_a_index(*a_index), dbl_array_type_a_value(*a_value), - col_value, col_dual, - row_value, row_dual, - col_basis, row_basis, ctypes.byref(model_status)) - return return_status, model_status.value, list(col_value), list(col_dual), list(row_value), list(row_dual), list(col_basis), list(row_basis) - -# ============= -# Highs_mipCall -highslib.Highs_mipCall.argtypes = (ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, - ctypes.c_int, ctypes.c_double, -ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_int), -ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int)) -highslib.Highs_mipCall.restype = ctypes.c_int - -def Highs_mipCall(col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, integrality): - global highslib - n_col = len(col_cost) - n_row = len(row_lower) - n_nz = len(a_index) - a_format = 1 - sense = 1 - offset = 0 - - # In case a_start has the fictitious start of column n_col - a_start_length = len(a_start) - - dbl_array_type_col = ctypes.c_double * n_col - dbl_array_type_row = ctypes.c_double * n_row - int_array_type_a_start = ctypes.c_int * a_start_length - int_array_type_a_index = ctypes.c_int * n_nz - dbl_array_type_a_value = ctypes.c_double * n_nz - - int_array_type_col = ctypes.c_int * n_col - int_array_type_row = ctypes.c_int * n_row - - col_value = [0] * n_col - col_dual = [0] * n_col - - row_value = [0] * n_row - row_dual = [0] * n_row - - col_basis = [0] * n_col - row_basis = [0] * n_row - - model_status = ctypes.c_int(0) - - col_value = dbl_array_type_col(*col_value) - row_value = dbl_array_type_row(*row_value) - - return_status = highslib.Highs_mipCall( - ctypes.c_int(n_col), ctypes.c_int(n_row), ctypes.c_int(n_nz), ctypes.c_int(a_format), - ctypes.c_int(sense), ctypes.c_double(offset), - dbl_array_type_col(*col_cost), dbl_array_type_col(*col_lower), dbl_array_type_col(*col_upper), - dbl_array_type_row(*row_lower), dbl_array_type_row(*row_upper), - int_array_type_a_start(*a_start), int_array_type_a_index(*a_index), dbl_array_type_a_value(*a_value), - int_array_type_col(*integrality), - col_value, row_value, ctypes.byref(model_status)) - return return_status, model_status.value, list(col_value), list(row_value) - -# ============ -# Highs_qpCall -highslib.Highs_qpCall.argtypes = (ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, - ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_double, -ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), -ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)) -highslib.Highs_call.restype = ctypes.c_int - -def Highs_qpCall(col_cost, col_lower, col_upper, row_lower, row_upper, a_start, a_index, a_value, q_start, q_index, q_value): - global highslib - n_col = len(col_cost) - n_row = len(row_lower) - n_nz = len(a_index) - q_n_nz = len(q_index) - a_format = 1 - q_format = 1 - sense = 1 - offset = 0 - - # In case a_start or q_start has the fictitious start of column n_col - a_start_length = len(a_start) - q_start_length = len(q_start) - - dbl_array_type_col = ctypes.c_double * n_col - dbl_array_type_row = ctypes.c_double * n_row - int_array_type_a_start = ctypes.c_int * a_start_length - int_array_type_a_index = ctypes.c_int * n_nz - dbl_array_type_a_value = ctypes.c_double * n_nz - - int_array_type_q_start = ctypes.c_int * q_start_length - int_array_type_q_index = ctypes.c_int * q_n_nz - dbl_array_type_q_value = ctypes.c_double * q_n_nz - - int_array_type_col = ctypes.c_int * n_col - int_array_type_row = ctypes.c_int * n_row - - col_value = [0] * n_col - col_dual = [0] * n_col - - row_value = [0] * n_row - row_dual = [0] * n_row - - col_basis = [0] * n_col - row_basis = [0] * n_row - - model_status = ctypes.c_int(0) - - col_value = dbl_array_type_col(*col_value) - col_dual = dbl_array_type_col(*col_dual) - row_value = dbl_array_type_row(*row_value) - row_dual = dbl_array_type_row(*row_dual) - col_basis = int_array_type_col(*col_basis) - row_basis = int_array_type_row(*row_basis) - - return_status = highslib.Highs_qpCall( - ctypes.c_int(n_col), ctypes.c_int(n_row), ctypes.c_int(n_nz), ctypes.c_int(q_n_nz), - ctypes.c_int(a_format), ctypes.c_int(q_format), - ctypes.c_int(sense), ctypes.c_double(offset), - dbl_array_type_col(*col_cost), dbl_array_type_col(*col_lower), dbl_array_type_col(*col_upper), - dbl_array_type_row(*row_lower), dbl_array_type_row(*row_upper), - int_array_type_a_start(*a_start), int_array_type_a_index(*a_index), dbl_array_type_a_value(*a_value), - int_array_type_q_start(*q_start), int_array_type_q_index(*q_index), dbl_array_type_q_value(*q_value), - col_value, col_dual, - row_value, row_dual, - col_basis, row_basis, ctypes.byref(model_status)) - return return_status, model_status.value, list(col_value), list(col_dual), list(row_value), list(row_dual), list(col_basis), list(row_basis) - From 362afe98de2b20a628e0e9dce84af67d6bcf03f9 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 18:24:45 +0300 Subject: [PATCH 02/44] added tests and table --- .github/workflows/cmake-linux-cpp.yml | 102 ++++++++++++++++++ .github/workflows/cmake-macos-cpp.yml | 102 ++++++++++++++++++ .github/workflows/cmake-windows-cpp.yml | 101 +++++++++++++++++ .github/workflows/test-csharp-macos.yml | 46 ++++++++ .github/workflows/test-csharp-ubuntu.yml | 49 +++++++++ .../{test-csharp.yml => test-csharp-win.yml} | 2 +- cmake/README.md | 32 +++++- 7 files changed, 432 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/cmake-linux-cpp.yml create mode 100644 .github/workflows/cmake-macos-cpp.yml create mode 100644 .github/workflows/cmake-windows-cpp.yml create mode 100644 .github/workflows/test-csharp-macos.yml create mode 100644 .github/workflows/test-csharp-ubuntu.yml rename .github/workflows/{test-csharp.yml => test-csharp-win.yml} (98%) diff --git a/.github/workflows/cmake-linux-cpp.yml b/.github/workflows/cmake-linux-cpp.yml new file mode 100644 index 0000000000..f5a2f77bb2 --- /dev/null +++ b/.github/workflows/cmake-linux-cpp.yml @@ -0,0 +1,102 @@ +name: cmake-linux-cpp + +on: [push, pull_request] + +jobs: + + release: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE + + - name: Build + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test + working-directory: ${{runner.workspace}}/build + run: ctest --parallel --timeout 300 --output-on-failure + + release_all_tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake All + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DALL_TESTS=ON + + - name: Build All + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test All + working-directory: ${{runner.workspace}}/build + run: ctest --parallel --timeout 300 --output-on-failure + + debug: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug + + - name: Build + working-directory: ${{runner.workspace}}/build + shell: bash + run: cmake --build . --parallel + + - name: Test + working-directory: ${{runner.workspace}}/build + run: ctest --parallel --timeout 300 --output-on-failure + + debug_all_tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake All + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug -DALL_TESTS=ON + + - name: Build All + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test All + working-directory: ${{runner.workspace}}/build + run: ctest --parallel --timeout 300 --output-on-failure diff --git a/.github/workflows/cmake-macos-cpp.yml b/.github/workflows/cmake-macos-cpp.yml new file mode 100644 index 0000000000..bf44b4fd75 --- /dev/null +++ b/.github/workflows/cmake-macos-cpp.yml @@ -0,0 +1,102 @@ +name: cmake-macos-cpp + +on: [push, pull_request] + +jobs: + + release: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE + + - name: Build + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test + working-directory: ${{runner.workspace}}/build + run: ctest --parallel --timeout 300 --output-on-failure + + release_all_tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake All + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DALL_TESTS=ON + + - name: Build All + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test All + working-directory: ${{runner.workspace}}/build + run: ctest --parallel --timeout 300 --output-on-failure + + debug: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug + + - name: Build + working-directory: ${{runner.workspace}}/build + shell: bash + run: cmake --build . --parallel + + - name: Test + working-directory: ${{runner.workspace}}/build + run: ctest --parallel --timeout 300 --output-on-failure + + debug_all_tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake All + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug -DALL_TESTS=ON + + - name: Build All + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test All + working-directory: ${{runner.workspace}}/build + run: ctest --parallel --timeout 300 --output-on-failure diff --git a/.github/workflows/cmake-windows-cpp.yml b/.github/workflows/cmake-windows-cpp.yml new file mode 100644 index 0000000000..f85322cabf --- /dev/null +++ b/.github/workflows/cmake-windows-cpp.yml @@ -0,0 +1,101 @@ + +name: cmake-windows-cpp + +on: [push, pull_request] + +jobs: + release: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE + + - name: Build + working-directory: ${{runner.workspace}}/build + shell: bash + run: cmake --build . --config Release --parallel + + - name: Test + working-directory: ${{runner.workspace}}/build + shell: bash + run: ctest --timeout 300 --output-on-failure -C Release + + release_all_tests: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake All + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DALL_TESTS=ON + + - name: Build All + working-directory: ${{runner.workspace}}/build + shell: bash + run: cmake --build . --parallel --config Release + + - name: Test All + working-directory: ${{runner.workspace}}/build + shell: bash + run: ctest --parallel --timeout 300 --output-on-failure -C Release + + debug: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE + + - name: Build + working-directory: ${{runner.workspace}}/build + shell: bash + run: cmake --build . --config Debug --parallel + + - name: Test + working-directory: ${{runner.workspace}}/build + shell: bash + run: ctest --output-on-failure -C Debug + + debug_all_tests: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DALL_TESTS=ON + + - name: Build + working-directory: ${{runner.workspace}}/build + shell: bash + run: cmake --build . --config Debug --parallel + + - name: Test + working-directory: ${{runner.workspace}}/build + shell: bash + run: ctest --output-on-failure -C Debug diff --git a/.github/workflows/test-csharp-macos.yml b/.github/workflows/test-csharp-macos.yml new file mode 100644 index 0000000000..0c149b8e89 --- /dev/null +++ b/.github/workflows/test-csharp-macos.yml @@ -0,0 +1,46 @@ +name: test-csharp-macos + +on: [push, pull_request] + +jobs: + fast_build_release: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCSHARP=ON + + - name: Build + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test + working-directory: ${{runner.workspace}}/build + run: ./bin/csharpexample.exe + + fast_build_debug: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DCMAKE_BUILD_TYPE=Debug + + - name: Build + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test + working-directory: ${{runner.workspace}}/build + run: ./bin/Debug/csharpexample.exe diff --git a/.github/workflows/test-csharp-ubuntu.yml b/.github/workflows/test-csharp-ubuntu.yml new file mode 100644 index 0000000000..800110887a --- /dev/null +++ b/.github/workflows/test-csharp-ubuntu.yml @@ -0,0 +1,49 @@ +name: test-csharp-ubuntu + +on: [push, pull_request] + +jobs: + fast_build_release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCSHARP=ON + + - name: Build + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test + working-directory: ${{runner.workspace}}/build + run: ./bin/csharpexample.exe + + fast_build_debug: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DCMAKE_BUILD_TYPE=Debug + + - name: Build + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test + shell: bash + working-directory: ${{runner.workspace}}/build + run: | + ls + ./bin/csharpexample.exe diff --git a/.github/workflows/test-csharp.yml b/.github/workflows/test-csharp-win.yml similarity index 98% rename from .github/workflows/test-csharp.yml rename to .github/workflows/test-csharp-win.yml index b1ba4dfa4e..33eb54937a 100644 --- a/.github/workflows/test-csharp.yml +++ b/.github/workflows/test-csharp-win.yml @@ -1,4 +1,4 @@ -name: test-csharp +name: test-csharp-win on: [push, pull_request] diff --git a/cmake/README.md b/cmake/README.md index 01d6f1742e..2bccde1b4c 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -1 +1,31 @@ -# HiGHS CMake Build Instructions \ No newline at end of file +# HiGHS CMake Build Instructions + +| OS | C++ | Python | .NET | +|:-------- | :---: | :------: | :----: | :----: | +| Linux | [![Status][linux_cpp_svg]][linux_cpp_link] | [![Status][linux_python_svg]][linux_python_link] | [![Status][linux_dotnet_svg]][linux_dotnet_link] | +| MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] | [![Status][macos_python_svg]][macos_python_link] | [![Status][macos_dotnet_svg]][macos_dotnet_link] | +| Windows | [![Status][windows_cpp_svg]][windows_cpp_link] | [![Status][windows_python_svg]][windows_python_link] | [![Status][windows_dotnet_svg]][windows_dotnet_link] | + +[linux_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_linux_cpp.yml/badge.svg +[linux_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_linux_cpp.yml +[macos_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_macos_cpp.yml/badge.svg +[macos_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_macos_cpp.yml +[windows_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_windows_cpp.yml/badge.svg +[windows_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_windows_cpp.yml + +[linux_python_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_ubuntu.yml/badge.svg +[linux_python_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_ubuntu.yml +[macos_python_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_macos.yml/badge.svg +[macos_python_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_macos.yml +[windows_python_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_win.yml/badge.svg +[windows_python_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_win.yml + +[linux_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_ubuntu.yml/badge.svg +[linux_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_ubuntu.yml +[macos_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_macos.yml/badge.svg +[macos_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_macos.yml +[windows_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_win.yml/badge.svg +[windows_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_win.yml + + + From 31030efa8e2e0f44bda6fcd03b88a9e2795f12ce Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 18:26:22 +0300 Subject: [PATCH 03/44] typo table --- cmake/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/README.md b/cmake/README.md index 2bccde1b4c..22a0845744 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -1,11 +1,13 @@ # HiGHS CMake Build Instructions | OS | C++ | Python | .NET | -|:-------- | :---: | :------: | :----: | :----: | +|:-------- | :---: | :------: | :----: | | Linux | [![Status][linux_cpp_svg]][linux_cpp_link] | [![Status][linux_python_svg]][linux_python_link] | [![Status][linux_dotnet_svg]][linux_dotnet_link] | | MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] | [![Status][macos_python_svg]][macos_python_link] | [![Status][macos_dotnet_svg]][macos_dotnet_link] | | Windows | [![Status][windows_cpp_svg]][windows_cpp_link] | [![Status][windows_python_svg]][windows_python_link] | [![Status][windows_dotnet_svg]][windows_dotnet_link] | +lallala + [linux_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_linux_cpp.yml/badge.svg [linux_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_linux_cpp.yml [macos_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_macos_cpp.yml/badge.svg From 345e4a348fadb445c107af1679945ee90f01dbd9 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 18:33:35 +0300 Subject: [PATCH 04/44] typos table --- cmake/README.md | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/cmake/README.md b/cmake/README.md index 22a0845744..a1fc124430 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -6,28 +6,26 @@ | MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] | [![Status][macos_python_svg]][macos_python_link] | [![Status][macos_dotnet_svg]][macos_dotnet_link] | | Windows | [![Status][windows_cpp_svg]][windows_cpp_link] | [![Status][windows_python_svg]][windows_python_link] | [![Status][windows_dotnet_svg]][windows_dotnet_link] | -lallala +[linux_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-linux-cpp.yml/badge.svg +[linux_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-linux-cpp.yml +[macos_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-macos-cpp.yml/badge.svg +[macos_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-macos-cpp.yml +[windows_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-windows-cpp.yml/badge.svg +[windows_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-windows-cpp.yml -[linux_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_linux_cpp.yml/badge.svg -[linux_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_linux_cpp.yml -[macos_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_macos_cpp.yml/badge.svg -[macos_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_macos_cpp.yml -[windows_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_windows_cpp.yml/badge.svg -[windows_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake_windows_cpp.yml +[linux_python_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-python-ubuntu.yml/badge.svg +[linux_python_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-python-ubuntu.yml +[macos_python_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-python-macos.yml/badge.svg +[macos_python_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-python-macos.yml +[windows_python_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-python-win.yml/badge.svg +[windows_python_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-python-win.yml -[linux_python_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_ubuntu.yml/badge.svg -[linux_python_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_ubuntu.yml -[macos_python_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_macos.yml/badge.svg -[macos_python_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_macos.yml -[windows_python_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_win.yml/badge.svg -[windows_python_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_python_win.yml - -[linux_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_ubuntu.yml/badge.svg -[linux_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_ubuntu.yml -[macos_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_macos.yml/badge.svg -[macos_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_macos.yml -[windows_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_win.yml/badge.svg -[windows_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test_csharp_win.yml +[linux_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-ubuntu.yml/badge.svg +[linux_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-ubuntu.yml +[macos_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-macos.yml/badge.svg +[macos_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-macos.yml +[windows_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-win.yml/badge.svg +[windows_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-win.yml From 4544e14f0054620a313bb413a61dc00f5cc362e9 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 19:57:33 +0300 Subject: [PATCH 05/44] tests and docs --- .github/workflows/cmake-linux-cpp.yml | 1 - .github/workflows/cmake-macos-cpp.yml | 1 - .github/workflows/test-csharp-macos.yml | 2 + .github/workflows/test-csharp-ubuntu.yml | 2 + CMakeLists.txt | 1 + README.md | 5 +- cmake/README.md | 153 +++++++++++++++++++++++ docs/src/interfaces/cpp/index.md | 22 ++-- docs/src/interfaces/cpp/link.md | 4 +- 9 files changed, 176 insertions(+), 15 deletions(-) diff --git a/.github/workflows/cmake-linux-cpp.yml b/.github/workflows/cmake-linux-cpp.yml index f5a2f77bb2..c2f674c55d 100644 --- a/.github/workflows/cmake-linux-cpp.yml +++ b/.github/workflows/cmake-linux-cpp.yml @@ -3,7 +3,6 @@ name: cmake-linux-cpp on: [push, pull_request] jobs: - release: runs-on: ${{ matrix.os }} strategy: diff --git a/.github/workflows/cmake-macos-cpp.yml b/.github/workflows/cmake-macos-cpp.yml index bf44b4fd75..82480721ea 100644 --- a/.github/workflows/cmake-macos-cpp.yml +++ b/.github/workflows/cmake-macos-cpp.yml @@ -3,7 +3,6 @@ name: cmake-macos-cpp on: [push, pull_request] jobs: - release: runs-on: ${{ matrix.os }} strategy: diff --git a/.github/workflows/test-csharp-macos.yml b/.github/workflows/test-csharp-macos.yml index 0c149b8e89..905ef80e0e 100644 --- a/.github/workflows/test-csharp-macos.yml +++ b/.github/workflows/test-csharp-macos.yml @@ -8,6 +8,7 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build @@ -29,6 +30,7 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build diff --git a/.github/workflows/test-csharp-ubuntu.yml b/.github/workflows/test-csharp-ubuntu.yml index 800110887a..cbe952fb07 100644 --- a/.github/workflows/test-csharp-ubuntu.yml +++ b/.github/workflows/test-csharp-ubuntu.yml @@ -8,6 +8,7 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build @@ -28,6 +29,7 @@ jobs: runs-on: ubuntu-latest steps: + - uses: actions/setup-dotnet@v4 - uses: actions/checkout@v4 - name: Create Build Environment diff --git a/CMakeLists.txt b/CMakeLists.txt index 163d6f91e7..62e4b2b246 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,7 @@ option(BUILD_TESTING "Build Tests" ON) option(FORTRAN "Build Fortran interface" OFF) message(STATUS "Build Fortran: ${FORTRAN}") option(CSHARP "Build CSharp interface" OFF) +message(STATUS "Build CSharp: ${CSHARP}") if (FORTRAN OR CSHARP) set(BUILD_SHARED_LIBS ON) diff --git a/README.md b/README.md index 22dc6318c2..d3d5da5a35 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,10 @@ - [Installation](#installation) - [Build from source using CMake](#build-from-source-using-cmake) - [Precompiled binaries](#precompiled-binaries) + - [Build with Nix](#build-with-nix) - [Interfaces](#interfaces) - - [Python](#python) - - [CSharp](#csharp) + - [Python](#python) + - [CSharp](#csharp) - [Reference](#reference) ## About HiGHS diff --git a/cmake/README.md b/cmake/README.md index a1fc124430..b8e46ea213 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -29,3 +29,156 @@ +## Introduction + + +HiGHS can be built from source using CMake: . CMake works by generating native Makefiles or build projects that can be used in the compiler environment of your choice. + +HiGHS can be built as a standalone project or it could be incorporated into an existing CMake project. + +## Requirement +You'll need: + +* `CMake >= 3.15`. +* A C++11 compiler + +#### Supported compilers + +Here is a list of the supported compilers: + +* Clang `clang` +* GNU `g++` +* Intel `icc` +* Microsoft `MSVC` + +# Build + +To build the C++ library and executable run + +``` bash +cd HiGHS +cmake -S. -B build +cmake --build build --parallel +``` + +This creates the [executable](@ref Executable) `build/bin/highs`. To perform a quick test to see whether the compilation was successful, run `ctest` from within the build folder. + +``` bash +ctest +``` + +On Windows, the configuration type must be specified: +``` bash +ctest -C Release +``` + +## Install + +The default installation location may need administrative +permissions. To install, after building and testing, run + +``` bash +cmake --install build +``` + +form the root directory. + +To install in a specified installation directory run CMake with the +`CMAKE_INSTALL_PREFIX` flag set: + +``` bash +cmake -S. -B build -DCMAKE_INSTALL_PREFIX=/path/to/highs_install +cmake --build build --parallel +cmake --install build +``` + +# CMake Options + +There are several options that can be passed to CMake to modify how the code +is built.
+To set these options and parameters, use `-D=`. + +All CMake options are passed at configure time, i.e., by running
+`cmake -S. -B -DOPTION_ONE=ON -DOPTION_TWO=OFF ...`
+before running `cmake --build `
+ +For example, to generate build files in a new +subdirectory called 'build', run: + +```sh +cmake -S. -Bbuild +``` +and then build with: + +```sh +cmake --build build +``` + +Following is a list of available options: +| CMake Option | Default Value | Note | +|:-------------|:--------------|:-----| +| `CMAKE_BUILD_TYPE` | Release | see CMake documentation [here](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html) | +| `BUILD_SHARED_LIBS` | ON(*) | Build shared libraries (.so or .dyld). * OFF by default on Windows | +| `BUILD_CXX` | ON | Build C++ | +| `FORTRAN` | OFF | Build Fortran interface | +| `CSHARP` | OFF | Build CSharp wrapper | +| `BUILD_DOTNET` | OFF | Build .Net package | +| `PYTHON_BUILD_SETUP` | OFF | Build Python bindings. Called at `pip install` from pyproject.toml | +| `ZLIB` | ON | Use ZLIB if available | +| `ALL_TESTS` | OFF | Run unit tests and extended instance test set | + + + +HiGHS can be integrated into other CMake-based projects. + +# Integrating HiGHS in your CMake Project + +If you already have HiGHS installed on your system, you can use `find_package()` to include HiGHS in your C++ CMake project. + +``` +project(LOAD_HIGHS LANGUAGES CXX) + +set(HIGHS_DIR path_to_highs_install/lib/cmake/highs) + +find_package(HIGHS REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main highs::highs) +``` + +The line +``` +set(HIGHS_DIR path_to_highs_install/lib/cmake/highs) +``` +adds the HiGHS installation path to `HIGHS_DIR`. This is equivalent to building this project with +``` +cmake -DHIGHS_DIR=path_to_highs_install/lib/cmake/highs .. +``` + +Alternatively, if you wish to include the code of HiGHS within your project, FetchContent is also available as follows: + +``` +project(LOAD_HIGHS LANGUAGES CXX) + +include(FetchContent) + +FetchContent_Declare( + highs + GIT_REPOSITORY "https://github.com/ERGO-Code/HiGHS.git" + GIT_TAG "latest" +) + +FetchContent_MakeAvailable(highs) + +add_executable(main call_from_cpp.cc) +target_link_libraries(main highs::highs) +``` diff --git a/docs/src/interfaces/cpp/index.md b/docs/src/interfaces/cpp/index.md index f6151d2c56..f37c9d8533 100644 --- a/docs/src/interfaces/cpp/index.md +++ b/docs/src/interfaces/cpp/index.md @@ -22,10 +22,8 @@ the full sequence of commands required is as follows ``` bash cd HiGHS -mkdir build -cd build -cmake -DFAST_BUILD=ON .. -cmake --build . +cmake -S. -B build +cmake --build build --parallel ``` This creates the [executable](@ref Executable) `build/bin/highs`. @@ -38,20 +36,28 @@ To perform a quick test to see whether the compilation was successful, run `ctes ctest ``` +On Windows, the configuration type must be specified: + +``` bash +ctest -C Release +``` + ### Install The default installation location may need administrative permissions. To install, after building and testing, run ``` bash -cmake --install . +cmake --install build ``` +form the root directory. + To install in a specified installation directory run CMake with the `CMAKE_INSTALL_PREFIX` flag set: ``` bash -cmake -DFAST_BUILD=ON -DCMAKE_INSTALL_PREFIX=/path/to/highs_install .. -cmake --build . -cmake --install . +cmake -S. -B build -DCMAKE_INSTALL_PREFIX=/path/to/highs_install +cmake --build build --parallel +cmake --install build ``` diff --git a/docs/src/interfaces/cpp/link.md b/docs/src/interfaces/cpp/link.md index d2414789a9..8ce1dac900 100755 --- a/docs/src/interfaces/cpp/link.md +++ b/docs/src/interfaces/cpp/link.md @@ -23,7 +23,6 @@ project(LOAD_HIGHS LANGUAGES CXX) set(HIGHS_DIR path_to_highs_install/lib/cmake/highs) find_package(HIGHS REQUIRED) -find_package(Threads REQUIRED) add_executable(main main.cpp) target_link_libraries(main highs::highs) @@ -48,9 +47,8 @@ include(FetchContent) FetchContent_Declare( highs GIT_REPOSITORY "https://github.com/ERGO-Code/HiGHS.git" - GIT_TAG "bazel" + GIT_TAG "latest" ) -set(FAST_BUILD ON CACHE INTERNAL "Fast Build") FetchContent_MakeAvailable(highs) From 6b993ed5ba08bc373a396b787040ca90c1c255bb Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 19:59:45 +0300 Subject: [PATCH 06/44] workflows --- .github/workflows/cmake-linux-cpp.yml | 2 +- .github/workflows/cmake-macos-cpp.yml | 2 +- .github/workflows/cmake-windows-cpp.yml | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake-linux-cpp.yml b/.github/workflows/cmake-linux-cpp.yml index c2f674c55d..4f3f48e78b 100644 --- a/.github/workflows/cmake-linux-cpp.yml +++ b/.github/workflows/cmake-linux-cpp.yml @@ -3,7 +3,7 @@ name: cmake-linux-cpp on: [push, pull_request] jobs: - release: + release: runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/.github/workflows/cmake-macos-cpp.yml b/.github/workflows/cmake-macos-cpp.yml index 82480721ea..d44c26a9a4 100644 --- a/.github/workflows/cmake-macos-cpp.yml +++ b/.github/workflows/cmake-macos-cpp.yml @@ -3,7 +3,7 @@ name: cmake-macos-cpp on: [push, pull_request] jobs: - release: + release: runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/.github/workflows/cmake-windows-cpp.yml b/.github/workflows/cmake-windows-cpp.yml index f85322cabf..a5b7a888b6 100644 --- a/.github/workflows/cmake-windows-cpp.yml +++ b/.github/workflows/cmake-windows-cpp.yml @@ -1,4 +1,3 @@ - name: cmake-windows-cpp on: [push, pull_request] From 070cea7d991ff3e1458c0fa7fd3be93b19e386d6 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 20:44:21 +0300 Subject: [PATCH 07/44] docs and tests --- cmake/README.md | 50 +++++++++++++--- docs/src/installation.md | 88 ++--------------------------- docs/src/interfaces/cpp/index.md | 48 +++------------- docs/src/interfaces/csharp/index.md | 35 ++++++++++++ 4 files changed, 90 insertions(+), 131 deletions(-) create mode 100644 docs/src/interfaces/csharp/index.md diff --git a/cmake/README.md b/cmake/README.md index b8e46ea213..ffe50c3838 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -29,13 +29,16 @@ -## Introduction - + +- [HiGHS CMake Build Instructions](#highs-cmake-build-instructions) + - [Requirement](#requirement) + - [Supported compilers](#supported-compilers) +- [Build](#build) + - [Install](#install) + - [Windows](#windows) +- [CMake Options](#cmake-options) +- [Integrating HiGHS in your CMake Project](#integrating-highs-in-your-cmake-project) + HiGHS can be built from source using CMake: . CMake works by generating native Makefiles or build projects that can be used in the compiler environment of your choice. @@ -66,7 +69,7 @@ cmake -S. -B build cmake --build build --parallel ``` -This creates the [executable](@ref Executable) `build/bin/highs`. To perform a quick test to see whether the compilation was successful, run `ctest` from within the build folder. +This generates HiGHS in the `build` directory and creates the [executable](@ref Executable) `build/bin/highs`, or `build/bin/Release/highs.exe` on Windows. To perform a quick test to see whether the compilation was successful, run `ctest` from within the build folder. ``` bash ctest @@ -97,6 +100,37 @@ cmake --build build --parallel cmake --install build ``` +## Windows + +By default, CMake builds the debug version of the binaries. These are generated in a directory `Debug`. To build a release version, add the option `--config Release` + +```bash + cmake -S . -B build + cmake --build build --config Release +``` + +It is also possible to specify a specific Visual studio version to build with: +```bash + cmake -G "Visual Studio 17 2022" -S . -B build + cmake --build build +``` + +When building under Windows, some extra options are available. One is building a 32 bit version or a 64 bit version. The default build is 64 bit. To build 32 bit, the following commands can be used from the `HiGHS/` directory: + +```bash + cmake -A Win32 -S . -B buildWin32 + cmake --build buildWin32 +``` + +Another thing specific for windows is the calling convention, particularly important for the HiGHS dynamic library (dll). The default calling convention in windows is cdecl calling convention, however, dlls are most often compiled with stdcall. Most applications which expect stdcall, can't access dlls with cdecl and vice versa. To change the default calling convention from cdecl to stdcall the following option can be added +```bash + cmake -DSTDCALL=ON -S . -B build + cmake --build build +``` + + + + # CMake Options There are several options that can be passed to CMake to modify how the code diff --git a/docs/src/installation.md b/docs/src/installation.md index dd4c9b0d4d..a4cae43abe 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -1,10 +1,14 @@ # Install HiGHS +## Compile from source + +HiGHS uses CMake as build system, and requires at least version +3.15. Details about building from source using cmake can be found in [`HiGHS/cmake/README.md`](https://github.com/ERGO-Code/HiGHS/blob/master/cmake/README.md) + ## Install via a package manager HiGHS can be installed using a package manager in the cases of -[`Julia`](@ref HiGHS.jl), [`Python`](@ref python-getting-started), and -[`Rust`](@ref Rust). +[`Julia`](@ref HiGHS.jl), [`Python`](@ref python-getting-started), [`CSharp`](@ref csharp-getting-started)and [`Rust`](@ref Rust). ## Precompiled Binaries @@ -35,83 +39,3 @@ filename. * For Windows users: choose the file ending in `x86_64-w64-mingw32-cxx11.tar.gz` * For M1 macOS users: choose the file ending in `aarch64-apple-darwin.tar.gz` * For Intel macOS users: choose the file ending in `x86_64-apple-darwin.tar.gz` - -## Compile from source - -HiGHS uses CMake as build system, and requires at least version -3.15. After extracting HiGHS from -[GitHub](https://github.com/ERGO-Code/HiGHS), setup a build folder and -call CMake as follows: - -```bash -$ mkdir build -$ cd build -$ cmake .. -``` - -Then compile the code using: - -```bashs -$ cmake --build . -``` - -To test whether the compilation was successful, run - -```bash -$ ctest -``` - -HiGHS is installed using the command - -```bash -$ cmake --install . -``` - -This installs the library in `lib/`, as well as all header files in `include/highs/`. For a custom -installation in `install_folder` run - -```bash -$ cmake -DCMAKE_INSTALL_PREFIX=install_folder . -``` - -and then - -```bash -$ cmake --install . -``` - -To use the library from a CMake project use - -`find_package(HiGHS)` - -and add the correct path to HIGHS_DIR. - -## Windows - -By default, CMake builds the debug version of the binaries. These are generated in a directory `Debug`. To build a release version, add the option `--config Release` - -```bash - cmake -S . -B build - cmake --build build --config Release -``` - -It is also possible to specify a specific Visual studio version to build with: -```bash - cmake -G "Visual Studio 17 2022" -S . -B build - cmake --build build -``` - -When building under Windows, some extra options are available. One is building a 32 bit version or a 64 bit version. The default build is 64 bit. To build 32 bit, the following commands can be used from the `HiGHS/` directory: - -```bash - cmake -A Win32 -S . -DFAST_BUILD=OFF -B buildWin32 - cmake --build buildWin32 -``` - -Another thing specific for windows is the calling convention, particularly important for the HiGHS dynamic library (dll). The default calling convention in windows is cdecl calling convention, however, dlls are most often compiled with stdcall. Most applications which expect stdcall, can't access dlls with cdecl and vice versa. To change the default calling convention from cdecl to stdcall the following option can be added -```bash - cmake -DSTDCALL=ON -S . -DFAST_BUILD=OFF -B build - cmake --build build -``` -An extra note. With the legacy `-DFAST_BUILD=OFF`, under windows the build dll is called `highs.dll` however the exe expects `libhighs.dll` so a manual copy of `highs.dll` to `libhighs.dll` is needed. Of course all above options can be combined with each other. - diff --git a/docs/src/interfaces/cpp/index.md b/docs/src/interfaces/cpp/index.md index f37c9d8533..305ad3e331 100644 --- a/docs/src/interfaces/cpp/index.md +++ b/docs/src/interfaces/cpp/index.md @@ -8,6 +8,7 @@ git clone https://github.com/ERGO-Code/HiGHS.git ### Building HiGHS from source code + HiGHS uses CMake (minimum version 3.15) as a build system, and can use the following compilers - Clang ` clang ` @@ -15,49 +16,14 @@ HiGHS uses CMake (minimum version 3.15) as a build system, and can use the follo - Intel ` icc ` - Microsoft ` MSVC ` -The simplest setup is to create a build folder (within the folder into -which HiGHS has been downloaded) and then build HiGHS within it. The -name of the build folder is arbitrary but, assuming it is HiGHS/build, -the full sequence of commands required is as follows +Instructions for building HiGHS from source code are in [`HiGHS/cmake/README.md`](https://github.com/ERGO-Code/HiGHS/blob/master/cmake/README.md). + +The simplest setup is to build HiGHS in a build directory within the root direcory. The +name of the build folder is arbitrary but, assuming it is `build`, +the sequence of commands is as follows ``` bash cd HiGHS cmake -S. -B build cmake --build build --parallel -``` - -This creates the [executable](@ref Executable) `build/bin/highs`. - -### Test build - -To perform a quick test to see whether the compilation was successful, run `ctest` from within the build folder. - -``` bash -ctest -``` - -On Windows, the configuration type must be specified: - -``` bash -ctest -C Release -``` - -### Install - -The default installation location may need administrative -permissions. To install, after building and testing, run - -``` bash -cmake --install build -``` - -form the root directory. - -To install in a specified installation directory run CMake with the -`CMAKE_INSTALL_PREFIX` flag set: - -``` bash -cmake -S. -B build -DCMAKE_INSTALL_PREFIX=/path/to/highs_install -cmake --build build --parallel -cmake --install build -``` +``` \ No newline at end of file diff --git a/docs/src/interfaces/csharp/index.md b/docs/src/interfaces/csharp/index.md new file mode 100644 index 0000000000..af763a4b24 --- /dev/null +++ b/docs/src/interfaces/csharp/index.md @@ -0,0 +1,35 @@ +# [Getting started](@id csharp-getting-started) + +## Install + +### Build from source + +There is a C# example code in `examples/call_highs_from_csharp.cs`. From the HiGHS root directory, run + +``` bash +cmake -S. -Bbuild -DCSHARP=ON +``` + +If a CSharp compiler is available, this builds the example using cmake and generates a binary in the build directory (`build/bin/csharpexample`). + +### NuGet + +The nuget package Highs.Native is on https://www.nuget.org, at https://www.nuget.org/packages/Highs.Native/. + +It can be added to your C# project with `dotnet` + +```bash +dotnet add package Highs.Native --version 1.7.0 +``` + +The nuget package contains runtime libraries for + +* `win-x64` +* `win-x32` +* `linux-x64` +* `linux-arm64` +* `macos-x64` +* `macos-arm64` + +Details for building locally can be found in `nuget/README.md`. + From 7bfdc4021e0b9cc8cf1b262515cdf698733be4a6 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 20:50:12 +0300 Subject: [PATCH 08/44] docs --- docs/make.jl | 10 +++--- docs/src/interfaces/cpp/link.md | 57 --------------------------------- 2 files changed, 5 insertions(+), 62 deletions(-) delete mode 100755 docs/src/interfaces/cpp/link.md diff --git a/docs/make.jl b/docs/make.jl index 378d543907..e4996d0b1d 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -68,17 +68,17 @@ Documenter.makedocs( ], "Callbacks" => "callbacks.md", "Interfaces" => Any[ - "Python" => Any[ - "interfaces/python/index.md", - "interfaces/python/example-py.md", - ], "C++" => Any[ "interfaces/cpp/index.md", "The HiGHS library" => "interfaces/cpp/library.md", - "Linking" => "interfaces/cpp/link.md", "Examples" => "interfaces/cpp/examples.md", ], "C" => "interfaces/c/index.md", + "CSharp" => "interfaces/csharp/index.md", + "Python" => Any[ + "interfaces/python/index.md", + "interfaces/python/example-py.md", + ], "Julia" => "interfaces/julia/index.md", "Other" => "interfaces/other.md", ], diff --git a/docs/src/interfaces/cpp/link.md b/docs/src/interfaces/cpp/link.md deleted file mode 100755 index 8ce1dac900..0000000000 --- a/docs/src/interfaces/cpp/link.md +++ /dev/null @@ -1,57 +0,0 @@ -## Using HiGHS from another CMake Project - -There are several ways the HiGHS library can be used within another C++ project. - -Firstly, make sure that HiGHS is installed locally with the correct CMake flags: - -``` bash -cd HiGHS -mkdir build -cd build -cmake -DFAST_BUILD=ON -DCMAKE_INSTALL_PREFIX=/path_to_highs_install/ .. -cmake --build . -cmake --install . -``` - -This installs HiGHS in `/path_to_highs_install/`. - -Suppose another C++ CMake project has executable code in some file `main.cpp`, which includes `Highs.h`. To use the HiGHS library, edit the `CMakeLists.txt` as follows: - -``` -project(LOAD_HIGHS LANGUAGES CXX) - -set(HIGHS_DIR path_to_highs_install/lib/cmake/highs) - -find_package(HIGHS REQUIRED) - -add_executable(main main.cpp) -target_link_libraries(main highs::highs) -``` - -The line -``` -set(HIGHS_DIR path_to_highs_install/lib/cmake/highs) -``` -adds the HiGHS installation path to `HIGHS_DIR`. This is equivalent to building this project with -``` -cmake -DHIGHS_DIR=path_to_highs_install/lib/cmake/highs .. -``` - -Alternatively, if you wish to include the code of HiGHS within your project, FetchContent is also available as follows: - -``` -project(LOAD_HIGHS LANGUAGES CXX) - -include(FetchContent) - -FetchContent_Declare( - highs - GIT_REPOSITORY "https://github.com/ERGO-Code/HiGHS.git" - GIT_TAG "latest" -) - -FetchContent_MakeAvailable(highs) - -add_executable(main call_from_cpp.cc) -target_link_libraries(main highs::highs) -``` From b9913a7fde554e593d5d538b1ff584d80fb3181b Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 21:06:55 +0300 Subject: [PATCH 09/44] wflows --- .github/workflows/test-csharp-macos.yml | 6 ++++++ .github/workflows/test-csharp-ubuntu.yml | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-csharp-macos.yml b/.github/workflows/test-csharp-macos.yml index 905ef80e0e..023394fa47 100644 --- a/.github/workflows/test-csharp-macos.yml +++ b/.github/workflows/test-csharp-macos.yml @@ -8,7 +8,10 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.x' - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build @@ -30,7 +33,10 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.x' - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build diff --git a/.github/workflows/test-csharp-ubuntu.yml b/.github/workflows/test-csharp-ubuntu.yml index cbe952fb07..8332c259c8 100644 --- a/.github/workflows/test-csharp-ubuntu.yml +++ b/.github/workflows/test-csharp-ubuntu.yml @@ -8,7 +8,10 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.x' - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build @@ -29,9 +32,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/setup-dotnet@v4 - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.x' + - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build From 08e605c259259cfde61f54db47b04876130dfc08 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 21:32:14 +0300 Subject: [PATCH 10/44] workflows and readme --- .github/workflows/test-csharp-macos.yml | 54 ------ .github/workflows/test-csharp-ubuntu.yml | 57 ------ .github/workflows/test-nuget-macos.yml | 101 ++++++++++ .github/workflows/test-nuget-package.yml | 232 ----------------------- .github/workflows/test-nuget-ubuntu.yml | 96 ++++++++++ .github/workflows/test-nuget-windows.yml | 53 ++++++ cmake/README.md | 36 ++-- 7 files changed, 273 insertions(+), 356 deletions(-) delete mode 100644 .github/workflows/test-csharp-macos.yml delete mode 100644 .github/workflows/test-csharp-ubuntu.yml create mode 100644 .github/workflows/test-nuget-macos.yml delete mode 100644 .github/workflows/test-nuget-package.yml create mode 100644 .github/workflows/test-nuget-ubuntu.yml create mode 100644 .github/workflows/test-nuget-windows.yml diff --git a/.github/workflows/test-csharp-macos.yml b/.github/workflows/test-csharp-macos.yml deleted file mode 100644 index 023394fa47..0000000000 --- a/.github/workflows/test-csharp-macos.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: test-csharp-macos - -on: [push, pull_request] - -jobs: - fast_build_release: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.x' - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCSHARP=ON - - - name: Build - working-directory: ${{runner.workspace}}/build - run: cmake --build . --parallel - - - name: Test - working-directory: ${{runner.workspace}}/build - run: ./bin/csharpexample.exe - - fast_build_debug: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.x' - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DCMAKE_BUILD_TYPE=Debug - - - name: Build - working-directory: ${{runner.workspace}}/build - run: cmake --build . --parallel - - - name: Test - working-directory: ${{runner.workspace}}/build - run: ./bin/Debug/csharpexample.exe diff --git a/.github/workflows/test-csharp-ubuntu.yml b/.github/workflows/test-csharp-ubuntu.yml deleted file mode 100644 index 8332c259c8..0000000000 --- a/.github/workflows/test-csharp-ubuntu.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: test-csharp-ubuntu - -on: [push, pull_request] - -jobs: - fast_build_release: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.x' - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCSHARP=ON - - - name: Build - working-directory: ${{runner.workspace}}/build - run: cmake --build . --parallel - - - name: Test - working-directory: ${{runner.workspace}}/build - run: ./bin/csharpexample.exe - - fast_build_debug: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.x' - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DCMAKE_BUILD_TYPE=Debug - - - name: Build - working-directory: ${{runner.workspace}}/build - run: cmake --build . --parallel - - - name: Test - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - ls - ./bin/csharpexample.exe diff --git a/.github/workflows/test-nuget-macos.yml b/.github/workflows/test-nuget-macos.yml new file mode 100644 index 0000000000..396a2e9505 --- /dev/null +++ b/.github/workflows/test-nuget-macos.yml @@ -0,0 +1,101 @@ +name: test-nuget-macos + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + # macos 12 is Intel + build_macos_12: + runs-on: macos-12 + # strategy: + # matrix: + # python: [3.11] + steps: + - uses: actions/checkout@v4 + - name: Build HiGHS + run: | + cmake -E make_directory ${{runner.workspace}}/build + cmake -E make_directory ${{runner.workspace}}/nugets + cmake -E make_directory ${{runner.workspace}}/test_nuget + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON + + - name: Build + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config Release --parallel + + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.0.x' + + - name: Dotnet pack + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + run: dotnet pack -c Release /p:Version=1.7.0 + + - name: Add local feed + run: dotnet nuget add source ${{runner.workspace}}/nugets + + - name: Dotnet push to local feed + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + run: dotnet nuget push ./bin/Release/*.nupkg -s ${{runner.workspace}}/nugets + + - name: Create new project and test + shell: bash + working-directory: ${{runner.workspace}}/test_nuget + run: | + dotnet new console + rm Program.cs + cp $GITHUB_WORKSPACE/examples/call_highs_from_csharp.cs . + dotnet add package Highs.Native -s ${{runner.workspace}}/nugets + dotnet run + + + + # macos 14 is M1 (beta) + build_macos_14: + runs-on: macos-14 + steps: + - uses: actions/checkout@v4 + - name: Build HiGHS + run: | + cmake -E make_directory ${{runner.workspace}}/build + cmake -E make_directory ${{runner.workspace}}/nugets + cmake -E make_directory ${{runner.workspace}}/test_nuget + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON + + - name: Build + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config Release --parallel + + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.0.x' + + - name: Dotnet pack + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + run: dotnet pack -c Release /p:Version=1.7.0 + + - name: Add local feed + run: dotnet nuget add source ${{runner.workspace}}/nugets + + - name: Dotnet push to local feed + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + run: dotnet nuget push ./bin/Release/*.nupkg -s ${{runner.workspace}}/nugets + + - name: Create new project and test + shell: bash + working-directory: ${{runner.workspace}}/test_nuget + run: | + dotnet new console + rm Program.cs + cp $GITHUB_WORKSPACE/examples/call_highs_from_csharp.cs . + dotnet add package Highs.Native -s ${{runner.workspace}}/nugets + dotnet run diff --git a/.github/workflows/test-nuget-package.yml b/.github/workflows/test-nuget-package.yml deleted file mode 100644 index 357af07ee5..0000000000 --- a/.github/workflows/test-nuget-package.yml +++ /dev/null @@ -1,232 +0,0 @@ -name: test-nuget-package - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - # macos 12 is Intel - build_macos_12: - runs-on: macos-12 - # strategy: - # matrix: - # python: [3.11] - steps: - - uses: actions/checkout@v4 - - name: Build HiGHS - run: | - cmake -E make_directory ${{runner.workspace}}/build - cmake -E make_directory ${{runner.workspace}}/nugets - cmake -E make_directory ${{runner.workspace}}/test_nuget - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON - - - name: Build - working-directory: ${{runner.workspace}}/build - run: cmake --build . --config Release --parallel - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.0.x' - - - name: Dotnet pack - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - run: dotnet pack -c Release /p:Version=1.7.0 - - - name: Add local feed - run: dotnet nuget add source ${{runner.workspace}}/nugets - - - name: Dotnet push to local feed - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - run: dotnet nuget push ./bin/Release/*.nupkg -s ${{runner.workspace}}/nugets - - - name: Create new project and test - shell: bash - working-directory: ${{runner.workspace}}/test_nuget - run: | - dotnet new console - rm Program.cs - cp $GITHUB_WORKSPACE/examples/call_highs_from_csharp.cs . - dotnet add package Highs.Native -s ${{runner.workspace}}/nugets - dotnet run - - - - # macos 14 is M1 (beta) - build_macos_14: - runs-on: macos-14 - steps: - - uses: actions/checkout@v4 - - name: Build HiGHS - run: | - cmake -E make_directory ${{runner.workspace}}/build - cmake -E make_directory ${{runner.workspace}}/nugets - cmake -E make_directory ${{runner.workspace}}/test_nuget - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON - - - name: Build - working-directory: ${{runner.workspace}}/build - run: cmake --build . --config Release --parallel - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.0.x' - - - name: Dotnet pack - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - run: dotnet pack -c Release /p:Version=1.7.0 - - - name: Add local feed - run: dotnet nuget add source ${{runner.workspace}}/nugets - - - name: Dotnet push to local feed - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - run: dotnet nuget push ./bin/Release/*.nupkg -s ${{runner.workspace}}/nugets - - - name: Create new project and test - shell: bash - working-directory: ${{runner.workspace}}/test_nuget - run: | - dotnet new console - rm Program.cs - cp $GITHUB_WORKSPACE/examples/call_highs_from_csharp.cs . - dotnet add package Highs.Native -s ${{runner.workspace}}/nugets - dotnet run - - build_linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build HiGHS - run: | - cmake -E make_directory ${{runner.workspace}}/build - cmake -E make_directory ${{runner.workspace}}/nugets - cmake -E make_directory ${{runner.workspace}}/test_nuget - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON - - - name: Build - working-directory: ${{runner.workspace}}/build - run: cmake --build . --config Release --parallel - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.0.x' - - - name: Dotnet pack - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - run: dotnet pack -c Release /p:Version=1.7.0 - - - name: Add local feed - run: dotnet nuget add source ${{runner.workspace}}/nugets - - - name: Dotnet push to local feed - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - run: dotnet nuget push ./bin/Release/*.nupkg -s ${{runner.workspace}}/nugets - - - name: Create new project and test - shell: bash - working-directory: ${{runner.workspace}}/test_nuget - run: | - dotnet new console - rm Program.cs - cp $GITHUB_WORKSPACE/examples/call_highs_from_csharp.cs . - dotnet add package Highs.Native -s ${{runner.workspace}}/nugets - dotnet run - - build_linux_8: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build HiGHS - run: | - cmake -E make_directory ${{runner.workspace}}/build - cmake -E make_directory ${{runner.workspace}}/nugets - cmake -E make_directory ${{runner.workspace}}/test_nuget - - - name: Configure CMake - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON - - - name: Build - working-directory: ${{runner.workspace}}/build - run: cmake --build . --config Release --parallel - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - - name: Dotnet pack - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - run: dotnet pack -c Release /p:Version=1.7.0 - - - name: Add local feed - run: dotnet nuget add source ${{runner.workspace}}/nugets - - - name: Dotnet push to local feed - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - run: dotnet nuget push ./bin/Release/*.nupkg -s ${{runner.workspace}}/nugets - - - name: Create new project and test - shell: bash - working-directory: ${{runner.workspace}}/test_nuget - run: | - dotnet new console - rm Program.cs - cp $GITHUB_WORKSPACE/examples/call_highs_from_csharp.cs . - dotnet add package Highs.Native -s ${{runner.workspace}}/nugets - dotnet run - - build_windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - name: Build HiGHS Windows native - run: | - cmake -E make_directory ${{runner.workspace}}/build - cmake -E make_directory ${{runner.workspace}}/nugets - cmake -E make_directory ${{runner.workspace}}/test_nuget - - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON - - - name: Build - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake --build . --config Release --parallel - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.0.x' - - - name: Dotnet pack - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - run: dotnet pack -c Release /p:Version=1.7.0 - - - name: Add local feed - run: dotnet nuget add source -n name ${{runner.workspace}}\nugets - - - name: Dotnet push to local feed - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - shell: bash - run: dotnet nuget push ./bin/Release/*.nupkg -s name - - - name: Create new project and test - working-directory: ${{runner.workspace}}/test_nuget - run: | - dotnet new console - rm Program.cs - cp ${{runner.workspace}}\HiGHS\examples\call_highs_from_csharp.cs . - dotnet add package Highs.Native -v 1.7.0 -s ${{runner.workspace}}\nugets - dotnet run \ No newline at end of file diff --git a/.github/workflows/test-nuget-ubuntu.yml b/.github/workflows/test-nuget-ubuntu.yml new file mode 100644 index 0000000000..cce98e7f21 --- /dev/null +++ b/.github/workflows/test-nuget-ubuntu.yml @@ -0,0 +1,96 @@ +name: test-nuget-ubuntu + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build_linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build HiGHS + run: | + cmake -E make_directory ${{runner.workspace}}/build + cmake -E make_directory ${{runner.workspace}}/nugets + cmake -E make_directory ${{runner.workspace}}/test_nuget + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON + + - name: Build + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config Release --parallel + + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.0.x' + + - name: Dotnet pack + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + run: dotnet pack -c Release /p:Version=1.7.0 + + - name: Add local feed + run: dotnet nuget add source ${{runner.workspace}}/nugets + + - name: Dotnet push to local feed + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + run: dotnet nuget push ./bin/Release/*.nupkg -s ${{runner.workspace}}/nugets + + - name: Create new project and test + shell: bash + working-directory: ${{runner.workspace}}/test_nuget + run: | + dotnet new console + rm Program.cs + cp $GITHUB_WORKSPACE/examples/call_highs_from_csharp.cs . + dotnet add package Highs.Native -s ${{runner.workspace}}/nugets + dotnet run + + build_linux_8: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build HiGHS + run: | + cmake -E make_directory ${{runner.workspace}}/build + cmake -E make_directory ${{runner.workspace}}/nugets + cmake -E make_directory ${{runner.workspace}}/test_nuget + + - name: Configure CMake + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON + + - name: Build + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config Release --parallel + + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Dotnet pack + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + run: dotnet pack -c Release /p:Version=1.7.0 + + - name: Add local feed + run: dotnet nuget add source ${{runner.workspace}}/nugets + + - name: Dotnet push to local feed + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + run: dotnet nuget push ./bin/Release/*.nupkg -s ${{runner.workspace}}/nugets + + - name: Create new project and test + shell: bash + working-directory: ${{runner.workspace}}/test_nuget + run: | + dotnet new console + rm Program.cs + cp $GITHUB_WORKSPACE/examples/call_highs_from_csharp.cs . + dotnet add package Highs.Native -s ${{runner.workspace}}/nugets + dotnet run + + \ No newline at end of file diff --git a/.github/workflows/test-nuget-windows.yml b/.github/workflows/test-nuget-windows.yml new file mode 100644 index 0000000000..68a4209754 --- /dev/null +++ b/.github/workflows/test-nuget-windows.yml @@ -0,0 +1,53 @@ +name: test-nuget-windows + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build_windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Build HiGHS Windows native + run: | + cmake -E make_directory ${{runner.workspace}}/build + cmake -E make_directory ${{runner.workspace}}/nugets + cmake -E make_directory ${{runner.workspace}}/test_nuget + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON + + - name: Build + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config Release --parallel + + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.0.x' + + - name: Dotnet pack + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + run: dotnet pack -c Release /p:Version=1.7.0 + + - name: Add local feed + run: dotnet nuget add source -n name ${{runner.workspace}}\nugets + + - name: Dotnet push to local feed + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + shell: bash + run: dotnet nuget push ./bin/Release/*.nupkg -s name + + - name: Create new project and test + working-directory: ${{runner.workspace}}/test_nuget + run: | + dotnet new console + rm Program.cs + cp ${{runner.workspace}}\HiGHS\examples\call_highs_from_csharp.cs . + dotnet add package Highs.Native -v 1.7.0 -s ${{runner.workspace}}\nugets + dotnet run \ No newline at end of file diff --git a/cmake/README.md b/cmake/README.md index ffe50c3838..1f621b8167 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -1,10 +1,10 @@ # HiGHS CMake Build Instructions -| OS | C++ | Python | .NET | -|:-------- | :---: | :------: | :----: | -| Linux | [![Status][linux_cpp_svg]][linux_cpp_link] | [![Status][linux_python_svg]][linux_python_link] | [![Status][linux_dotnet_svg]][linux_dotnet_link] | -| MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] | [![Status][macos_python_svg]][macos_python_link] | [![Status][macos_dotnet_svg]][macos_dotnet_link] | -| Windows | [![Status][windows_cpp_svg]][windows_cpp_link] | [![Status][windows_python_svg]][windows_python_link] | [![Status][windows_dotnet_svg]][windows_dotnet_link] | +| OS | C++ | Python | CSharp Example | .NET | +|:-------- | :---: | :------: | :----: | :----: | +| Linux | [![Status][linux_cpp_svg]][linux_cpp_link] | [![Status][linux_python_svg]][linux_python_link] | *(1)* | [![Status][linux_dotnet_svg]][linux_dotnet_link] | +| MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] | [![Status][macos_python_svg]][macos_python_link] | *(1)* |[![Status][macos_dotnet_svg]][macos_dotnet_link] | +| Windows | [![Status][windows_cpp_svg]][windows_cpp_link] | [![Status][windows_python_svg]][windows_python_link] | [![Status][windows_csharp_svg]][windows_csharp_link] | [![Status][windows_dotnet_svg]][windows_dotnet_link] | [linux_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-linux-cpp.yml/badge.svg [linux_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-linux-cpp.yml @@ -20,25 +20,35 @@ [windows_python_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-python-win.yml/badge.svg [windows_python_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-python-win.yml -[linux_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-ubuntu.yml/badge.svg -[linux_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-ubuntu.yml -[macos_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-macos.yml/badge.svg -[macos_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-macos.yml -[windows_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-win.yml/badge.svg -[windows_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-win.yml +[windows_csharp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-win.yml/badge.svg +[windows_csharp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-csharp-win.yml + +[linux_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-nuget-ubuntu.yml/badge.svg +[linux_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-nuget-ubuntu.yml +[macos_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-nuget-macos.yml/badge.svg +[macos_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-nuget-macos.yml +[windows_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-nuget-win.yml/badge.svg +[windows_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-nuget-win.yml + +*(1)* CMake C# is currently only supported for Microsoft Visual Studio 11 2012 and + later. You can still build and run the HiGHS C# nuget package on Linux and MacOS with `dotnet`, see the workflows in the .NET column. It is only the CSharp example build with CMake that is not supported for Unix generators. +
+*Contents* - [HiGHS CMake Build Instructions](#highs-cmake-build-instructions) + - [Introduction](#introduction) - [Requirement](#requirement) - - [Supported compilers](#supported-compilers) + - [Supported compilers](#supported-compilers) - [Build](#build) - [Install](#install) - [Windows](#windows) - [CMake Options](#cmake-options) - [Integrating HiGHS in your CMake Project](#integrating-highs-in-your-cmake-project) +## Introduction HiGHS can be built from source using CMake: . CMake works by generating native Makefiles or build projects that can be used in the compiler environment of your choice. @@ -50,7 +60,7 @@ You'll need: * `CMake >= 3.15`. * A C++11 compiler -#### Supported compilers +## Supported compilers Here is a list of the supported compilers: From cabfb018ee3359909b9ea65993e23b80553bb4d8 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 21:34:33 +0300 Subject: [PATCH 11/44] rename wflow --- .github/workflows/test-nuget-win.yml | 53 ++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/test-nuget-win.yml diff --git a/.github/workflows/test-nuget-win.yml b/.github/workflows/test-nuget-win.yml new file mode 100644 index 0000000000..28eb217f43 --- /dev/null +++ b/.github/workflows/test-nuget-win.yml @@ -0,0 +1,53 @@ +name: test-nuget-win + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build_windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Build HiGHS Windows native + run: | + cmake -E make_directory ${{runner.workspace}}/build + cmake -E make_directory ${{runner.workspace}}/nugets + cmake -E make_directory ${{runner.workspace}}/test_nuget + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON + + - name: Build + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . --config Release --parallel + + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.0.x' + + - name: Dotnet pack + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + run: dotnet pack -c Release /p:Version=1.7.0 + + - name: Add local feed + run: dotnet nuget add source -n name ${{runner.workspace}}\nugets + + - name: Dotnet push to local feed + working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native + shell: bash + run: dotnet nuget push ./bin/Release/*.nupkg -s name + + - name: Create new project and test + working-directory: ${{runner.workspace}}/test_nuget + run: | + dotnet new console + rm Program.cs + cp ${{runner.workspace}}\HiGHS\examples\call_highs_from_csharp.cs . + dotnet add package Highs.Native -v 1.7.0 -s ${{runner.workspace}}\nugets + dotnet run \ No newline at end of file From 601bb639bad338420876bc97cfaf8d5772d5f886 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 21:35:50 +0300 Subject: [PATCH 12/44] nuget win testg --- .github/workflows/test-nuget-windows.yml | 53 ------------------------ 1 file changed, 53 deletions(-) delete mode 100644 .github/workflows/test-nuget-windows.yml diff --git a/.github/workflows/test-nuget-windows.yml b/.github/workflows/test-nuget-windows.yml deleted file mode 100644 index 68a4209754..0000000000 --- a/.github/workflows/test-nuget-windows.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: test-nuget-windows - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build_windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - name: Build HiGHS Windows native - run: | - cmake -E make_directory ${{runner.workspace}}/build - cmake -E make_directory ${{runner.workspace}}/nugets - cmake -E make_directory ${{runner.workspace}}/test_nuget - - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCSHARP=ON -DBUILD_DOTNET=ON - - - name: Build - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake --build . --config Release --parallel - - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.0.x' - - - name: Dotnet pack - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - run: dotnet pack -c Release /p:Version=1.7.0 - - - name: Add local feed - run: dotnet nuget add source -n name ${{runner.workspace}}\nugets - - - name: Dotnet push to local feed - working-directory: ${{runner.workspace}}/build/dotnet/Highs.Native - shell: bash - run: dotnet nuget push ./bin/Release/*.nupkg -s name - - - name: Create new project and test - working-directory: ${{runner.workspace}}/test_nuget - run: | - dotnet new console - rm Program.cs - cp ${{runner.workspace}}\HiGHS\examples\call_highs_from_csharp.cs . - dotnet add package Highs.Native -v 1.7.0 -s ${{runner.workspace}}\nugets - dotnet run \ No newline at end of file From 6d7459cfbd143766e317da384297909c1b56271e Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Mon, 20 May 2024 23:51:17 +0300 Subject: [PATCH 13/44] added fortran col --- .github/workflows/test-fortran-macos.yml | 30 +++++++++++++++++++ ...st-fortran.yml => test-fortran-ubuntu.yml} | 2 +- .github/workflows/test-fortran-win.yml | 30 +++++++++++++++++++ cmake/README.md | 17 +++++++---- 4 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/test-fortran-macos.yml rename .github/workflows/{test-fortran.yml => test-fortran-ubuntu.yml} (96%) create mode 100644 .github/workflows/test-fortran-win.yml diff --git a/.github/workflows/test-fortran-macos.yml b/.github/workflows/test-fortran-macos.yml new file mode 100644 index 0000000000..cfe40d361d --- /dev/null +++ b/.github/workflows/test-fortran-macos.yml @@ -0,0 +1,30 @@ +name: test-fortran-macos + +on: [push, pull_request] + +jobs: + fast_build_release: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DFORTRAN=ON + + - name: Build + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test + shell: bash + working-directory: ${{runner.workspace}}/build + run: | + ls + ./bin/fortrantest diff --git a/.github/workflows/test-fortran.yml b/.github/workflows/test-fortran-ubuntu.yml similarity index 96% rename from .github/workflows/test-fortran.yml rename to .github/workflows/test-fortran-ubuntu.yml index 360818f466..2cee9533a4 100644 --- a/.github/workflows/test-fortran.yml +++ b/.github/workflows/test-fortran-ubuntu.yml @@ -1,4 +1,4 @@ -name: test-fortran +name: test-fortran-ubuntu on: [push, pull_request] diff --git a/.github/workflows/test-fortran-win.yml b/.github/workflows/test-fortran-win.yml new file mode 100644 index 0000000000..8b58a6a009 --- /dev/null +++ b/.github/workflows/test-fortran-win.yml @@ -0,0 +1,30 @@ +name: test-fortran-win + +on: [push, pull_request] + +jobs: + fast_build_release: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DFORTRAN=ON + + - name: Build + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test + shell: bash + working-directory: ${{runner.workspace}}/build + run: | + ls + ./bin/fortrantest diff --git a/cmake/README.md b/cmake/README.md index 1f621b8167..b4d4eb0777 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -1,10 +1,10 @@ # HiGHS CMake Build Instructions -| OS | C++ | Python | CSharp Example | .NET | -|:-------- | :---: | :------: | :----: | :----: | -| Linux | [![Status][linux_cpp_svg]][linux_cpp_link] | [![Status][linux_python_svg]][linux_python_link] | *(1)* | [![Status][linux_dotnet_svg]][linux_dotnet_link] | -| MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] | [![Status][macos_python_svg]][macos_python_link] | *(1)* |[![Status][macos_dotnet_svg]][macos_dotnet_link] | -| Windows | [![Status][windows_cpp_svg]][windows_cpp_link] | [![Status][windows_python_svg]][windows_python_link] | [![Status][windows_csharp_svg]][windows_csharp_link] | [![Status][windows_dotnet_svg]][windows_dotnet_link] | +| OS | C++ | Fortran | Python | CSharp Example | .NET | +|:-------- | :---: | :------: | :----: | :----: | :----: | +| Linux | [![Status][linux_cpp_svg]][linux_cpp_link] | [![Status][linux_fortran_svg]][linux_fortran_link] | [![Status][linux_python_svg]][linux_python_link] | *(1)* | [![Status][linux_dotnet_svg]][linux_dotnet_link] | +| MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] |[![Status][macos_fortran_svg]][macos_fortran_link] | [![Status][macos_python_svg]][macos_python_link] | *(1)* |[![Status][macos_dotnet_svg]][macos_dotnet_link] | +| Windows | [![Status][windows_cpp_svg]][windows_cpp_link] | [![Status][windows_fortran_svg]][windows_fortran_link] | [![Status][windows_python_svg]][windows_python_link] | [![Status][windows_csharp_svg]][windows_csharp_link] | [![Status][windows_dotnet_svg]][windows_dotnet_link] | [linux_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-linux-cpp.yml/badge.svg [linux_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-linux-cpp.yml @@ -30,6 +30,13 @@ [windows_dotnet_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-nuget-win.yml/badge.svg [windows_dotnet_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-nuget-win.yml +[linux_fortran_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-fortran-ubuntu.yml/badge.svg +[linux_fortran_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-fortran-ubuntu.yml +[macos_fortran_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-fortran-macos.yml/badge.svg +[macos_fortran_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-fortran-macos.yml +[windows_fortran_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-fortran-win.yml/badge.svg +[windows_fortran_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/test-fortran-win.yml + *(1)* CMake C# is currently only supported for Microsoft Visual Studio 11 2012 and later. You can still build and run the HiGHS C# nuget package on Linux and MacOS with `dotnet`, see the workflows in the .NET column. It is only the CSharp example build with CMake that is not supported for Unix generators. From 229c19c461979592401264ce5f0cee80e50a7372 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 00:39:57 +0300 Subject: [PATCH 14/44] docs --- README.md | 4 +-- cmake/README.md | 2 +- docs/README.md | 2 +- docs/make.jl | 3 +- docs/src/guide/index.md | 2 +- docs/src/installation.md | 4 +-- docs/src/interfaces/cpp/index.md | 2 +- docs/src/interfaces/cpp/library.md | 14 ++++---- docs/src/interfaces/csharp.md | 55 +++++++++++++++++++++++++++++ docs/src/interfaces/csharp/index.md | 35 ------------------ docs/src/interfaces/fortran.md | 11 ++++++ docs/src/interfaces/other.md | 33 ----------------- docs/src/options/intro.md | 8 ++--- nuget/HowToAlternative.md | 8 ++--- 14 files changed, 91 insertions(+), 92 deletions(-) create mode 100644 docs/src/interfaces/csharp.md delete mode 100644 docs/src/interfaces/csharp/index.md create mode 100644 docs/src/interfaces/fortran.md diff --git a/README.md b/README.md index d3d5da5a35..ea55a4a69a 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ _The nix build files are provided by the community and are not officially suppor ## Interfaces -There are HiGHS interfaces for C, C#, FORTRAN, and Python in [HiGHS/src/interfaces](https://github.com/ERGO-Code/HiGHS/blob/master/src/interfaces), with example driver files in [HiGHS/examples](https://github.com/ERGO-Code/HiGHS/blob/master/examples). More on language and modelling interfaces can be found at https://ergo-code.github.io/HiGHS/stable/interfaces/other/. +There are HiGHS interfaces for C, C#, FORTRAN, and Python in `HiGHS/src/interfaces`, with example driver files in `HiGHS/examples/`. More on language and modelling interfaces can be found at https://ergo-code.github.io/HiGHS/stable/interfaces/other/. We are happy to give a reasonable level of support via email sent to highsopt@gmail.com. @@ -143,7 +143,7 @@ from the root directory. The HiGHS C++ library no longer needs to be separately installed. The python package `highspy` depends on the `numpy` package and `numpy` will be installed as well, if it is not already present. -The installation can be tested using the small example [call_highs_from_python_highspy.py](https://github.com/ERGO-Code/HiGHS/blob/master/examples/call_highs_from_python_highspy.py). +The installation can be tested using the small example `HiGHS/examples/call_highs_from_python_highspy.py`. The [Google Colab Example Notebook](https://colab.research.google.com/drive/1JmHF53OYfU-0Sp9bzLw-D2TQyRABSjHb?usp=sharing) also demonstrates how to call `highspy`. diff --git a/cmake/README.md b/cmake/README.md index b4d4eb0777..d55f6e11c0 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -211,7 +211,7 @@ The line set(HIGHS_DIR path_to_highs_install/lib/cmake/highs) ``` adds the HiGHS installation path to `HIGHS_DIR`. This is equivalent to building this project with -``` +``` bash cmake -DHIGHS_DIR=path_to_highs_install/lib/cmake/highs .. ``` diff --git a/docs/README.md b/docs/README.md index 61426e0037..86464838fd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,7 +11,7 @@ To edit the documentation, checkout a branch and edit the Markdown files in the To build locally, [install Julia](https://julialang.org/downloads/), then (from the `docs` directory) run: -``` +``` bash $ julia make.jl ``` diff --git a/docs/make.jl b/docs/make.jl index e4996d0b1d..772c6e7e39 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -74,11 +74,12 @@ Documenter.makedocs( "Examples" => "interfaces/cpp/examples.md", ], "C" => "interfaces/c/index.md", - "CSharp" => "interfaces/csharp/index.md", + "Fortran" => "interfaces/fortran.md", "Python" => Any[ "interfaces/python/index.md", "interfaces/python/example-py.md", ], + "CSharp" => "interfaces/csharp.md", "Julia" => "interfaces/julia/index.md", "Other" => "interfaces/other.md", ], diff --git a/docs/src/guide/index.md b/docs/src/guide/index.md index 3d93481564..bba05a2a6a 100644 --- a/docs/src/guide/index.md +++ b/docs/src/guide/index.md @@ -2,7 +2,7 @@ This guide describes the features of HiGHS that are available when it is called from [`Python`](@ref python-getting-started), [`C++`](@ref -cpp-getting-started), [`C`](@ref c-api) and [`Fortran`](@ref +cpp-getting-started), [`C`](@ref c-api), [`C#`](@ref csharp) and [`Fortran`](@ref fortran-api). It is written in three sections: [basic](@ref guide-basic), [further](@ref guide-further) and [advanced](@ref guide-advanced). diff --git a/docs/src/installation.md b/docs/src/installation.md index a4cae43abe..e9a3e764d7 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -3,12 +3,12 @@ ## Compile from source HiGHS uses CMake as build system, and requires at least version -3.15. Details about building from source using cmake can be found in [`HiGHS/cmake/README.md`](https://github.com/ERGO-Code/HiGHS/blob/master/cmake/README.md) +3.15. Details about building from source using cmake can be found in `HiGHS/cmake/README.md`. ## Install via a package manager HiGHS can be installed using a package manager in the cases of -[`Julia`](@ref HiGHS.jl), [`Python`](@ref python-getting-started), [`CSharp`](@ref csharp-getting-started)and [`Rust`](@ref Rust). +[`Julia`](@ref HiGHS.jl), [`Python`](@ref python-getting-started), [`CSharp`](@ref nuget) and [`Rust`](@ref Rust). ## Precompiled Binaries diff --git a/docs/src/interfaces/cpp/index.md b/docs/src/interfaces/cpp/index.md index 305ad3e331..23c43dd6d3 100644 --- a/docs/src/interfaces/cpp/index.md +++ b/docs/src/interfaces/cpp/index.md @@ -16,7 +16,7 @@ HiGHS uses CMake (minimum version 3.15) as a build system, and can use the follo - Intel ` icc ` - Microsoft ` MSVC ` -Instructions for building HiGHS from source code are in [`HiGHS/cmake/README.md`](https://github.com/ERGO-Code/HiGHS/blob/master/cmake/README.md). +Instructions for building HiGHS from source code are in `HiGHS/cmake/README.md`. The simplest setup is to build HiGHS in a build directory within the root direcory. The name of the build folder is arbitrary but, assuming it is `build`, diff --git a/docs/src/interfaces/cpp/library.md b/docs/src/interfaces/cpp/library.md index 53869789a3..27f8615300 100644 --- a/docs/src/interfaces/cpp/library.md +++ b/docs/src/interfaces/cpp/library.md @@ -5,22 +5,22 @@ The HiGHS library is defined in the [`src/Highs.h`](https://github.com/ERGO-Code Models in HiGHS are defined as an instance of the `HighsModel` class. This consists of one instance of the `HighsLp` class, and one instance of the `HighsHessian` class. Communication of models to and from HiGHS is possible via instances of the `HighsLp` or `HighsModel` class. In the C and other interfaces, communication of models is via scalar values and addresses of arrays. In C++, the neatest way of passing a model to HiGHS is to create an instance of the `HighsModel` class, populate its data, and call -``` +``` cpp Highs::passModel(const HighsModel& model) ``` or create and populate an instance of the `HighsLp` class, and call -``` +``` cpp Highs::passModel(const HighsLp& lp) ``` For reading models from a file, use -``` +``` cpp Highs::readModel(const std::string& filename) ``` Below is an example of building a `HighsModel` -``` +``` cpp // Create and populate a HighsModel instance for the LP // Min f = x_0 + x_1 + 3 @@ -56,7 +56,7 @@ Below is an example of building a `HighsModel` ## Solve model -``` +``` cpp // Create a Highs instance Highs highs; HighsStatus return_status; @@ -79,7 +79,7 @@ Below is an example of building a `HighsModel` Solution information: -``` +``` cpp const HighsInfo& info = highs.getInfo(); cout << "Simplex iteration count: " << info.simplex_iteration_count << endl; cout << "Objective function value: " << info.objective_function_value << endl; @@ -91,7 +91,7 @@ Solution information: ## Integrality variables To indicate that variables must take integer values use the `HighsLp::integrality` vector. -``` +``` cpp model.lp_.integrality_.resize(lp.num_col_); for (int col=0; col < lp.num_col_; col++) model.lp_.integrality_[col] = HighsVarType::kInteger; diff --git a/docs/src/interfaces/csharp.md b/docs/src/interfaces/csharp.md new file mode 100644 index 0000000000..ef07a3e78d --- /dev/null +++ b/docs/src/interfaces/csharp.md @@ -0,0 +1,55 @@ +## [CSharp](@id csharp) + +### Build from source + +There is a C# example code in `examples/call_highs_from_csharp.cs`. From the HiGHS root directory, run + +``` bash +cmake -S. -Bbuild -DCSHARP=ON +``` + +If a CSharp compiler is available, this builds the example using cmake and generates a binary in the build directory (`build/bin/csharpexample`). + +## [NuGet](@id nuget) + +The nuget package Highs.Native is on https://www.nuget.org, at https://www.nuget.org/packages/Highs.Native/. + +It can be added to your C# project with `dotnet` + +```bash +dotnet add package Highs.Native --version 1.7.0 +``` + +The nuget package contains runtime libraries for + +* `win-x64` +* `win-x32` +* `linux-x64` +* `linux-arm64` +* `macos-x64` +* `macos-arm64` + +Details for building locally can be found in `nuget/README.md`. + +#### C# API + +The C# API can be called directly. Here are observations on calling the HiGHS C# API from C#: + + * The file `HiGHS/src/interfaces/highs_csharp_api.cs` contains all the PInvoke you need. + * Make sure, that the native HiGHS library (`highs.dll`, `libhighs.dll`, + `libhighs.so`, ... depending on your platform) can be found at runtime. How + to do this is platform dependent, copying it next to your C# executable + should work in most cases. You can use msbuild for that. On linux, installing + HiGHS system wide should work. + * Make sure that all dependencies of the HiGHS library can be found, too. For + example, if HiGHS was build using `Visual C++` make sure that the + `MSVCRuntime` is installed on the machine you want to run your application + on. + * Depending on the name of your HiGHS library, it might be necessary to change + the constant "highslibname". See [document](https://learn.microsoft.com/en-us/dotnet/standard/native-interop/cross-platform) + on writing cross platform P/Invoke code if necessary. + * Call the Methods in `highs_csharp_api.cs` and have fun with HiGHS. + +This is the normal way to call plain old C from C# with the great simplification +that you don't have to write the PInvoke declarations yourself. + diff --git a/docs/src/interfaces/csharp/index.md b/docs/src/interfaces/csharp/index.md deleted file mode 100644 index af763a4b24..0000000000 --- a/docs/src/interfaces/csharp/index.md +++ /dev/null @@ -1,35 +0,0 @@ -# [Getting started](@id csharp-getting-started) - -## Install - -### Build from source - -There is a C# example code in `examples/call_highs_from_csharp.cs`. From the HiGHS root directory, run - -``` bash -cmake -S. -Bbuild -DCSHARP=ON -``` - -If a CSharp compiler is available, this builds the example using cmake and generates a binary in the build directory (`build/bin/csharpexample`). - -### NuGet - -The nuget package Highs.Native is on https://www.nuget.org, at https://www.nuget.org/packages/Highs.Native/. - -It can be added to your C# project with `dotnet` - -```bash -dotnet add package Highs.Native --version 1.7.0 -``` - -The nuget package contains runtime libraries for - -* `win-x64` -* `win-x32` -* `linux-x64` -* `linux-arm64` -* `macos-x64` -* `macos-arm64` - -Details for building locally can be found in `nuget/README.md`. - diff --git a/docs/src/interfaces/fortran.md b/docs/src/interfaces/fortran.md new file mode 100644 index 0000000000..96353c033b --- /dev/null +++ b/docs/src/interfaces/fortran.md @@ -0,0 +1,11 @@ + +## [Fortran](@id fortran-api) + +The interface is in +[`HiGHS/src/interfaces/highs_fortran_api.f90`]. Its +methods are simply bindings to the [`C` API](@ref c-api) + +To include in the build, switch the Fortran CMake parameter on: +``` bash +cmake -DFORTRAN=ON .. +``` \ No newline at end of file diff --git a/docs/src/interfaces/other.md b/docs/src/interfaces/other.md index fd4bfdbf59..89bc34afe2 100644 --- a/docs/src/interfaces/other.md +++ b/docs/src/interfaces/other.md @@ -8,39 +8,6 @@ HiGHS can be used via AMPL, see the [AMPL Documentation](https://dev.ampl.com/solvers/highs/index.html). -## C# - -Here are observations on calling HiGHS from C#: - - * The file [`highs_csharp_api.cs`](https://github.com/ERGO-Code/HiGHS/blob/master/src/interfaces/highs_csharp_api.cs) - contains all the PInvoke you need. Copy it into your C# project. - * Make sure, that the native HiGHS library (`highs.dll`, `libhighs.dll`, - `libhighs.so`, ... depending on your platform) can be found at runtime. How - to do this is platform dependent, copying it next to your C# executable - should work in most cases. You can use msbuild for that. On linux, installing - HiGHS system wide should work. - * Make sure that all dependencies of the HiGHS library can be found, too. For - example, if HiGHS was build using `Visual C++` make sure that the - `MSVCRuntime` is installed on the machine you want to run your application - on. - * Depending on the name of your HiGHS library, it might be necessary to change - the constant "highslibname". See [document](https://learn.microsoft.com/en-us/dotnet/standard/native-interop/cross-platform) - on writing cross platform P/Invoke code if necessary. - * Call the Methods in `highs_csharp_api.cs` and have fun with HiGHS. - -This is the normal way to call plain old C from C# with the great simplification -that you don't have to write the PInvoke declarations yourself. - -## [Fortran](@id fortran-api) - -The interface is in -[`highs_fortran_api.f90`](https://github.com/ERGO-Code/HiGHS/blob/master/src/interfaces/highs_fortran_api.f90). Its -methods are simply bindings to the [`C` API](@ref c-api) - -To include in the build, switch the Fortran CMake parameter on: -``` -cmake -DFORTRAN=ON .. -``` ## GAMS diff --git a/docs/src/options/intro.md b/docs/src/options/intro.md index 7396072a87..686d529a43 100644 --- a/docs/src/options/intro.md +++ b/docs/src/options/intro.md @@ -21,9 +21,9 @@ $ bin/highs --options_file="" ## Option methods -To set the value of option `name`, call: +The following code illustrates how to access the HiGHS options in Python. To set the value of option `name`, call: -``` +``` python status = h.setOptionValue(name, value) ``` @@ -32,13 +32,13 @@ explicit value. To get the value of option `name`, call: -``` +``` python [status, value] = h.getOptionValue(name) ``` To get the type of option `name`, call: -``` +``` python [status, type] = h.getOptionType(name) ``` diff --git a/nuget/HowToAlternative.md b/nuget/HowToAlternative.md index 7912918bed..afa5272948 100644 --- a/nuget/HowToAlternative.md +++ b/nuget/HowToAlternative.md @@ -27,7 +27,7 @@ In order to check if the runtimes are contained in the nuget package, one can op ## nuget structure for native libraries The nuget package is required to look like this for the native libraries -``` +``` bash package/ |-- lib/ | |-- netstandard2.0/ @@ -35,13 +35,13 @@ package/ |-- runtimes/ | |-- linux-x64/ | | |-- native/ -| | |-- [linux-x64 native libraries] +| | ! [linux-x64 native libraries] | |-- linux-arm64/ | | |-- native/ -| | |-- [linux-arm64 native libraries] +| | ! [linux-arm64 native libraries] | |-- win-x64/ | | |-- native/ -| | |-- [win-x64 native libraries] +| | ! [win-x64 native libraries] ``` ## Examples for the builds From 1354c1533755e47d1bd29e8357ac7c5e0289c377 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 00:46:07 +0300 Subject: [PATCH 15/44] cosmetic --- docs/make.jl | 2 +- docs/src/interfaces/{c/index.md => c_api.md} | 0 docs/src/interfaces/csharp.md | 6 +++--- docs/src/interfaces/fortran.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename docs/src/interfaces/{c/index.md => c_api.md} (100%) diff --git a/docs/make.jl b/docs/make.jl index 772c6e7e39..132d36c4de 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -73,7 +73,7 @@ Documenter.makedocs( "The HiGHS library" => "interfaces/cpp/library.md", "Examples" => "interfaces/cpp/examples.md", ], - "C" => "interfaces/c/index.md", + "C" => "interfaces/c_api.md", "Fortran" => "interfaces/fortran.md", "Python" => Any[ "interfaces/python/index.md", diff --git a/docs/src/interfaces/c/index.md b/docs/src/interfaces/c_api.md similarity index 100% rename from docs/src/interfaces/c/index.md rename to docs/src/interfaces/c_api.md diff --git a/docs/src/interfaces/csharp.md b/docs/src/interfaces/csharp.md index ef07a3e78d..0455946d8f 100644 --- a/docs/src/interfaces/csharp.md +++ b/docs/src/interfaces/csharp.md @@ -1,6 +1,6 @@ -## [CSharp](@id csharp) +#### [CSharp](@id csharp) -### Build from source +#### Build from source There is a C# example code in `examples/call_highs_from_csharp.cs`. From the HiGHS root directory, run @@ -10,7 +10,7 @@ cmake -S. -Bbuild -DCSHARP=ON If a CSharp compiler is available, this builds the example using cmake and generates a binary in the build directory (`build/bin/csharpexample`). -## [NuGet](@id nuget) +#### [NuGet](@id nuget) The nuget package Highs.Native is on https://www.nuget.org, at https://www.nuget.org/packages/Highs.Native/. diff --git a/docs/src/interfaces/fortran.md b/docs/src/interfaces/fortran.md index 96353c033b..fecbe63b48 100644 --- a/docs/src/interfaces/fortran.md +++ b/docs/src/interfaces/fortran.md @@ -1,5 +1,5 @@ -## [Fortran](@id fortran-api) +#### [Fortran](@id fortran-api) The interface is in [`HiGHS/src/interfaces/highs_fortran_api.f90`]. Its From ea9b607043d301237993a15948a47e35e29c7e55 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 00:49:27 +0300 Subject: [PATCH 16/44] test fortran macos --- .github/workflows/test-fortran-macos.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-fortran-macos.yml b/.github/workflows/test-fortran-macos.yml index cfe40d361d..83847ca8ea 100644 --- a/.github/workflows/test-fortran-macos.yml +++ b/.github/workflows/test-fortran-macos.yml @@ -4,11 +4,22 @@ on: [push, pull_request] jobs: fast_build_release: - runs-on: macos-latest + + matrix: + os: [macos-latest] + toolchain: + - {compiler: gcc, version: 13} + - {compiler: intel-classic, version: '2021.10'} steps: - uses: actions/checkout@v4 + - uses: fortran-lang/setup-fortran@v1 + id: setup-fortran + with: + compiler: ${{ matrix.toolchain.compiler }} + version: ${{ matrix.toolchain.version }} + - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build From b3344f29ce635f142782c8ea4ed062043d97d1f5 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 01:03:31 +0300 Subject: [PATCH 17/44] macos fortran --- .github/workflows/test-fortran-macos.yml | 61 ++++++++++++------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/.github/workflows/test-fortran-macos.yml b/.github/workflows/test-fortran-macos.yml index 83847ca8ea..68111e19ed 100644 --- a/.github/workflows/test-fortran-macos.yml +++ b/.github/workflows/test-fortran-macos.yml @@ -4,38 +4,39 @@ on: [push, pull_request] jobs: fast_build_release: - - matrix: + runs-on: ${{ matrix.os }} + strategy: + matrix: os: [macos-latest] toolchain: - {compiler: gcc, version: 13} - {compiler: intel-classic, version: '2021.10'} - steps: - - uses: actions/checkout@v4 - - - uses: fortran-lang/setup-fortran@v1 - id: setup-fortran - with: - compiler: ${{ matrix.toolchain.compiler }} - version: ${{ matrix.toolchain.version }} - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DFORTRAN=ON - - - name: Build - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake --build . --parallel - - - name: Test - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - ls - ./bin/fortrantest + steps: + - uses: actions/checkout@v4 + + - uses: fortran-lang/setup-fortran@v1 + id: setup-fortran + with: + compiler: ${{ matrix.toolchain.compiler }} + version: ${{ matrix.toolchain.version }} + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DFORTRAN=ON + + - name: Build + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test + shell: bash + working-directory: ${{runner.workspace}}/build + run: | + ls + ./bin/fortrantest From 7ba619af2de79a5b368862acc0a9441e587fc166 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 01:04:47 +0300 Subject: [PATCH 18/44] steps --- .github/workflows/test-fortran-macos.yml | 56 ++++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/test-fortran-macos.yml b/.github/workflows/test-fortran-macos.yml index 68111e19ed..556dcfee1e 100644 --- a/.github/workflows/test-fortran-macos.yml +++ b/.github/workflows/test-fortran-macos.yml @@ -12,31 +12,31 @@ jobs: - {compiler: gcc, version: 13} - {compiler: intel-classic, version: '2021.10'} - steps: - - uses: actions/checkout@v4 - - - uses: fortran-lang/setup-fortran@v1 - id: setup-fortran - with: - compiler: ${{ matrix.toolchain.compiler }} - version: ${{ matrix.toolchain.version }} - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DFORTRAN=ON - - - name: Build - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake --build . --parallel - - - name: Test - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - ls - ./bin/fortrantest + steps: + - uses: actions/checkout@v4 + + - uses: fortran-lang/setup-fortran@v1 + id: setup-fortran + with: + compiler: ${{ matrix.toolchain.compiler }} + version: ${{ matrix.toolchain.version }} + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DFORTRAN=ON + + - name: Build + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake --build . --parallel + + - name: Test + shell: bash + working-directory: ${{runner.workspace}}/build + run: | + ls + ./bin/fortrantest From 043b80901378b47e99a96155dbd8716d69785fd2 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 01:07:44 +0300 Subject: [PATCH 19/44] test fortran ubuntu --- .github/workflows/test-fortran-ubuntu.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-fortran-ubuntu.yml b/.github/workflows/test-fortran-ubuntu.yml index 2cee9533a4..06e4ed7cf4 100644 --- a/.github/workflows/test-fortran-ubuntu.yml +++ b/.github/workflows/test-fortran-ubuntu.yml @@ -4,11 +4,28 @@ on: [push, pull_request] jobs: fast_build_release: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + toolchain: + - {compiler: gcc, version: 13} + - {compiler: intel, version: '2023.2'} + - {compiler: intel-classic, version: '2021.10'} + - {compiler: nvidia-hpc, version: '23.11'} + include: + - os: ubuntu-latest + toolchain: {compiler: gcc, version: 12} steps: - uses: actions/checkout@v4 + - uses: fortran-lang/setup-fortran@v1 + id: setup-fortran + with: + compiler: ${{ matrix.toolchain.compiler }} + version: ${{ matrix.toolchain.version }} + - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build From a778542d9fd79cefe16e3824c3ada80cb8523a1e Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 01:20:15 +0300 Subject: [PATCH 20/44] compiler options --- .github/workflows/test-fortran-macos.yml | 1 - .github/workflows/test-fortran-ubuntu.yml | 1 - app/CMakeLists.txt | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test-fortran-macos.yml b/.github/workflows/test-fortran-macos.yml index 556dcfee1e..fdf82ca276 100644 --- a/.github/workflows/test-fortran-macos.yml +++ b/.github/workflows/test-fortran-macos.yml @@ -10,7 +10,6 @@ jobs: os: [macos-latest] toolchain: - {compiler: gcc, version: 13} - - {compiler: intel-classic, version: '2021.10'} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test-fortran-ubuntu.yml b/.github/workflows/test-fortran-ubuntu.yml index 06e4ed7cf4..6f747e8b60 100644 --- a/.github/workflows/test-fortran-ubuntu.yml +++ b/.github/workflows/test-fortran-ubuntu.yml @@ -11,7 +11,6 @@ jobs: toolchain: - {compiler: gcc, version: 13} - {compiler: intel, version: '2023.2'} - - {compiler: intel-classic, version: '2021.10'} - {compiler: nvidia-hpc, version: '23.11'} include: - os: ubuntu-latest diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 0363d7dcab..7b03fe65f0 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -19,7 +19,7 @@ if(FAST_BUILD) $ ) - if(UNIX) + if(UNIX AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") target_compile_options(highs-bin PUBLIC "-Wno-unused-variable") target_compile_options(highs-bin PUBLIC "-Wno-unused-const-variable") endif() From af9d7d4f8d881a5b4c68082d471b5e814d901c5a Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 01:35:23 +0300 Subject: [PATCH 21/44] badge and tests --- .github/workflows/test-fortran-macos.yml | 2 +- .github/workflows/test-fortran-ubuntu.yml | 4 ++-- README.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-fortran-macos.yml b/.github/workflows/test-fortran-macos.yml index fdf82ca276..e7e169d425 100644 --- a/.github/workflows/test-fortran-macos.yml +++ b/.github/workflows/test-fortran-macos.yml @@ -9,7 +9,7 @@ jobs: matrix: os: [macos-latest] toolchain: - - {compiler: gcc, version: 13} + - {compiler: g++, version: 13} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test-fortran-ubuntu.yml b/.github/workflows/test-fortran-ubuntu.yml index 6f747e8b60..7030087313 100644 --- a/.github/workflows/test-fortran-ubuntu.yml +++ b/.github/workflows/test-fortran-ubuntu.yml @@ -10,8 +10,8 @@ jobs: os: [ubuntu-latest] toolchain: - {compiler: gcc, version: 13} - - {compiler: intel, version: '2023.2'} - - {compiler: nvidia-hpc, version: '23.11'} + # - {compiler: intel, version: '2023.2'} + # - {compiler: nvidia-hpc, version: '23.11'} include: - os: ubuntu-latest toolchain: {compiler: gcc, version: 12} diff --git a/README.md b/README.md index ea55a4a69a..c3b299835e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # HiGHS - Linear optimization software -[![Build Status](https://github.com/ERGO-Code/HiGHS/workflows/build/badge.svg)](https://github.com/ERGO-Code/HiGHS/actions?query=workflow%3Abuild+branch%3Amaster) +[![Build Status]](https://github.com/github/docs/actions/workflows/main.yml/badge.svg) [![Conan Center](https://img.shields.io/conan/v/highs)](https://conan.io/center/recipes/highs) [![PyPi](https://img.shields.io/pypi/v/highspy.svg)](https://pypi.python.org/pypi/highspy) [![PyPi](https://img.shields.io/pypi/dm/highspy.svg)](https://pypi.python.org/pypi/highspy) From 16ee4eaa61de16672dfc3c4efc21ddc693222a09 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 01:36:04 +0300 Subject: [PATCH 22/44] badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c3b299835e..b710e602ca 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # HiGHS - Linear optimization software -[![Build Status]](https://github.com/github/docs/actions/workflows/main.yml/badge.svg) +[![Build Status](https://github.com/github/docs/actions/workflows/main.yml/badge.svg) [![Conan Center](https://img.shields.io/conan/v/highs)](https://conan.io/center/recipes/highs) [![PyPi](https://img.shields.io/pypi/v/highspy.svg)](https://pypi.python.org/pypi/highspy) [![PyPi](https://img.shields.io/pypi/dm/highspy.svg)](https://pypi.python.org/pypi/highspy) From e4e64512782c7171ea316b1fc4a8a4d479fea918 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 01:37:15 +0300 Subject: [PATCH 23/44] clean up --- app/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 7b03fe65f0..0363d7dcab 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -19,7 +19,7 @@ if(FAST_BUILD) $ ) - if(UNIX AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") + if(UNIX) target_compile_options(highs-bin PUBLIC "-Wno-unused-variable") target_compile_options(highs-bin PUBLIC "-Wno-unused-const-variable") endif() From 815ffcad26a581d06ce6cfb7acf848d5104639d5 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 01:39:24 +0300 Subject: [PATCH 24/44] clean up badge --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b710e602ca..8e79897072 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # HiGHS - Linear optimization software -[![Build Status](https://github.com/github/docs/actions/workflows/main.yml/badge.svg) +[![Build Status](https://github.com/ERGO-Code/HiGHS/actions/workflows/build-fast.yml/badge.svg) [![Conan Center](https://img.shields.io/conan/v/highs)](https://conan.io/center/recipes/highs) [![PyPi](https://img.shields.io/pypi/v/highspy.svg)](https://pypi.python.org/pypi/highspy) [![PyPi](https://img.shields.io/pypi/dm/highspy.svg)](https://pypi.python.org/pypi/highspy) @@ -11,7 +11,7 @@ - [Installation](#installation) - [Build from source using CMake](#build-from-source-using-cmake) - [Precompiled binaries](#precompiled-binaries) - - [Build with Nix](#build-with-nix) + - [Build with Nix](#build-with-nix) - [Interfaces](#interfaces) - [Python](#python) - [CSharp](#csharp) @@ -85,7 +85,7 @@ _These binaries are provided by the Julia community and are not officially suppo See https://ergo-code.github.io/HiGHS/stable/installation/#Precompiled-Binaries. -### Build with Nix +#### Build with Nix There is a nix flake that provides the `highs` binary: From 5b2fc13a0a8e86f58dd1b094d35273a045c50ef8 Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 01:41:47 +0300 Subject: [PATCH 25/44] macos gcc --- .github/workflows/test-fortran-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-fortran-macos.yml b/.github/workflows/test-fortran-macos.yml index e7e169d425..fdf82ca276 100644 --- a/.github/workflows/test-fortran-macos.yml +++ b/.github/workflows/test-fortran-macos.yml @@ -9,7 +9,7 @@ jobs: matrix: os: [macos-latest] toolchain: - - {compiler: g++, version: 13} + - {compiler: gcc, version: 13} steps: - uses: actions/checkout@v4 From 2ae480317b2c5ff721a4bb641c1995bf42ee26bd Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 01:43:14 +0300 Subject: [PATCH 26/44] win gfortran --- .github/workflows/test-fortran-win.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-fortran-win.yml b/.github/workflows/test-fortran-win.yml index 8b58a6a009..a24d693f3d 100644 --- a/.github/workflows/test-fortran-win.yml +++ b/.github/workflows/test-fortran-win.yml @@ -4,7 +4,21 @@ on: [push, pull_request] jobs: fast_build_release: - runs-on: windows-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest] + toolchain: + - {compiler: gcc, version: 13} + + steps: + - uses: actions/checkout@v4 + + - uses: fortran-lang/setup-fortran@v1 + id: setup-fortran + with: + compiler: ${{ matrix.toolchain.compiler }} + version: ${{ matrix.toolchain.version }} steps: - uses: actions/checkout@v4 From 21fcee7e1fb24a00e219a028a939c91eb7f8c23d Mon Sep 17 00:00:00 2001 From: Ivet Galabova Date: Tue, 21 May 2024 01:47:41 +0300 Subject: [PATCH 27/44] wflow win --- .github/workflows/test-fortran-win.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test-fortran-win.yml b/.github/workflows/test-fortran-win.yml index a24d693f3d..6b4e1755e2 100644 --- a/.github/workflows/test-fortran-win.yml +++ b/.github/workflows/test-fortran-win.yml @@ -20,9 +20,6 @@ jobs: compiler: ${{ matrix.toolchain.compiler }} version: ${{ matrix.toolchain.version }} - steps: - - uses: actions/checkout@v4 - - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build From ebfd9f7ed07272175cb1ce88ccbb647993f6413b Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 16:01:36 +0100 Subject: [PATCH 28/44] fortran test --- .github/workflows/test-fortran-macos.yml | 18 ++-- .github/workflows/test-fortran-ubuntu.yml | 2 +- .github/workflows/test-fortran-win.yml | 41 --------- CMakeLists.txt | 100 +++++++++++----------- cmake/README.md | 4 +- 5 files changed, 60 insertions(+), 105 deletions(-) delete mode 100644 .github/workflows/test-fortran-win.yml diff --git a/.github/workflows/test-fortran-macos.yml b/.github/workflows/test-fortran-macos.yml index fdf82ca276..01570daab7 100644 --- a/.github/workflows/test-fortran-macos.yml +++ b/.github/workflows/test-fortran-macos.yml @@ -3,26 +3,18 @@ name: test-fortran-macos on: [push, pull_request] jobs: - fast_build_release: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest] - toolchain: - - {compiler: gcc, version: 13} + release: + runs-on: macos-latest steps: - uses: actions/checkout@v4 - - uses: fortran-lang/setup-fortran@v1 - id: setup-fortran - with: - compiler: ${{ matrix.toolchain.compiler }} - version: ${{ matrix.toolchain.version }} - - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build + - name: gfortran + run: brew install gfortran + - name: Configure CMake shell: bash working-directory: ${{runner.workspace}}/build diff --git a/.github/workflows/test-fortran-ubuntu.yml b/.github/workflows/test-fortran-ubuntu.yml index 7030087313..937f51b12c 100644 --- a/.github/workflows/test-fortran-ubuntu.yml +++ b/.github/workflows/test-fortran-ubuntu.yml @@ -1,4 +1,4 @@ -name: test-fortran-ubuntu +name: test-fortran on: [push, pull_request] diff --git a/.github/workflows/test-fortran-win.yml b/.github/workflows/test-fortran-win.yml deleted file mode 100644 index 6b4e1755e2..0000000000 --- a/.github/workflows/test-fortran-win.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: test-fortran-win - -on: [push, pull_request] - -jobs: - fast_build_release: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest] - toolchain: - - {compiler: gcc, version: 13} - - steps: - - uses: actions/checkout@v4 - - - uses: fortran-lang/setup-fortran@v1 - id: setup-fortran - with: - compiler: ${{ matrix.toolchain.compiler }} - version: ${{ matrix.toolchain.version }} - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DFORTRAN=ON - - - name: Build - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake --build . --parallel - - - name: Test - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - ls - ./bin/fortrantest diff --git a/CMakeLists.txt b/CMakeLists.txt index 62e4b2b246..d34225c00a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,59 +171,61 @@ if (BUILD_CXX) check_type_size("int *" SIZEOF_INT_P LANGUAGE CXX) message(STATUS "Found int * size: ${SIZEOF_INT_P}") cmake_pop_check_state() + + if (NOT (FORTRAN AND MACOS)) + # Use current CMAKE_C_FLAGS and CMAKE_CXX_FLAGS when checking for IPO support, + # instead of defaults: https://cmake.org/cmake/help/latest/policy/CMP0138.html + if(MSVC AND BUILD_SHARED_LIBS) + # MSVC does support LTO, but WINDOWS_EXPORT_ALL_SYMBOLS does not work if + # LTO is enabled. + set(ipo_supported NO) + message(STATUS "IPO / LTO not supported on MSVC when building a shared library") + elseif(MINGW AND NOT CLANG) + # MinGW supports LTO, but it causes tests to fail at runtime like this: + # + # Mingw-w64 runtime failure: + # 32 bit pseudo relocation at 00007FF779C9D070 out of range, targeting 00007FFAAC101400, yielding the value 000000033246438C. + # + # TODO Figure out and fix the root cause of that, then remove this section. + set(ipo_supported NO) + message(STATUS "IPO / LTO not currently supported building HiGHS on MinGW") + else() + if(CMAKE_VERSION VERSION_GREATER "3.23.0") + cmake_policy(SET CMP0138 NEW) + endif() - # Use current CMAKE_C_FLAGS and CMAKE_CXX_FLAGS when checking for IPO support, - # instead of defaults: https://cmake.org/cmake/help/latest/policy/CMP0138.html - if(MSVC AND BUILD_SHARED_LIBS) - # MSVC does support LTO, but WINDOWS_EXPORT_ALL_SYMBOLS does not work if - # LTO is enabled. - set(ipo_supported NO) - message(STATUS "IPO / LTO not supported on MSVC when building a shared library") - elseif(MINGW AND NOT CLANG) - # MinGW supports LTO, but it causes tests to fail at runtime like this: - # - # Mingw-w64 runtime failure: - # 32 bit pseudo relocation at 00007FF779C9D070 out of range, targeting 00007FFAAC101400, yielding the value 000000033246438C. - # - # TODO Figure out and fix the root cause of that, then remove this section. - set(ipo_supported NO) - message(STATUS "IPO / LTO not currently supported building HiGHS on MinGW") - else() - if(CMAKE_VERSION VERSION_GREATER "3.23.0") - cmake_policy(SET CMP0138 NEW) + include(CheckIPOSupported) + check_ipo_supported(RESULT ipo_supported OUTPUT check_ipo_support_output) + message(STATUS "IPO / LTO supported by compiler: ${ipo_supported}") endif() - include(CheckIPOSupported) - check_ipo_supported(RESULT ipo_supported OUTPUT check_ipo_support_output) - message(STATUS "IPO / LTO supported by compiler: ${ipo_supported}") - endif() - - if(DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) - # The user explicitly requested IPO. If it's not supported, CMake *should* - # produce an error: https://cmake.org/cmake/help/latest/policy/CMP0069.html - # However, we can give a more helpful error message ourselves. - message(STATUS "IPO / LTO: ${CMAKE_INTERPROCEDURAL_OPTIMIZATION} as requested by user") - if(CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT ipo_supported) - message(SEND_ERROR - "IPO / LTO was requested through CMAKE_INTERPROCEDURAL_OPTIMIZATION, " - "but it is not supported by the compiler. The check failed with this output:\n" - "${check_ipo_support_output}") + if(DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) + # The user explicitly requested IPO. If it's not supported, CMake *should* + # produce an error: https://cmake.org/cmake/help/latest/policy/CMP0069.html + # However, we can give a more helpful error message ourselves. + message(STATUS "IPO / LTO: ${CMAKE_INTERPROCEDURAL_OPTIMIZATION} as requested by user") + if(CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT ipo_supported) + message(SEND_ERROR + "IPO / LTO was requested through CMAKE_INTERPROCEDURAL_OPTIMIZATION, " + "but it is not supported by the compiler. The check failed with this output:\n" + "${check_ipo_support_output}") + endif() + elseif(NOT ipo_supported) + message(STATUS "IPO / LTO: disabled because it is not supported") + elseif(NOT BUILD_SHARED_LIBS) + # For a static library, we can't be sure whether the final linking will + # happen with IPO enabled, so we err on the side of caution. A better + # approach would be to request "fat LTO" in this case (for gcc/clang), to + # make the static library usable whether or not LTO is enabled at link + # time. Unfortunately CMake makes that impossible: + # https://gitlab.kitware.com/cmake/cmake/-/issues/23136 + message(STATUS + "IPO / LTO: disabled by default when building a static library; " + "set CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON to enable") + else() + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + message(STATUS "IPO / LTO: enabled") endif() - elseif(NOT ipo_supported) - message(STATUS "IPO / LTO: disabled because it is not supported") - elseif(NOT BUILD_SHARED_LIBS) - # For a static library, we can't be sure whether the final linking will - # happen with IPO enabled, so we err on the side of caution. A better - # approach would be to request "fat LTO" in this case (for gcc/clang), to - # make the static library usable whether or not LTO is enabled at link - # time. Unfortunately CMake makes that impossible: - # https://gitlab.kitware.com/cmake/cmake/-/issues/23136 - message(STATUS - "IPO / LTO: disabled by default when building a static library; " - "set CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON to enable") - else() - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) - message(STATUS "IPO / LTO: enabled") endif() endif() diff --git a/cmake/README.md b/cmake/README.md index d55f6e11c0..f4ba060ea0 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -4,7 +4,7 @@ |:-------- | :---: | :------: | :----: | :----: | :----: | | Linux | [![Status][linux_cpp_svg]][linux_cpp_link] | [![Status][linux_fortran_svg]][linux_fortran_link] | [![Status][linux_python_svg]][linux_python_link] | *(1)* | [![Status][linux_dotnet_svg]][linux_dotnet_link] | | MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] |[![Status][macos_fortran_svg]][macos_fortran_link] | [![Status][macos_python_svg]][macos_python_link] | *(1)* |[![Status][macos_dotnet_svg]][macos_dotnet_link] | -| Windows | [![Status][windows_cpp_svg]][windows_cpp_link] | [![Status][windows_fortran_svg]][windows_fortran_link] | [![Status][windows_python_svg]][windows_python_link] | [![Status][windows_csharp_svg]][windows_csharp_link] | [![Status][windows_dotnet_svg]][windows_dotnet_link] | +| Windows | [![Status][windows_cpp_svg]][windows_cpp_link] | *(2)* | [![Status][windows_python_svg]][windows_python_link] | [![Status][windows_csharp_svg]][windows_csharp_link] | [![Status][windows_dotnet_svg]][windows_dotnet_link] | [linux_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-linux-cpp.yml/badge.svg [linux_cpp_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-linux-cpp.yml @@ -40,6 +40,8 @@ *(1)* CMake C# is currently only supported for Microsoft Visual Studio 11 2012 and later. You can still build and run the HiGHS C# nuget package on Linux and MacOS with `dotnet`, see the workflows in the .NET column. It is only the CSharp example build with CMake that is not supported for Unix generators. +*(2)* Not tested yet. +
From bbd28e2224bb660b11af989f785630cf81fe82eb Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 16:11:07 +0100 Subject: [PATCH 29/44] clean up --- .github/workflows/cmake-windows-cpp.yml | 2 +- .github/workflows/test-fortran-macos.yml | 33 -------- CMakeLists.txt | 100 +++++++++++------------ README.md | 10 +-- cmake/README.md | 2 +- 5 files changed, 53 insertions(+), 94 deletions(-) delete mode 100644 .github/workflows/test-fortran-macos.yml diff --git a/.github/workflows/cmake-windows-cpp.yml b/.github/workflows/cmake-windows-cpp.yml index a5b7a888b6..5fadce34e6 100644 --- a/.github/workflows/cmake-windows-cpp.yml +++ b/.github/workflows/cmake-windows-cpp.yml @@ -28,7 +28,7 @@ jobs: run: ctest --timeout 300 --output-on-failure -C Release release_all_tests: - runs-on: windows-latest + runs-on: windows-2019 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test-fortran-macos.yml b/.github/workflows/test-fortran-macos.yml deleted file mode 100644 index 01570daab7..0000000000 --- a/.github/workflows/test-fortran-macos.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: test-fortran-macos - -on: [push, pull_request] - -jobs: - release: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v4 - - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: gfortran - run: brew install gfortran - - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DFORTRAN=ON - - - name: Build - shell: bash - working-directory: ${{runner.workspace}}/build - run: cmake --build . --parallel - - - name: Test - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - ls - ./bin/fortrantest diff --git a/CMakeLists.txt b/CMakeLists.txt index d34225c00a..68e24246eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,60 +172,58 @@ if (BUILD_CXX) message(STATUS "Found int * size: ${SIZEOF_INT_P}") cmake_pop_check_state() - if (NOT (FORTRAN AND MACOS)) - # Use current CMAKE_C_FLAGS and CMAKE_CXX_FLAGS when checking for IPO support, - # instead of defaults: https://cmake.org/cmake/help/latest/policy/CMP0138.html - if(MSVC AND BUILD_SHARED_LIBS) - # MSVC does support LTO, but WINDOWS_EXPORT_ALL_SYMBOLS does not work if - # LTO is enabled. - set(ipo_supported NO) - message(STATUS "IPO / LTO not supported on MSVC when building a shared library") - elseif(MINGW AND NOT CLANG) - # MinGW supports LTO, but it causes tests to fail at runtime like this: - # - # Mingw-w64 runtime failure: - # 32 bit pseudo relocation at 00007FF779C9D070 out of range, targeting 00007FFAAC101400, yielding the value 000000033246438C. - # - # TODO Figure out and fix the root cause of that, then remove this section. - set(ipo_supported NO) - message(STATUS "IPO / LTO not currently supported building HiGHS on MinGW") - else() - if(CMAKE_VERSION VERSION_GREATER "3.23.0") - cmake_policy(SET CMP0138 NEW) - endif() - - include(CheckIPOSupported) - check_ipo_supported(RESULT ipo_supported OUTPUT check_ipo_support_output) - message(STATUS "IPO / LTO supported by compiler: ${ipo_supported}") + # Use current CMAKE_C_FLAGS and CMAKE_CXX_FLAGS when checking for IPO support, + # instead of defaults: https://cmake.org/cmake/help/latest/policy/CMP0138.html + if(MSVC AND BUILD_SHARED_LIBS) + # MSVC does support LTO, but WINDOWS_EXPORT_ALL_SYMBOLS does not work if + # LTO is enabled. + set(ipo_supported NO) + message(STATUS "IPO / LTO not supported on MSVC when building a shared library") + elseif(MINGW AND NOT CLANG) + # MinGW supports LTO, but it causes tests to fail at runtime like this: + # + # Mingw-w64 runtime failure: + # 32 bit pseudo relocation at 00007FF779C9D070 out of range, targeting 00007FFAAC101400, yielding the value 000000033246438C. + # + # TODO Figure out and fix the root cause of that, then remove this section. + set(ipo_supported NO) + message(STATUS "IPO / LTO not currently supported building HiGHS on MinGW") + else() + if(CMAKE_VERSION VERSION_GREATER "3.23.0") + cmake_policy(SET CMP0138 NEW) endif() - if(DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) - # The user explicitly requested IPO. If it's not supported, CMake *should* - # produce an error: https://cmake.org/cmake/help/latest/policy/CMP0069.html - # However, we can give a more helpful error message ourselves. - message(STATUS "IPO / LTO: ${CMAKE_INTERPROCEDURAL_OPTIMIZATION} as requested by user") - if(CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT ipo_supported) - message(SEND_ERROR - "IPO / LTO was requested through CMAKE_INTERPROCEDURAL_OPTIMIZATION, " - "but it is not supported by the compiler. The check failed with this output:\n" - "${check_ipo_support_output}") - endif() - elseif(NOT ipo_supported) - message(STATUS "IPO / LTO: disabled because it is not supported") - elseif(NOT BUILD_SHARED_LIBS) - # For a static library, we can't be sure whether the final linking will - # happen with IPO enabled, so we err on the side of caution. A better - # approach would be to request "fat LTO" in this case (for gcc/clang), to - # make the static library usable whether or not LTO is enabled at link - # time. Unfortunately CMake makes that impossible: - # https://gitlab.kitware.com/cmake/cmake/-/issues/23136 - message(STATUS - "IPO / LTO: disabled by default when building a static library; " - "set CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON to enable") - else() - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) - message(STATUS "IPO / LTO: enabled") + include(CheckIPOSupported) + check_ipo_supported(RESULT ipo_supported OUTPUT check_ipo_support_output) + message(STATUS "IPO / LTO supported by compiler: ${ipo_supported}") + endif() + + if(DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) + # The user explicitly requested IPO. If it's not supported, CMake *should* + # produce an error: https://cmake.org/cmake/help/latest/policy/CMP0069.html + # However, we can give a more helpful error message ourselves. + message(STATUS "IPO / LTO: ${CMAKE_INTERPROCEDURAL_OPTIMIZATION} as requested by user") + if(CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT ipo_supported) + message(SEND_ERROR + "IPO / LTO was requested through CMAKE_INTERPROCEDURAL_OPTIMIZATION, " + "but it is not supported by the compiler. The check failed with this output:\n" + "${check_ipo_support_output}") endif() + elseif(NOT ipo_supported) + message(STATUS "IPO / LTO: disabled because it is not supported") + elseif(NOT BUILD_SHARED_LIBS) + # For a static library, we can't be sure whether the final linking will + # happen with IPO enabled, so we err on the side of caution. A better + # approach would be to request "fat LTO" in this case (for gcc/clang), to + # make the static library usable whether or not LTO is enabled at link + # time. Unfortunately CMake makes that impossible: + # https://gitlab.kitware.com/cmake/cmake/-/issues/23136 + message(STATUS + "IPO / LTO: disabled by default when building a static library; " + "set CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON to enable") + else() + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + message(STATUS "IPO / LTO: enabled") endif() endif() diff --git a/README.md b/README.md index 8e79897072..4051ad3950 100644 --- a/README.md +++ b/README.md @@ -60,14 +60,9 @@ solves the model in `ml.mps` ```sh highs ml.mps ``` -HiGHS is installed using the command - -```sh - cmake --install build -``` - -with the optional setting of `--prefix `, or the cmake option `CMAKE_INSTALL_PREFIX` if it is to be installed anywhere other than the default location. +More details on building with CMake can be found in `HiGHS/cmake/README.md`. +#### Building with Meson As an alternative, HiGHS can be installed using the `meson` build interface: ``` sh @@ -117,7 +112,6 @@ python >>> highspy.Highs() ``` - _The nix build files are provided by the community and are not officially supported by the HiGHS development team._ ## Interfaces diff --git a/cmake/README.md b/cmake/README.md index f4ba060ea0..840ac83ff5 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -3,7 +3,7 @@ | OS | C++ | Fortran | Python | CSharp Example | .NET | |:-------- | :---: | :------: | :----: | :----: | :----: | | Linux | [![Status][linux_cpp_svg]][linux_cpp_link] | [![Status][linux_fortran_svg]][linux_fortran_link] | [![Status][linux_python_svg]][linux_python_link] | *(1)* | [![Status][linux_dotnet_svg]][linux_dotnet_link] | -| MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] |[![Status][macos_fortran_svg]][macos_fortran_link] | [![Status][macos_python_svg]][macos_python_link] | *(1)* |[![Status][macos_dotnet_svg]][macos_dotnet_link] | +| MacOS | [![Status][macos_cpp_svg]][macos_cpp_link] | *(2)* | [![Status][macos_python_svg]][macos_python_link] | *(1)* |[![Status][macos_dotnet_svg]][macos_dotnet_link] | | Windows | [![Status][windows_cpp_svg]][windows_cpp_link] | *(2)* | [![Status][windows_python_svg]][windows_python_link] | [![Status][windows_csharp_svg]][windows_csharp_link] | [![Status][windows_dotnet_svg]][windows_dotnet_link] | [linux_cpp_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/cmake-linux-cpp.yml/badge.svg From a9716934bb6556ad230676f18a02aed04c7c9aad Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 17:18:50 +0100 Subject: [PATCH 30/44] badges --- .github/workflows/{build-fast.yml => build.yml} | 0 README.md | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) rename .github/workflows/{build-fast.yml => build.yml} (100%) diff --git a/.github/workflows/build-fast.yml b/.github/workflows/build.yml similarity index 100% rename from .github/workflows/build-fast.yml rename to .github/workflows/build.yml diff --git a/README.md b/README.md index 4051ad3950..0dd1af6c8d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,14 @@ # HiGHS - Linear optimization software -[![Build Status](https://github.com/ERGO-Code/HiGHS/actions/workflows/build-fast.yml/badge.svg) +![Build Status](https://github.com/ERGO-Code/HiGHS/actions/workflows/build.yml/badge.svg) [![Conan Center](https://img.shields.io/conan/v/highs)](https://conan.io/center/recipes/highs) +\ [![PyPi](https://img.shields.io/pypi/v/highspy.svg)](https://pypi.python.org/pypi/highspy) [![PyPi](https://img.shields.io/pypi/dm/highspy.svg)](https://pypi.python.org/pypi/highspy) +\ +[![NuGet version](https://img.shields.io/nuget/v/Highs.Native.svg)](https://www.nuget.org/packages/Highs.Native) +[![NuGet download](https://img.shields.io/nuget/dt/Highs.Native.svg)](https://www.nuget.org/packages/Highs.Native) +\ - [HiGHS - Linear optimization software](#highs---linear-optimization-software) - [About HiGHS](#about-highs) From 9a6be807f525d587740ee0730dfaf64cfbf6a430 Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 17:27:37 +0100 Subject: [PATCH 31/44] more badges --- .../workflows/{build.yml => build-fast.yml} | 0 README.md | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) rename .github/workflows/{build.yml => build-fast.yml} (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build-fast.yml similarity index 100% rename from .github/workflows/build.yml rename to .github/workflows/build-fast.yml diff --git a/README.md b/README.md index 0dd1af6c8d..84b22db9b8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # HiGHS - Linear optimization software -![Build Status](https://github.com/ERGO-Code/HiGHS/actions/workflows/build.yml/badge.svg) + + +[![Build Status][fast_build_svg]][fast_build_link] +[![Build Status][linux_build_svg]][linux_build_link] +[![Build Status][macos_build_svg]][macos_build_link] +[![Build Status][windows_build_svg]][windows_build_link] +\ [![Conan Center](https://img.shields.io/conan/v/highs)](https://conan.io/center/recipes/highs) \ [![PyPi](https://img.shields.io/pypi/v/highspy.svg)](https://pypi.python.org/pypi/highspy) @@ -8,7 +14,15 @@ \ [![NuGet version](https://img.shields.io/nuget/v/Highs.Native.svg)](https://www.nuget.org/packages/Highs.Native) [![NuGet download](https://img.shields.io/nuget/dt/Highs.Native.svg)](https://www.nuget.org/packages/Highs.Native) -\ + +[fast_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-fast.yml/badge.svg +[fast_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-fast.yml +[linux_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-linux.yml/badge.svg +[linux_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-linux.yml +[macos_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-macos.yml/badge.svg +[macos_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-macos.yml +[windows_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-windows.yml/badge.svg +[windows_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-windows.yml - [HiGHS - Linear optimization software](#highs---linear-optimization-software) - [About HiGHS](#about-highs) From 4480962af6a86e6d787a98e5fece3deadee6f636 Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 17:35:13 +0100 Subject: [PATCH 32/44] readme --- README.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 84b22db9b8..0f370457c6 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,9 @@ - [Documentation](#documentation) - [Installation](#installation) - [Build from source using CMake](#build-from-source-using-cmake) + - [Build with Meson*](#build-with-meson) + - [Build with Nix*](#build-with-nix) - [Precompiled binaries](#precompiled-binaries) - - [Build with Nix](#build-with-nix) - [Interfaces](#interfaces) - [Python](#python) - [CSharp](#csharp) @@ -81,7 +82,7 @@ solves the model in `ml.mps` ``` More details on building with CMake can be found in `HiGHS/cmake/README.md`. -#### Building with Meson +#### Build with Meson As an alternative, HiGHS can be installed using the `meson` build interface: ``` sh @@ -90,15 +91,6 @@ meson test -C bbdir ``` _The meson build files are provided by the community and are not officially supported by the HiGHS development team._ -### Precompiled binaries - -Precompiled static executables are available for a variety of platforms at -https://github.com/JuliaBinaryWrappers/HiGHSstatic_jll.jl/releases - -_These binaries are provided by the Julia community and are not officially supported by the HiGHS development team. If you have trouble using these libraries, please open a GitHub issue and tag `@odow` in your question._ - -See https://ergo-code.github.io/HiGHS/stable/installation/#Precompiled-Binaries. - #### Build with Nix There is a nix flake that provides the `highs` binary: @@ -133,6 +125,15 @@ python _The nix build files are provided by the community and are not officially supported by the HiGHS development team._ +### Precompiled binaries + +Precompiled static executables are available for a variety of platforms at +https://github.com/JuliaBinaryWrappers/HiGHSstatic_jll.jl/releases + +_These binaries are provided by the Julia community and are not officially supported by the HiGHS development team. If you have trouble using these libraries, please open a GitHub issue and tag `@odow` in your question._ + +See https://ergo-code.github.io/HiGHS/stable/installation/#Precompiled-Binaries. + ## Interfaces There are HiGHS interfaces for C, C#, FORTRAN, and Python in `HiGHS/src/interfaces`, with example driver files in `HiGHS/examples/`. More on language and modelling interfaces can be found at https://ergo-code.github.io/HiGHS/stable/interfaces/other/. From 75b4aa99d049cb3fa35ee4ea337a2c816e916e53 Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:01:52 +0100 Subject: [PATCH 33/44] cosmetic edit of focs --- docs/src/interfaces/fortran.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/interfaces/fortran.md b/docs/src/interfaces/fortran.md index fecbe63b48..8d5786b46a 100644 --- a/docs/src/interfaces/fortran.md +++ b/docs/src/interfaces/fortran.md @@ -2,7 +2,7 @@ #### [Fortran](@id fortran-api) The interface is in -[`HiGHS/src/interfaces/highs_fortran_api.f90`]. Its +`HiGHS/src/interfaces/highs_fortran_api.f90`. Its methods are simply bindings to the [`C` API](@ref c-api) To include in the build, switch the Fortran CMake parameter on: From 40ca385f23b21f3a08a7476446d3fcbbb2826574 Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:03:19 +0100 Subject: [PATCH 34/44] badges documentation --- docs/src/index.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/src/index.md b/docs/src/index.md index 988dab89d8..3e2cbf5e8b 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,6 +1,29 @@ # HiGHS - High Performance Optimization Software -[![Build Status](https://github.com/ERGO-Code/HiGHS/workflows/build/badge.svg)](https://github.com/ERGO-Code/HiGHS/actions?query=workflow%3Abuild+branch%3Amaster) + + +![Build Status][fast_build_svg]][fast_build_link] +[![Build Status][linux_build_svg]][linux_build_link] +[![Build Status][macos_build_svg]][macos_build_link] +[![Build Status][windows_build_svg]][windows_build_link] +\ +[![Conan Center](https://img.shields.io/conan/v/highs)](https://conan.io/center/recipes/highs) +\ +[![PyPi](https://img.shields.io/pypi/v/highspy.svg)](https://pypi.python.org/pypi/highspy) +[![PyPi](https://img.shields.io/pypi/dm/highspy.svg)](https://pypi.python.org/pypi/highspy) +\ +[![NuGet version](https://img.shields.io/nuget/v/Highs.Native.svg)](https://www.nuget.org/packages/Highs.Native) +[![NuGet download](https://img.shields.io/nuget/dt/Highs.Native.svg)](https://www.nuget.org/packages/Highs.Native) + +[fast_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-fast.yml/badge.svg +[fast_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-fast.yml +[linux_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-linux.yml/badge.svg +[linux_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-linux.yml +[macos_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-macos.yml/badge.svg +[macos_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-macos.yml +[windows_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-windows.yml/badge.svg +[windows_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-windows.yml !!! warning This HiGHS documentation is a work in progress. From 59cc16a9ed9656d334288640ce4294794b63839d Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:09:11 +0100 Subject: [PATCH 35/44] readme --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 0f370457c6..684ff5712d 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,9 @@ - [Precompiled binaries](#precompiled-binaries) - [Interfaces](#interfaces) - [Python](#python) + - [C](#c) - [CSharp](#csharp) + - [Fortran](#fortran) - [Reference](#reference) ## About HiGHS @@ -161,6 +163,9 @@ The installation can be tested using the small example `HiGHS/examples/call_high The [Google Colab Example Notebook](https://colab.research.google.com/drive/1JmHF53OYfU-0Sp9bzLw-D2TQyRABSjHb?usp=sharing) also demonstrates how to call `highspy`. +### C +The C API is in `HiGHS/src/interfaces/highs_c_api.h`. It is included in the default build. For more details, check out our documentation website https://ergo-code.github.io/HiGHS/. + ### CSharp The nuget package Highs.Native is on https://www.nuget.org, at https://www.nuget.org/packages/Highs.Native/. @@ -182,6 +187,11 @@ The nuget package contains runtime libraries for Details for building locally can be found in `nuget/README.md`. +### Fortran + +The Fortran API is in `HiGHS/src/interfaces/highs_fortran_api.f90`. It is *not* included in the default build. For more details, check out our documentation website https://ergo-code.github.io/HiGHS/. + + ## Reference If you use HiGHS in an academic context, please acknowledge this and cite the following article. From 2c20140c3bbb193000c1afaeec24208e49902d25 Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:13:59 +0100 Subject: [PATCH 36/44] readme running highs --- README.md | 50 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 684ff5712d..575766425c 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ - [Build with Meson*](#build-with-meson) - [Build with Nix*](#build-with-nix) - [Precompiled binaries](#precompiled-binaries) + - [Running HiGHS](#running-highs) - [Interfaces](#interfaces) - [Python](#python) - [C](#c) @@ -75,13 +76,6 @@ To test whether the compilation was successful, change into the build directory ```sh ctest ``` - -HiGHS can read MPS files and (CPLEX) LP files, and the following command -solves the model in `ml.mps` - -```sh - highs ml.mps -``` More details on building with CMake can be found in `HiGHS/cmake/README.md`. #### Build with Meson @@ -136,6 +130,48 @@ _These binaries are provided by the Julia community and are not officially suppo See https://ergo-code.github.io/HiGHS/stable/installation/#Precompiled-Binaries. +## Running HiGHS + +HiGHS can read MPS files and (CPLEX) LP files, and the following command +solves the model in `ml.mps` + +```sh + highs ml.mps +``` +#### Command line options + +When HiGHS is run from the command line, some fundamental option values may be +specified directly. Many more may be specified via a file. Formally, the usage +is: + +```bash +$ bin/highs --help +HiGHS options +Usage: + bin/highs [OPTION...] [file] + + --model_file arg File of model to solve. + --read_solution_file arg File of solution to read. + --options_file arg File containing HiGHS options. + --presolve arg Presolve: "choose" by default - "on"/"off" + are alternatives. + --solver arg Solver: "choose" by default - "simplex"/"ipm" + are alternatives. + --parallel arg Parallel solve: "choose" by default - + "on"/"off" are alternatives. + --run_crossover arg Run crossover: "on" by default - + "choose"/"off" are alternatives. + --time_limit arg Run time limit (seconds - double). + --solution_file arg File for writing out model solution. + --write_model_file arg File for writing out model. + --random_seed arg Seed to initialize random number generation. + --ranging arg Compute cost, bound, RHS and basic solution + ranging. + --version Print version. + -h, --help Print help. +``` +For a full list of options, go to our [documentation page](https://ergo-code.github.io/HiGHS/stable/options/definitions/). + ## Interfaces There are HiGHS interfaces for C, C#, FORTRAN, and Python in `HiGHS/src/interfaces`, with example driver files in `HiGHS/examples/`. More on language and modelling interfaces can be found at https://ergo-code.github.io/HiGHS/stable/interfaces/other/. From 0641466dbe122404212c540823825a63c6728bb7 Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:14:44 +0100 Subject: [PATCH 37/44] contents --- README.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 575766425c..b691b5bdda 100644 --- a/README.md +++ b/README.md @@ -24,21 +24,20 @@ [windows_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-windows.yml/badge.svg [windows_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-windows.yml -- [HiGHS - Linear optimization software](#highs---linear-optimization-software) - - [About HiGHS](#about-highs) - - [Documentation](#documentation) - - [Installation](#installation) - - [Build from source using CMake](#build-from-source-using-cmake) - - [Build with Meson*](#build-with-meson) - - [Build with Nix*](#build-with-nix) - - [Precompiled binaries](#precompiled-binaries) - - [Running HiGHS](#running-highs) - - [Interfaces](#interfaces) - - [Python](#python) - - [C](#c) - - [CSharp](#csharp) - - [Fortran](#fortran) - - [Reference](#reference) +- [About HiGHS](#about-highs) +- [Documentation](#documentation) +- [Installation](#installation) + - [Build from source using CMake](#build-from-source-using-cmake) + - [Build with Meson*](#build-with-meson) + - [Build with Nix*](#build-with-nix) + - [Precompiled binaries](#precompiled-binaries) +- [Running HiGHS](#running-highs) +- [Interfaces](#interfaces) + - [Python](#python) + - [C](#c) + - [CSharp](#csharp) + - [Fortran](#fortran) +- [Reference](#reference) ## About HiGHS From 60a903874986a70b9f72119ee94ef30833f8ab46 Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:15:40 +0100 Subject: [PATCH 38/44] sh --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b691b5bdda..83c9340367 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ When HiGHS is run from the command line, some fundamental option values may be specified directly. Many more may be specified via a file. Formally, the usage is: -```bash +```sh $ bin/highs --help HiGHS options Usage: From 4a6a95eb7fbde71c399b4dbbeef207cb7393e8b7 Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:16:11 +0100 Subject: [PATCH 39/44] sh --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83c9340367..bd23561bab 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ When HiGHS is run from the command line, some fundamental option values may be specified directly. Many more may be specified via a file. Formally, the usage is: -```sh +``` $ bin/highs --help HiGHS options Usage: From 3f56011b98e7ec363e8df99ba629b2ee5a73e0f7 Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:17:53 +0100 Subject: [PATCH 40/44] shell --- README.md | 12 ++++++------ cmake/README.md | 14 +++++++------- docs/src/executable.md | 4 ++-- docs/src/interfaces/csharp.md | 2 +- docs/src/interfaces/python/index.md | 2 +- docs/src/options/intro.md | 2 +- nuget/README.md | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index bd23561bab..85dc406a99 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Documentation is available at https://ergo-code.github.io/HiGHS/. HiGHS uses CMake as build system, and requires at least version 3.15. To generate build files in a new subdirectory called 'build', run: -```sh +```shell cmake -S . -B build cmake --build build ``` @@ -72,7 +72,7 @@ This installs the executable `bin/highs` and the library `lib/highs`. To test whether the compilation was successful, change into the build directory and run -```sh +```shell ctest ``` More details on building with CMake can be found in `HiGHS/cmake/README.md`. @@ -134,7 +134,7 @@ See https://ergo-code.github.io/HiGHS/stable/installation/#Precompiled-Binaries. HiGHS can read MPS files and (CPLEX) LP files, and the following command solves the model in `ml.mps` -```sh +```shell highs ml.mps ``` #### Command line options @@ -181,13 +181,13 @@ We are happy to give a reasonable level of support via email sent to highsopt@gm The python package `highspy` is a thin wrapper around HiGHS and is available on [PyPi](https://pypi.org/project/highspy/). It can be easily installed via `pip` by running -```sh +```shell $ pip install highspy ``` Alternatively, `highspy` can be built from source. Download the HiGHS source code and run -```sh +```shell pip install . ``` from the root directory. @@ -207,7 +207,7 @@ The nuget package Highs.Native is on https://www.nuget.org, at https://www.nuget It can be added to your C# project with `dotnet` -```bash +```shell dotnet add package Highs.Native --version 1.7.0 ``` diff --git a/cmake/README.md b/cmake/README.md index 840ac83ff5..4cb04ac682 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -123,26 +123,26 @@ cmake --install build By default, CMake builds the debug version of the binaries. These are generated in a directory `Debug`. To build a release version, add the option `--config Release` -```bash +```shell cmake -S . -B build cmake --build build --config Release ``` It is also possible to specify a specific Visual studio version to build with: -```bash +```shell cmake -G "Visual Studio 17 2022" -S . -B build cmake --build build ``` When building under Windows, some extra options are available. One is building a 32 bit version or a 64 bit version. The default build is 64 bit. To build 32 bit, the following commands can be used from the `HiGHS/` directory: -```bash +```shell cmake -A Win32 -S . -B buildWin32 cmake --build buildWin32 ``` Another thing specific for windows is the calling convention, particularly important for the HiGHS dynamic library (dll). The default calling convention in windows is cdecl calling convention, however, dlls are most often compiled with stdcall. Most applications which expect stdcall, can't access dlls with cdecl and vice versa. To change the default calling convention from cdecl to stdcall the following option can be added -```bash +```shell cmake -DSTDCALL=ON -S . -B build cmake --build build ``` @@ -163,12 +163,12 @@ before running `cmake --build `
For example, to generate build files in a new subdirectory called 'build', run: -```sh +```shell cmake -S. -Bbuild ``` and then build with: -```sh +```shell cmake --build build ``` @@ -187,7 +187,7 @@ Following is a list of available options: diff --git a/docs/src/executable.md b/docs/src/executable.md index d18d46ab63..d9f1777555 100644 --- a/docs/src/executable.md +++ b/docs/src/executable.md @@ -6,7 +6,7 @@ For convenience, the executable is assumed to be `bin/highs`. The model given by the MPS file `model.mps` is solved by the command: -```bash +```shell $ bin/highs model.mps ``` @@ -19,7 +19,7 @@ When HiGHS is run from the command line, some fundamental option values may be specified directly. Many more may be specified via a file. Formally, the usage is: -```bash +```shell $ bin/highs --help HiGHS options Usage: diff --git a/docs/src/interfaces/csharp.md b/docs/src/interfaces/csharp.md index 0455946d8f..884c3a419e 100644 --- a/docs/src/interfaces/csharp.md +++ b/docs/src/interfaces/csharp.md @@ -16,7 +16,7 @@ The nuget package Highs.Native is on https://www.nuget.org, at https://www.nuget It can be added to your C# project with `dotnet` -```bash +```shell dotnet add package Highs.Native --version 1.7.0 ``` diff --git a/docs/src/interfaces/python/index.md b/docs/src/interfaces/python/index.md index 82851f2e4b..991b2cae32 100644 --- a/docs/src/interfaces/python/index.md +++ b/docs/src/interfaces/python/index.md @@ -6,7 +6,7 @@ HiGHS is available as `highspy` on [PyPi](https://pypi.org/project/highspy/). If `highspy` is not already installed, run: -```bash +```shell $ pip install highspy ``` diff --git a/docs/src/options/intro.md b/docs/src/options/intro.md index 686d529a43..ff33cae234 100644 --- a/docs/src/options/intro.md +++ b/docs/src/options/intro.md @@ -15,7 +15,7 @@ options file. A sample options file, giving documentation of all the options is written to the console by the command: -```bash +```shell $ bin/highs --options_file="" ``` diff --git a/nuget/README.md b/nuget/README.md index 9f7cd71d99..879c409c03 100644 --- a/nuget/README.md +++ b/nuget/README.md @@ -6,7 +6,7 @@ The nuget package Highs.Native is on https://www.nuget.org, at https://www.nuget It can be added to your C# project with `dotnet` -```bash +```shell dotnet add package Highs.Native --version 1.7.0 ``` @@ -29,7 +29,7 @@ cmake -S. -Bbuild -DCSHARP=ON -DBUILD_DOTNET=ON Then, from `build/dotnet/Highs.Native`, run -```bash +```shell dotnet pack -c Release /p:Version=$version ``` From 28212e2bde3955fa0dffd2a20498265a1af8a954 Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:19:10 +0100 Subject: [PATCH 41/44] options link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85dc406a99..9c5707baea 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ Usage: --version Print version. -h, --help Print help. ``` -For a full list of options, go to our [documentation page](https://ergo-code.github.io/HiGHS/stable/options/definitions/). +For a full list of options, go to the [options page](https://ergo-code.github.io/HiGHS/stable/options/definitions/) on the documentation website. ## Interfaces From 0f349a959cb55fefc1842d7e9a0f1515b98cc15e Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:20:22 +0100 Subject: [PATCH 42/44] options link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c5707baea..6a3d97bd62 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ Usage: --version Print version. -h, --help Print help. ``` -For a full list of options, go to the [options page](https://ergo-code.github.io/HiGHS/stable/options/definitions/) on the documentation website. +For a full list of options, see the [options page](https://ergo-code.github.io/HiGHS/stable/options/definitions/) of the documentation website. ## Interfaces From 7aa1902dd0b374bd2cbb2369bd0cf9ad0e519f6b Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:33:45 +0100 Subject: [PATCH 43/44] fail fast false --- .github/workflows/build-wheels.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 09a7b555dd..74cf31979d 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -1,6 +1,7 @@ name: build-wheels on: [push] +# on: [pull_request] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -12,7 +13,7 @@ jobs: runs-on: ${{ matrix.buildplat[0] }} strategy: # Ensure that a wheel builder finishes even if another fails - fail-fast: true + fail-fast: false matrix: # From NumPy # Github Actions doesn't support pairing matrix values together, let's improvise From 53cf4a68cd107bbc10622021b13a63ce3694b01b Mon Sep 17 00:00:00 2001 From: galabovaa Date: Mon, 10 Jun 2024 18:41:56 +0100 Subject: [PATCH 44/44] docs --- docs/src/index.md | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index 3e2cbf5e8b..828a33820e 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -3,27 +3,13 @@ -![Build Status][fast_build_svg]][fast_build_link] -[![Build Status][linux_build_svg]][linux_build_link] +[![Build Status][fast_build_svg]][fast_build_link] + [fast_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-fast.yml/badge.svg [fast_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-fast.yml -[linux_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-linux.yml/badge.svg -[linux_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-linux.yml -[macos_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-macos.yml/badge.svg -[macos_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-macos.yml -[windows_build_svg]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-windows.yml/badge.svg -[windows_build_link]: https://github.com/ERGO-Code/HiGHS/actions/workflows/build-windows.yml !!! warning This HiGHS documentation is a work in progress.