As a Java developer, you develop software that provides solutions for your business problems. When a problem has an optimization objective, your program should minimize/maximize this objective. There are plenty of great tools such as Constraint Programming (CP) Solvers and Linear Programming (LP) Solvers which may help you to define and solve such optimization problems. However, you don’t plan to become an optimization expert and/or learn specialized modeling languages. You just want to define your optimization problem in Java and see how one of these powerful solvers can find a good practical solution. If this is your motivation, then Java Solver is for you.
Solution
Java Solver is an open source product that provides a minimalistic, simple-to-use Java API for modeling and solving optimization problems. It contains only one class JavaSolver, from which you need to inherit your own Solver. This class may have only one method define() that will use your own Java objects to define constrained variables and posting constraints on them. Java Solver uses the basic methods of the standard Constraint Programming API JSR-331. You don’t need to write a solving algorithm: instead, you simply call the default method minimize() or maximize() to find an optimal solution using any available 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. That’s the intent. To see how it’s actually done, look at the introductory example.