|
From: Nick C. <sr...@ea...> - 2001-09-06 18:41:49
|
Hi, I've attached the first cut of a base model class that attempts to hide the scheduling mechanism. (For those of you tuning in late, this is for teaching purposes although its probably applicable to a lot of current models as well). Its based on the tutorial TemplateModel by Lars-Erik and Gulya. The idea here is that the user subclasses SimpleModel and implements or overrides a few methods while SimpleModel takes care of the scheduling. The important pieces here are: 1. The run*(), and *step() methods. The idea here is to split up the behavoir executed each tick into pre (preStep()), post (postStep()), and executing (step()) phases. So in the case of a cooperation game, the user would override the step() method to have the agents play the game, and the preStep() and postStep() would do any necessary prepartion or destruction. What actually executes each tick is preStep(), step() and then postStep(). If autoStep is set to true, SimpleModel will execute the preStep(), autoStep() and then postStep(). autoStep() loops through the agent list calling step on each agent. For this to work the agents must implement the Stepable interface. 2. The stopping time stuff. This was in the TemplateModel code so I assumed it was important and implemented it. The idea here is that the user can set the stopping time via a call to setStoppingTime in their model, and SimpleModel will schedule the model to stop when that tick has completed. So, is this enough? Do we need to include some random number initialization? Should SimpleModel be abstract and force people to implement buildModel()? Any other thoughts, comments, etc. are of course welcome. Nick Lars-Erik Cederman wrote: > Nick: This sounds like music to our ears! When do you think you might be > done with this new version? Gulya and I will be teaching RePast as of > October and we're obviously very keen to have a standardized hiding > mechanism. > > We'd be more than happy to contribute ideas and code so that we can get > this one up and running very soon. > > I should mention that Gulya has now arrived in Cambridge. His email > address is gu...@la.... > > Cheers, L-E > > > >> Hi, >> >> I'm thinking for the next release of repast I'll add something along >> the lines of your tutorial model that hides the scheduler, and assumes >> a step method in the agents. I'd appreciate your thoughts on this. >> >> thanks, >> >> Nick >> >> -- >> Nick Collier >> Social Science Research Computing >> University of Chicago >> http://repast.sourceforge.net > > > -- Nick Collier Social Science Research Computing University of Chicago http://repast.sourceforge.net |