Friday 17 June 2011

Developer Journal 101 - On Persistent Populations


The simulation reached 256 robots and paused as I expected. I'm going to have to make the robots reproduce less often.

I'm concerned that no matter how advanced the robot behaviors are, the current body shape does not convey that well. The current body shape requires more work to demonstrate behaviors, requiring me to observe specific actions, and either reproduce or write about them. A more humanoid body shape conveys advanced behaviors much more easily.

I've found that switching from thinking in steps to thinking in seconds helps me to better grasp the simulation. For example, thinking of robots maturing after 1 hour rather than 20,000 steps.

The result of last night's simulation run, save file 110617-1455, has the following information.

Step: 281911 NumFood: 8 NumFoodEver: 1568 NumCrit: 257 NumCritEver: 2526
numSick: 13
numChild: 59
0 to 10000: 227
10000 to 20000: 30

I culled the population back to 55 robots and created save file 110617-1500, which has the following details.

Step: 281911 NumFood: 8 NumFoodEver: 1568 NumCrit: 55 NumCritEver: 2526
numSick: 6
numChild: 18
0 to 10000: 49
10000 to 20000: 6

Currently the robots can mate as soon as they are born.

I don't know if this matters but when I put 0.02 into a float, the number becomes 0.0199999996.

Results of messing with the physics engine

I've change the code so that robots have to live for 1 simulation hour before they can reproduce.

After they have mated, they have to wait 1 simulation hour before they can mate again.

Strange. When I load the simulation, there is a crash that occurs when I load in the input vector in class Robot.

110617-1500 (19 MB) crashed
110617-1455 (87 MB) crashed
110616-2000 (71 MB) crashed
110616-1910 (46 MB) crashed
110616-1855 (21 MB) crashed, I'm pretty sure that this worked yesterday
110616-1828 (87 MB) crashed
skip a few
110614-1855 (49 MB) crashed, I know that this one should work for sure

I think from now on I'll load straight after saving.

I ran the simulation from scratch and created the save file 110617-1845 (5 MB). I loaded 110617-1845 and it worked.

Trying a re-compile. Same crash.

terminate called after throwing an instance of 'boost::archive::archive_exception'
  what():  class version St6vectorIS_IfSaIfEESaIS1_EE

Program exited with code 03.

I don't know what to do to continue the simulation I've been running for the past few days. I could restart but I want to get in the habit of working with a persistent population.

I took a nap to think about how I can overcome this problem but there doesn't seem to be a way. Looks like I'm going to have to restart the simulation.

I'm going to switch from binary files to text files. I'm also not going to serialize containers in my process of migrating away from Boost Serialization. I toyed with unraveling my input and output vectors. I had to split the serialization function into save() and load() and write the code to unravel the vectors. Then I realized the vectors were vectors of vectors of floats and not just vectors of floats. I've gone the easier option of skipping serializing those vectors at all.

I just realized that the reason food has a different shape after load is because I adjust the scale when food energy reduces and then when I load, I apply the new scale to the graphic.


RELATED

2 comments:

  1. Hi Binh Nguyen,

    I'm following your work from a long time now.
    A classmate and me are working on a similar project for our Bachelor Thesis.

    We're doing GA creature simulation with Qt, Bullet (and optional Ogre rendering).
    We didn't took the agent approach, but we are looking more on a fitness approach to develop corporal behavior, jump, move, etc...

    I think we've got a video of a precedent version here http://adolio.ch/videos/projects/GeneLab/GeneLab-CreatureViewerDemo_720p.ogg
    we didn't had selection/fitness and mutation yet. We could just create and see "random" or pre-constructed creatures moving :) . The next part of this project will be more interesting.

    Let me know if you have some trouble with more complex body struct, constraint etc... we experimented a lot on this.

    I'm looking forward on your work.

    Cyprien

    ReplyDelete
  2. Hi Cyprien,

    Thank you for following my work. I'm excited to hear that you are working on a similar project for your bachelor thesis. Are you considering doing honors and further research?

    I like how you are focusing on developing physical behaviors. I've just watched your video and I'm impressed by your work. The editor looks great and I'm eager to see where your work goes.

    I am anticipating that developing more complex body structures will be problematic. Part of me is looking forward to it and the other part of me is dreading it so thank you for making your expertise available to me.

    Please keep me updated with how your work goes and let me know whether you have a website I can visit.

    Regards,

    Binh

    ReplyDelete