Linear program solvers in Java
This post summarizes my exploration of programs that can solve linear programming (LP) problems in Java using one of the standard solvers. I will keep updating it as I learn more about the solvers and ways to make them work.
I have had a bit frustrating start on finding a thing that actually works. Here are the free resources that I tried:
- SCPSolver: The website says that this tool enables a java programmer to solve an LP in 5 minutes. The caveat is the solution doesn't work for 64 bit JVM. I must install a 32-bit JDK, but that impacts the way other components of my code work!
- Java ILP: A Java interface for integer and linear programs, but it requires installing a separate solver as well.
It was frustrating because all these tools required me to install new software on my machine, which requires administrative rights on a UT machine. Hopefully, someone from our IT department will reply back to me soon.
UPDATE:
I finally had to resort to CPLEX, which is a paid software, though available for free to faculty members and students (also because it has its potential advantages of having all optimization solvers in one place).
After a bit of struggle, I finally got CPLEX to work with Java. For future references, here are the steps I followed:
After a bit of struggle, I finally got CPLEX to work with Java. For future references, here are the steps I followed:
- Download CPLEX for students online (visit IBM website)
- Install the optimization package (the whole software occupies around 4GB on your hard disk)
- Open the Netbeans project properties where CPLEX is intended to be used. Add cplex.jar file as an external jar located in ~\IBM\ILOG\CPLEX_Studio128\cplex\lib.
- Add the reference to the bin folder under cplex to Djava.library.path using command line (or you may set VMoptions under Run properties of the project, but I could not get that to work)
- Open cmd
- Type the following command: java -Djava.library.path="C:\Program Files\IBM\ILOG\CPLEX_Studio128\cplex\bin\x64_win64"
- Run CPLEX commands in Java (the tutorial for which is available online: getting started with CPLEX pdf)
Comments
Post a Comment