Recursive sub lists

Hello everyone, I need to group a list of numbers [n1,n2,n3,4,n5]. Each group need to have a specific sum of the values in the group. So I have a list of value of the sums [m1,m2,m3,].
Each group need to be something like this m1=n1+n2+n4, m2=n3, m3=n5+n6. I tried using the drop item technik but this looks a little bit more triky this case. I hope that is clear enought and that somebody is able to help me.

@abaghin ,

like this
https://forum.dynamobim.com/t/a-list-of-the-surface-area-summed-together/91083/2

KR

Andreas

1 Like

FirsttFitDecreasing from BIM4Struct should do the trick.

More here: Beam length cut optimization - #16 by Dieter_Vermeulen

This is quite similar to what i need to do, the problem that the node calculate for each “bin” - container possible numbers that can go inside them. I need the grouping of each containers using just once a value and not twince like it does.

So you don’t have one size of bin, but many?

@abaghin ,

basicly you look for something like that but with different lengths ?

Do you know for sure you’ll have exact amounts for all of your bins? How do you expect it to handle leftover values or unfinished bins? Are you expecting it to optimize around your bin sizes or do you just want it to fill the most bins as efficiently as possible?

The answers to these questions will determine how to go about solving for this situation.

2 Likes

I´ve managed to do that

@abaghin ,

you make unique items (List.Shuffle) ? before your input ? or you solve that in the pythonscript

What happend in your pythoncode ? :slight_smile: