question

Marc R5 avatar image
1 Like"
Marc R5 asked Felix Möhlmann commented

Optimize iterating order within groups

Hello,

I have a model set up, with the optimizer running fine. I have a column "order" in my global table called "arrivals", that it is passed into a parameter, then used in the optimizer to loop and get different scenarios shuffling the order.

How can I make the optimizer to iterate as it does, but not into the whole arrivals table, but just iterating within each group (in my case each group would be the concatenation of "building"&"floor"), mantaining the order of building&floor?

Thank you very much!

Layout v3.2_13.fsm

FlexSim 22.0.2
optimizerbatches
layout-v32-13.fsm (640.4 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.

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Marc R5 commented

Since there are not that many groups you could simply create one sequence parameter for each and offset the assigned numbers in the "On Set" code. So the first group would be assigned the numbers from 1 to 38, the next from 39 to 95 and so on.

1649657538208.png


If you want to only use the one parameter, you can sort the table by building, floor and then order number. This will keep each group together but ordered according to the sequence parameter. Afterwards, the order numbers are reassigned as the current row number of each entry. Finally, the table is then restored to the original row ordering by using a newly created column that stores the original row numbers. (Otherwise the next time the order is changed, the resulting order would depend on the previous one)

Table arrivals = Table("Arrivals");
// Sort the groups by assigned order
arrivals.sort([5, 6, 8]);
// Reassign order numbers
for(int row = 1; row <= arrivals.numRows; row++)
{
    arrivals[row][8] = row;
}
// Sort back into original configuration
arrivals.sort(20);

Both options should work, though I presume the optimizer might fare a little better with the first option, since the order of each group is determined independently from each other.

layout-v32-13-fm.fsm


1649657538208.png (27.0 KiB)
layout-v32-13-fm.fsm (558.6 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.

Marc R5 avatar image Marc R5 commented ·
Hello Felix,

The first option is not the best for me as, from project to project, buildings, floors, etc could vary and I could also vary the number of projects taken into account in the simulation, so that could give me a lot of parameters to create... but it is good to know this solution.

About the second one, I think it is a solution I could use!

Thanks!

0 Likes 0 ·
Marc R5 avatar image
0 Likes"
Marc R5 answered Felix Möhlmann commented

The new column "original_order" where is created and updated? or did you create it manually?

· 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.

Felix Möhlmann avatar image Felix Möhlmann commented ·

Yes, that column was created manually.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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