Eclipse Community Forums Forum Search:

Home » Modeling » AMP » distance between agents
distance between agents Sun, 15 January 2012 18:57
 giorgos Messages: 6Registered: October 2011 Junior Member
Hi,

I was wondering what exactly does the function org.ascape.model.Scape.calculateDistance(LocatedAgent origin,LocatedAgent target)
calculates.Does it calculate the distance according to the option that has been chosen for the Neighborhood of the Space (Moore,Euclidian,Von_Neumann)? As I noticed by observing the values that the function returns, I think that is calculates only the difference of the x coordinate.For example, for the distance between agent1, whose hostCell is [8,14], and agent2, whose hostCell is [13,33], it returns 5 (13-8).

Agent1 Cell [8, 14]
Agent2 Cell [13, 33]
Distance 5.0

In this example, if I have understood well the meaning of the Moore distance, I think that the Moore distance is 19. Is there any other function that returns this distance?
Re: distance between agents [message #779864 is a reply to message #779443] Mon, 16 January 2012 17:42
 Miles ParkerMessages: 1341Registered: July 2009 Senior Member
Yes, it is defined by the space of the Scape. Note that Moore distance will always be the max of either the x or y delta. It's possible that you're actually computing distance within a one-dimensional space, so check that. But what I think may be happening is that you're in periodic (toroidal) space in which case the y coordinates are actually nearer each other. How big is the space?
Re: distance between agents [message #780235 is a reply to message #779864] Tue, 17 January 2012 12:26
 giorgos Messages: 6Registered: October 2011 Junior Member
The Space I use is 2-dimensional and its size is 50x50. The option Border Rule is set to Aperiodic, so I don't think that this is the problem. I have noticed that the function calculateDistance() always returns the x difference even if the y difference is bigger. However, the function

this.getHostCell().getDistance(Agent2.getHostCell());

returns the Moore distance between Agent2 and the agent that is calling the function. So, I think that I will do it this way.
Re: distance between agents [message #780366 is a reply to message #780235] Tue, 17 January 2012 17:09
 Miles ParkerMessages: 1341Registered: July 2009 Senior Member
I wonder if this is a bug that might have been fixed on the Ascape side but not yet brought over to the Eclipse version. You might check the Ascape forum for related bugs.
 Previous Topic: Agent having dynamic structures Next Topic: Cannot see graph view
Goto Forum:

Current Time: Thu Apr 26 11:46:58 GMT 2018