What is JOpt?

JOpt is an open source Java wrapper that provides objects like Variable, Constraint, and Term and lets you express your linear or mixed integer programs in a natural manner, while remaining agnostic to the details of the solver backend. JOpt is not a solver. Rather, it requires a solver such as CPlex or the free LPSolve to operate.

This means that any program written with JOpt will work for any of serveral solvers used by the end user.

Why JOpt?

Features

Limitations

Downloads

All pre-compiled versions, including historical versions are available here. Documentation for prior versions is available here (some of which is still relevant).

Jopt is now housed on Github. The repository can be found at https://github.com/blubin/jopt.

Instructions

Download and install the software. You can do this either via Maven, or simply by downloading and placing the jopt.jar in your project, then including it in your classpath. You can of course also obtain the source code from the github repository, but it is possible to use JOpt directly from the pre-compiled jar file.

For simple examples of how to use JOpt, see:

For more infomration see the package javadoc, available here

More detailed documentation, but generated for prior versions of the software, is available here.

Some information on specific features is provided in the FAQ below.

JOpt Users

JOpt has been used in many projects to date. Of note:

If you use JOpt in a project, please let us know!

Contact Information

Benjamin Lubin is the primary author of JOpt, and the contact point for JOpt users.

FAQ

Does JOpt support multi-threading?
Yes, JOpt is intended to be re-entrant. You can solve multiple concurrent MIPs/LPs in separate threads using JOpt, even using a single machine. JOpt will maintain of pool of connections to the underlying solver and reuse these, lowering the overhead of creating and destroying these connections in every thread/call. This pool has a maximum size, which controls the maximum number of concurrent solve calls that will execute concurrently on the same machine (you can of course use multiple machines to parallelize beyond this point). See CPLEXInstanceManager.java for details. Some solvers, e.g. CPlex, use parallelism intermally within a single solve. Use of multiple threads can be controlled via SolveParams.java. For best results, one should pay attention to how many Cores are being used internally by the solver, and how many solvers are being run. Solver Threads * Number of concurrent solvers should be roughly the same as the number of cores in the machine.
How do I control the solver behavior?
JOptExposes many of the underyling solver parameters through the SolveParam.java class. See the documentation for the settings available. Note that not all underlying parameters are currently made available in the interface, you can add more using the existing ones as an example.
Does JOpt support multiple solutions per solve?
Yes, via the CPlex SolutionPool infrastructure. See SOLUTION_POOL_MODE and related settings in SolveParam.java.
Does JOpt support CPlex Infeasibility analysis?
CPlex now includes infeasibility analysis; JOpt can be configured to exploit this. See MIPInfeasibleException.java in the Javadoc documentation.
Can you propose solution values to JOpt to provide a bootstrap/hint of the search?
CPlex supports this, and JOpt includes API to pass this information through to CPlex. See IMIP.setProposedValues(), and related functions.
What is the JOpt load balancer?
JOpt ships as a single jar file contains both a server-side component (which runs the actual solver) and a client-side component (which you integrate with your program). Jopt actually runs in one of two modes:

What is the status of JOpt client/server and load balancer?
Opt provides a round-robin load balancer. If you solve multiple concurrent LP/MIPs, and have access to multiple machines with a solver, JOpt can take advantage of all of your machines. Communication occurs via standard Java RMI, and requires compiling using RMIC. The new Maven build process does not perform RMIC. So you will need to download from source and run RMIC yourself if you want to use this mode. See the historical documentation for further information.