I need help to create an algorithm to control a machine which will do something very similar of what a multi-head weigher does. I will have a array of 192 available "heads" to make combinations.
I don't need to find all availabe combinations. The machine will take some time to process the combinations so if I find, let's say, 30 combinations every time it will be enought.
I want to optimize it and use first the combinations thar need to use 1 head only, then the combinations of 2 heads only and then 3 heads and so on so the machine output will be higher as possible.
This will be implemented on a PLC so I don't have "unlimited" resourses like a PC. Recursion for example is a problem.
I will be using codesys to program
I'd like to see a suggestion on how to implement this
For example the machine need to outup 3KG to 3.2KG loads. And I have up to 192 weights ranging from 0.5 to 4KG (yes, it can have overloads). I need to find the 30 best combos every time.
EX
Combo 1 = HEAD1 = 3.1Kg Combo 2 = HEAD5 (1.5) + Head8 (1.6) = 3.1Kg