Skip to content

Clients for JOpt.TourOptimizer

JOpt.TourOptimizer can be containerized using Docker, which means that it can be run as a container on any system that has Docker installed. This allows for easy deployment and scaling of the service.

To access the JOpt.TourOptimizer (Repository), you can use various programming languages and libraries to create a client that can interact with the service through its REST API. The REST API of JOpt.TourOptimizer exposes a set of endpoints that can be used to create and solve optimization models, as well as retrieve and update the status of existing models.


Available example clients

In addition to our DemoApplication we prepared a client implementation in Java and C# to get you started with the containerized JOpt.TourOptimizer service.

You can visit our GitHub repositories:

We used the OpenAPI specification to automatically generate the clients. You can also utilize it to generate clients in various programming languages. This allows you to quickly and easily create a client in the programming language of your choice without having to manually write the code to interact with the service.

It is also possible to use the JOpt.TourOptimizer on cloud platforms like Azure, by deploying the containerized service to an Azure Container Instance or an Azure Kubernetes Service.

It is important to keep in mind that in order to use the JOpt.TourOptimizer, you must have a valid license for the service and the proper credentials to authenticate with the service.

Creating JSON test input

It is possible to transfer an Optimization problem defined with the core library into valid JSON test input for the JOpt.TourOptimizer.

The following code can be used to fulfil this transformation task:

public static String jsonFromOptimization(IOptimization opti)
        throws IOException, ConvertException, SerializationException {

    String licenseKey = "YOUR_JSON_LIC"; // Replace by your JSON license key

    Duration timeOut = Duration.ofMinutes(10);

    JSONConfig myExtension = JSONConfig.builder()

    return JSONOptimization.asJSON(
                JSONOptimization.fromOptization(opti, Optional.of(myExtension))


This code snippet is a utility method that converts an IOptimization object to a JSON string (including the solution if the input "opti" was already executed). The method takes in an IOptimization object, opti, and converts it to a JSON string using the JSONOptimization class. The JSONConfig object is created with the license key, a timeout, and the JSONOptimization.fromOptimization method is used to convert the IOptimization object to a JSONOptimization object. The JSONOptimization.asJSON method is then used to convert the JSONOptimization object to a JSON string, which is then returned by the method.

The timeout variable is used to set the maximum time the process of converting the optimization object to JSON should take. In case a JOpt.TourOptimizer REST server is used, it will use this timeout variable as the maximum time to finish the optimization run.


It's worth noting that the example code uses the string "YOUR_JSON_LIC" as a placeholder for the actual JSON license key, which should be replaced with a valid key in order for the code to work properly.


Please find two examples illustrating this process on GitHub:

Loading JSON input or output into the core library

It is also possible to load the JSON back into the core library.

The following code can be used to load a JSON String and get an CompltableFuture of the result.

public static CompletableFuture<OptimizationConfig<JSONConfig>> 
    loadFromString(String jsonDef)
        throws SerializationException, InvalidLicenceException, 
        InterruptedException, ExecutionException,
        ConvertException, IOException {

    // 1) Create a config object from the String
    OptimizationConfig<JSONConfig> config = 
        ConfigSerialization.deserialize(jsonDef, JSONConfig.class)

    // 2) Create an empty JSONOptimization that will be populated
    IJSONOptimization myOpti = new JSONOptimization();

    // 3) Here, you can attach to the observables to see progress,
    // errors, etc. by using e.g. attachToObservables method
    // attachToObservables(myOpti);

    // 4) This will populate the Optimization with a config and generates
    // a completable future on the result of the run
    CompletableFuture<OptimizationConfig<JSONConfig>> resultFuture = 

    return resultFuture;


This code is defining a method loadFromString that takes in a string jsonDef as an input parameter and returns a CompletableFuture<OptimizationConfig<JSONConfig>>. The method is used for loading and deserializing a configuration for the JOpt.TourOptimizer in JSON format, and starting an asynchronous optimization process.

The first step is to create a config object from the input string jsonDef by deserializing it and passing it to the OptimizationConfig class. The withExtension method is used to assign a timeout of 2 minutes.

Next, an empty JSONOptimization object is created, which will be populated later.

An attachToObservables method can be used to attach to observables to see progress, errors, etc.

Finally, the startAsynchConfigFuture method is called on the myOpti object, passing in the config object, which populates the Optimization with a config and generates a completable future on the result of the optimization run. The resultFuture variable is returned by the method.

Video Tutorials

We prepared two videos guiding you through the process of utilizing our Java-REST-Client.

1) Using DNA's Tour Optimizer as a service (Introduction Part 1):

  • Manually create JSON data and copy and paste it to JOpt.TourOptimizer server.

(Click to open the video):


2) Using DNA's Tour Optimizer as a service (Introduction Part 2):

  • Use generated models to create JSON data and send it to the JOpt.TourOptimizer REST-server.

(Click to open the video):



For reading our license agreement and for further information about license plans, please visit


A product by dna-evolutions ©