0

I'm trying to think of some way to implement this concept (in Python, but I can translate so that's not an issue) but have no idea where to begin:

this is the setup:

#"collection"        "oNum"                 "object"
object_collection = [[o01, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o02, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o03, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o04, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o05, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o06, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o07, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o08, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o09, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o10, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o11, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o12, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o13, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o14, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o15, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o16, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o17, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o18, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o19, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o20, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o21, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o22, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o23, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],
                     [o24, [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]]]

This may be better outlined as a dictionary, I'm aware, so that's not a limitation.

Parameters of the problem are:
1. Need to Sum the values of the "objects" where
----> All "objects" will be random integers between the values of 0 and 15
----> All "objects'" combined total cannot exceed 100 (but they can be less than 100)

for example:

object_collection = [[o01, [11]], # 0 + 11 = 11
                     [o02, [2]], # 11 + 2 = 13
                     [o03, [1]], # 13 + 1 = 14
                     [o04, [6]], # 14 + 6 = 20
                     [o05, [5]], # 20 + 5 = 25
                     [o06, [4]], # 25 + 4 = 29
                     [o07, [3]], # 29 + 3 = 32
                     [o08, [2]], # 32 + 2 = 34
                     [o09, [1]], #... 
#                    X + Y <= 100
#... you get the point

The the total value will exceed 100 if all 24 values are set to the maximum, but the basis of the question is centered around identifying correlations between the ratios rather than the individual raw data points. Technically, each "object" has a maximum of 100, but setting one object's value to 100 leaves 0 for any other object.

I've tried a few things already, but any help you may have would be appreciated.

Thank you.

Greg
  • 1
  • Please share your code you tried and error you are facing? – JRG Jul 29 '17 at 21:48
  • Actually, it's similar to the question answered here: https://stackoverflow.com/questions/4880960/sum-of-all-values-in-a-python-dict but the difference is that I have a range of values rather than a single integer as well as my question has an upper bound of 100 for the sum of all the "object" variables (ranges). – Greg Jul 29 '17 at 21:52
  • https://meta.stackexchange.com/questions/165519/where-should-i-post-questions-about-algorithms-stack-overflow-or-software-engin –  Jul 29 '17 at 21:53

0 Answers0