Hi All,

I'm Trying to solve this puzzle for my script:

Let's say we have 3 lists, A,B and C with the following elements

'A' = [5,3,1]

'B' = [6,5,2]

'C' = [2,0,-2]

I want to go through all 27 combination sequentially, looking for a combination that is 'valid' AND has the highest sum. Let's say that A=3 B=2 and C = 2 is valid. Testing all 27 and computing the score (sum) will work, but is computationally too expensive for larger problems.

I mean to say that the program should test the highest combination first:

A=5 , B=6, C= 2 then A=5 B=5 C=2 etc

Thanks for your help!