Phase 2. Creating retailers
In the previous phase we added a distributor, in this phase we will create retailers.
time we are not adding a single agent, but creating a population of
agents. There are 14 retailers in the supply chain we are modeling. We
will read their coordinates from a database and place retailers on the
GIS map according to their addresses. This is done by sending the
the online OpenStreetMap server, obtaining the corresponding
coordinates from the server and placing the retailers on the map in the
points with the obtained coordinates.
- Drag the
element from the
palette onto the
Population of agents
- On the next page of the wizard, select the
I want to create a new agent type
Agent type name
field. The specified name will autofill the
Agent population name
- Select the
Use database table
next page of the wizard prompts you to select the database storing the
data on the agent population we are creating. Leave the default Excel/Access
setting in the
- Click the
button and navigate to the MS Excel file that stores the data we need to import.
The required MS Excel file is located here:
AnyLogic folder/resources/tutorials/Supply Chain/data.xlsx. The
is the location on your computer containing the installed AnyLogic, e.g.
C:/Program Files/AnyLogic 8 Professional.
Double-click the file or select it and click the
button to select the file.
- When finished, the
Select table(s) you want to import
table on the right will contain the list of the database tables
contained in the selected database. Here you can select the tables that
you want to import into your model's database, as well as modify their
auto-generated names in the Name in AnyLogic DB
column. Leave the
entry selected and click
next page of the wizard allows to set up the parameters of the created
agent. We want to read the location data and put it into the new location
type inside each retailer. Leave the default settings and click
- Finally, choose animation shape for the new agent. Select the
option and then choose the
element from the list. Click
The properties of the created
agent population will open once we finish setting up this agent type.
Let's make retailers use the addresses from their
parameter as their GIS location names.
Setup the retailers coordinates
- Navigate to the properties of the
population (if you have lost the
selection, you can select the population in the
view, find it in the
Main > Agents
branch of the model's tree).
- In the
Agent parameters mapping
table, click in the first cell of the
column and select
GIS location name
from the list. Now the value of the
parameter will be used as the name of the retailer's GIS location.
We have finished setting up the retailers.
You can double-click the
agent type in the
view and inspect the agent's graphical diagram. It should have the retailer's animation shape and the
Switch back to the
diagram where we will continue developing our model. Agents live on the
plays the role of environment for those agents. You can open any agent
type from the model tree to add elements onto its diagram just like we
added them onto the Main.
Zoom out the
GIS map to see the whole France. It is important to have the whole
country in the visible area of the GIS map, because the server will be
searching the requested by AnyLogic agent coordinates within the
visible area of the map only. If you have just Paris displayed on the
map, the server may return Rennes metro station located in Paris
instead of Rennes city coordinates, etc.
Run the model. You should see the retailers located
in the French cities, the names of which were read from our model's
Phase 1. Creating a distributor
Phase 3. Adding trucks