## superbhimanshu

Hello everyone,
I have multiple lists of variables. Every list contains the variables corresponding to a single/unique entity.

``````listVar_Entity1 = [x1, x2, x3, x4]
listVar_Entity2 = [x5, x6, x7]
listVar_Entity3 = [x8, x9, x10, x11, x12]
# and so on
``````

Every member in a list has a mapping to each member of every other list for example:

``````mapping(x1,x9) = some_value
``````

but there is no relation between variables within a list. I want to find the combination of members of different lists such that the addition of mapping between those variable is maximized assuming mapping(x1, x9) = mapping(x9, x1).
Thanks
sincerely,
Himanshu

## pyTony 888

I do not think I understand enough what you are trying to do, you should post some example of input and output and also show what you have done until now yourself.

## superbhimanshu

Thanks for replying. Here are some more details about input and output:
```Input= [[x1, x2, x3, x4], [x5, x6, x7], [x8, x9, x10, x11, x12], [x13, x14]] Output = (x2, x6, x11, x14 value) #exactly one member from each lists(with the Input list) in Input value = sum( mapping(x2,x6) + mapping(x2, x11) + mapping(x2, x14) + mapping(x6,x11) + mapping(x6, x14) + mapping(x11, x14)) #summation of mappings of all possible combinations of varibales in the output tuple```
So, the ouput is such that the `value` is maximized. I hope this makes things a bit more clear.
Thanks a lot
regards,
Himanshu

## superbhimanshu

Thanks for replying. Here are some more details about input and output:

``````Input= [[x1, x2, x3, x4], [x5, x6, x7], [x8, x9, x10, x11, x12], [x13, x14]]
Output = (x2, x6, x11, x14 value)  #exactly one member from each lists(with the Input list) in Input
value = sum( mapping(x2,x6) + mapping(x2, x11) + mapping(x2, x14) + mapping(x6,x11) + mapping(x6, x14) + mapping(x11, x14))
#so the value is summation of mappings of all possible combinations of varibales in the output tuple
``````

So, the ouput is such that the `value` is maximized. I hope this makes the problem a bit more clear.
Thanks a lot
regards,
Himanshu

## pyTony 888

see product in module itertools.

## superbhimanshu

Thanks Sir,
I have done that..but the complexity increases many folds when the number of input lists or variables in them increase even by single value. Is there any way to use concepts of dynamic programming in that. I have checked many problems on that but none of them relates to my situation.
Thanks
regards,
Himanshu

## pyTony 888

Post your code and we can see if we should do with it. What is your plan for applying dynamic programming?