|
| From: | Nigel Galloway |
| Subject: | [Help-glpk] Compiling glpsol.java using glpk_java |
| Date: | Wed, 3 Mar 2010 18:27:30 +0100 |
Xypron,
The glpk_java distribution provides a Java interface to most of the
glpk API. I think some improvements are needed to access glp_main and
hence write glpsol in Java.
Attched is glpsol.java, the comments indicate the changes needed to
swig.i to enable it to function.
If you are willing to make these enhancements please feel free to
include glpsol.java in the glpk_java examples.
If you wish to include glpsol.class in the glpk_java jar then
something similar to the following is possible:
On Linux
address@hidden:$ /usr/jdk1.6.0_07/bin/java -jar glpsol.jar --math yacfs.mod
GLPSOL: GLPK LP/MIP Solver, v4.43
Parameter(s) specified in the command line:
--math yacfs.mod
Reading model section from yacfs.mod...
Reading data section from yacfs.mod...
48 lines were read
Generating equalz1...
Generating equalz2...
Model has been successfully generated
GLPK Simplex Optimizer, v4.43
2 rows, 2 columns, 4 non-zeros
Preprocessing...
2 rows, 2 columns, 4 non-zeros
Scaling...
A: min|aij| = 1.900e+01 max|aij| = 5.657e+02 ratio = 2.977e+01
GM: min|aij| = 9.192e-01 max|aij| = 1.088e+00 ratio = 1.183e+00
EQ: min|aij| = 8.450e-01 max|aij| = 1.000e+00 ratio = 1.183e+00
Constructing initial basis...
Size of triangular part = 1
0: obj = 0.000000000e+00 infeas = 4.829e-01 (1)
* 1: obj = 0.000000000e+00 infeas = 0.000e+00 (0)
OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.1 Mb (122835 bytes)
best linear fit is:
y = 0.426126 + 0.610772x
Model has been successfully processed
On Windows:
Microsoft Windows [Version 6.0.6001]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
> java -jar glpsol.jar --math yacfs.mod
GLPSOL: GLPK LP/MIP Solver 4.39
Reading model section from yacfs.mod...
Reading data section from yacfs.mod...
48 lines were read
Generating equalz1...
Generating equalz2...
Model has been successfully generated
Original LP has 2 rows, 2 columns, 4 non-zeros
Presolved LP has 2 rows, 2 columns, 4 non-zeros
Scaling...
A: min|aij| = 1.900e+001 max|aij| = 5.657e+002 ratio = 2.977e+001
GM: min|aij| = 9.192e-001 max|aij| = 1.088e+000 ratio = 1.183e+000
EQ: min|aij| = 8.450e-001 max|aij| = 1.000e+000 ratio = 1.183e+000
Constructing initial basis...
Size of triangular part = 1
0: obj = 0.000000000e+000 infeas = 4.829e-001 (1)
* 1: obj = 0.000000000e+000 infeas = 0.000e+000 (0)
OPTIMAL SOLUTION FOUND
Time used: 0.0 secs
Memory used: 0.1 Mb (117287 bytes)
best linear fit is:
y = 0.426126 + 0.610772x
Model has been successfully processed
Also attached is glpsol.jar which contains the comiled Java classes.
Also attache is glpkIDE.dll which is the Windows32 compiled swig
interface which should work with any glpk compiled as a "dll" called
glpk.dll.
Also attache is libglpkIDE.so which is the Linux64 compiled swig
interface which should work with any glpk compiled as an "so" called
libglpk.so.
--
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com
Powered by Outblaze
glpsol.java
Description: Binary data
glpsol.jar
Description: Binary data
glpkIDE.dll
Description: Binary data
libglpkIDE.so
Description: Binary data
| [Prev in Thread] | Current Thread | [Next in Thread] |