Thursday 23 June 2011

Developer Journal 105


I came in today and was greeted with a message from Windows that my virtual memory was low and had to be increased. I tried to do a screen capture but I lost the screen capture as I worked to regain control of the computer.

The simulation had crashed with a segmentation fault. The last save file was 110623-0104 (59 MB).

Program received signal SIGSEGV, Segmentation fault.
0x6fcb2ebc in libstdc++-6!_ZSt14__convert_to_vIfEvPKcRT_RSt12_Ios_IostateRKPi () from D:\agi\tools\mingw32\bin\libstdc++-6.dll

I checked the task manager and the simulation was taking up 1,445,708 K of memory. Yikes.


The simulation has now run for almost 5 simulation hours, not including the few hours before I started serializing the time counters.

elapsed real time: 10 seconds
elapsed sim time:  1.66667 seconds
total real time:   21 hours 49 minutes 58 seconds
total sim time:    4 hours 53 minutes 19.8333 seconds

The population is going strong.

Step: 1269812 NumFood: 8 NumFoodEver: 4512 NumCrit: 186 NumCritEver: 790
numSick: 2
numChild: 3
0 to 10000: 19
10000 to 20000: 10
...
skip a few
...
1250000 to 1260000: 0
1260000 to 1270000: 1

The changes I made yesterday are still useful. I'm getting about 2 to 4 frames per second instead of 1 frame per minute like I sometimes got with large populations.

The population also seems to be plucky and continues to persist. I plan to implement the changes to prevent reproduction when I'm picking up robots that have fallen off the world and to increase the waiting time before being able to reproduce for the first time and being able to reproduce again.

I was also thinking of limiting the time robots are fertile. For example, let's say a robot, Dave, has to wait one hour before being able to reproduce again. After one hour, Dave is then only fertile for thirty minutes before having to wait another thirty minutes before being fertile again.

The other idea I had was that robots had to be pregnant for a while before being able to give birth. Let's say our robot, Dave is pregnant, then Dave has to survive for thirty minutes before giving birth.

The reason I'm doing all this is to control the rate at which the population grows because my computer can't handle large populations, culling the population randomly causes a loss of intelligence, and I want the smarter robots to reproduce. I could just put a hard limit on upper population, preventing births to occur when the population is big but then this loses the opportunities for getting the robots to develop further intelligence.

save time: 3 minutes 32 seconds
load time: 8 minutes 9 seconds

Grr. I changed the save code to immediately do a load after saving so that I can make sure there aren't any funny errors. Saving takes 3 minutes. Loading takes 8 minutes. I am a bad programmer.

Grr. I reached the population upper limit again. On the other hand, wohoo! I reached a day of real time running, 110623-1446 (81 MB).

elapsed real time: 10 seconds
elapsed sim time:  1.1 seconds
total real time:   1 day 33 minutes 10 seconds
total sim time:    5 hours 13 minutes 16.0333 seconds

save time: 3 minutes 52 seconds
load time: 8 minutes 35 seconds

Step: 1305744 NumFood: 8 NumFoodEver: 5087 NumCrit: 256 NumCritEver: 884
numSick: 1
numChild: 4
0 to 10000: 35
10000 to 20000: 19
20000 to 30000: 13
...
skip a few
...
1290000 to 1300000: 0
1300000 to 1310000: 1

Culling the population back to 56 robots, 110623-1503 (17 MB)

Hmm, the simulation was using about 800 MB of memory.

Ooh. There are many other columns in the Task Manager. I don't know what they do but ooh.

Progress!

+ Checked the new gains in frames per second doesn't inadvertently kill the robots off mysteriously somehow
+ Fixed a segmentation fault when exiting the simulation
+ Implemented a button to save without loading
+ Prevented reproduction when robots congregate in the same place because they were put there after being picked up because they had fallen off the world by randomizing where they are put
+ Prevented reproduction when robots congregate in the same place because they were put there after being picked up because they had fallen off the world by preventing reproduction when they are off the ground
+ Increased the time robots have to wait before they can reproduce for the first time and the time robots have to wait before being able to reproduce again

Small actions, but they make me feel better.



RELATED

No comments:

Post a Comment