monitor a turtle dependent list

3 views
Skip to first unread message

Andreas Duering

unread,
Mar 27, 2014, 6:51:43 AM3/27/14
to modell...@googlegroups.com
Dear all,

I am creating a list for the family tree of each agent.
Is the define parameter behavior the right way to set up the list? It seems to work but how can I test it?

Is there any way of how to display / monitor the created lists of all the agents? Where would I have to look for the results. As monitors can only display global numbers they cannot show you the agent-specific lists.

Best
Andreas



Howard Noble

unread,
Mar 27, 2014, 8:35:13 AM3/27/14
to modell...@googlegroups.com
Hi Andreas,

You can create a list in several ways but generally just give it a name e.g. my-family [] the [] initialises the variable as a list

If you're entering the world of list management prepare yourself for a treat. You might want to read this section of the netlogo programming guide: http://ccl.northwestern.edu/netlogo/5.0/docs/programming.html#lists

in terms of testing whether your list is working you can ask each person agent to do something like:

foreach my-family [
 show ?
]

or just show my-family

assuming my-family is the name of your list




--
You received this message because you are subscribed to the Google Groups "The Modelling4All project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modelling4al...@googlegroups.com.
To post to this group, send email to modell...@googlegroups.com.
Visit this group at http://groups.google.com/group/modelling4all.
For more options, visit https://groups.google.com/d/optout.

Ken Kahn

unread,
Mar 27, 2014, 8:47:31 AM3/27/14
to Modelling4All
Hi.

If the list is per agent then my-tree or the like is appropriate rather than a global parameter.

Monitors can display the results of any 'reporter'. E.g. [my-family] of one-of all-of-kind "Person" would display the list for a different random person each time. Obviously more useful expressions can be defined.

You could have a button that says 'Monitor the family tree of an individual' that when pressed either sets a global to a random individual or  has an interface where the user clicks on the individual they want to monitor. Then the monitor is something like

ifelse-value is-agent? the-monitored-individual [[my-family] of  the-monitored-individual] [""]

which will display nothing if  the-monitored-individual isn't set.

Best,

-ken

Andreas Duering

unread,
Mar 28, 2014, 4:46:28 AM3/28/14
to modell...@googlegroups.com
Hi Ken & Howard,

thanks for your answers. It kind of works but how can I display all of the lists per agent in the output of the Behaviour Space?

Best
Andreas

Andreas Duering, M.A., M.St.
Clarendon Scholar
D.Phil. student in Archaeology
School of Archaeology
University of Oxford
St Cross College
andreas...@stx.ox.ac.uk
andreasdu...@gmail.com


2014-03-27 12:47 GMT+00:00 Ken Kahn <toon...@gmail.com>:
Hi.

If the list is per agent then my-tree or the like is appropriate rather than a global parameter.

Monitors can display the results of any 'reporter'. E.g. [my-family] of one-of all-of-kind "Person" would display the list for a different random person each time. Obviously more useful expressions can be defined.

You could have a button that says 'Monitor the family tree of an individual' that when pressed either sets a global to a random individual or  has an interface where the user clicks on the individual they want to monitor. Then the monitor is something like

ifelse-value is-agent? the-monitored-individual [[my-family] of  the-monitored-individual] [""]

which will display nothing if  the-monitored-individual isn't set.

Best,

-ken
On 27 March 2014 13:35, Howard Noble <howard...@gmail.com> wrote:

Ken Kahn

unread,
Mar 28, 2014, 5:43:03 AM3/28/14
to Modelling4All
Hi.

In the section 'Measure runs using these reporters' you can add the same type of code you can add to a monitor. E.g.

 [my-family] of  alll-of-kind "male"
 [my-family] of  alll-of-kind "female"

would add two new columns filled with the lists.

Best,

-ken

Andreas Duering

unread,
Mar 28, 2014, 9:36:46 AM3/28/14
to modell...@googlegroups.com
Perfect :-)!
I had tried a few things but it was just that I forgot the parantheses. It showed me an error telling me that I could not monitor lists of agent specific parameters.

