Jon’s PhD Journal

April 10, 2007

Tuesday: back from Prague, CVS-ing and re-coding …

Filed under: Coding, Notes — JDE @ 6:40 pm

Back from a friend’s weekend Stag-do in Prague over the bank holiday, and luckily only feeling slightly broken! Voice is a little sore, but nothing too pressing.

This week I’m aiming to get the 3D simulation of birds back up and running, where I can output the positions of birds into text files, then change flocking parameters, and do some analysis to see what differences the changes to parameters make. I also want to get a Subversion CVS up and running, to store all the code I use, so that working copies are effetively protected from my personal acts of idiocy!

As such, today’s aims are to:

  • get a Subversion repository running*
    • in a flash of inspiration (*cough*) how about looking to use the integration tools between Eclipse and Subversion … ? This should make life a lot easier over the future! For example, Subclipse
  • get the Java simulation working again, and try to get the looping issue working as well
    • just tried my original simulation with the “java -classpath .” trick, and the thing worked, saving me a bit of time

Now I seem to have got Subversion up and running — I think … I’ve got a lot of new and interesting symbols in Windows Explorer for a start.

The Java simulation I was working on before now appears to be working: I can output bird positional data from the simulation into a text file for analysis. Now the next part is to get the simulation to exit after a number of iterations — e.g. loop for 1000 timesteps then exit. Currently this does not appear to be working, using a break statement. I was having an issue in getting the timestep counter to increment correctly so added in a new public variable, which is the timestep counter: the develop of the simulation I’m using is using an Enumeration interface, which appears to only allow iterations over a set collection — I think it was this that was confusing me as to why the counters I’ve previously coded loop permenantly 1 -> 10, and then reset.

Okay, now got the simulation to exit after hit a magic number of iterations. Now wondering if I could get it to automatically change the key parameters automatically … e.g. change the bounding radius of each bird, run a simulation for n steps, increment the radius parameter, repeat … Would be a pretty neat way to generate a lot of data quickly.

14:42 Update: My Lords, Ladies, Gentlemen, Boys and Girls, we have an official Milestone alert: I’ve just created my first data set! 100,000 timesteps of 10 birds flying around, with  a boid radius of 0.1. Some stats:

  • 100K timesteps takes about 10min to complete
  • this produces a text file of 4MB in size

This does make me think I need to work out how to auto-increment the keys parameters: I can then leave the simulation running, and churning out data. More likely, as I have access to an old XP box, I can get the simulation up and running on that, and leave it churning away whilst I do other things on my laptop — e.g. reading, analysis, etc.

The snag with this is though that once the screen has been drawn, you have 10 birds with set qualities: e.g. their important parameters have been set. So this would surely mean that you need to wipe the simulation’s slate clean, so to speak and thinking out loud, using the new variable information? So let’s think this through:

  1. Set the initial parameter under test
  2. Run the simulation for a set number of timesteps
  3. When the max. timesteps is reached, stop:
    1. change the parameter settings
    2. clear the simulation of the current birds
    3. redraw the birds, setting their behaviour as per 3.1 above
  4. Run the simulation again.
  5. Repeat until the maximum setting of the parameter under test is reached.

Interestingly, in the Flocking3D class on line 82 there’s a line that says to create a new WrapFlocking3D class: this latter class seems to be the one that adds all the information into the simulation scene. So you would need someway of killing off the first WrapFlocking3D class and then redraw it …. Hmm, interesting problem — but aren’t they all?!? ;-)

Haha, just set up old XP boxen to find I can’t remember the password … dang. There are workarounds which I shall put into place, however …. But whilst I’m working on that, it might be a good idea to start looking at the data I have now in my possesssion. To repeat, I have a 4MB file of positional data for 10 birds with a boundary radius parameter of 0.1f — so this is the equivalent of 10 birds moving around for 10,000 discrete time intervals (100K / 10). To begin I’ll start off with working with a small data set, of 100 discrete time intervals (1000 timsteps) — now the first question is, what do I want to measure?

Let’s just think of one bird for a moment: what would be good to measure? Some ideas:

  • total distance travelled
  • distance compared to others

However, this shall be left alone for today, and picked up tomorrow — until then!!

Blog at WordPress.com.