Skip to content

Commit

Permalink
Switch to cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
fontanf committed Apr 15, 2024
1 parent 5605faa commit 47a18cb
Show file tree
Hide file tree
Showing 63 changed files with 534 additions and 841 deletions.
5 changes: 0 additions & 5 deletions .bazelrc

This file was deleted.

20 changes: 17 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8"]

env:
CAPACITATED_VEHICLE_ROUTING_DATA: ${{ github.workspace }}/data/capacitated_vehicle_routing
KNAPSACK_WITH_CONFLICTS_DATA: ${{ github.workspace }}/data/knapsack_with_conflicts
JOB_SEQUENCING_AND_TOOL_SWITCHING_DATA: ${{ github.workspace }}/data/job_sequencing_and_tool_switching
FLOWSHOP_SCHEDULING_DATA: ${{ github.workspace }}/data/flowshop_scheduling
SCHEDULING_WITH_SDST_TWT_DATA: ${{ github.workspace }}/data/scheduling_with_sdst_twt
SEQUENTIAL_ORDERING_DATA: ${{ github.workspace }}/data/sequential_ordering
TEAM_ORIENTEERING_DATA: ${{ github.workspace }}/data/team_orienteering
TIME_DEPENDENT_ORIENTEERING_DATA: ${{ github.workspace }}/data/time_dependent_orienteering
VEHICLE_ROUTING_WITH_TIME_WINDOWS_DATA: ${{ github.workspace }}/data/vehicle_routing_with_time_windows

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -26,7 +37,10 @@ jobs:
python3 -m pip install gdown
python3 scripts/download_data.py
- name: Build
run: bazel build -- //...
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release --parallel
cmake --install build --config Release --prefix install
- name: Run tests
run: python3 -u scripts/run_tests.py test_results
- name: Checkout main branch
Expand All @@ -35,8 +49,8 @@ jobs:
git fetch --depth 1
git checkout master
- name: Build
run: bazel build -- //...
run: bazel build -- //examples/...
- name: Run tests
run: python3 -u scripts/run_tests.py test_results_ref
- name: Process tests
run: python3 ./bazel-localsearchsolver/external/optimizationtools/scripts/process_tests.py --ref test_results_ref --new test_results
run: python3 -u ./build/_deps/optimizationtools-src/scripts/process_tests.py --ref test_results_ref --new test_results
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.15.0)

project(LocalSearchSolver LANGUAGES CXX)

# Require C++14.
set(CMAKE_CXX_STANDARD 14)

# Enable output of compile commands during generation.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Add sub-directories.
add_subdirectory(extern)
add_subdirectory(src)
add_subdirectory(test)
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ Data can be downloaded from [fontanf/orproblems](https://github.com/fontanf/orpr

Compile:
```shell
bazel build -- //...
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release --parallel
cmake --install build --config Release --prefix install
```

Download data:
Expand All @@ -182,7 +184,7 @@ python3 scripts/download_data.py

Then, examples can be executed as follows:
```shell
./bazel-bin/examples/sequential_ordering_main -v 1 -i ./data/sequential_ordering/soplib/R.200.100.1.sop -f soplib -a best-first-local-search --maximum-number-of-nodes 100 -c sol.txt
./install/bin/localsearchsolver_sequential_ordering --verbosity-level 1 --input ./data/sequential_ordering/soplib/R.200.100.1.sop --format soplib --algorithm best-first-local-search --maximum-number-of-nodes 100 --certificate solution.txt
```
```
=======================================
Expand Down Expand Up @@ -308,7 +310,7 @@ Total distance: 194
```

```shell
./bazel-bin/examples/knapsack_with_conflicts_main -v 1 -i ../ordata/packing/knapsack_with_conflicts/bettinelli2017/sparse_corr/test_1000_1000_r0.001-0.dat -f bettinelli2017 -t 5 -c sol.txt
./install/bin/localsearchsolver_knapsack_with_conflicts --verbosity-level 1 --input ./data/packing/knapsack_with_conflicts/bettinelli2017/sparse_corr/test_1000_1000_r0.001-0.dat --format bettinelli2017 --time-limit 5 --certificate solution.txt
```
```
=======================================
Expand Down
138 changes: 0 additions & 138 deletions WORKSPACE

This file was deleted.

Loading

0 comments on commit 47a18cb

Please sign in to comment.