From 11300ab9fd6536d8d3926233c8cf2dacb90efa9b Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Thu, 21 Mar 2024 17:59:40 +0100 Subject: [PATCH 1/6] add AUTHORS --- AUTHORS | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 AUTHORS diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..1964b13 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,10 @@ +# This is the official list of authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS files. + +# Names should be added to this file as one of +# Organization's name +# Individual's name +# Individual's name + +Google LLC +Mizux Seiha From d8f225d9eb059d65d6444c78eb2c4a7cf4fd4859 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Thu, 21 Mar 2024 18:00:01 +0100 Subject: [PATCH 2/6] bump ortools-java to 9.9.3963 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0c84e4a..e36bbe9 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ com.google.ortools ortools-java - 9.8.3296 + 9.9.3963 jar compile From feb0057347747264926b3850fd3e4ab2298551d5 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Thu, 21 Mar 2024 18:00:13 +0100 Subject: [PATCH 3/6] rework BasicExample.java --- .../org/or_tools/example/BasicExample.java | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/or_tools/example/BasicExample.java b/src/main/java/org/or_tools/example/BasicExample.java index d297b3e..6ec0e04 100644 --- a/src/main/java/org/or_tools/example/BasicExample.java +++ b/src/main/java/org/or_tools/example/BasicExample.java @@ -16,6 +16,7 @@ package org.or_tools.example; // [START import] import com.google.ortools.Loader; +import com.google.ortools.init.OrToolsVersion; import com.google.ortools.linearsolver.MPConstraint; import com.google.ortools.linearsolver.MPObjective; import com.google.ortools.linearsolver.MPSolver; @@ -29,9 +30,15 @@ public static void main(String[] args) { Loader.loadNativeLibraries(); // [END loader] + System.out.println("Google OR-Tools version: " + OrToolsVersion.getVersionString()); + // [START solver] // Create the linear solver with the GLOP backend. MPSolver solver = MPSolver.createSolver("GLOP"); + if (solver == null) { + System.out.println("Could not create solver SCIP"); + return; + } // [END solver] // [START variables] @@ -43,8 +50,9 @@ public static void main(String[] args) { // [END variables] // [START constraints] - // Create a linear constraint, 0 <= x + y <= 2. - MPConstraint ct = solver.makeConstraint(0.0, 2.0, "ct"); + double infinity = java.lang.Double.POSITIVE_INFINITY; + // Create a linear constraint, x + y <= 2. + MPConstraint ct = solver.makeConstraint(-infinity, 2.0, "ct"); ct.setCoefficient(x, 1); ct.setCoefficient(y, 1); @@ -60,15 +68,33 @@ public static void main(String[] args) { // [END objective] // [START solve] - solver.solve(); + System.out.println("Solving with " + solver.solverVersion()); + final MPSolver.ResultStatus resultStatus = solver.solve(); // [END solve] // [START print_solution] + System.out.println("Status: " + resultStatus); + if (resultStatus != MPSolver.ResultStatus.OPTIMAL) { + System.out.println("The problem does not have an optimal solution!"); + if (resultStatus == MPSolver.ResultStatus.FEASIBLE) { + System.out.println("A potentially suboptimal solution was found"); + } else { + System.out.println("The solver could not solve the problem."); + return; + } + } + System.out.println("Solution:"); System.out.println("Objective value = " + objective.value()); System.out.println("x = " + x.solutionValue()); System.out.println("y = " + y.solutionValue()); // [END print_solution] + + // [START advanced] + System.out.println("Advanced usage:"); + System.out.println("Problem solved in " + solver.wallTime() + " milliseconds"); + System.out.println("Problem solved in " + solver.iterations() + " iterations"); + // [END advanced] } private BasicExample() {} From ab2259c362f8799a3fdb5ab03bcfede7745c2a5d Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Thu, 21 Mar 2024 18:01:26 +0100 Subject: [PATCH 4/6] fix copyright --- src/main/java/org/or_tools/example/BasicExample.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/or_tools/example/BasicExample.java b/src/main/java/org/or_tools/example/BasicExample.java index 6ec0e04..2e0b22e 100644 --- a/src/main/java/org/or_tools/example/BasicExample.java +++ b/src/main/java/org/or_tools/example/BasicExample.java @@ -1,4 +1,4 @@ -// Copyright 2010-2022 Google LLC +// Copyright 2010-2024 Google LLC // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at From 04a4191d3dc5ebe61acdd5fc75a305c874650a03 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Tue, 3 Sep 2024 17:31:41 +0200 Subject: [PATCH 5/6] ci: cleanup amd64_docker workflow --- .github/workflows/amd64_docker.yml | 30 +++++++++++++++++------------- Dockerfile | 17 ++++++++++------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/.github/workflows/amd64_docker.yml b/.github/workflows/amd64_docker.yml index 107f221..a7c6aa0 100644 --- a/.github/workflows/amd64_docker.yml +++ b/.github/workflows/amd64_docker.yml @@ -1,3 +1,4 @@ +# ref: https://github.com/docker-library/official-images name: amd64 Docker on: [push, pull_request, workflow_dispatch] @@ -6,16 +7,19 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: docker version - run: docker version - - name: docker info - run: docker info - - name: docker build env - run: docker build --target env . - - name: docker build devel - run: docker build --target devel . - - name: docker build build - run: docker build --target build . - - name: docker build test - run: docker build --target test . + - uses: actions/checkout@v4 + - name: Check docker + run: | + docker version + docker info + docker buildx ls + - name: Build env image + run: docker build --target env . + - name: Build devel image + run: docker build --target devel . + - name: Build project + run: docker build --target build . + - name: Run project + run: docker build --target run --progress plain . + - name: Pack project + run: docker build --target pack . diff --git a/Dockerfile b/Dockerfile index e244f5a..e7e6d2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,10 @@ # Create a virtual environment with all tools installed # ref: https://hub.docker.com/_/ubuntu -FROM ubuntu:22.04 AS env +FROM ubuntu:latest AS env # Install system build dependencies ENV PATH=/usr/local/bin:$PATH -RUN apt-get update -qq \ -&& DEBIAN_FRONTEND=noninteractive apt-get install -yq \ -default-jdk maven \ +RUN apt update -qq \ +&& DEBIAN_FRONTEND=noninteractive apt install -yq default-jdk maven \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ENV JAVA_HOME=/usr/lib/jvm/default-java @@ -17,8 +16,12 @@ COPY . . # Build FROM devel AS build -RUN mvn compile +RUN mvn compile -B -# Run test -FROM build AS test +# Run +FROM build AS run RUN mvn exec:java + +# Pack +FROM build AS pack +RUN mvn package -B From 4abe420b27d65af3af1d43786b0429fc50a5699c Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Wed, 4 Sep 2024 11:00:12 +0200 Subject: [PATCH 6/6] fix example message when solver not found --- src/main/java/org/or_tools/example/BasicExample.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/or_tools/example/BasicExample.java b/src/main/java/org/or_tools/example/BasicExample.java index 2e0b22e..0d9b4fd 100644 --- a/src/main/java/org/or_tools/example/BasicExample.java +++ b/src/main/java/org/or_tools/example/BasicExample.java @@ -36,7 +36,7 @@ public static void main(String[] args) { // Create the linear solver with the GLOP backend. MPSolver solver = MPSolver.createSolver("GLOP"); if (solver == null) { - System.out.println("Could not create solver SCIP"); + System.out.println("Could not create solver GLOP"); return; } // [END solver]