Discussion:
[jade-develop] Create multi agents from the input file?
soleil pacific
2013-12-13 04:33:44 UTC
Permalink
My study case is read from a file (text or excel) and then create agents by numbers of agents in the input file. like this, I have a txt file:

1 Red 50,100 90
2 Yellow 90,20 80
3 Blue 60,45 85
4 Black 70,40 95
5 Blue 100,30 70

---
which means have to create 5 agents with infor (or attributes) colors, coordinates and, the last number is level of power.
Could anyone guide me or suggest me the ideas to solve this problem?

Thank you so much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20131213/2ba90d92/attachment.html>
Caire Giovanni
2013-12-18 22:39:28 UTC
Permalink
Hi,

You can have an agent that read your text file and for each line launches an agent passing the elements in the line as argument as below

String[] args = parseLine();
AgentController ac = getContainerController().createAgent(?a?+n, ?your-fully-qualified-agent-class-name?, args);
ac.start();

where parseLine() is a method that is supposed to parse a line in your text file and returns the elements in the line as an array of String.

Bye,

Giovanni

Da: jade-develop-bounces at avalon.tilab.com [mailto:jade-develop-bounces at avalon.tilab.com] Per conto di soleil pacific
Inviato: venerd? 13 dicembre 2013 05:34
A: jade-develop at avalon.tilab.com
Oggetto: [jade-develop] Create multi agents from the input file?

My study case is read from a file (text or excel) and then create agents by numbers of agents in the input file. like this, I have a txt file:

1 Red 50,100 90
2 Yellow 90,20 80
3 Blue 60,45 85
4 Black 70,40 95
5 Blue 100,30 70

---
which means have to create 5 agents with infor (or attributes) colors, coordinates and, the last number is level of power.
Could anyone guide me or suggest me the ideas to solve this problem?
Thank you so much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20131218/ed596148/attachment.html>
Loading...