# My diploma project - organisms evolution

So. I have the last project before I graduate from my university and it’s called organisms evolution.

Basically I create random organism from primitive shapes/objects (cubes or blocks for example), connected them with joints and then use motors (at least I think it’s the best approach for this) to simulate limbs movement (muscles). That’s the basic idea. Then I take the results like distance traveled and complexity of the organism (structure) and calculate some values in which I perform genetic algorithms to get better organisms.

End project should look something like this (not so sophisticated):

Now. I have no idea or some basic idea how to get started. I would apprecate if you guys pointed me in the right direction.

So I was thinking somethign like this:

I create the creature from only blocks. Every block can have 6 children (left, right, top, bottom, front, rear). I represent those using a custom tree in which a node has always 6 child nodes.

For the sake of reducing complexity I thought of using hinge constraint between those blocks. But I came across a problem. When u specify wrong axis for DoF the block start spining (like a tire in a car) and that’s not realistic (no creature has that kind of limb afaik).

I was thinking of using some other constraint (with 2 free axes). Any ideas?

Now my main concern is how to time the limb movements (enabling/disabling the motors)? Should I use simpleUpdate and do this every n TPFs? Or how would you guys approach this?

The limb movement could be in sync (every limb moves at the same time) or async (limbs move independently - every limb has its own time cycle).

I would really appreciate some help cause I’m a little frustrated with this because I don’t know where/how to start.

I did make some progress with processing + java + jbullet but it was too hardcore. So much boilerplate code and other things to think about so I decided to try it with jMonkey.

Thank you!

I’d say that you extend AbstractAppState, override the update method and in there put the code for the creature.

You could use hinges, two of them gives two directions

You can also specify the max angle of the hinge thus making it less spin like a wheel

I think this looks prittie funny, tho I think the speed of the evolution could be boost if you “kill” all evolved creatures that havn’t moved furthur than the generation before

That way you get the weak out of the way faster.

Interesting idea indeed, love to see how it works out!

It might not be a perfect fit, especially since it seems like you’d like some physics involved, but have a look at this Script Blocks “game of life” experiment. It might give you some ideas.

Hi depy.

Your choice in diploma work is a good one and can be a great learning experience in programming genetic algos.

First question: How much computer power will you have access to (i.e. on what kind of hardware will you run your software?)

looks pretty interesting. heard of this? same selection of generated characteristics over generations:

http://boxcar2d.com/

Whole algorithm/simulation will run on my personal computer. I will most likely have to do simulations over night.

@depy: I see. Well depending on if you have access to one or more modern GPU’s you may want to look into OpenCL (Wiki). I am sure you will be able to find native bindings for use in Java applications (e.g. JOCL, JogAmp).

Regarding specific suggestions on how to develop your software I would say that starting small and with lots of experiments is definately the way to go. Start out by getting to know the different API’s available and write short program tests in some of the once that you think will fit your needs. If done properly, projects such as this one tend to demand a lot from it’s developer so there is little point in moving with haste.

Another suggestion could be to take a more abstract view on the project as a whole. I assume this is a college-level (BA or MA) diploma work and as such you will have aquired proficiency in the different mathematical aspects of genetic algorithms. Maybe it would be a good idea to implement a more dynamic perspective by not setting a specific integer number on offspring acceptance or rejection. Here is an example of such an effort in the form of a whitepaper. Note that the example is still somewhat static in that it uses the traveling salesman problem as part of its implementation. Perhaps you could try working with limits and integrals, thus creating more diffuse upper and lower boundries. Just a thought…

Sorry for wall-o-text. Hope you can extract something good from it.

Nice. You made some good points.

I’m actually diving into basics now more or less. I’m wondering from where ppl learn jmonkeyengine and bulletphysics cause I can’t find more advanced documentation.

For example. I was considering using SixDofJoint but could not figure out how the motors in that join work, it just wasnt moving.

Is there some pdf documentation or someting I’ve missed?

lwjgl supports OpenCL too afaik

@depy: In the matter of how and where to learn more about jME I can tell you that I use the javadocs together with the forum and examples section here on the community site (the contrib-code section is great too!). I totally agree that the documentation for jME is below “sub-par”… but imho the usability and success of a new API lies not so much in it’s documentation as it lies in it’s community. And when it comes to community response… jME is fxxkin’ awesome.

As far as I can gather… the best way to getting help on specific topics is to be very narrow in your inqury. The more specific questions you ask the more precise the answers you get will be. Also… on a related note…I am absolutely NOT a skilled jME developer myself. I just started working with this library a few months ago. So far I have accomplished very little in my actual project, but I am getting there. It takes a while to get into but I am starting to feel more comfortable.

Regarding your issue with SixDofJoint, I will look into it. Maybe I can give you some feedback or help in some way… and I’ll prolly learn something on the way myself.