Subject: RE : extract targets as a set from whole area
From: Christophe Le Page (christophe.l@chula.ac.th)
Date: Fri Jun 16 2006 - 11:06:21 CEST
Hi Miao,
Not quite sure to understand what you need.
Nevertheless, you should write an accessing method in your model class
targetCells
^self theCells select: [:aCell | aCell theme = #Attraction].
Then you should assign attribute “targets” to all the instances of your
agent class
createAgent: aClass number: anInteger
|newAgent|
anInteger timesRepeat: [
tutu := self newEntity: aClass.
tutu targets: self targetCells]
> -----Message d'origine-----
> De : owner-cormas@cirad.cirad.fr [mailto:owner-cormas@cirad.cirad.fr] De
> la part de Miao Wang
> Envoyé : lundi 5 juin 2006 19:36
> À : cormas@cirad.fr
> Objet : extract targets as a set from whole area
>
> Hi Everyone:
>
> I have a new problem of setting tartgets as a set.
>
> At first I set target , which is a instance variable of agents in my
> model( the agent will walk towards the target), like this:
>
> touristNeighbours := (self perception:10) select: [:cell | cell theme =
> #Attraction].
> target := Cormas selectRandomlyFrom:touristNeighbours.
>
> in this way the Target is related with the agent's location.
>
> Since the Targets set of all agents is the same (diferent agnets visit
> the targets in different order). What I am trying to do is to extract
> targets set as a collection from the whole study area(all the cells with
> the attribute of #Attraction),the targets set will not related with the
> agent's location. I don't know whether it is possible to set the Targets
> set under Agent protocol or should it be set under the spatialEntitySet
> protocol? Should it be a Composit Spatial Entity->Fragmented spatial
> Entity?
>
> 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