Permutation of sum of items from list

I have 2 lists

Currently they’re the same length but they may not always be.

I want to pair the numbers (1 number from [0] and 1 number from [1])

EDIT - further down

Hello,
here is a possible way

not sure of the result

Cordially
christian.stan

2 Likes

Love it :wink:

3 Likes

Designscript scares me…
Can you explain what the last line is doing here please?

image

I guess it’s stepping through something?

Amendment (realised I was doing something wrong):

List 1 numbers <= 85
List 2 numbers <= 85

I have put largest numbers first in each list.

lst1 [n] > lst2[n] (I want to match pairs and tick them off as I go)

So lst1[0] > lst2[0] so both numbers at index 0 can be removed. Etc, etc.

I tried python but the output isn’t quite as expected.

All the numbers from lst2 should be in the python output but they’re not.

What have I done wrong?

Here is
I tried to explain what I understood from Mr. Sol document on his github

There is a document on linkedin of Mr. Vikram from memory too (I don’t know how to find it anymore I forgot to copy paste the address, edit: I found)

But it’s still far from being as clear for me as for them [many others too, so as not to offend anyone]
(that’s a fact)
Cordially
Christian

oops, I hadn’t seen that you were looking for a python way, I still really really have a lot to work on this aspect
cordially
christian.stan

Are you looking for an optimized solution of pairings, or a ‘first fit’ pairings?

Asking as these are two extremely different problems.

optimised.

the most matches possible.

I reckon paring the largest two first will work?

Not necessarily. Bin packing isn’t a single solution set. That you only allow two items per bin helps reduce scope enough that it might work out, but the question becomes “what is optimized” after you get pairs that work. By going “largest first pairing” you may wind up with a pair of 1’s as the last item, resulting in some sets at 100% utilization while others are hardly serving any demand which could have ramifications in other aspects of the system (is: if the bins are mechanical systems then the bins at 100% utilization will need maintenance then then bins at 2% utilization)

Understanding the problem better is required to help find something near the desired optimum.

It’s not for packing.
It’s as simple as, has to be 85 or less.

Doesn’t matter what the left over figure is… Although if it’s 1% and 1% I suppose another 1% would be good…

It’s for calculating offcuts.

Whooo.