Skip to content

Commit

Permalink
Merge pull request #1 from fontanf/feature/switch-to-cmake
Browse files Browse the repository at this point in the history
Feature/switch to cmake
  • Loading branch information
fontanf authored Apr 14, 2024
2 parents 1dad78d + 6e88f8f commit c334f48
Show file tree
Hide file tree
Showing 37 changed files with 807 additions and 406 deletions.
2 changes: 0 additions & 2 deletions .bazelrc

This file was deleted.

16 changes: 13 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8"]

env:
KNAPSACK_WITH_CONFLICTS_DATA: ${{ github.workspace }}/data/knapsack_with_conflicts
SEQUENTIAL_ORDERING_DATA: ${{ github.workspace }}/data/sequential_ordering
FLOWSHOP_SCHEDULING_DATA: ${{ github.workspace }}/data/flowshop_scheduling
SIMPLE_ASSEMBLY_LINE_BALANCING_1_DATA: ${{ github.workspace }}/data/simple_assembly_line_balancing_1

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -25,7 +32,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 @@ -34,8 +44,8 @@ jobs:
git fetch --depth 1
git checkout main
- 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-treesearchsolver/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(TreeSearchSolver LANGUAGES CXX)

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

# 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)
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ Algorithms:

Data can be downloaded from [fontanf/orproblems](https://github.com/fontanf/orproblems)

[Sequential ordering problem](examples/sequential_ordering.hpp)
[Sequential ordering problem](include/examples/sequential_ordering.hpp)

* The branching scheme is taken from "Tree search for the sequential ordering problem" (Libralesso et al., 2020) [PDF](https://ecai2020.eu/papers/1126_paper.pdf).
* It is a forward branching scheme.
* The guide of a node is its bound.
* This implementation returns state-of-the-art results on the instances of the scientific literature with a dense precedence graph.

[Permutation flow shop scheduling problem, makespan](examples/permutation_flowshop_scheduling_makespan.hpp) and [Permutation flow shop scheduling problem, total completion time](examples/permutationflowshopschedulingtct.hpp)
[Permutation flow shop scheduling problem, makespan](include/examples/permutation_flowshop_scheduling_makespan.hpp) and [Permutation flow shop scheduling problem, total completion time](include/examples/permutationflowshopschedulingtct.hpp)

* The branching schemes are taken from "Iterative beam search algorithms for the permutation flowshop" (Libralesso et al., 2022) [DOI](https://doi.org/10.1016/j.ejor.2021.10.015).
* For the makespan variant, it is a bidirectional branching scheme.
Expand All @@ -48,15 +48,17 @@ Data can be downloaded from [fontanf/orproblems](https://github.com/fontanf/orpr

* Here, the library is used to implement an exact dynamic programming algorithm implemented as a tree search

[Knapsack problem with conflicts](examples/knapsack_with_conflicts.hpp)
[Knapsack problem with conflicts](include/examples/knapsack_with_conflicts.hpp)

[Simple assembly line balancing problem of type 1 (SALBP-1)](examples/simple_assembly_line_balancing_1.hpp)
[Simple assembly line balancing problem of type 1 (SALBP-1)](include/examples/simple_assembly_line_balancing_1.hpp)

## Usage, running examples from command line

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 @@ -66,7 +68,7 @@ python3 scripts/download_data.py

Then, examples can be executed as follows:
```shell
./bazel-bin/examples/sequential_ordering_main --verbosity-level 1 --input "./data/sequential_ordering/soplib/R.700.1000.60.sop" --format soplib --algorithm iterative-beam-search --certificate solution.txt
./instance/bin/treesearchsolver_sequential_ordering --verbosity-level 1 --input "./data/sequential_ordering/soplib/R.700.1000.60.sop" --format soplib --algorithm iterative-beam-search --certificate solution.txt
```
```
======================================
Expand Down
69 changes: 0 additions & 69 deletions WORKSPACE

This file was deleted.

98 changes: 0 additions & 98 deletions examples/BUILD

This file was deleted.

10 changes: 10 additions & 0 deletions extern/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Enable FetchContent.
include(FetchContent)

# Fetch fontanf/orproblems.
FetchContent_Declare(
orproblems
GIT_REPOSITORY https://github.com/fontanf/orproblems.git
GIT_TAG e9a58e010f7dc0ca7b5eea2358ed11d386f8622a)
#SOURCE_DIR "${PROJECT_SOURCE_DIR}/../orproblems/")
FetchContent_MakeAvailable(orproblems)
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit c334f48

Please sign in to comment.