Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Combinations with Best Total value without Exceeding a maximum cost

$
0
0

Hello,

I have an interesting problem I am trying to solve and I am wondering if TSQL, or another tool like SSAS would be a good option for this. I am trying to find out the best performance from 8 parts while staying under a specific budget. Below is a generic example:

I have to find the best combination of the following:

3 Part A
3 Part B
1 Part C
1 Part D(can be either A, B, or C)

The raw data that I will be using will look something like this:

Part #  |  Price   |  Value  | ID

A          |  $22     |  44      |   1

A          |  $21     |  42      |   2

B          |  $20     |  41      |   3

C          |  $18     |  37      |   4

B          |  $17     |  35      |   5

...............................................

B          |  $2       |  1        |   200

I will have over 200 combinations of parts in total (some A, some B, some C).

In addition, I will have to find the best optimal total value for 100$ or less. It will be like Use it or Lose it 100$ so you want to be as close as possible without going over. 

I am looking for something that can find out the optimal and rank it according to total value in a relatively quick amount of time. I know there are a lot of possibilities for this.

The end result will be something like this:

Total Value | Total Cost | A1 | A2 | A3 | B1 | B2 | B3 | C1 | D1

---------------------------------------------------------------

240           |   100        | 1  |  6 |  15 | 2  |  5 | 20 |  4 |  3

Let me know if you have any questions. Hopefully this makes some sense.




Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>