Time dimension

In RegMAS every main loop is a “tick” over the time dimension, currently 1 year long.

Most objects have a time counter, specifying the time remaining till the object, or some of its proprieties, will go out of scope. The tick in the manager_farmer is applied on the update() function, and just after that, objects time counter are compared to allow destroying of the objects when their time counter become equal to zero. This imply that during normal model simulation all objects have a time counter of at least 1: a counter “remainingAge” of 1 should be interpreted as “this object will be destroyed at the end of this year”.

Model objects and plots (referring to rental contract) are time-aware objects. This is implementing letting know them: a) when the object (or the contract) started life; b) how long is its life; c) which is the current year.

All other time-related variables (notably the last valid year) are derived. This implementation, as compared to keeping a time counter on each object, has the advantage the an explicit upgrade() is not required.

The following is an example of an object created in 2002 (startYear = 2002) with lifeTerm of 4 years (getLastYear() would return 2005):

year getAge() getRemainingAge()
2001 0 0
2002* 0 4
2003* 1 3
2004* 2 2
2005* 3 1
2006 0 0
2007 0 0

This object would be destroyed at the end of 2005, after the run() function and before farmers make their individual update() calculations.
* → means object or (rental contract) exist

model/other/time.txt · Last modified: 2014/05/11 15:38 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki