Hi Russel,

Thanks for you answer.
Maybe my question is lame, but how do I refer to an agent directly? My
agents already contain something similar to *getAndRemoveBag()*, and it
works, but the problem is method I use to get neighboring agents *
double)>* provides copy of a neighbor agent, not reference to it.

Also I really like the idea of stack. If I'd try to implement it, should I
create a separate stack class and schedule it from the "controller class"?

On Mon, Aug 12, 2013 at 2:34 PM, Russell Thomas <
[log in to unmask]> wrote:

>  Also, if these IntBags are really “artifacts” owned or possessed by
> “agents”, they why not create separate objects called Artifacts or
> equivalent?
> Each artifact would have variable of type Agent to identify it’s owner --
> a single agent.  Each agent would have a bag of “myArtifacts”.  Upon
> request from another agent, the owner agent could transferOwnership() of
> the requested artifact, removing it from its own myArtifacts bag, and by
> calling a method in the artifact object: changeOwner(newAgentID).  The
> artifact object could then signal completion of the transaction by calling
> addNewArtifact() method in the requesting agent, which would add it to
> myArtifacts.
> On 8/11/13 6:18 PM, "Aуdar Aliev" <[log in to unmask]> wrote:
> Hello everyone,
> I'm relatively new to mason as well as agent based modelling in general,
> and have been stuck with this problem for 2 days.
> I need my agents to exchange IntBags with each other.
> Within each agent I have a Bag called *population* which contains a *set
> of IntBags*. Each N steps I want my agents to find their closest
> neighbours and get certain number of IntBags from them.
> My problem is that, while my agents are able to get IntBags obtaining
> copies of neighbouring ilk agents using
> map.getNeighboursExactlyWithinDistance(), I couldn't find a way to *remove
> * IntBags agent* obtained *from the source agent population.
> Can anyone advice on how to do it?
> Thank you in advance.
> Best