I am using Anylogic where I have just one ResourcePool made by just one Resource Type unit (created through the command "Resource Agent" in the Process Library).
I define the capacity of the ResourcePool, let's say, to 20 and I would like to have each of the single element (or some of them) within the Pool with a different value for the same parameter (e.g 3 units have parameter=1 , other 4 units parameter=2 ...).
First of all how can I set individually each of this parameter? Do I need to use a population of agent? If yes how can I do that? And how can I call the resourcePoolPopulation in other location within the model?
Is there a clevere way to do that?
Hope it is clear, thanks!
That is a weak spot of resource pools, IMO. They are designed to hold a homogeneous "soup" of similar resources and it is hard to pull in a specific element.
However, not impossible, there are various ways. You can create your resource agents manually in an agent population first and add them to the pool manually after creation. Then, in the service object, tick "manual resource unit choice" (or similar) and use a criteria that matches your resource params.
Related
I have a resourcePool block. The resource units are Worker type.
However, I cant't access this units calling the resourcePool block from conveyor Stations nor from Service blocks. No matter if I use "agent" or "unit" (in Station -> Resource choice condition), I only can access to resourcePool.agents(), which is a list from which I can't access to Worker agent.
Does anyone knows why, and how could I access to Worker agents considering they are created as Resource Units?
You use agent populations for this. Create an empty population of Worker agents and set the Resource Pool (in its Advanced properties) to add units to a custom population (and select your population).
Now all the resource units are accessible via the population.
I'm simulating a manufacturing process. The stations need a variable number of ResourcePool "workers". Let's say there are 5 workers for 4 stations, and I want to simulate that those workers can work indifferently in any of the stations.
The problem is that they are not working in the closest station. Oppositely, even when a worker is next to the station, maybe the furthest worker goes until this station which needs the resource, and then the process starts. Obviously, this is inefficient and doesn't represent the reality.
I already have the workers defined, their shifts, their timetables, etc. I have tried to use the function getNeartestAgent() in 'Customize request choice', but it doesn't work. I also tried to calculate the distance of each agent with getDistance(), but I don't know how to manage it and I'm sure it must be a simpler solution even when I'm not working on GIS.
[31/08/22]
Recently I tried to develop a similar model, and I still have the same problem. The model consists of 3 stations which need 1 unit of ResourcePool. In this pool, there are 2 units. This units are agent type Operario. So, I need to choose the closest unit to the station. I tried several things, the following are just some...:
Service blocks -> Resource selection -> "Nearest to the agent". The agent is the material item, so the unit should go to the closest agent being treated in the station. However, it didn't work (units where to any station indeferently).
Service blocks -> Resource selection -> "Unit with top rating". The Unit rating field was 1/distanceTo(node1.getXYZ()). It didn't work either.
Stations (instead of Service blocks) -> Customize resource choice -> Resource choice condition. I can't stablish a boolean variable related to the unit position, as I can't compare among them.
Function. I can't compare units from ResourcePool, as they are detected as Agent and not as Operario.
ResourcePool. I tried to stablish the priority based on the distance to a certain node. But then I can't call these agents (Operario) from the station. It seems here I can only refer to material items, eventhough I write "unit.(...)".
Does anyone know how can I choose the closest resource to the station in which the task is performed? Should be through Customize resource choice -> Resource choice condition, but I don't know how!
when you use a service or seize block, in the advanced properties, there's an option called "Resource Selection"
You have to choose "Nearest to the agent"
If this doesn't work, it might mean that a resource that is close by and not selected, might be actually busy with something else... you have debug your model in order to be sure that it is not the case.
I’m working with a AnyLogic simulation on emergency department. The departments leader want to test the benefits of adding, nurses, treatments room etc. It was easy to make it so that they can dynamically change the number of nurses through the GUI, as this is a "Moving" resource type. However, how can I dynamically change a Static resource type like ED-rooms which is tied to specific Network Nodes?
It's not that I want the resource pools to be dynamically created. But it's that I want to control how big of a portion of the existing resource pool that will be used. The current capacity is 13 rooms, and I want this to be varied from 13 to 28
Using get_Capacity(n) works for non-static resources such as Nurses etc. but when I use .set_Capacity(n) for a Static Resource I get the following error:
"(ECRoom is here referring to rooms in the emergency department): java.lang.RuntimeException: root.ECRoom: Capacity definition type should be 'Direct' to support this operation"
The easiest way is to just pre-define several ResourcePool elements with static ED rooms linked to whatever node they would be using.
Then, set their normal capacity to zero and only change it to some non-zero value if the user wants it.
If you simply need to change the capacity at runtime, myResourcePool.set_Capacity(someNumber) is your friend :)
(Dynamically creating resource pools, home nodes, etc. is all possible but a whole different ball-game)
I have a pool of 25 agents (Operators). When an Order is generated, I seize a few Operators and move them to one of many different ProductionSuites as determined by a parameter in the Order.
Within the ProductionSuite, I have a variable of type ResourcePool that I would like to use to have these Operators perform tasks.
In the main window, I put this code in the "On seize unit:" code box:
agent.assignedSuite.suiteOperatorPool.addAgentToContents(unit);
but this triggers a NullPointerException error. Am I using the addAgentToContents method incorrectly?
You have not initialized your suiteOperatorPool variable, it's "initial value" field is empty. Hence, this is just an empty shell of type ResourcePool that cannot do anything, including adding agents to it.
You would need to initialize it properly using the ResourcePool API, but I don't think that is possible.
Also, you cannot have resources be part of 2 resource pools, as you are trying to do. You should think of a different way to solve your problem. Maybe rephrase the issue so we can think of alternatives. You might not need a RP at all but just use pure agent functionality...?
I am using AnyLogic to model a process where an Agent needs to retrieve a resource that could be at 1 of several locations. I am having difficulty "storing" resources at multiple locations. I have "moved" the resource to one of two locations using moveTo(), but when the Agent goes to the other location - where the resource is NOT stored, it still seized the resource. Is there a way to limit the seize to only look for resources at that location?
Thanks!
In 8.3.1, your resource selection can be "Nearest the agent".
In previous versions, you can select "Customize resource choice" to select a specific agent. This might look something like agent.location == unit.location, where agent is the agent doing the seizing and unit represents a unit of the pool. If the resource agent and seizing agent both have a location variable that matches, the seize will seize that agent.