Creating a collection of populations

Viewed 68

Currently working on a scalable model for a manufacturing company. The model is required to allow products to go through a series of processes, and I am trying to model each process as its population of agents so that the process can be scaled up in quantity easily. However, I need to set in a list (or work plan) for each product containing the population of agents that they are required to pass through. How can I create a collection to store these different sets of populations of agents?

2 Answers
  1. Drag the Collection element from the Agent palette onto the graphical diagram of agent type or experiment.
  2. Name it. For example, myCollection
  3. Choose the type you want: ARRAYLIST, LINKEDLIST, LINKEDHASHSET, TREESET, TREEMAP, LINKEDHASHMAP
  4. Choose the element class. Maybe Object or Agent.
  5. Use myCollection.add(agent) to add the agents you want to the collection.

Could you store each collection in a hashmap? Use the A,B,etc as the key?

HashMap<String, ArrayList> hmAgentLists = new HashMap<String, ArrayList>();

you can add different collections of agents to that, and then grab the right one using the key.

Related