Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ARCHITECTURE=arm64v8/
RUBY_VERSION=2.6
ORTOOLS_VERSION=v7.8 # select from https://github.com/google/or-tools/releases
10 changes: 8 additions & 2 deletions .github/actions/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ case $ORTOOLS_VERSION in
export ORTOOLS_URL="https://github.com/google/or-tools/releases/download/v7.5/or-tools_debian-10_v7.5.7466.tar.gz"
;;
'v7.8')
export ORTOOLS_URL="https://github.com/google/or-tools/releases/download/v7.8/or-tools_debian-10_v7.8.7959.tar.gz"
export ORTOOLS_URL="https://github.com/google/or-tools/releases/download/v7.8/or-tools_debian-10_v7.8.7959.tar.gz"
;;
'v9.0')
export ORTOOLS_URL="https://github.com/google/or-tools/releases/download/v9.0/or-tools_debian-10_v9.0.9048.tar.gz"
;;
'v9.3')
export ORTOOLS_URL="https://github.com/google/or-tools/releases/download/v9.3/or-tools_amd64_debian-11_v9.3.10497.tar.gz"
;;
*)
echo "Unknown OR-Tools version"
esac

echo "Download asset at ${ORTOOLS_URL}"
docker build --build-arg ORTOOLS_URL=${ORTOOLS_URL} -f ./Dockerfile -t "${IMAGE_NAME}" .
docker build --build-arg RUBY_VERSION="2.6" --build-arg ORTOOLS_URL=${ORTOOLS_URL} -f ./Dockerfile -t "${IMAGE_NAME}" .
docker run -d --name optimizer -t "${IMAGE_NAME}"
docker exec -i optimizer bash -c "LD_LIBRARY_PATH=/srv/or-tools/lib/ /srv/optimizer-ortools/tsp_simple -time_limit_in_ms 500 -intermediate_solutions -instance_file '/srv/optimizer-ortools/data/test_ortools_single_route_with_route_order' -solution_file '/tmp/optimize-or-tools-output'"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
types: [opened, synchronize, reopened]

