We are trying to create a generic moving capability for our agents that way we can use this capability in many projects.
The way I thought to do it was to create an agent called move and use it as a member in each agent I have in the future. (I would have wanted to use it as the upper class but since Java can only use one class as a parent this is not possible).
The problem is that when preforming the moveTo() command in the move agent it does not move the spacial coordinates of the owner agent.
Is it possible to link the two parameters so that any time x,y,z change in move agent the x,y,z in the owner agent also change?
If I understood your question right you want to have more control over your agent movements and have some custom logic you want to apply to all moveTo blocks. In that case it's easier to create a custom flowchart for your move than trying to modify your agents. You can use your custom move (instead of moveTo) every time you need to move any agent.
Related
I have an material agent that is moved from the Main agent to inside another agent (simulating a room). I can send the material agent using the Exit and Enter blocks. The 'room' agent contains a network that the material agent is being sent to.
The material agent is initially being moved in Main using a Transporter. However I'm not able to get this Transporter to follow the material agent into the room agent. The main questions is - is it possible to send a Transporter into another agent? Or does it need to remain in the agent that the Transporter Fleet is located?
Thank you.
I will correct benjamin by saying that with setEnvironment you can't do it since that's a function that is called on the agent initialization.
Instead of setEnvironment,something you do normally is to send the agent to a new population (which is the way you dynamically change environment), but it doesn't work with transporters
My answer would be that you can't do it since transporters who follow paths are defined as strict AGVs and can only move on their initial network and you can't change the network, unlike other agents.
But i'm always a bit suspicious of myself when i say something is not possible...
This should be possible with some setEnvironment() calls.
However, it is not a good setup. Think of reality: your rooms are spatially all part of the same environment: your flat (or factory or whatever). Moving from 1 room to the next does not mean you change your flat. You stay in the same environment.
You should setup your room agents like that as well: their spatial representation should reside in Main (or whatever agent they are embedded in).
Use a parameter of type ShapeRectangle or similar in your Room agent to define which rectangle (or else) represents the spatial aspect of the room.
Then, the flow chart blocks in the Room agent simply refer to that parameter for their spatial needs.
I am creating a model that includes both Material Handling and ABM components. I have an Agent Type that is called "Box" and there are 5 boxes that are placed on a conveyor in main. I have another Agent Type called "Product". The boxes are expected to carry the product. As a result, the box and product are expected to move on the conveyor as one. So, I was looking for something similar to move to agent, but that only works if the agent is not moving (i.e. it won't follow the agent everywhere it would just move to its position at the time the function is called). I can think of many solutions, none being ideal. Some include:
Not really moving the product agent, instead adding an animation shape of the product in the Box agent type and turn it on and off depending on the Product's state.
Using DES blocks (pickup/dropoff), but the problem with these is they convert the two agents to one... I am looking to keep both agents, but have them move together
Using something similar to Attach Resource, but then I'll have to define my Box or Product agent as a resource type
These are some of the solutions that came to mind, but I feel there must be a smoother solution. Any suggestions? Is there an ABM function that can resolve this?
Thanks!
I have in my model some free-moving agents, which travel to specific nodes. I use the function...
moveTo(node)
...to specify the node an agent should visit. Using this function, the agent travels the shortest path to the node. However, the model layout contains areas (i.e. image files), which the agent should not pass. Right now, the agents may travel through these areas to reach their destination. Now I'm wondering, whether there is an easy way to permit an agent to enter specific areas in the model, when traveling to a node.
I already took a look at the example model "Wandering Elephants" where the elephants are permitted to walk through areas with water. The solution there is, that if an elephant meets water in the direction it's currently heading, it randomly searches for another direction, until it finds one without water. However, this approach doesn't really fit to my problem, as the elephants in the model wander around without any specific destination. I'm searching for a method, which works for an agent that travels to a specific point. In the best case, the agent would search the shortest path around the obstacle to reach its destination.
Edit 1: The following figure shows my problem in a nutshell. On the left side is my model structure, while on the right side the state chart of my custom agent. What is happening in the model: The 3 sources are producing agents, which will be delayed for an uncertain time (delay stops with stopDelay()). Everytime an agent enters a delay, the delay is added to the collection request. My customagent check requests in a loop until the collection contains at least one request. Then, the customagent randomly selects a request (i.e. delay object) to serve. Each delay is associated with a node (the collection processNodes maps delays to nodes). Now, I want to cast my customagent to a Transporter and move it to the corresponding node. The agent should avoid collisions with the stripped walls in the model. I want to avoid any seizing and releasing of resources. I just want to adapt the behaviour of the Transport agent from the material handling library to my agent.
Edit 2:
In my current testbed, my custom agent does not consider node 1 or node 2. For testing, the agent should only try to reach node without any collisions.
I found a sufficient work-around. Not exactly what I wanted, but it works. Against my initial intention, I use now seize and release for transports. However, I added a hold-block in front of each seized-block and only a resource, which decides to serve the process, is able to unblock the corresponding hold. The on-enter control of the unblocked hold ensures that the hold is directly blocked again as soon as a single agent flows through. For the case that other users are also interested in the solution, I attached the flow-chart of the process and the state-chart of the Transporter-Agent. The system structure is quite the same as in my initial question.
There is no build-in way unless you use transporters from the Material handling library (or pedestrians). These can do what you need.
So easiest might be to convert you agents to transporters temporarily.
Otherwise, you will have to code something yourself...
I am trying to develop a model that essentially shows the movement of material in the warehouse.
I want the rackstore block to move multiple boxes at a time in the rack using crane. In the current model, crane takes one box at a time, stores it in the rack and comes back to take next box.
Not sure if RackStore supports that, but as always, you can find a solution in AnyLogic.
One simple fix: bundle your packages together into 1 agent using the batch object. Then, they stay together until being taken out by the crane at the end (via RackPick) and you can un-batch them to their original agents. Have a look at some example models using batching.
cheers
Depending on the details of your model, one option is to use batch as Benjamin stated, but I think I feel the pickup dropoff blocks would work better because with the dropoff you can drop the boxes one by one, while the batch forces you to separate all the boxes at once...
So with the rackstore you can't do this, but if you use the pickup and then dropoff, you will have to store somewhere in your model what rack positions are free though, because when you move the crane you will have to choose the rack position yourself, while the rackstore does it automatically...
Nevertheless, the batch may also work... it depends on the details of your model
In Anylogic, how to make an agent run an action (like search in a certain radius for an agent) while moving towards another agent? I'm using PML to move to another agent but how can I include an intermediate task in the flow? Maybe combining with state charts? Any idea?
Difficult to say with these details but I feel like you may want something of this sort:
This event should be inside the agent that is moving (in which case the "yourAgent." should be removed:
Another option is to have a statechart inside the agent that is moving, something like this:
You trigger the message transition when your agent starts moving and you create a conditional transition with the condition distanceTo(otherAgent)
There are more ways of doing this... but these 2 came to mind first