magneticflux- / ortools-java

Apache License 2.0
15 stars 3 forks source link
hacktoberfest

ortools-java

Packages Google OR-Tools as a self-extracting jar file at Maven coordinates com.skaggsm.ortools:ortools-natives-all:8.0.8283.

Why?

There are two types of existing solutions: those that require the natives to be bundled manually, and those that bundle natives and extract them on-demand:

Solutions prior to this were of the former variety and were difficult to use and deploy, prone to human error, and infrequently updated.

The new official solution borrows code for the simple classpath case from this project, but does not handle more complex classpaths.

This solution is a superset of the official solution; it handles more complex classpaths.

How to Use

  1. Add the JCenter repository to resolve the artifacts
  2. Add a dependency on com.skaggsm.ortools:ortools-natives-all:8.0.8283 in your build tool of choice
  3. Write code:
    // Somewhere before using OR-Tools classes
    OrToolsHelper.loadLibrary();

Before using, ensure the system meets the minimum requirements for installing OR-Tools.

Supported Java Versions

Simple Classpaths

Basic requirements: >= Java 8

Complex Classpaths (Spring, etc.)

Basic requirements: >= Java 11

Confirmed working versions:

Confirmed NOT working versions:

More information here: #10.

Details

This library is divided into several modules:

Native library lifecycle:

  1. JVM startup
  2. OrToolsHelper.loadLibrary(); called
    • Native binaries are extracted to a temp directory
    • Native binaries are loaded by the system
  3. JVM shutdown
    • Native binaries are deleted