nkremerh / sugarscape

Development repository for the Digital Terraria Lab implementation of the Sugarscape agent-based societal simulation.
https://github.com/digital-terraria-lab/sugarscape
MIT License
7 stars 12 forks source link

Fixes #64 agent blindness with tribes and one resource #65

Closed colinhanrahan closed 4 months ago

colinhanrahan commented 4 months ago

This behavior is particularly evident in cultural_tagging.json. I could also add the config option to this PR if we decide on that. See #64.

nkremerh commented 4 months ago

Go ahead and add the configuration option for this one. Let's call it agentTagPreferences where it's a Boolean value. True indicates to use tag-based (tribe-based) preferences for resources. False indicates no tag-based preferences are used.

If I'm reading the code correctly, this should be reflected in line 1034 in findWelfare and as a new attribute for the agent.

colinhanrahan commented 4 months ago

@nkremerh It doesn't really fit in with the code we have for randomizeAgentEndowments — there's no precedent for Boolean variables per agent. It will be the same for every agent and never change during the course of the simulation, so maybe it's closer to a Sugarscape variable like self.configuration["screenshots"] or self.configuration["headlessMode"] than an Agent one? We can still name it agentTagPreferences, but it just won't be part of each agent's config.

Edit: neighborhood mode, movement mode, and vision mode are basically Booleans. I'll just try it as an Agent attribute and see what it looks like.

colinhanrahan commented 4 months ago

I added the new option to the "true default" config in sugarscape.py. This means it should be automatically set to false for all of the examples, which is what we want. However, this does bring up the issue that the formatting of example configs will go out-of-date every time we add a config option. I think we should only include the options we are changing from the default in the example configs and allow sugarscape.py to handle the rest of them. This would keep the configs cleaner and more up-to-date. I'll add it to our Kanban backlog as a potential change.

nkremerh commented 4 months ago

Correct, the tag preferences will work just like movement mode, etc.

Yes, ideally each example will only include options which deviate from the default config at the bottom of sugarscape.py.

nkremerh commented 4 months ago

Final change: add a description of the new config option to the README.

colinhanrahan commented 4 months ago

How does this look?