Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » AMP » distance between agents
distance between agents [message #779443] Sun, 15 January 2012 13:57 Go to next message
giorgos  is currently offline giorgos
Messages: 6
Registered: 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 12:42 Go to previous messageGo to next message
Miles Parker is currently offline Miles Parker
Messages: 1338
Registered: 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 07:26 Go to previous messageGo to next message
giorgos  is currently offline giorgos
Messages: 6
Registered: 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 12:09 Go to previous message
Miles Parker is currently offline Miles Parker
Messages: 1338
Registered: 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: Wed Apr 23 20:49:36 EDT 2014

Powered by FUDForum. Page generated in 0.01712 seconds