I'm running a simulation on a school building on Anylogic PLE version. I used pedGoTo block for Peds (as students) to go to their lockers, using a polygonal area and attractors for each locker. The model runs for a bit but eventually I get the following error:
root.ToLockers.pedGoToTarget:Unreachable target
Click on this link to see a picture of my area and attractors
Click on this link to see a picture of the error during the simulation.
(I'm new to stack overflow and for some reason I'm not allowed to embed pictures)
The peds try to go through walls to reach the attractors. I made sure to draw the polygonal area around walls and any object that might be in the way to avoid this but it keeps happening. It happens with a different attractor every time I run the model so it's not just a specific one. The attractors are set to Random.
How can I fix this to avoid peds trying to go through walls?
It's not exactly clear form the image but my advice would be to try some more debugging of reachability using the following method:
Use the same layout
Create a separate flow where an agent is injected at a random point on the layout
Make the agent attempt to reach that location
There can be two outcomes:
The point is unreachable from anywhere - meaning that a mistake was made in drawing the layout at the destination (locker) location
The point is unreachable from some locations - meaning that there are issues with pathfinding in which case it is advisable to create intermediate points that should be reached before targeting final destination (locker)
Related
I'm using a AStar pathfinding plugin in Unity, and it works prety well previously until I got this result.
Please see the screen shot of Unity Editor view, the blue nodes are walkable area, the yellow point is the starting position, and the target node is where the Star icon is. So the desired way should be the green line, but the actual result is the red line.
I know it's very possible that it's not the problem of the plugin, but I checked my code many times and can't find any problem and it works well in other cases.
what is even more strange is that if I remove the walkable nodes in the purple area, the plugin finds the right way.
I'd like to know what is the possible mistake that could lead to this result, any clue would be appreicated. Thanks.
I sadly can't debug your graph remotely, but I would check many paths from your current start position gradually towards the goal, where it switches to a correct path and diagnose which nodes are disconnected.
Maybe some nodes are elevated or obstructed.
In a nutshell, try to debug your game grid to a minimal reproducible buggy behaviour and a working one and try to understand where they differ from each other.
Some basic hints on the inner workings of A*:
As mentioned in the comment, A* is not guaranteed to produce the optimal path (e.g. when nodes have negative weight)
It considers many paths and might amidst the calculation walk on strange routes (depending on the heuristic)
i am trying to use one of the 3d Objects in Anylogic , once i drag the item , it doesn't show the real shape of the object upon running and it shows the following enter image description here
check on the resources section of your project if they are actually there... sometimes you move the .alp somewhere else and you lose the location of the objects... or sometimes AnyLogic just makes our life difficult
if you have issues with the elements, you will see a red or grey circle instead of green.
This is a follow-up question to modelling population density in a mock model: Modelling population density in AnyLogic
Now I wanted to implement those changes in my main model. The functionality works, and the agents are generated at the correct places, but somehow they appear behind the image. If I set the the image to not visible, I can see that the agents are actually generated.
Short recap of how the functionality works:
I have traced the borders of regions using a polyline on top of an image of the country. Next, I have created a function to let agents appear in a random location inside one of the polyline shapes.
I am probably overlooking something simple, but could you give me any pointers?
Thanks!
This should be simple. Bring your agents to the front as shown in the following image:
You can experiment also sending your image to back.
I have developed scratch card effect.I am stuck at logic of how can I know object got visible which is behind the scratch card image? So that I can show reward screen.
PS: with modifications in this link I able to work this scratch card effect in uGUI.
There are many ways you could go about this. Assuming you know the dimensions of the red "target image" that the user is trying to uncover, you could take a fixed number of samples from the area that the target is under. Once, say, 80% of those samples are transparent (i.e. the target is visible at those positions), you can consider the object visible and show the reward screen.
You can use GetPixel to get the individual samples from the scratch texture.
I want to create a traffic simulation model where the user can move patches (that would act as nodes or junctions). Firstly is this possible , and if so would it be possible to see a code example? Secondly once this is done , will it be possible for the user to draw necessary links between nodes, upon which turtles can travel?
thanks
Yes, what you describe is very possible by combining a couple ideas. Check out two models in the the Code Examples folder of the Models Library: "Link-Walking Turtles" and "Mouse Drag One".