Andreas Duering, M.A., M.St.
Clarendon Scholar
D.Phil. student in Archaeology
School of Archaeology
University of Oxford
St Cross College
andreas...@stx.ox.ac.uk
andreasdu...@gmail.com


2014-03-28 9:43 GMT+00:00 Ken Kahn <toon...@gmail.com>:
Hi.

In the section 'Measure runs using these reporters' you can add the same type of code you can add to a monitor. E.g.

 [my-family] of  alll-of-kind "male"
 [my-family] of  alll-of-kind "female"

would add two new columns filled with the lists.

Best,

-ken
On 28 March 2014 09:46, Andreas Duering <andreasdu...@gmail.com> wrote:

Andreas Duering

unread,
Mar 28, 2014, 11:23:51 AM3/28/14
to modell...@googlegroups.com
Hi Ken & Howard,

I am now using this
"set mylist lput 42 mylist ; mylist is now [2 7 10 Bob [3 0 -2] 42]" from the user manual
to create the list (female reproduction --> create female offspring --> add behaviours to newly created females)
I can also completely show the lists per female in the BehaviorSpace via [my-flist] of all-of-kind "females".

However, the list is not adding the new values, it seems to replace them and thereby the info of the previous generations is lost.

I aim for: [ who no of first female of lineage / greatgrandmother ] [my grandmother's count of children up to my mother] [my mother's count of children up to me] []...

Andreas Duering, M.A., M.St.
Clarendon Scholar
D.Phil. student in Archaeology
School of Archaeology
University of Oxford
St Cross College
andreas...@stx.ox.ac.uk
andreasdu...@gmail.com


2014-03-28 13:36 GMT+00:00 Andreas Duering <andreasdu...@gmail.com>:
Perfect :-)!
I had tried a few things but it was just that I forgot the parantheses. It showed me an error telling me that I could not monitor lists of agent specific parameters.
Andreas Duering, M.A., M.St.
Clarendon Scholar
D.Phil. student in Archaeology
School of Archaeology
University of Oxford
St Cross College
andreas...@stx.ox.ac.uk
andreasdu...@gmail.com


2014-03-28 9:43 GMT+00:00 Ken Kahn <toon...@gmail.com>:

Hi.

In the section 'Measure runs using these reporters' you can add the same type of code you can add to a monitor. E.g.

 [my-family] of  alll-of-kind "male"
 [my-family] of  alll-of-kind "female"

would add two new columns filled with the lists.

Best,

-ken
On 28 March 2014 09:46, Andreas Duering <andreasdu...@gmail.com> wrote:

Ken Kahn

unread,
Mar 28, 2014, 12:19:24 PM3/28/14
to Modelling4All
Hi.

This was very tricky. You need

[lput my-number_of_children  my-fline] of myself

instead of

lput [ my-number_of_children ] of myself my-fline

The reason is create female offspring calls create-agents which is documented as 'Create additional agents initialising them as if at set up time. '

So in your code my-fline has the value of a freshly initialised female which is what setup female line does. By moving the lput and my-fline inside the square brackets we get the value of the variables for 'myself'', i.e. the mother. Make sense?

Best,

-ken 

Andreas Duering

unread,
Mar 28, 2014, 1:10:35 PM3/28/14
to modell...@googlegroups.com
Hihi, makes sense but I would have never found that out without your help :-) Thanks!

Andreas Duering, M.A., M.St.
Clarendon Scholar
D.Phil. student in Archaeology
School of Archaeology
University of Oxford
St Cross College
andreas...@stx.ox.ac.uk
andreasdu...@gmail.com


2014-03-28 16:19 GMT+00:00 Ken Kahn <toon...@gmail.com>:
Hi.

This was very tricky. You need

[lput my-number_of_children  my-fline] of myself

instead of

lput [ my-number_of_children ] of myself my-fline

The reason is create female offspring calls create-agents which is documented as 'Create additional agents initialising them as if at set up time. '

So in your code my-fline has the value of a freshly initialised female which is what setup female line does. By moving the lput and my-fline inside the square brackets we get the value of the variables for 'myself'', i.e. the mother. Make sense?

Best,

-ken 
Reply all
Reply to author
Forward
0 new messages