question

Yunjukuo avatar image
0 Likes"
Yunjukuo asked Yunjukuo commented

How to assign items to machines based on machine constraints

There are four types of products in the following scenario, and the machine that can be used by each product is written in the table "ItemType_Processor". In the table, 1 means this product can be produced by this machine, and 0 means this product cannot be produced by this machine. Example: Product 2 can be produced by Processors 2, 4, and 5.

My question is how to randomly (e.g. uniform) assign which machine an item is produced with according to the "ItemType_Processor" table constraint?

My current idea is to set item lable "Processor" in OnEntry of Queue2, and select "Port By Case" in "Send to Port". But I am not sure how to write an efficient program/code that restricts assignment of machines according to the "ItemType_Processor" table.

1661086116182.png

File link:

https://drive.google.com/drive/folders/1cS5SfJ1H5ccRbyP6GaLKCjoY-KodD5fr?usp=sharing

FlexSim 16.1.2
itemtypesend to portconstraints
1661086116182.png (127.2 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

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel commented

In attached picture you see steps for Queue and Processors to accomplish your logic. You will change the value in brackets to translate your table conditions. Naturally you will add a global item list to your model in Toolbox. All tested in FlexSim 16.0

push-to-list-pull-with-in.jpg


· 6
5 |100000

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

Fengjun0113 avatar image Fengjun0113 commented ·
Hello @Joerg Vogel, could you please upload your model to drive and give us the link as @Yunjukuo did? It would be easier to understand with the model besause we can see other setting.
0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Fengjun0113 commented ·
There aren’t any further settings besides an added global item list called by default “ItemList1”. You need not any connections from Queue to Processors for this approach.


Please try it yourself. I won’t upload a model!
0 Likes 0 ·
Fengjun0113 avatar image Fengjun0113 Joerg Vogel commented ·
Okay, I did it ! Thanks for your help !
0 Likes 0 ·
Yunjukuo avatar image Yunjukuo commented ·

Thank for your reply. But this method doesn't seem to be fully meet our need. My previous description may omit too many details. I make more supplementary explanations below and attach a new model( item_machines_constraint_2016_V2.fsm ) below.

https://drive.google.com/drive/folders/1cS5SfJ1H5ccRbyP6GaLKCjoY-KodD5fr?usp=sharing

Actually I'm working on a scheduling problem and want to randomly generate the initial scheduling solution "Scheduling" table, this solution must satisfy the constraints in the "ItemType_Processor" table. I'm looking for an efficient way to generate the "Processor" column in the "Scheduling" table. (Of course it is possible to use for loop with array and switch to achieve this, but it may be very inefficient)

I will use the algorithm written by myself to search for the best scheduling solution (objective and optimize algorithm is not the focus of this problem, this part is not included in the attach model)

1661245422889.png

Also, the method I'm looking for is to be able to "follow constraints according to the Global Table", so that the user can easily modify the settings of Global Table according their situation, without having to change the settings("Query") of each processor. Considering that there may be more than 50 types of item and more than 100 machines in my actual problem.

Do you have suggestions to effectively build such function? or any other suggested approach for building scheduling problem?


0 Likes 0 ·
1661245422889.png (133.9 KiB)
Joerg Vogel avatar image Joerg Vogel Yunjukuo commented ·

As I understand your schedule table, you decide which processor should process a scheduled item. The Table "ItemType_Processor" is meaningless, because your assign processor number in your schedule already.

port-by-case-16.pngThis condition is perfectly matched by the "Send To Port" function template "Port by Case".

You need just to connect in the right order your processors to the queue or set the right port number in "Port by Case" to divert your items to the right processor.

If you want to send items by label and Global table lookup, when the predefined processor is unavailable, then you are going better with a more advanced global list. Whenever a processor is pulling an item, he checks allowed itemtypes to get entered and order the list by age of items.

If you need to pull items instantly and then by age descendingly you need a list field to distinguish between age = 0 and age > 0. There must be a condition in your query to priorize age = 0 over older listed items. You may achieve this by a nested ordered list. Or there is a query of a self-joined list with duplicate entries ordered by contrary values. Or there are two pull operations to distinguish between those opposite conditions age = 0 and ordered age descendingly.

Because there are so much variation possible, I need more input from you, before I can setup a solution.

BUT I think you should setup a new question, wherein you exactly describe what conditions you want to get accomplished.

0 Likes 0 ·
port-by-case-16.png (924.6 KiB)
Yunjukuo avatar image Yunjukuo Joerg Vogel commented ·

Sorry, I know I need to use "port by case" but I forgot to adjust in "item_machines_constraint_2016_V2.fsm". My question is how to write a code to full "Scheduling" table (value in table should be randomly generate and does not violate "ItemType_Processor" table restrictions). The "Scheduling" table in model is just a demonstration.

I'll setup a new question to describe details.

0 Likes 0 ·