Given $n$ object types, each with cost $n_{c}$, I need to combine object instances such that the total costs equal a known total $T$. Each object type can have $0 \le x \le y$ instances (where $x$ is a positive integer), but I wish to maximize diversity of object types.

I believe a linear equation expressing this would look like the following?

$a{c}\cdot \left( \begin{array}{ccc} \ 0 \ 1 \ 2 \ .. \ y \end{array} \right) + b{c}\cdot \left( \begin{array}{ccc} \ 0 \ 1 \ 2 \ .. \ y \end{array} \right) + .. +n_{c}\cdot \left( \begin{array}{ccc} \ 0 \ 1 \ 2 \ .. \ y \end{array} \right) = T $

I've tried what little linalg I remember from university, plus some simple combinatorics.. no dice.

Wednesday, 9 January 2013 22:20 GMT