PDA

View Full Version : Sleeper: Identifying the optimal solution in an array



NukedWhale
08-06-2008, 10:27 AM
Let's assume I have columns/products (A,B,C) and potential levels of my columns as rows 1,2,3.

Data is comma separated

A,B,C
1: 1,2,0
2: -1,0,1
3: 3,2,1

The data in the grid represents a value tied to the level of a particular product. So if I have product A at level 1 then the value is 1.

My solution has to have every product, and the sum of the levels has to equal 6. The best solution is the one with the greatest summed value. Example: A1, B2, C3 (every product and levels add to 6) would have a summed value of 2.

Generally speaking, what is the best way to solve a problem such as this? Now imagine I have 10 times as many products and product levels.