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
Jonathan M West <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Fri, 23 Jun 2017 21:45:21 +0000
text/plain (28 lines)
Actually looking through the functions of the GeomVectorField it looks like I could just use getObjectsWithinDistance and then come up with a roadrage score  based on the size of the bag returned, though I guess I would still need to grab world from the Gridlock class, I just wouldn't have to personally iterate through the array of agent references because it looks like all I'll need is the location member of the current agent. Am I understanding this correctly?

-----Original Message-----
From: MASON Multiagent Simulation Toolkit [mailto:[log in to unmask]] On Behalf Of Sean Luke
Sent: Friday, June 23, 2017 4:36 PM
To: [log in to unmask]
Subject: Re: Modifying gridlock so agents know position of other nearby agents

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