help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Help-glpk] Which is the closer-to-be-officially-endorsed Java (jni)


From: xypron
Subject: RE: [Help-glpk] Which is the closer-to-be-officially-endorsed Java (jni) GLPK interface?
Date: Thu, 5 Nov 2009 10:00:26 -0800 (PST)

Hello Giampaolo,

>> glpk-java is using SWIG to create the JNI wrapper classes. Therefore it
>> is
>> easy to upgrade to any future version of GLPK.
>> (SWIG is hosted at http://www.swig.org .)
>
>Right. I see, however, that swig tends to add some burden in the Java side.
>In example, I see that constants from glpk.h are converted into methods. Am
>I right or it is just I don't know almost anything about swig?

Let us have a look at the code:

public interface GLPKConstants {
  public final static int GLP_MAJOR_VERSION =
GLPKJNI.GLP_MAJOR_VERSION_get();
  public final static int GLP_MINOR_VERSION =
GLPKJNI.GLP_MINOR_VERSION_get();
  public final static int GLP_MIN = GLPKJNI.GLP_MIN_get();
  public final static int GLP_MAX = GLPKJNI.GLP_MAX_get();

Obviously methods are only called during the initialization of class
GLPKConstants,
the runtime compiler could do this during compilation.

Your coding will use the public member:
  // set solver parameters
  iocp = new glp_iocp(); 
  GLPK.glp_init_iocp(iocp);
  iocp.setPresolve(GLPKConstants.GLP_ON);

Have a look at the examples provided with glpk-java.

> Xypron, may I ask why there is a specific project for the win binaries?
> And
> why the Debian package shows autoconf/automake capabilities which are
> missing in the glpk-java project? Can't they be back-ported?
For Linux glpk binaries are distributed as packages, e.g. in Debian.
Project gnuwin32 does not update glpk Windows binaries frequently.
Hence I set up a Sourceforge project to provide current executables for
glpk.
GLPK-Java is integrated as a bonus.

>> glpk-java currently currently does not support callback routines. I
>> would
>> welcome contributions to add this feature.
>Ah, you see the GlpkHookIFC interface in the stan's glpk-jni subproject,
>isn't it?
For reference look at chapter 5.1.1 "Using the callback routine" of
doc/glpk.pdf.

What is needed is a java method to which you can path the java listener and
a variable of structure glpk_iocp. This method should fill parameter cb_func
with a reference to a C routine and cb_info with a reference to the java
listener.

Best regards

Xypron

-- 
View this message in context: 
http://old.nabble.com/Which-is-the-closer-to-be-officially-endorsed-Java-%28jni%29-GLPK-interface--tp26203025p26216579.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]