question

Sofia G21 avatar image
0 Likes"
Sofia G21 asked Jason Lightfoot edited

Conditional rule for A* path or barrier for allowing ONLY on forklift on it

Hey Flexsim community. I am trying to have certain paths in my A* map have a conditional rule that allows only one forklift on/through it? What would be the syntax for that rule? How do I write that?

PS: I know that it might not work as great as I'd like because it will be calculated/checked against at the beginning of travel, but want to test some scenarios. Thanks in advance for the help!

FlexSim 22.0.2
a star navigationforklift
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

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot edited

The rule needs to return 0 to allow the traveller to pass, and 1 if the barrier is in place. So you need to track the barrier allocation somehow using a list, label or other attribute.

So then the question is how to reference the barrier attribute in the rule. Well at the moment: "If you want to have a different rule for each barrier, then you need to add a rule for each barrier." Then you will hard code your barrier reference into the rule using a Model.find("myBarrierAsAString/path") so that you can find out what is the current allocation. So you may be able to specify a rule generically that could be written once and used for hundreds of barriers in your model if the reference was passed in, but you won't be able to do that currently - you need to create a rule for each of them.

Another option you could try is for you to add dynamicBarrier objects based on some allocation tracking rather than using rules.


(I still don't see why this is a problem for caching since we have to evaluate each rule each time the path finding algorithm is called - and we can still cache by barrier/rule combination for the same call using a map. One hundred rules each with one barrier is the same as one rule with 100 barriers - both mean we need to store 100 values - it's just one is much easier for the user to implement. A simple checkbox for the rule to "evaluate per barrier" will give the best of both worlds)

5 |100000

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