问题
I am having a trouble with coding in matrix.
I have a matrix P with n x m dimensions.
I need to find the first largest N (less than n) elements from the P and flag them to 1.
Let the matrix be Y, where Y(i,j)=1 or 0
Constraint : max(sum(Y(i))=1 ; min(sum(Y(i))=0
Application - I have n number of customers list and m number of offers. P(i,j) is expected profit from i th customer with j th offer. I need to figure out a matrix Y (n x m) which gives me the maximum expected profit.
Each customers can get maximum 1 offer (or 0) and there is a budget so that we can only make N offers.
来源:https://stackoverflow.com/questions/18032627/first-n-largest-elements-from-matrix-with-constraints-matlab