[OS] Java: how to start?

Olivier Cailloux olivier.cailloux at ecp.fr
Wed Jan 27 17:45:00 EST 2010


Hello,

I just discovered the Coin-OR project and I am very enthousiastic about it.

What I would like to do is as simple as using Java code to describe a 
linear program instance (LP or MIP) and call a solver from that Java 
code. For the moment, I would like to simply call a local solver such as 
glpk (installed on my computer). What interests me particularily in that 
project is the ability to use a different solver, such as a commercial 
one if more performance is needed, without having to re-write the code. 
Or even distribute my software as-is, giving the user the ability to use 
it for free with glpk and to use it with his cplex licence, e.g., if he 
has one or want to buy one.

I have a few questions about how to achieve that goal.

- I can't find how to create a correct osil file representing a simple 
problem instance. Must be something I didn't get with the way the 
coefficients are stored, etc. (Reading from the Optimization Services 
2.0 User’s Manual, Section 11). I have found the example file 
OSTestCode.cpp, but when trying to follow the same logic with a simpler 
model (two constraints), it does not seem to produce a correct osil file.
- Is there a way to convert a .mod file to a .osil file so that I can 
better understand how that works?
=> Reading from Section 9.1, I tried to use the OSSolverAmpl command 
line tool to convert the file, but I didn't found how to make it write 
an osil file from my .mod file.
=> Section 10.3.2 mentions the OSnl2osil class that is able to convert 
such files, but I can't find a Java equivalent. Does it exist?
- Is there any complete working example in the form of a Java piece of 
code, defining a problem with a few variables and constraints, and 
solving it locally?
=> When calling solver.solve() on a GLPKSover() instance, it apparently 
tries to call a web service, as the oril file I receive says that it 
"Cannot run program 
.../webapps/os/WEB-INF/code/solver/OSSolverServiceLinux", and also 
contains 
"<serviceURI>http://127.0.1.1:8080/os/OSSolverService.jws</serviceURI>". 
How to specify I want to simply launch my local GLPK instance? 
(CoinSolver() doesn't work either, but maybe for a different reason.)
- How to make the command line tool OSSolverService use my glpk 
instance? "./OSSolverService -solver clp -osil .../parincLinear.osil" 
works, but "./OSSolverService -solver glpk -osil .../parincLinear.osil" 
yields "the GLPK solver requested is not present" (although glpk is 
installed and works on my system).

Thanks a lot for any help.
Olivier



More information about the OS mailing list