I want to create system of n agents. All agents are generate random Integer value. My goal is calculating average of these n numbers. My simple idea of algorithm:
Problems:
Maybe somebody know how I can do this?
The examples online tend to focus on using the Boot
class:
java -cp jade.jar jade.Boot -agents agentName:org.agents.MyAgentClass
You could spawn more agents simply by adding more to the -agents
option command-line args (separated by semi-colons):
java -cp jade.jar jade.Boot -agents \
agent1:org.agents.MyAgentClass;agent2:org.agents.MyAgentClass
If you need a variable number of agents, you could move this to a bash script that appends more agents depending on a parameter.
If you really want to go crazy, you can create your own container and add agents to it from your own code and bypass the Boot
class. Since your use case is so simple, I don't know that this would be a good way to go yet.