Switching Between Solvers

Java Solver allows you to easily switch between underlying off-the-shelf solvers without changing anything in your optimization model. There are many Constraint and Linear solvers (open source and commercial) which can be utilized by Java Solver.  Constraint solvers can represent almost any problem while linear solvers are limited to linear constraints only. Linear solvers usually can find optimal solutions for problems of very large size faster in situations when constraint solvers stop short.

Java Solver samples show you how to switch an underlying solver by changing one setting in the batch file. For instance, the introductory example uses the batch file “runZoo.bat” to run the model with the constraint solver “Sugar”:

The results will be shown as:

If  in the above bat-file comment out “Sugar” (put “rem” in front of it) and un-comment set SOLVER=Constrainer, the same model will be solved with another constraint solver and the results will look as follows:

Now, if you comment out CONSTRAINER, and set SOLVER=Scip, the same problem will be solved usin the linear solver SCIP:

Not all solvers are good for solving all problems, and having an ability to easily switch between different solvers is a big plus!