[Gecode] Java interface

Guido Tack tack at ps.uni-sb.de
Sat Jan 8 19:06:18 CET 2005


Hi everyone!

I have just checked in a Java interface for Gecode. It uses SWIG 
(http://www.swig.org) to automatically generate everything from a 
relatively simple interface file.

Things that still need to be done:
* It must be thread safe. Java creates "real" threads for executing 
native methods, so we either have to make the methods thread safe or 
synchronize them globally. At the moment, threads seam to make it crash 
:-(
* Set constraints are missing (but easy to add).
* At the moment, only the DFS search engine is available from Java. I 
will soon add Branch and Bound - especially interesting because JNI 
makes it easy to write callback functions in Java. This is really cool 
;-)
* The low-level representation of variables is the same as in Alice: 
they're integer indices into an array of real Gecode variables. At the 
moment, it is not checked whether a certain variable is valid in a 
Space. I will either add checks or come up with a different scheme.
* Lift all kinds of exceptions from C++ to Java.
* Test it with Windows (as soon as I get my Sony notebook back...)
* Do some benchmarks - there is probably some overhead in the 
interface, but to me it seems to be reasonably low.
* Implement the Java explorer ;-)

To summarize: SWIG seems to be well suited for this task - it took me 
just two days from learning the very basic things about SWIG to having 
a rather complete interface. I hope it will be just as easy to create 
O'Caml and Python interfaces.

Cheers,

	Guido




More information about the gecode-users mailing list