0

I need to make an M dimensional vector and restrict it to have R entries as zeros. Is there any expression or condition in vector form that can ensure this ?

Waqas
  • 83
  • Do you mean the trailing $R$ entries, or just at least any $R$ entries? – MPW Sep 20 '14 at 05:28
  • Make an M-R dimensional vector whose coefficients are not zero and take the coefficients of other dimensions zero. – Jasser Sep 20 '14 at 05:28
  • I need to take the vector in M dimensional form as it is a decision variable in an optimizaiton problem. I need to ensure that the M dimensional vector has R number of zero entries. These could be any of the M entries but the total should be equal to R zero entries. – Waqas Sep 20 '14 at 05:32
  • So the problem is to make a check condition on expression on the vector which ensures that there are R zero entries in the vector and it has to be regardless of the position. – Waqas Sep 20 '14 at 05:33
  • The actual value of the vector can go from 0 to less than 1. I can manipulate to so that the vector contains numbers 1 or any value between 0 and 1. Is there any method that I can restrict the number of 1s of this new vector ? – Waqas Sep 20 '14 at 05:55

1 Answers1

0

Divide the unit interval in M subintervals $I_k (1\leq k \leq M)$ of equal length. Take a random number $X_1$ with uniform distribution over the unit interval. For the index $k_1$ of the interval where $X_1$ lies, make the $k_1$-th component of the vector equal to zero. Now divide the unit interval in $M-1$ subintervals, numerate them now $I_1,\ldots, I_{k_1-1},I_{k_1+1},\ldots, I_M$ take again a random number $X_2$, for the index $k_2$ make the component $k_2$ equal to zero. Repeat till you have $R$ indices, always taking out the indices you had already. Maybe there is a better way, but I have had not yet breakfast and think veeeery slowly.

Hope it helps.

Karl
  • 710
  • The value which the elements of the vector has to take would be decided by an optimization problem. All i need is to make sure that the vector has R zeros pointing to a certain items not selected. I need a restriction on the number of zeros in the vector in the form of an equation to be put as a constraint in the optimization function. For example I have a vector a whose value has to be decided by an optimization function. The element values can be from 0 to less than 1 but the I need a constraint that limits the number of zeros to R. – Waqas Sep 20 '14 at 06:44
  • Sorry that is now a totally different question. It seems to depend on the optimization problem and your description is quite unclear. I fear nobody will be able to help you if you cannot describe your problem precisely. "42" – Karl Sep 20 '14 at 09:16
  • Hi. I have given my optimization function in the below post. Do share your comments or help :) http://math.stackexchange.com/questions/942333/how-to-solve-non-linear-optimization-problem-with-division – Waqas Sep 23 '14 at 04:12