question

Felipe Capalbo avatar image
0 Likes"
Felipe Capalbo asked Jason Lightfoot commented

Binary Constraint for Objects Overlapping

I'm building a Reinforcement Learning model to optimize a layout. When the model provides a solution, some of the objects may be overlapped.

Is there a way to create a script to set a binary value when any of the objects in the 3D overlaps? This binary value will be used in the Reward Function to set it to 0 (invalid solution) or 1 (valid solution).

FlexSim 23.2.3
overlapping
· 2
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·
This would be a feature of a physical simulation tool, which isn’t FlexSim. You have to implement it yourself by checking size and location to find intersections. Some user here might to propose to use the agent system tool, but it will reduce your running performance massively.
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

Hi @Felipe Capalbo, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Jason Lightfoot commented

If the rotations of the objects in question don't get too crazy, it should be sufficient to check if any of the corners of one object lies within the bounding volume of the other to detect overlap.

Attached is an example model with a user command that checks for overlap on the XY-plane.

2d-overlap-fm.fsm


2d-overlap-fm.fsm (34.0 KiB)
· 2
5 |100000

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

Felipe Capalbo avatar image Felipe Capalbo commented ·

This user command works when the objects are partially overlapped, but when its totally overlapped, which will be my case of use, it don't accuse as "1".

1711455728505.png

1711455739439.png

0 Likes 0 ·
1711455728505.png (195.5 KiB)
1711455739439.png (129.7 KiB)
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Felipe Capalbo commented ·

You might find it useful to split out the function to test if a single point is within a rectangle as I have in this user library which will autoinstall these commands:
1711457132313.png

withinRectangle23.2.fsl

0 Likes 0 ·