Getting started with JOpt.TourOptimizer

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.
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.
Option A: Clone into your IDE (recommended for developers)
Clone the repository with one of these commands:
| Method | Command |
|---|---|
| HTTPS | git clone https://github.com/DNA-Evolutions/Java-TourOptimizer-Examples.git |
| SSH | git clone [email protected]:DNA-Evolutions/Java-TourOptimizer-Examples.git |
| GitHub CLI | gh 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 public DNA Evolutions Maven repository repo.dna-evolutions.com/releases, which the project's pom names. Then run the main method of any example class, for example FirstOptimizationExample in basic/firstoptimization_01.
The lines of the JOpt core, their Java versions and their Maven coordinates are on JOpt.Core overview; the changes of the newest versions are in Core releases.
- For all projects: add the line
-Dmaven.resolver.transport=wagonbelow-vmargsineclipse.ini(SpringToolsForEclipse.iniin Spring Tools) and restart Eclipse. - For this project only: create the file
.mvn/maven.configin the project folder with the same line.
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.

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:2.1.0
The container runs in trusted mode, which needs no sign-in service and no secret store. When it runs, the Swagger UI answers at http://localhost:8081/swagger-ui/index.html. The JOpt.TourOptimizer overview describes the service, Settings lists its settings, among them the port and the license, and Trusted mode shows the setups on Linux, Windows, macOS and Kubernetes.
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
- Java SDK sandbox tutorial (YouTube)
- TourOptimizer as a service (REST), part 1 (YouTube)
- TourOptimizer as a service (REST), part 2 (YouTube)
- Angular demo app tutorial (YouTube)
Geocoding and road distances
Geocoding, distance and driving-time matrices and routes on real roads come from GeoCoderRouter. GeoCoderRouter is one service and runs in the JOpt Platform stack next to JOpt.TourOptimizer; only JOpt.TourOptimizer calls it. See GeoCoderRouter for what it does, and the contact page for access to the JOpt Platform stack.
Troubleshooting checklist
- The REST endpoint runs and is reachable: the Swagger UI opens.
- Inside Docker, the client uses
host.docker.internalas 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.
Related pages
After the first run, read on in this order:
- Feature list and feature atlas: the features of JOpt.TourOptimizer as a sorted list and as an atlas
- Basic examples: fundamentals and core modeling patterns
- Advanced examples: constraints from practice and combinations of features
- 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-11-27