Let\'s say we\'ve got an input:
10 // saying 1st property should be 10(in total)
10 // saying 2d property should be 10 (in total)
5 // saying theres 5 record
You can use the same approach of knapsack problem, but instead of 2D matrix, you will have a 3D table, a dimension for each parameter (2 constraint + index).
The recursive formula will be similar, but of course will be done for both parameters.
f(item,cost1,cost2) = max {
f(item-1,cost1,cost2),
f(item,cost1-firstCost[i],cost2-secondCost[i]) + profit[i]
}
(Base clauses will be similar as well, but with an extra dimension.)