Java Solver: Modeling and Solving Optimization Problems

Java Solver is an open source product that provides a minimalistic, simple-to-use Java API for modeling and solving optimization problems. It’s freely available from Download the product, try examples, and use it for your decision optimization problems.


When your business problem has an optimization objective, you need a software capable to minimize/maximize this objective. There are plenty of great tools such as Constraint Programming Solvers and Linear Programming  Solvers which may help you to define and solve different optimization problems. However, you don’t plan to become an optimization expert and/or learn specialized modeling languages does not matter how good they are. If you just want to define your optimization problem in Java and see how one of these powerful solvers can find a good practical solution, then Java Solver is for you.


Simply download a free Java Solver without any licensing limitations even for commercial use – its available under the open source LGPL license. You will receive source code and jar-files needed for modeling and solving optimization problems using a very simple Java API. The learning curve is minimal as you learn by examples provided at For your own problem, you need to create a Java class inherited from the standard class JavaSolver. Your class should specify only one method define() that will use your own Java objects to define constrained variables and posting constraints on them. To do that you will use the basic methods of the JCP standard JSR-331 “Constraint Programming API”. However, you don’t need to read any manual – just look how it can be done using simple examples.  And you don’t need to write any solving methods: instead, you simply call the default method minimize() or maximize(). They will find an optimal solution using any available 3rd party CP/LP solver. You also may overload the method saveSolution() to save the found solution into your own Java objects. To switch between different solvers you just add their jar-files to the classpath without changing a character in your model.

Example (explanations)


As the Specification lead of the JSR-331 standard, I plan to personally support Java Solver as well. So, if you need any help to start using Java Solver, feel free to contact me directly at If you want to contribute, let me know and I will provide you with a direct access to the GitHub repository “javasolver”.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.