AnyLogic
Expand
Font size

Pickup

Removes agents from a given Queue block and adds them to the contents of the incoming agent (“container”). The Queue block may be either connected to the inPickup port of Pickup or specified in the parameter queue (the latter has priority over connected block). When an agent arrives at in port, Pickup iterates through the contents of the queue and selects the agents according to the given mode, which can be: all agents, first N agents, an exact quantity of agents (the block will wait until the specified number is reached), agents for which the given condition is true. The whole operation takes zero time.

In the mode where an exact quantity of agents is selected, not only the Queue block, but any other block can be connected to the inPickup port of the Pickup block.

The pickup condition is evaluated when the agent is still in the queue, but On pickup action is called after the agent has been removed from the queue and added to the container.

Some examples of pickup condition:

Later on the added agents can be dropped off using the Dropoff block, or, with discarding the container agent, by Unbatch. Consider also using Batch instead of Pickup if you need just to group the agents.

Demo model: Pickup and Dropoff Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).

Parameters

Pickup
Defines how the agents are selected to be picked up from the Queue block. You can set up this block to remove All available agents from the Queue, a Quantity (if available), wait until the specified number of agents has accumulated (Exact quantity (wait for) or remove agents for which the specified boolean condition is true (While condition is true).
Syntax: Pickup.PickupType pickupType
Set new value at runtime: set_pickupType(new value)
Valid values:
Pickup.BY_CONDITION — While condition is true
Pickup.QUANTITY — Quantity (if available)
Pickup.EXACT_QUANTITY — Exact quantity (wait for)
Pickup.ALL — All available agents
Condition
[Visible if agents are picked up While condition is true]
Condition evaluated for each agent in the Queue to determine whether it should be picked up. The condition expression may depend on the container agent as well as on the “candidate” to be picked up.
Value type: boolean
Local variables:
agent — the agent to be picked up
TContainer container — the container agent
Default value: true — all agents are picked up
Quantity
[Visible if Quantity (if available) of agents are being picked up]
Expression evaluated to determine how many agents should be picked up.
Value type: int
Local variable: TContainer container — the container agent
Pick from
Choose here how you specify the Queue block storing the agents to be added into the agent-container.
You can set the block to pick agents from the Queue connected to the port (namely, to the lower inPickup port), or from the Specified Queue object (in this case you specify the block in the Queue object field below).
Syntax: boolean queueIsConnectedToPort
Queue object
[Visible and applies only if the option Pick from is set to Specified Queue object]
The Queue block from which the agents will be picked up. If specified, has priority over the connected Queue block graphically connected to the inPickup port.
Value type: Queue
Local variable: TContainer container — the container agent

Advanced

Forced pushing
If the option is selected (true), when agents finish processing at the block, they are instantly pushed further regardless the state of the succeeding block.
If the option is not selected, agents are not pushed, but pulled: only when the succeeding block is ready to accept one more agent, it requests the agent from this block, and only then this agent passes further.
Syntax: boolean pushProtocol
Default value: false

Actions

On enter
Code executed when the container enters this block.
Local variable: TContainer container — the container agent.
On pickup
Code executed for each agent that is removed from the queue and added to the container.
Local variables:
agent — the agent being picked up
TContainer container — the container agent
On exit
Code executed when the container exits this block.
Local variable: TContainer container — the container agent

Ports

in
The input port.
inPickup
The input port that should be connected to the out port of a Queue block. The port can be left unconnected if the Queue block is specified in the properties of this Pickup block (the option Pick from is set to Specified Queue object).
out
The output port.
How can we improve this article?