Hi,
Actually, it really depends on your needs. Implementing « instant communication » between agents is easy, for instance:
species driver {
list<list> messages <- [];
action receive(list message) {
messages << message;
}
action send(list message, driver to) {
to.receive(message);
}
action manage() {
loop message over: messages {
driver sender <- message[0];
road r <- message[1];
float time <- message[2];
… do whatever is needed with these information …
}
messages <- [];
}
action example_talk() {
list message <- [];
driver to <- one_of(driver - self);
message << self; // the sender
message << road overlapping self ; // the data, whatever it is, here the road on which I am
message << cycle ; // other stuff (it really depends on how you want the messages to be formatted), here the current cycle
}
}
This is just an example, of course, and you might want to delay the reception of messages, or make the agents manage one at a time, etc.
If you want something more structured, which could enable dialogs between agents, you should go for the « communicating » skill, which implements the FIPA Agent Communication Language.
Hope this helps !
Cheers
Alexis
> --
> You received this message because you are subscribed to the Google Groups "GAMA" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
gama-platfor...@googlegroups.com.
> To post to this group, send email to
gama-p...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/gama-platform.
> For more options, visit
https://groups.google.com/d/optout.
--
Senior Researcher, UMI UMMISCO 209, IRD & UPMC, France.
Invited Researcher, DREAM, Can Tho University, Viet Nam.
--
alexis....@gmail.com |
http://tiny.cc/liqemw
[Vietnam]
+84915088155 [France]
+33608698845
--
GAMA:
https://code.google.com/p/gama-platform/