Monitoring rectangular node usage - anylogic

I move a batch of agents to a node, where they are unbatched. Once the unbatched agents occupy this node, the node is not available for other batches of agents to move there, so I remove that node from a collection of available nodes, AvailableNodes.(There are about 50 nodes total). Each unbatched agent has a parameter that is the node it has been moved to. The question is how to add back a node to AvailableNodes once all unbatched agents have been moved from that node. Do I have a variable associated with each node that I increment or decrement as agents enter/exit the node? If so, how do I associate a unique variable with a node? Or is there a better way?

Oh you are walking in muddy waters with bad practices... your nodes should belong to a resourcepool, meaning that instead of a node, you should have an agent with a node in it... That way you don't need any collection at all.
Another option is to create a small class that will have the node and the availability... and maybe the number of agents currently present in that node. Just create a new class, and add these 3 variables. Then on the start of the model you add instances of that class to the collection availableNodes and you can then just do theClass.numberOfAgents+=1 or -=1 depending on wether agents are being added to the node. To find an available agent you can then do TheClass x=findFirst(availableNodes, a->a.numberOfAgents==0); and then you can send your agents to x.node;
There is also a possibility continuing to do what you are doing... but I won't even go there because it will be a mess.

Related

Batching agents based on arrivalnode

In my Anylogic model, my source block generates agents on different nodes based on a database values defining which node the agent has to arrive.
The orders at the same location arrive at the same time (so for example at 7:30, 3 agent orders arrive at node1 and 4 agent order arrive at node2).
Now what I want to do is that the orders at node1 make a batch of 1x2 and 1x1 and I want that the orders at node2 to form a batch 2. These agents than will seize a transporter which transports these batches to the same location and than unbatch.
So my question is how will I create batches based on the arrivallocation loaded from the database.
Thanks.
Create a variable in the agents myNode of type RectangularNode. Store the node the agents are being positioned at in the Source block.
Use a SelectOutput block downstream of the `SourceĀ“ block that splits the agents by their current node.
Then, use batch objects as usual as the arriving agents are now split by their node location.

Can resources carry multiple agents in Anylogic?

In the below image I am using AGV as resources to carry Containers(agents) in the rackStore and rack Pick blocks. By default, one AGV carries only one agent; Is it possible to set agent carrying capacity of resources such that it can carry multiple agents?
Sure. Just use the Batch element before the pickup and batch your containers together. Then, the AGV will pickup a batch, i.e. several containers.

Assign priorities for multiple Seize Blocks for the same resource in AnyLogic

I have a not so typical scenario for which I am not sure how to proceed:
There are two stations located at two different locations.
Both stations require the same resource.
The resource moves from station to station once released. So it keeps going from station 1 to station 2 to station 1, etc. until it is seized again. This is modeled by adding a link from the resource process port of the release block. So it is not completely released unless a condition applies. The condition is that there are agents waiting in the queue of the seize block of that same resource. So it should keep moving until it is needed again. The tricky part is that there are two seize blocks for that resource, one for each station. It is possible that agents are ready and waiting in the resource's seize element at both stations. I am adding an image of the resource's process at release. So at "selectOuput4" it checks whether station 1's seize element has agents waiting, if so, the resource is released and can be seized. Otherwise, it moves to station 2 and checks the same but for station 2.
My concern is that there might be a situation where both stations have agents waiting in their respective seize blocks. How can I make sure the resource will be seized by station 1's seize element and not station 2's, and vice versa. Is there a way to control where the resource is going in a case where two seize elements are waiting for it? Or is it always random?
I apologize for the long post, and I hope I managed to deliver my idea properly.
First, I think your design is a bit weird because you keep the resource always seized.
What I would do is first have a statechart in the resource that controls the resource movement from one place to the next so you have more control over it. The statechart would be used to move your resource ONLY when it's not seized. This will allow a case in which your resource is moving from station 1 to station 2 but something comes to station 1 queue and the resource can immediately react and come back to station 1 before it reaches station 2 (if you think it would be a good idea to do that)
The second is that the seize block defines the priority for a task when the agent arrives to the seize block, and your situation requires changing that priority dynamically, which can't be done as far as I know, so the wait block before the seize block is unfortunately a good option.

Preventing source blocks to generate agents if destination is occupied

I'm trying to create a packaging cell for 5 items into 1 package; the 5 items are picked up from a resource (worker) and placed into a packaging machine which generate the package; a conveyor moves the packages from the machine to a buffer and every once in a while (say every 20 packages) the worker stops picking the items and goes to the buffer the put all the packages in a box, ideally ready to be shipped. Once the worker has completed the box he has to go back to his pick&place task.
Now, my issues are:
When the worker stops picking the items from the rackSystem and goes to the buffer, the source blocks have to stop generating agents, otherwise the simulation will stop saying that there are no available cells in the rack;
When the worker gets back to his picking task the source blocks have to start generating agents again.
With the hold blocks in the picture I managed to stop the source blocks when the worker stops picking from the rack, anyway I could not make the process start again when the box is complete. How can i do this?
Everything works fine except from the fact that once the worker returns to the picking location and take the last 5 items from the rack, no more agents are allowed to enter the rack.
Actually from this setup, I think you should do this:
Let your sources create agents continuously. In reality (I suppose) things also do not stop coming in just because the worker is doing something else.
Gather all agents in an infinite queue, as you do
remove the hold blocks
instead, make your RackStore and RackPick objects utilize the worker resource pool (tick the box as below and select your resource pool)
You may need to play with the "customize resource choice" selection as well to ensure that your worker only tries to store items when the RackSystem has a space, though, something like below:

Group Priority on a Subset of Nodes

I am using a recent build of Torque/Maui (w/ PBS) to schedule jobs on a cluster with heterogenous hardware. Hardware consists on two set of 10 nodes for which I would like to have two group have elevated priority on one of the sets of nodes. For example:
Node set A of 10 nodes has elevated priority for User Group 1
Node set B of 10 nodes has elevated priority for User Group 2
I am familiar with how this is accomplished for all nodes, which is documented here:
http://docs.adaptivecomputing.com/maui/5.1.3priorityusage.php
However, I am unfamiliar on the best strategy to set this type of priority on a subset of the cluster. From what I can ascertain from the Maui docs it may be done using node sets or partitions, but I am unsure if either of these are correct or there is another strategy all together.
Edit: I would prefer to have a single queue as it simplifies usability and would enable a user to potentially use the entire cluster, albeit with differing priority on node set A and B.
Thanks in advance for the help.
The way I understand the question, you've confused node allocation with job priority. Job priority determines how much more quickly Maui will run a job, as it accrues priority in the priority reservation queue. This will determine how soon a job can run, within the constraints placed on the job, relative to all other jobs in the eligible/idle queue.
That's separate from where Maui decides to place (schedule) jobs. The most natural way to handle this type of use case is with standing reservations. You can create reservations over each set of nodes (via host list, feature, or partition), and then give both groups (or everyone) access to both reservations, but apply negative affinity to everyone outside the group with preferential access.
Example:
SRCFG[rsvA] NODEFEATURES=setA
SRCFG[rsvA] GROUPLIST=group1,ALL-
SRCFG[rsvA] HOSTLIST=ALL
SRCFG[rsvB] NODEFEATURES=setB
SRCFG[rsvB] GROUPLIST=group2,ALL-
SRCFG[rsvB] HOSTLIST=ALL
With this configuration, Maui will create reservation rsvA to include only the nodes with the "setA" property/feature, and jobs from group1 will gravitate (i.e., have positive affinity) to the nodes in that reservation. Likewise, jobs from users in group2 will flow to the nodes in rsvB, with the "setB" property (as defined in the nodes file, or on NODECFG lines in the maui.cfg). This configuration works fine with a single queue, and is essentially user-transparent.