peter-ch / MultiNEAT

Portable NeuroEvolution Library
http://MultiNEAT.com
GNU Lesser General Public License v3.0
328 stars 104 forks source link

Compilation with Cython #19

Closed jr-garcia closed 7 years ago

jr-garcia commented 8 years ago

I made some changes so the Cython version compiles and the examples run. Library can be installed with (assuming Python3 as default)

MN_BUILD=cython
python setup.py install 

or

MN_BUILD=cython
python setup.py develop

or

sudo su
MN_BUILD=cython
pip install ./

It seems to not have crashes nor memory leaks. Still, it probably needs Boost since at least in Genome.cpp, boost shared pointers are needed. Notably missing in this version is pickle support. Without it, Genomes in multiprocessing jobs are uninitialized. I put needed changes for pickling in another branch since I modified .cpp sources and that got ugly and might be wrong since I know very little about C (and Parameters and Substrate pickling is pending). Some more compatibility with pip is there, but more work is needed to upload to Pypi. Hope this gives some ideas or saves some work for somebody. Thanks.

peter-ch commented 8 years ago

Hey thanks a lot for this! I was thinking of moving it over to pybind11 but if it works with Cython that would be awesome.

jr-garcia commented 7 years ago

It certainly works. Just requires a little refinement to be perfect (also you can close this when you like :) ).

peter-ch commented 7 years ago

It's merged now.