question

ksugai avatar image
0 Likes"
ksugai asked Felix Möhlmann edited

Set route cost using AGV Cstomization Delegate

image.png

Customize cost.fsm

In the attached model, I am trying to use the AGV Customization Delegate to set cost on each path.

In the getPathTravelWeight hook, cost is defined by referencing a global table.

If the red path (path1) is used, the total cost is 3, and if the black paths (path2 and path3) are used, the total cost is 2, so I assume the AGV will choose the black paths, but when I run the simulation, the red path is used.

If the cost of path1 is set to 4, the black paths are used.


Please let me know if there is any mistake in the AGV Customization Delegate settings in the model.

Thank you in advance.

route costagv customization delegate
image.png (145.1 KiB)
customize-cost.fsm (34.8 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Felix Möhlmann edited

There is nothing 'wrong' with the code you use but your assumptions about how the routing works might be too simple.

The path finding algorithm treats each Control Point and Transfer Cluster as 'nodes' with the path inbetween as the 'edge' that connects those nodes. Each of these edges incur their own cost. This does for example include the edge from the CP at the top to the transfer it sits on. The distance might be zero but travelling from the CP to the transfer will still infer the fixed cost you have assigned to the path.

So in short: The fixed costs per path might be counted more often than you think depending on how many 'edges' use the path.

Another potential issue with fixed costs is that they might be too small. When dynamic routing is active the AGV system uses the A* algorithm to search for the best path as opposed to Dijkstra's algorithm which would otherwise be run once to generate a complete routing table. The difference between the two is that A* uses a heuristic to decide which node to 'explore' next. I don't know for certain, but I would assume that the straight-line distance from the node to the target is used. In other words, the algorithm assumes that the cost between a node and the target can not be smaller than the distance. If this is not true, it might lead to the algorithm ignoring paths that would end up being a better choice because the heuristic overestimates their cost.

In conclusion, the returned cost should be the product of the distance travelled along the path and some factor >= 1 for the routing to work correctly.

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.