Setting attributes of a grid cell

18 views
Skip to first unread message

Stephen Davies

unread,
Jan 1, 2021, 1:11:03 PMJan 1
to ProjectMesa
Happy new year!

Is there a preferred "Mesa way" to set attributes on a cell of a mesa.space Grid?

To be clear: I do have agents that occupy spaces in the grid, and those agents have attributes. But I would also like to give each cell attribute values that remain attached to that cell even when agents move in and out of there. (For example, in E&A's Sugarscape, not only do agents have attributes like vision and metabolism, but each cell on the sugarscape also has attributes like current level of sugar and max sugar capacity.)

I could make a separate data structure, whose coordinates exactly mimic those of my SingleGrid object, to hold those attributes, but I wonder if I'm missing a more elegant way that the Mesa designers intended the classes in mesa.space to be used.

- Stephen

Tom Pike

unread,
Jan 1, 2021, 4:57:25 PMJan 1
to ProjectMesa
Typically,  a "resource agent" is just added to the grid.

Here is an Sugarscape using the trading variation from "Growing Artificial Society"....


Here is Wolf-Sheep Predation example with grass as grid attribute...

Stephen Davies (sdavies)

unread,
Jan 3, 2021, 1:46:36 PMJan 3
to Tom Pike, ProjectMesa
Ah, I see. Question: is there any way to follow the approach you suggest but still use a SingleGrid? (I like the functionality of the SingleGrid for my immediate purpose, since there can only be one agent in a cell at a time. However, if I need to add a dummy "resource agent" permanently to each cell, I'm guessing that's not an option?)

Thanks for the response in any event!

- Stephen


________________________________________
From: proje...@googlegroups.com <proje...@googlegroups.com> on behalf of Tom Pike <thomas...@gmail.com>
Sent: Friday, January 1, 2021 4:57 PM
To: ProjectMesa
Subject: [projectmesa] Re: Setting attributes of a grid cell

Typically, a "resource agent" is just added to the grid.

Here is an Sugarscape using the trading variation from "Growing Artificial Society"....

https://github.com/tpike3/SugarScape/tree/master/Initial/NetScape_Standard

Here is Wolf-Sheep Predation example with grass as grid attribute...

https://github.com/projectmesa/mesa/tree/master/examples/wolf_sheep/wolf_sheep

On Friday, January 1, 2021 at 1:11:03 PM UTC-5 stephencl...@gmail.com wrote:
Happy new year!

Is there a preferred "Mesa way" to set attributes on a cell of a mesa.space<http://secure-web.cisco.com/1gokAGRwchiwMaXv8JciKHUVffsGEDSF0vOaP7PMifRgrZ6XVHhj7mLmNYdj7k1iaZPIS5qWs6tkaJwfUxRXf6amBHfy9Qk7mCCICkn6pRiFBzQOcaK3Cg7NsBqEk_hxSSp2bFpDZQ090Elgu2VxpFX6jlqQU0ISDdywuTlR8ixIa_WTlFIPPTdHe9Mw7WNPp3IJnk-Bg-EB58wle94VrPFpdUOjg_L_IxCKPZdJ6edoa0zSf5F1as0PSALHcPP-FZChXgdG0JC1QAzG2njeJAp24GQjdvYfKurZgrArlZrPBgKHFxiHYv3SnWq3kjCy8ywWiD85K0pQi5DAcZ8yYrQ/http%3A%2F%2Fmesa.space> Grid?

To be clear: I do have agents that occupy spaces in the grid, and those agents have attributes. But I would also like to give each cell attribute values that remain attached to that cell even when agents move in and out of there. (For example, in E&A's Sugarscape, not only do agents have attributes like vision and metabolism, but each cell on the sugarscape also has attributes like current level of sugar and max sugar capacity.)

I could make a separate data structure, whose coordinates exactly mimic those of my SingleGrid object, to hold those attributes, but I wonder if I'm missing a more elegant way that the Mesa designers intended the classes in mesa.space<http://secure-web.cisco.com/1gokAGRwchiwMaXv8JciKHUVffsGEDSF0vOaP7PMifRgrZ6XVHhj7mLmNYdj7k1iaZPIS5qWs6tkaJwfUxRXf6amBHfy9Qk7mCCICkn6pRiFBzQOcaK3Cg7NsBqEk_hxSSp2bFpDZQ090Elgu2VxpFX6jlqQU0ISDdywuTlR8ixIa_WTlFIPPTdHe9Mw7WNPp3IJnk-Bg-EB58wle94VrPFpdUOjg_L_IxCKPZdJ6edoa0zSf5F1as0PSALHcPP-FZChXgdG0JC1QAzG2njeJAp24GQjdvYfKurZgrArlZrPBgKHFxiHYv3SnWq3kjCy8ywWiD85K0pQi5DAcZ8yYrQ/http%3A%2F%2Fmesa.space> to be used.

- Stephen

--
Project repos: github.com/projectmesa
---
You received this message because you are subscribed to a topic in the Google Groups "ProjectMesa" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/projectmesa/_yemKEad5qo/unsubscribe<https://secure-web.cisco.com/1oyz2YWSw_Njw8ahdRCCMV06t6jOqrW1SQtw1aSksZin2svruxG_bmk35btJpd2CPuj8nq6xCF8N6YNRgPqWtAw9Ba8n9zXbymc_QhxAN3k4XZVv8D0zew4X1s5OITcz8LGRuL1DBg1UUx6WzL_8W9KqTc16i88IYcyq8Yghnj-6rv3YdXG_HZbXQzBRiqhMTbq3JbW2533Qr-tdlfTwEgzkAUsGIW_A0WbCElQ5Yy28uEwp0A5L9fX6TZ7taWqoDfSsLqaoD_KVgciYB13RWDEeno0pjhwo-7l77zJuixe0-xmzLLeoCl40KiuV7Z6W4JaxVmzkaTlXJ6oy7VIZkSQ/https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Fprojectmesa%2F_yemKEad5qo%2Funsubscribe>.
To unsubscribe from this group and all its topics, send an email to projectmesa...@googlegroups.com<mailto:projectmesa...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectmesa/34fa7d32-c650-444b-9c39-546b2242bd44n%40googlegroups.com<https://secure-web.cisco.com/1arloCsGTAbhvxWQFXwqfC4Lz4JRQFVFvTCE-MZsS4XT-jeWk1VJ-Mq9BYxOwuC5Xu5aD7CMy81B6OKYEAb3oQYBixZ2GsyPI6IDlXWLlvrY7m5hbShqM_alh8St17bfJa7ipu7Jx0Sg3EazSe1oqMK8QD_GGH5nC1fXZjC3ScijCylpgDBXnyLtinS2sMYJGFGXIEBoGW8AgCFG5MgX0Y0vIS7X_1dscmUyaKWl9ETI2Zg7DoCvhgThBXDUPF_zYci-VcL7QG9grvJIfIUdKzfgqtMh3IgNwtUIe9a5CwAi0_Au0eOfCfvRuhUfBEZoru-TGZi_ruV1kiG7rIZj01w/https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fprojectmesa%2F34fa7d32-c650-444b-9c39-546b2242bd44n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter>.

Tom Pike

unread,
Jan 3, 2021, 4:38:44 PMJan 3
to Stephen Davies (sdavies), ProjectMesa
The only way to have a resource agent and other agent on the grid u have to use multigrid. 
Reply all
Reply to author
Forward
0 new messages