Skip to content

Commit

Permalink
added binaries for lucas bergers vrp pipeline and lkh3 for windows, m…
Browse files Browse the repository at this point in the history
…ac, linux
  • Loading branch information
koalamitice committed Aug 14, 2024
1 parent 786ece2 commit ceb1cc2
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ build/
.settings
.springBeans
.sts4-cache
bin/
bin/main
bin/test
!**/src/main/**/bin/
!**/src/test/**/bin/

Expand Down
35 changes: 35 additions & 0 deletions solvers/custom/berger-vrp/bin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
### How to Cross-compile the Rust Pipeline:

Guide is written for Mac-ARM System

1. Download Repo: https://github.com/ProvideQ/hybrid-vrp-solver
2. Install Rust: https://www.rust-lang.org/tools/install
3. Install a specific Rust nightly build (needed cause the solver uses experimental features): `rustup install nightly-2023-07-01`
4. Check how the nightly build is called on your machine (this is shown when running the install command, on Mac it is called *nightly-2023-07-01-aarch64-apple-darwin*)
5. Set the nightly build as default: `rustup default nightly-2023-07-01(... specific version name on machine)`

#### Mac Version: (native)
1. build the source code using `cargo build --release`

#### Windows Version (cross compilation)
1. Add Target for Windows: `rustup target add x86_64-pc-windows-gnu`
2. Install Cross Toolchain: `brew install mingw-w64`
3. Create .cargo/config.toml and add the following lines: <br>
```
[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"
```
4. run `cargo build --target x86_64-pc-windows-gnu --release`

#### Linux Version (cross compilation)
* only gnu is supported, Lucas Bergers code does not support static linking
1. Target for Linux: `rustup target add 86_64-unknown-linux-gnu`
2. Toolchain: `arch -arm64 brew install SergioBenitez/osxct/x86_64-unknown-linux-gnu`
3. Create .cargo/config.toml and add the following lines: (Path for linker: `which 86_64-unknown-linux-gnu`)<br>
```
[target.x86_64-pc-windows-gnu]
linker = "/opt/homebrew/bin/x86_64-unknown-linux-gnu-gcc"
```
4. run `cargo build --target x86_64-unknown-linux-gnu --release`
5. When you have issues, check here: https://github.com/briansmith/ring/issues/1605

Binary file added solvers/custom/berger-vrp/bin/pipeline-linux-gnu
Binary file not shown.
Binary file added solvers/custom/berger-vrp/bin/pipeline-mac
Binary file not shown.
Binary file not shown.
Binary file added solvers/custom/lkh/bin/LKH-unix
Binary file not shown.
Binary file added solvers/custom/lkh/bin/LKH-windows.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion solvers/custom/lkh/vrp_lkh.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


parser.add_argument("tsplib_file")
parser.add_argument("--lkh-instance", default="./bin/LKH-mac")
parser.add_argument("--lkh-instance", default="./bin/LKH-unix")
parser.add_argument("--output-file")
parser.add_argument("-t", "--max-trials", default=1000)
parser.add_argument("-r", "--runs", default=10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private static String getSpringProfileForOs() throws MissingSpringProfileExcepti
} else if (osName.contains("mac")) {
return "mac";
} else if (osName.contains("nix") || osName.contains("nux") || osName.contains("aix")) {
return "unix";
return "linux";
} else {
throw new MissingSpringProfileException("Could not start Toolbox, "
+ "there is no Spring Profile that matches your OS specification.");
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/application-linux.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# unix-specific Binary for the Berger-Vrp pipeline:
custom.berger-vrp.solver=bin/pipeline-linux-gnu

# unix-specific Binary for the LKH solver:
custom.lkh.solver=${custom.lkh.directory}/bin/LKH-unix
2 changes: 1 addition & 1 deletion src/main/resources/application-mac.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
custom.berger-vrp.solver=bin/pipeline-mac

# Mac-specific Binary for the LKH solver:
custom.lkh.solver=${custom.lkh.directory}/bin/LKH-mac
custom.lkh.solver=${custom.lkh.directory}/bin/LKH-unix
Empty file.
4 changes: 2 additions & 2 deletions src/main/resources/application-windows.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# windows-specific Binary for the Berger-Vrp pipeline:
custom.berger-vrp.solver=bin/pipeline-windows
custom.berger-vrp.solver=bin/pipeline-windows.exe

# windows-specific Binary for the LKH solver:
custom.lkh.solver=${custom.lkh.directory}/bin/LKH-windows
custom.lkh.solver=${custom.lkh.directory}/bin/LKH-windows.exe

0 comments on commit ceb1cc2

Please sign in to comment.