From: Richard T. <ric...@ya...> - 2005-01-12 22:20:56
|
Dear Nick, Thanks for your advice. Please can you give me an example of how to use the DataRecorder in this way to record strings? I can't quite figure out how this could be done. Am I right in thinking that the difference between ObjectDataRecorder and DataRecorder is a matter of programming style? As well as the block headers! To Meredith: the sed script sounds a great suggestion. I would like to have a look at that. Thanks, Richard --- Nick Collier <nic...@ve...> wrote: > Richard, > > I'm afraid this is the way the ObjectDataRecorder is > intended to work. The > idea is that the "block header", that is the block > beginning with # runs: 1, > records the conditions under which your recorded > data is generated. It was > assumed that you would always want to know this and > so you can't turn the > header off, I think. > > If you just want to recorder tabular data in rows > and columns, take a look > at the DataRecorder. If you have any questions about > this, feel free to ask. > > Alternatively, if you are not interested in any of > the header data the > repast generates for you, you could just dump your > data to a file, using > Java IO calls (e.g. BufferedWriter) or look into a > logging package like > log4J. > > Nick > > > > -----Original Message----- > > From: rep...@li... > > > [mailto:rep...@li...]On > Behalf Of Richard > > Taylor > > Sent: Friday, January 07, 2005 9:33 AM > > To: rep...@li... > > Subject: [Repast-interest] ObjectDataRecorder > > > > > > Dear list members, > > > > I am having a bit of trouble using the RePast > > libraries to record objects and control how they > are > > written to file. > > I would appreciate some advice on how to avoid > writing > > dynamic parameters in the data block everytime I > call > > the record() method of ObjectDataRecorder. > > I am using the following method to record an array > of > > strings: > > > > protected void initDataRecorder() { > > > > GILRecorder = new > > ObjectDataRecorder("./GIL.txt",this); > > String [] GILObject = (String[]) getGIL(); > > int GIL_len = GIL.size(); > > for (int GILIndex=0 ; GILIndex<GIL_len ; > GILIndex++) > > GILRecorder.record(GILObject[GILIndex]); > > GILRecorder.write(); > > } > > > > The method is called once near the beginning of > > buildModel(). The problem is that in each loop, a > lot > > of unwanted parameters are written to file in > addition > > to the String. For example: > > > > Timestamp: 06-Jan-2005 15:32:01 > > NUM_AGENTS: 500 > > NUM_CYCLES: 1000 > > NUM_INIT_SKILLS: 5 > > > > # run: 1 > > # RngSeed: 1105025519246 > > # NUM_RADICAL_INNOVATIONS: 0 > > # NUM_INCREMENTAL_INNOVATIONS: 25 > > # TOTAL_NUM_SKILLS: 50 > > > > sk1 sk4 sk5 sk0 sk2 > > # run: 1 > > # RngSeed: 1105025519246 > > # NUM_RADICAL_INNOVATIONS: 0 > > # NUM_INCREMENTAL_INNOVATIONS: 25 > > # TOTAL_NUM_SKILLS: 50 > > > > sk6 sk1 sk5 sk0 sk2 > > # run: 1 > > # RngSeed: 1105025519246 > > # NUM_RADICAL_INNOVATIONS: 0 > > # NUM_INCREMENTAL_INNOVATIONS: 25 > > # TOTAL_NUM_SKILLS: 50 > > > > sk2 sk6 sk5 sk1 sk0 > > > > All I want are the lines "sk1 sk4 sk5 sk0 sk2" > etc. > > Do you have any suggestion how this could be > sorted > > out? > > > > May I take the opportunity to praise those > involved > > for your excellent work on RePast. I think that > the > > libraries have been well chosen, and they have > been > > useful to me for setting up models quickly for > batch > > simulations. I am looking forward to using the > > graphical parts of the software soon. > > > > Regards, > > > > Richard Taylor > > Post-doctoral researcher > > Centre for Policy Modelling > > Manchester, UK > > > > > > > > > > > > > > > ___________________________________________________________ > > ALL-NEW Yahoo! Messenger - all new features - even > more fun! > > http://uk.messenger.yahoo.com > > > > > > > ------------------------------------------------------- > > The SF.Net email is sponsored by: Beat the > post-holiday blues > > Get a FREE limited edition SourceForge.net t-shirt > from ThinkGeek. > > It's fun and FREE -- well, > almost....http://www.thinkgeek.com/sfshirt > > _______________________________________________ > > Repast-interest mailing list > > Rep...@li... > > > https://lists.sourceforge.net/lists/listinfo/repast-interest > > > > > ___________________________________________________________ ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com |