Combination of several items

Asked

Viewed 70 times

1

I have a set of items and each item has the following elements:

E = (índice, espessura, largura, demanda)
i = índice; e = espessura; l = largura; d = demanda;

I have two more variables:

int min, max;

Let’s call the possible combinations of C, that C is the set of i of E, such that soma(l(C)) is smaller than the max and greater than the min. i can repeat in the set.

For example, I have the following items:

E = {{1, 2, 50, 100}, {2, 2, 30, 100}, {3, 2, 40, 100};
min = 100; max = 200;

So

C = {
    {1,1}, // Sum(l(C)) = 100
    {1,1,1}, // Sum(l(C)) = 150
    {1,1,2,3}, // Sum(l(C)) = 170
    {1,1,3,1}, // Sum(l(C)) = 190
    // e mais algumas várias outras possibilidades
}

However, C is not a set of ordered pairs, so {1,2} = {2,1}.

How am I going to calculate all these possibilities without there being identical repetitions like this?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.