[gecode-users] Logilab's Python Wrapper for Gecode
Guido Tack
tack at ps.uni-sb.de
Wed Mar 22 09:24:30 CET 2006
Hi Grégoire!
> During this print we started the development of a Python wrapper for
> Gecode. We were able to wrap a simple generic space which allows to
> dynamically register integer variables in it and post a few constraints. We
> also implemented a generic propgator over ints which triggers a Python
> callback on propagate().
> The embryonic wrapper is available at
> http://codespeak.net/pypy/dist/pypy/lib/logic/gecode_wrapper/
That's nice work. I saw that you used the same idea we're using for the Alice
wrapper, to represent variables as array indices. One problem with this
approach is that you can't allocate "temporary" variables, you always have to
copy all the variables you've created. Are you planning to work around this?
As you know, we're using swig to generate a Java wrapper. Did you consider
this option, too? Although we had to annotate a lot, and provide many
customized translations between Java and C++, I still think it saved us a lot
of work.
We recently had some problems with memory management. A propagator written in
Java must be kept alive as long as the "corresponding C++ propagator" is
alive - and due to a bug in swig, our Java propagators were never finalized.
This means we had a huge memory leak. Does Python provide some clever way for
coping with these kinds of problems?
> The guys from Logilab (http://www.logilab.org and
> http://www.logilab.fr) which had already implemented a pure Python
> constraint solver (http://www.logilab.org/projects/constraint) are in
> the process of developing the Python wrapper.
Please let us know when you release something, so that we can put a pointer on
our web site.
Cheers,
Guido
--
Guido Tack
Programming Systems Lab, Saarland University, Germany
http://www.ps.uni-sb.de/~tack
More information about the gecode-users
mailing list