env:
ORTOOLS_VERSION: v7.8
ORTOOLS_VERSION: v9.3
REGISTRY: ${{ secrets.REGISTRY }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
Expand Down
19 changes: 4 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
# 1.0.13 is the latest version containing bundler 2 required for optimizer-api
FROM phusion/passenger-ruby25:1.0.13
ARG RUBY_VERSION
ARG ARCHITECTURE

FROM ${ARCHITECTURE}ruby:${RUBY_VERSION}

ARG ORTOOLS_URL=${ORTOOLS_URL}

LABEL maintainer="Mapotempo <tech@mapotempo.com>"

WORKDIR /srv/

# Trick to install passenger-docker on Ruby 2.5. Othwerwise `apt-get update` fails with a
# certificate error. See following links for explanantion:
# https://issueexplorer.com/issue/phusion/passenger-docker/325
# and
# https://issueexplorer.com/issue/phusion/passenger-docker/322
# Basically, DST Root CA X3 certificates are expired on Setember 2021 and apt-get cannot validate
# with the old certificates and the certification correction is only done for Ruby 2.6+ on the
# passenger-docker repo because Ruby 2.5 is EOL.
RUN mv /etc/apt/sources.list.d /etc/apt/sources.list.d.bak
RUN apt update && apt install -y ca-certificates
RUN mv /etc/apt/sources.list.d.bak /etc/apt/sources.list.d
# The above trick can be removed after Ruby version is increased.

RUN apt-get update > /dev/null && \
apt-get -y install git wget pkg-config build-essential cmake autoconf libtool zlib1g-dev lsb-release > /dev/null

Expand Down
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
OR_TOOLS_TOP=../or-tools

TUTORIAL=resources
TUTORIAL=./resources

# -isystem prevents most of the warnings rooted in or-tools library appearing in our compilation
CFLAGS := -std=c++14 -isystem$(OR_TOOLS_TOP)/include
CFLAGS := -std=c++17 -isystem $(OR_TOOLS_TOP)/include

# During development uncomment the next line to have debug checks and other verifications
# DEVELOPMENT = true
ifeq ($(DEVELOPMENT), true)
CFLAGS := $(CFLAGS) -O0 -DDEBUG -ggdb3 -fsanitize=address -fkeep-inline-functions -fno-inline-small-functions
# CXX := ../callcatcher/build/scripts-3.6/callcatcher $(CXX) # comment out to check uncalled functions
CXX := LSAN_OPTION=verbosity=1:log_threads=1 $(CXX) # adress sanitizer works only if the executable launched without gdb
else
CFLAGS := $(CFLAGS) -O3 -DNDEBUG
Expand Down Expand Up @@ -44,11 +45,11 @@ tsp_simple.o: tsp_simple.cc ortools_vrp.pb.h \
tsptw_data_dt.h \
limits.h \
values.h
$(CXX) $(CFLAGS) -I $(TUTORIAL) -c ./tsp_simple.cc -o tsp_simple.o
$(CXX) $(CFLAGS) -isystem$(TUTORIAL) -c ./tsp_simple.cc -o tsp_simple.o

tsp_simple: $(ROUTING_DEPS) tsp_simple.o ortools_vrp.pb.o ortools_result.pb.o $(OR_TOOLS_TOP)/lib/libortools.so
$(CXX) $(CFLAGS) -fwhole-program tsp_simple.o ortools_vrp.pb.o ortools_result.pb.o $(OR_TOOLS_LD_FLAGS) \
-L $(OR_TOOLS_TOP)/lib -Wl,-rpath $(OR_TOOLS_TOP)/lib -lortools -lprotobuf -lglog -lgflags -labsl_raw_hash_set -labsl_time -labsl_time_zone \
$(CXX) $(CFLAGS) -g tsp_simple.o ortools_vrp.pb.o ortools_result.pb.o $(OR_TOOLS_LD_FLAGS) \
-L $(OR_TOOLS_TOP)/lib -Wl,-rpath $(OR_TOOLS_TOP)/lib -lortools \
-o tsp_simple

local_clean:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ optimizer-ortools
Compute an optimized solution to the Vehicle Routing Problem with Time Windows and various constraints using OR-Tools.
This wrapper is designed to be called through [Optimizer-API](https://github.com/Mapotempo/optimizer-api) and has been tested on Ubuntu 17.10, 18.04; Linux Mint 18; Debian 8, 10.

The current implementation has been tested with the version 7.8 of OR-Tools
The current implementation has been tested with the version 9.3 of OR-Tools

Installation
============
## Requirements

Require OR-Tools for the C++ part. Fetch source code at [https://github.com/google/or-tools](https://github.com/google/or-tools).

Download OR-Tools here : https://github.com/google/or-tools/releases/tag/v7.8
Download OR-Tools here : https://github.com/google/or-tools/releases/tag/v9.3

- Recommended Asset : [or-tools_debian-10_v7.8.7959.tar.gz](https://github.com/google/or-tools/releases/download/v7.8/or-tools_debian-10_v7.8.7959.tar.gz)
- Recommended Asset : [or-tools_debian-10_v9.0.9048.tar.gz](https://github.com/google/or-tools/releases/download/v9.3/or-tools_debian-10_v9.0.9048.tar.gz)

More details on [Google Optimization Tools Documentation](https://developers.google.com/optimization/introduction/installing)

Expand Down
6 changes: 3 additions & 3 deletions ci-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ Optimizer requires the two following images that must be manually built.
### Ortools

```
export ORTOOLS_VERSION=v7.8
export ORTOOLS_VERSION=v9.3
cd ./docker/ortools
docker build --build-arg ORTOOLS_VERSION=${ORTOOLS_VERSION} \
-f ./Dockerfile -t ${REGISTRY}mapotempo/ortools:${ORTOOLS_VERSION} .
```

## Build
```
export ORTOOLS_VERSION=v7.8
export ORTOOLS_VERSION=v9.3
export BRANCH=${BRANCH:-ce}
docker build --build-arg ORTOOLS_VERSION=${ORTOOLS_VERSION} \
-f ./Dockerfile -t ${REGISTRY}mapotempo-${BRANCH}/optimizer-ortools:latest .
```
```
19 changes: 0 additions & 19 deletions ci-utils/ortools/asset_url.sh

This file was deleted.

Binary file modified data/test_ortools_single_route_with_route_order
Binary file not shown.
Binary file added data/test_with_cluster
Binary file not shown.
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3.7'
x-app-args: &app-args
ARCHITECTURE: ${ARCHITECTURE}
RUBY_VERSION: ${RUBY_VERSION}
ORTOOLS_VERSION: ${ORTOOLS_VERSION}

x-app: &default-app
volumes:
- ./:/srv/app/
env_file:
- ./.env

services:
main:
<<: *default-app
build:
args:
<<: *app-args
context: .
dockerfile: Dockerfile
image: dev.example.com/mapotempo/optimizer-ortools
tty: true
Loading