genetic-js icon indicating copy to clipboard operation
genetic-js copied to clipboard

Added support for async fitness function using Promises

Open richardklafter opened this issue 8 years ago • 4 comments

Minimal changes to support async fitness fitness functions with promises.

richardklafter avatar Jan 30 '17 01:01 richardklafter

Does this run my fitness functions in parallel? How could I check something like that...

zinefer avatar Jan 16 '18 06:01 zinefer

It runs all the fitness functions from one generation in parallel. If your fitness function is 100% JS this will not speed anything up but if your fitness function makes network calls or preforms some other async operation they will all be done in parallel.

I used it for tuning the parameters of an AI I built to play a game. In that case, running my fitness function took ~3min and I did it on lots of remote servers.

richardklafter avatar Jan 16 '18 17:01 richardklafter

Yeah, I came to that realization a bit later last night. My fitness function is just javascript that will require some engineering to get to run asynchronously. Thanks for your help.

zinefer avatar Jan 16 '18 23:01 zinefer

For those looking for async support, I've forked this repo and rewrote it in TypeScript and added support for async fitness method (including unit tests): https://github.com/Glavin001/genetic-js Hope this helps you, too! 😃

Glavin001 avatar Jul 09 '18 05:07 Glavin001