K
Kenneth P. Turvey
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm taking a class in Evolutionary Computation. I just turned in an
assignment that implements a simple genetic algorithm based on bit
strings. For mutation I simply check each bit in the population and
flip it with some constant probability. For a population of 10,000
individuals of 100 bits that means that I have to execute the method
Random.nextDouble() 1,000,000 times. I thought about this a bit and I
could do the same operation by getting a single value from a binomial
distribution and then selecting that number of bits at random. This
would require far fewer operations that the current brute force method.
For real problems this might not matter that much since mutation would
take a small percentage of the time spent in the algorithm, but for my
test problems mutation is the biggest contributor to run time.
So, now to the question. Is there an open source implementation of
nextBinomial() out there somewhere? I did a quick search of the web and
didn't find one. I could implement my own, but it probably wouldn't be
as fast as a widely used open source implementation and I don't want to
spend the time on something that is really a library function if I don't
have to.
Note that I'm not trying to cheat here. If I end up using it in an
assignment I will credit the author and the prof won't mind. This is a
graduate course.
Thank you.
- --
Kenneth P. Turvey <[email protected]>
http://kt.squeakydolphin.com (not much there yet)
Jabber IM: (e-mail address removed)
Phone: (314) 255-2199
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFDRwbHi2ZgbrTULjoRAkxhAJsEm9g5EfvsY9P7bnE9E3czsTgsDQCg9Glz
pS2dmdxSYVmjUcfpFpUSt9A=
=vcUC
-----END PGP SIGNATURE-----
Hash: SHA1
I'm taking a class in Evolutionary Computation. I just turned in an
assignment that implements a simple genetic algorithm based on bit
strings. For mutation I simply check each bit in the population and
flip it with some constant probability. For a population of 10,000
individuals of 100 bits that means that I have to execute the method
Random.nextDouble() 1,000,000 times. I thought about this a bit and I
could do the same operation by getting a single value from a binomial
distribution and then selecting that number of bits at random. This
would require far fewer operations that the current brute force method.
For real problems this might not matter that much since mutation would
take a small percentage of the time spent in the algorithm, but for my
test problems mutation is the biggest contributor to run time.
So, now to the question. Is there an open source implementation of
nextBinomial() out there somewhere? I did a quick search of the web and
didn't find one. I could implement my own, but it probably wouldn't be
as fast as a widely used open source implementation and I don't want to
spend the time on something that is really a library function if I don't
have to.
Note that I'm not trying to cheat here. If I end up using it in an
assignment I will credit the author and the prof won't mind. This is a
graduate course.
Thank you.
- --
Kenneth P. Turvey <[email protected]>
http://kt.squeakydolphin.com (not much there yet)
Jabber IM: (e-mail address removed)
Phone: (314) 255-2199
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFDRwbHi2ZgbrTULjoRAkxhAJsEm9g5EfvsY9P7bnE9E3czsTgsDQCg9Glz
pS2dmdxSYVmjUcfpFpUSt9A=
=vcUC
-----END PGP SIGNATURE-----