Re: [Help-glpk] GLPK 4.38 for Java under Linux

2009-05-27 Thread Andrew Makhorin
> I already thought of this way of getting rid of a variable. But
> keeping all the variables in the model, even bounded to 0, won´t slow
> down the simplex method? (there may be quite a lot of "removed" variables)

Every time glp_simplex returns you can check status of such variables
and remove those ones which became non-basic.




___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] GLPK 4.38 for Java under Linux

2009-05-27 Thread Sylvain Fournier
I already thought of this way of getting rid of a variable. But keeping all
the variables in the model, even bounded to 0, won´t slow down the simplex
method? (there may be quite a lot of "removed" variables)

2009/5/27 Andrew Makhorin 

> Rather than to "physically" remove a basic column from the problem
> object with glp_del_cols you can "logically" remove it fixing it at
> zero with glp_set_col_bnds(..., GLP_FX, 0, 0). In this case the basis
> remains valid.
>
>
___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] GLPK 4.38 for Java under Linux

2009-05-26 Thread Andrew Makhorin
> Thanks for the quick and detailed answer. I will keep using the warm up
> functionality, because I don?t really have an idea of which variable(s)
> should enter the basis.

Rather than to "physically" remove a basic column from the problem
object with glp_del_cols you can "logically" remove it fixing it at
zero with glp_set_col_bnds(..., GLP_FX, 0, 0). In this case the basis
remains valid.



___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] GLPK 4.38 for Java under Linux

2009-05-25 Thread Sylvain Fournier
Many thanks Xypron for the way to compile the library. I will try it and get
back to you if something is going wrong.

Sylvain


> Date: Sat, 23 May 2009 10:04:09 -0700 (PDT)
> From: xypron 
> Subject: Re: [Help-glpk] GLPK 4.38 for Java under Linux
> To: Help-glpk@gnu.org
> Message-ID: <23686380.p...@talk.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
>
> Hello Sylvain,
>
> Sylvain Fournier wrote:
> >
> > I then saw that there is a glpk_4_38_java library available (
> > http://winglpk.sourceforge.net/), I tried it on Windows and it seems to
> > work
> > fine. But there is a problem of organization in my code, as I use a
> > different Java interface when running on Linux and when running on
> > Windows.
> > So finally, my question on this subject is: is there a Java interface
> > equivalent as the one found at http://winglpk.sourceforge.net/, but for
> > Linux? In other words, has the glpk_4_38_java.dll also been compiled
> under
> > Linux as a .so?
> >
>
> The commands below can be used to create the libraries.
> Currently I am puzzled because the call to GLPK.glp_create_prob() works
> fine, while
> GLPK.glp_mpl_alloc_wksp() fails with
> java: symbol lookup error: /usr/local/lib/libglpk_4_38_java.so: undefined
> symbol: glp_mpl_alloc_wksp
>
> Best regards
>
> Xypron
>
>
> # download and unzip
> wget ftp://ftp.gnu.org/gnu/glpk/glpk-4.38.tar.gz
> tar -xzf glpk-4.38.tar.gz
> wget
>
> http://freefr.dl.sourceforge.net/sourceforge/winglpk/glpsol_dll-4.38-32bit.zip
> unzip -o glpsol_dll-4.38-32bit.zip
>
> # make and install glpk
> cd glpk-4.38
> ./configure --enable-dl --enable-odbc
> sudo make install
>
> # create libraries with swig
> cd swig
> mkdir src
> mkdir src/java
> mkdir java
> mkdir java/org
> mkdir java/org/gnu
> mkdir java/org/gnu/glpk
> swig -c++ -java -package org.gnu.glpk -o src/java/glpk_wrap.c -outdir
> java/org/gnu/glpk glpk.i
> g++ -c -fpic src/java/glpk_wrap.c -I../include
> -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux
> g++ -shared glpk_wrap.o -lglpk -lltdl -lgmp -o libglpk_4_38_java.so
> sudo cp libglpk_4_38_java.so /usr/local/lib
> cd java/org/gnu/glpk
> javac *.java
> cd ../../..
> jar cf glpk.jar *
>
> # make and try example
> cd ../../examples
> javac -cp ../swig/java/glpk.jar GLPKSwig.java
> java --cp ../swig/java/glpk.jar:. GLPKSwig
>
___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] GLPK 4.38 for Java under Linux

2009-05-25 Thread Sylvain Fournier
2009/5/23 Andrew Makhorin 
>
>
> Lpx_warm_up will be replaced by glp_warm_up, which will provide the
> same functionality.
>
>
Thanks for the quick and detailed answer. I will keep using the warm up
functionality, because I don´t really have an idea of which variable(s)
should enter the basis.

Sylvain
___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] GLPK 4.38 for Java under Linux

2009-05-23 Thread xypron

Hello Andrew,

the error was caused by some old library installed in /usr/lib while the
default
installation path of GLPK is /usr/local/lib.

Best regards

Xypron



