3

I'm using AnyLogic for a project in Supply Chain. I would love to ask those who have seen the predefined model in AnyLogic.

Its path is in: Welcome > Example Models > Supply Chains and Logistics > Product delivery. In the model they used a function called set_center (You can find it in the Main). You can find below the code in AnyLogic

for (Distributor distributor : distributors) 
    distributor.set_center(
        distributor.getNearestAgentByRoute(manufacturingCenters));

For my project, I created a model inspired from the predefined model described above but the function set_center didn't work. It tells me in the console

The method set_center(shiptopoint.getNearestAgentByRoute(retailers)) is undefined for the type Shiptopoint

Where shiptopoint and retailers are agents that I created for my model (They are both population agents)

I tried to find the Java Code but I didn't find it.
Does anyone have a clue please?

bkis
  • 2,530
  • 1
  • 17
  • 31
Chloe
  • 83
  • 6

1 Answers1

2

set_center(...) is an automatically created method for the parameter center in the agent type Distributor. Each parameter you create gets such a method, see AnyLogic help on parameters.

You lack a parameter center in your agent type, so there is no such method.

Benjamin
  • 10,603
  • 3
  • 16
  • 28
  • Hi @Chloe, Glad the answer was helpful. Please upvote this answer as “useful” (up-arrow next to the answer) to help other users find it in the future as well. See https://stackoverflow.com/help/why-vote for more info on how SOF works :) – Benjamin Aug 11 '20 at 11:44