Ho una situazione in cui mi piacerebbe il tuo input e penserò a risolvere l'algoritmo.
Le specifiche
There are inventories with a specified amount of capacity.
'X (width) and Y (time)' creates together a total space. '60 * 100 = 6000'. In reality "width" are a business value unit, but we can talk width here.Now there also are boxes, which take a part of the space.
Each box take width (X) and time (Y). Two boxes with 80 * 20 each, will fill a inventory with 1600+1600. It will result a fill factor, 2800 space left in the inventory, after the boxes are added. Each box always belong to it's inventory.There exist unlimited, serial dependent, inventories with boxes added individually. The former inventory have to be performed before next are performed.
Boxes themself have a attribute, like a color, which make a ownership in higher context. Like a "give me all boxes of color -yellow-" context. I.e. to find out which inventories contain that color. A box with same color can exist several times, even in same inventory. But if in same inventory, they have unique box-id's.
Il problema
There have to be added optimization strategy which make width (X) adjustable. Time (Y) is still fixed and can't change. The optimization rule is that available space in former inventory should be filled with a part/slice from second inventory.
Time must fit. I.e. 2x15 or 1x25 can fit to 1x30. 1x35 can't fit. Also the width added to former, must be reduced from second. Remember that a box isn't allowed to be removed from it's inventory (but width can be 1 as minimum). Though, on adjustment, new boxes have to be created in the former inventory.
È una teoria matematica, ma principalmente voglio trasformare un algoritmo di questo tipo in codice. Oppure rivolgi la domanda a quale tipo di teorie cercare. Forse questo è un problema comune? o troppo complesso considerato come "re-inventare la ruota" e raccomandare di acquistare un modulo di terze parti.
[Modifica] "lunghezza" modificata in "larghezza"
Aggiunto un grafico per illustrare meglio come verrà applicata la regola di ottimizzazione.
C'èunremainderdiunpiccolopezzoverdeadestra,dopol'ottimizzazione,acausadella"almeno 1 larghezza deve rimanere" -rule. Il rosso e il blu non si adattavano perfettamente.