Andrew Makhorin wrote:
> 
>> Currently I am puzzled because the call to GLPK.glp_create_prob() works
>> fine, while 
>> GLPK.glp_mpl_alloc_wksp() fails with
>> java: symbol lookup error: /usr/local/lib/libglpk_4_38_java.so: undefined
>> symbol: glp_mpl_alloc_wksp
> 
> It is unclear. Libtool must export all symbols prefixed with 'glp_':
> 
> libglpk_la_LDFLAGS = -version-info @VERINFO@ \
> -export-symbols-regex '^(glp_|_glp_lpx_).*'
> 
> Looks like there is something wrong in libtool, or not?
> 
> 
> 
> ___
> Help-glpk mailing list
> Help-glpk@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-glpk
> 
> 

-- 
View this message in context: 
http://www.nabble.com/GLPK-4.38-for-Java-under-Linux-tp23671681p23687832.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.



___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] GLPK 4.38 for Java under Linux

2009-05-23 Thread Andrew Makhorin
> Currently I am puzzled because the call to GLPK.glp_create_prob() works
> fine, while 
> GLPK.glp_mpl_alloc_wksp() fails with
> java: symbol lookup error: /usr/local/lib/libglpk_4_38_java.so: undefined
> symbol: glp_mpl_alloc_wksp

It is unclear. Libtool must export all symbols prefixed with 'glp_':

libglpk_la_LDFLAGS = -version-info @VERINFO@ \
-export-symbols-regex '^(glp_|_glp_lpx_).*'

Looks like there is something wrong in libtool, or not?



___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] GLPK 4.38 for Java under Linux

2009-05-23 Thread Andrew Makhorin
> I have another question about my algorithm. I am using a Branch Price
> scheme. When I add variables, I want to use the basis of the previous run
> as the first basis of the current run (I don´t want to solve the model
> from scratch each time!)

If you add new column(s), glp_add_cols makes them non-basic, so the
current basis as well as the basis factorization remain valid. Note that
by default the glpk simplex solver (glp_simplex) starts the search from
the current basis defined in the problem object, so if the basis is
valid, you do not need to call lpx_warm_up.

>  When I delete columns however, it may occur that
> one of them was in the basis, that consequently is not valid any more.
> Is there a simple way for me to use the same basis in the next run in
> case it was not modified, and update this basis in the case it has lost
> at least one variable?

You can use the routine glp_get_col_stat to determine whether a column
is basic or non-basic. If the column is basic, deleting it invalidates
the basis. So if you want the simplex solver to continue the search,
you should use the routine glp_set_row_stat/glp_set_col_stat to change
the status of some appropriate non-basic row/column to GLP_BS, i.e. to
make the basis valid.

>  (I used the warm_up function and I was looking at
> its return code, but this function seems to be deprecated on the newest
> versions.)

Lpx_warm_up will be replaced by glp_warm_up, which will provide the
same functionality.



___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] GLPK 4.38 for Java under Linux

2009-05-23 Thread xypron

Hello Sylvain,

Sylvain Fournier wrote:
> 
> I then saw that there is a glpk_4_38_java library available (
> http://winglpk.sourceforge.net/), I tried it on Windows and it seems to
> work
> fine. But there is a problem of organization in my code, as I use a
> different Java interface when running on Linux and when running on
> Windows.
> So finally, my question on this subject is: is there a Java interface
> equivalent as the one found at http://winglpk.sourceforge.net/, but for
> Linux? In other words, has the glpk_4_38_java.dll also been compiled under
> Linux as a .so?
> 

The commands below can be used to create the libraries.
Currently I am puzzled because the call to GLPK.glp_create_prob() works
fine, while 
GLPK.glp_mpl_alloc_wksp() fails with
java: symbol lookup error: /usr/local/lib/libglpk_4_38_java.so: undefined
symbol: glp_mpl_alloc_wksp

Best regards

Xypron


# download and unzip
wget ftp://ftp.gnu.org/gnu/glpk/glpk-4.38.tar.gz
tar -xzf glpk-4.38.tar.gz
wget
http://freefr.dl.sourceforge.net/sourceforge/winglpk/glpsol_dll-4.38-32bit.zip
unzip -o glpsol_dll-4.38-32bit.zip

# make and install glpk
cd glpk-4.38
./configure --enable-dl --enable-odbc
sudo make install

# create libraries with swig
cd swig
mkdir src
mkdir src/java
mkdir java
mkdir java/org
mkdir java/org/gnu
mkdir java/org/gnu/glpk
swig -c++ -java -package org.gnu.glpk -o src/java/glpk_wrap.c -outdir
java/org/gnu/glpk glpk.i
g++ -c -fpic src/java/glpk_wrap.c -I../include
-I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux
g++ -shared glpk_wrap.o -lglpk -lltdl -lgmp -o libglpk_4_38_java.so
sudo cp libglpk_4_38_java.so /usr/local/lib
cd java/org/gnu/glpk
javac *.java
cd ../../..
jar cf glpk.jar *

# make and try example
cd ../../examples
javac -cp ../swig/java/glpk.jar GLPKSwig.java
java --cp ../swig/java/glpk.jar:. GLPKSwig

-- 
View this message in context: 
http://www.nabble.com/GLPK-4.38-for-Java-under-Linux-tp23671681p23686380.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.



___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk