Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

Agent communication in a selected area

New Message Reply Date view Thread view Subject view Author view

Subject: Agent communication in a selected area
From: François Rebaudo (rebaudo@gmail.com)
Date: Sat Apr 26 2008 - 00:43:00 CEST

Hello,

One question for which I'll be glad to receive some help.

My CA is divided into x areas of y cells (like big cells containing smaller
ones), and this information is contained in an instance variable named
agroPart (agroPart=[1:90]).
I have 5 different types of agent [Agri01 ; Agri02 ; Agri03 ; Agri04 ;
Agri05]. When one send a message, I would like to be sent only to agents
situated in the same area x of the CA (or to be received only by agents of
the area x of the CA). What I found to make it work is the following code:

CormasNS.Models.SimPolillaSimiatug_v02 defineClass: #Agri01
    superclass: #{CormasNS.Kernel.GroupCommLocation}
    indexedType: #none
    private: false
    instanceVariableNames: '... stockSend stockRead '
    classInstanceVariableNames: ''
...

*alarmCalling*
...
    bigNeighbours size > numCeldas
        ifTrue:
            [alarm := MsgHelp new.
            alarm sender: self.
            alarm symbol: #alarm.
            self acquaintances do:
                    [:x |
                    alarm location: (Cormas selectRandomlyFrom:
bigNeighbours).
                    alarm receiver: x.
                    self sendMessageAsynchronously: alarm].
        emit:=1.
        90 timesRepeat:[
            self patch agroPart = emit ifTrue:[self stockSend: emit].
            emit:=emit+1]]

*readMail*
| aMessage recept|

aMessage := self nextMessage.

recept:=1.
90 timesRepeat:[
    self patch agroPart = recept ifTrue:[self stockRead: recept].
    recept:=recept+1].

self stockRead = self stockSend ifTrue:[
    aMessage notNil ifTrue:[
        self leave.
        self moveTo: aMessage location]
    ifFalse: [
        self moveIntoAgroPart]]

But I would like my agents to send the message to both the agents of its
type and the other agents. What should I change to my code to realize that.

Thanks

François Rebaudo

New Message Reply Date view Thread view Subject view Author view
 

Back to home