Getting started with JOpt.TourOptimizer

Illustration on a dark street grid: from a glowing start point, two lime paths lead through a Java SDK panel and a REST / OpenAPI panel to a screen with a check mark and a rising line chart

This page leads developers to a first optimization run with JOpt.TourOptimizer, on one of two paths. On the Java SDK path, the optimizer runs in-process as a Java dependency. On the REST path, JOpt.TourOptimizer runs as a service in a container, and a client in any language calls it. The sandbox quickstart has the Docker commands for both paths.

To ask questions about JOpt and get code that follows the published examples, see JOpt AI Expert.

Before you start

  • A license. The Java examples set the public evaluation license; for more elements, see License guide: element limits.
  • Docker, for the browser sandbox and for the TourOptimizer container.
  • For the Java SDK path in your own IDE: Git, a JDK in the version that the examples pom sets, and an IDE with Maven support.

Java SDK: run the examples in-process

The Java examples in Java-TourOptimizer-Examples run the optimizer in-process, so they need no REST endpoint. They go from basic to advanced and expert examples and show how a model is built and how constraints interact. Read Basic elements first: it introduces the elements of JOpt and their names.

The three example levels with sample topics: basic for onboarding, advanced for modeling and production, expert for customization

Clone the repository with one of these commands:

MethodCommand
HTTPSgit clone https://github.com/DNA-Evolutions/Java-TourOptimizer-Examples.git
SSHgit clone [email protected]:DNA-Evolutions/Java-TourOptimizer-Examples.git
GitHub CLIgh repo clone DNA-Evolutions/Java-TourOptimizer-Examples

Import the project into IntelliJ IDEA, Eclipse or VS Code as a Maven project. Maven resolves the dependencies from the DNA Evolutions Nexus repository that the project's pom names. Then run the main method of any example class, for example FirstOptimizationExample in basic/firstoptimization_01.

Option B: Use the browser sandbox (CodeServer)

The CodeServer sandbox is a browser IDE in a Docker container with Java and Maven installed, so you need no local Java, Maven or IDE. On the first launch it clones the examples, and on the first run Maven downloads the dependencies. Start it with:

docker run -it -d --name jopt-examples -p 127.0.0.1:8042:8080 -v "$PWD/:/home/coder/project" dnaevolutions/jopt_example_server:latest

Then open http://localhost:8042/ and log in with the password from the sandbox quickstart.

The Java examples sandbox in the browser at localhost:8042, with FirstOptimizationExample.java in the editor and the optimization progress in the terminal

What a successful run looks like

The example prints the optimization progress and the result to the console. A successful run shows:

  • an optimization run that ends without exceptions;
  • the result object or report;
  • at least one route with an ordered sequence of nodes.

Next, follow the basic examples, for example the first optimization example. The tutorial First optimization explains that example step by step.

REST service: call JOpt.TourOptimizer from any language

To use JOpt from Python, C#, a generated Java client or any other stack, run JOpt.TourOptimizer as a REST service. You need two parts: the TourOptimizer REST endpoint, a backend service that runs the optimization, and a client in your language. The client example repositories show how to create a request, submit it and parse the result.

Step 1: Start the TourOptimizer container

docker run -d --rm --name jopt-touroptimizer -p 8081:8081 -e SPRING_PROFILES_ACTIVE=cors dnaevolutions/jopt_touroptimizer:latest

When the container runs, the Swagger UI answers at http://localhost:8081/swagger-ui/index.html. The Docker-REST-TourOptimizer repository documents the service, and the REST server page describes its settings, among them the port and the license.

Step 2: Choose a client example repository

Clone one of these repositories, or start its sandbox with the command from the sandbox quickstart:

Each repository shows how to configure the endpoint and documents how its OpenAPI client models are generated and updated.

Step 3: Set the endpoint address

If the client runs inside a sandbox container and the REST endpoint runs on your host, use http://host.docker.internal:8081. Do not use http://localhost:8081 inside the sandbox: there it points to the container itself.

Tutorial videos

3) RoutePlanner and GeoCoder (current availability)

JOpt.RoutePlanner and JOpt.GeoCoder are currently offered primarily as SaaS components.

If you want to:

  • geocode large address corpora (GeoCoder), or
  • use hosted routing / travel-time planning (RoutePlanner),

please contact us to discuss access, tenancy, and integration options:

Troubleshooting checklist

  • The REST endpoint runs and is reachable: the Swagger UI opens.
  • Inside Docker, the client uses host.docker.internal as the endpoint host.
  • The repository matches your path: the Java examples for the SDK, a client example repository for REST.
  • Start with the basic examples before complex constraints.

After the first run, read on in this order:

  1. Feature list and feature atlas: the features of JOpt.TourOptimizer as a sorted list and as an atlas
  2. Basic examples: fundamentals and core modeling patterns
  3. Advanced examples: constraints from practice and combinations of features
  4. Expert examples: custom restrictions and costs, warm starts with your own solution, the algorithm pipeline, early stop on convergence

Added: 2026-02-27 (JOpt core 7.5.3-j17) | Last updated: 2026-10-21