Subject: Re: walk towards a target
From: Pierre Bommel (bommel@cirad.fr)
Date: Tue Apr 04 2006 - 04:31:24 CEST
Hello Miao,
> Hello!
>
> I am trying to let the agents in my model to walk towards some
> targets.I think maybe the method: walkToMaxOf: aSymbol constrainedBy:
> aBlock is the right method.I don't know What 'aSymbol' refers to? is
> 'aSymbol' an instance variable of spatial entity or a instance
> variable of agents? what is the meaning of 'ex-aequo destinations'in
> the notation for this method?
You can use wayTo: that is defined at the level of SpatialEntityElement
:
wayTo: anotherCell
It returns an OrderedCollection of cells describing the shortest
(direct) way to anotherCell.
or wayTo: constraint:. Ex for an agent moving towards anotherCell, you
can write :
moveTowards: anotherCell
path := self patch wayTo: anotherCell constraint: [:aCell | aCell
landCover ~= #ditch].
self moveTo: path first
walkToMaxOf: aSymbol is a method from Agent class that makes an agent
moves towards a cell following a gradient. aSymbol is a name of a
method that should return a number. Ex:
self walkToMaxOf: #spiceLevel the agent moves to the cell that
contains the highest quantity of spice (as in Sugarscape).
Pierre
>
>
> Great Thanks!
>
> Mira
>
>
> Miao Wang at Geomatics
> School of Civil Engineering and Geosciences
> G.19, Cassie Building,
> University of Newcastle Upon Tyne, NE1 7RU
> England
> Email: miao.wang1@ncl.ac.uk
>
>
Pierre Bommel - CIRAD - UR Green
Universidade de Brasília - Centro de Desenvolvimento Sustentável
SHIS QI 26, Conjunto 15, Casa 18
71670-150
Brasilia DF
tel: (00 55 61) 3367 3405
http://www.cirad.fr/ur/green