June 2017


Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sean Luke <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Fri, 23 Jun 2017 22:36:05 +0200
text/plain (20 lines)
The basic problem is that the gridlock example is storing agents in a GeomVectorField.  This field uses a QuadTree as its backing store.  This means that if an agent moves, the QuadTree has to be rebuilt, an O(n log n) operation at least.  Yuck.

The app should have used the Continuous class; agents can move in O(1).  

So what does this mean for you?  It basically means that for the time being, going through the agent list is probably your best option.  But if the app example had done this correctly, you could instead do a range query on the Continuous class and go this significantly faster (if there are a lot of agents).


On Jun 23, 2017, at 10:23 PM, Jonathan M West <[log in to unmask]> wrote:

> As a tutorial for myself I am trying to modify Gridlock so that the agents know the position of other agents nearby. Is the best way to do this similar to the students tutorial (creating references to the Gridlock class in the agent class)? Or is there another better way to reference the other agents in the step function? The end goal is to have the red dots on the map turn black when they get in traffic jams. I want to calculate a “roadrage” score based on the closeness of the other other agents on the map and then use that to change the shading of the portrayal dot. Currently getting the list of other agents like this
> Gridlock gridlock = (Gridlock) state;
> ArrayList<Agent> othercars= gridlock.agentList;
> I can iterate through “othercars” and pull the location member of each agent in that list to perform simple distance math. Am I going about it the right way?
> Thank You
> Jon West