schellingagentsjl5.jl (6.3 KB)
The attached file contains my modified version of the code for the Schelling model, which I am running using the latest versions of VS Code, Julia, Agents.jl, and the other packages noted in the code. Everything runs and looks quite good, including all the examples. However, there are a few things that I have not been able to figure out related to the Interactive Visualization Example
Issue with Inspecting Agents: When I hover over the agents in the Makie window, the values shown for the agent in the tooltip are for x, y, and z. These are clearly the elements of the position field, although I am not sure why there is a value for z. However, the values for the ID field and the fields I added, group and happy, do not appear. I have tried to use the agent2string function, but to no avail.
Issue with setting up adata: Rather than plotting the number of agents that are happy, I wanted to show either the number of agents that are unhappy or the number of agents that are happy in each of the two groups. However, I was unable to figure out how to do this. I was particularly surprised that using [(:happy, count, group1)] , which worked fine in the Data Collection Example, caused problems here.
Issue with stopping the model when a condition is reached: I included the terminate condition in the abmexploration() function just as I did in the Data Collection and Parameter Scanning Examples. While it worked as expected in those examples, it did not here. The model would only stop when I clicked on the “run model” button in the Makie window.
I have scoured the documentation and examples both at Agents.jl and the Agents.jl Example Zoo, as well as the Slack and Discourse channels. Any thoughts on these would be greatly appreciated.