question

tomonori S avatar image
0 Likes"
tomonori S asked Andrew O commented

About layout optimization

I would like to use the optimizer to optimize the layout.
In the attached model, the range that can be moved is set by setting the upper and lower limits of the X axis and Y axis of each processor in the parameters.
As a result of performing optimizations, there is some overlap between processors. Is it possible to layout them so that they do not overlap?

img.png

layout_optimization.fsm



FlexSim 22.0.8
parametersobjectoptimize
img.png (338.8 KiB)
· 1
5 |100000

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

Andrew O avatar image Andrew O commented ·

Hi @tomonori S, was one of Jordan Johnson's or Kavika F's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. 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 unaccept and comment back to reopen your question.

0 Likes 0 ·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered

This is a case for using constraints in the model. However, because the constraint is relatively complicated, it is much easier to use FlexScript to implement the constraint, instead of using the default constraint.

Here is a modified version of the model:

layout-optimization_1.fsm

The basic concept is to make a user event at time zero. That user event checks your constraint. In this case, the check is to make sure no processor overlaps with any other processor. The result of the user event is stored in a Global Variable called HasOverlap. Then, I added a performance measure to record the value of HasOverlap.

In the optimizer setup, the constraint uses the performance measure HasOverlap:

HasOverlap <= 0

To keep the simulation from running further, I use the endreplication(1) command. This way, if the optimizer suggests locations that create overlap, the simulation won't run past time zero, and return an infeasible result.


5 |100000

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

Kavika F avatar image
0 Likes"
Kavika F answered Felix Möhlmann commented

Hey @tomonori S, one thing you could do to make sure processors don't overlap is provide a "Constraint" in the Optimization job. Your constraint equation could check to see if different processors' x and y coordinates are far enough apart. Constraints are equations that must be true, so make sure your equations keep that in mind.

// Example constraint equation
// This will check to see that the difference between Processor1 and Processor2's X or Y coordinates are greater than 2 model units apart
// We use OR in between each conditional statement because we only care if one of these is true. These two processors can have the same X coordinate but different Y coordinates (and vice versa).
[Processor1_Xaxis]-[Processor2_Xaxis] > 2 OR [Processor2_Xaxis]-[Processor1_Xaxis] > 2 OR [Processor1_Yaxis]-[Processor2_Yaxis] > 2 OR [Processor2_Yaxis]-[Processor1_Yaxis] > 2
· 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.

tomonori S avatar image tomonori S commented ·

Thank you for your reply.

Since there are 4 processors this time, I think there will be 6 constraints(img-01.png). For example, if you have 30 processors and you don't want them to overlap after layout optimization, the constraints will be huge. Is there any good way to handle this? Also, are there any other methods?

layout_optimization.fsm

img-01.png

0 Likes 0 ·
img-01.png (16.9 KiB)
Felix Möhlmann avatar image Felix Möhlmann tomonori S commented ·

You could try the approach to not have any constraints on the initial placement but then adjust the locations when the model starts, so they don't have any overlap.

The code in the script console of the attached model demonstrates how that could work. It assumes that all objects have the same orientation. Otherwise you would have to write a 'proper' collision detection, rathen than just comparing position and size.

noOverlapTest.fsm

0 Likes 0 ·
nooverlaptest.fsm (29.1 KiB)