I have two $\mathrm{n}\times{}1$ column vectors, $\underset{n\times 1}{\mathrm{A}}$ (with elements $a_{i}$) and $\underset{n\times 1}{\mathrm{X}}$ (with elements $x_{i}$) and a scalar $l$ which is a non-null threshold.
I am searching the value of another scalar, $w$, (that applies to all elements $x_{i}$ of $\underset{n\times 1}{\mathrm{X}}$) for which the total count (number) of lines (or rows) that satisfies equation 1 is equal to $l$ (or as close as possible to).
$$ \forall i \quad {\mathrm{a}_{i}} \leq{} {\mathrm{x}_{i}} \cdot{} {w} $$
Equation 1.
I don't really know how to write this in a correct way (especially how to express the "number, i.e. the count of the lines for which the equation is satisfied" and which should be $l$).
I gave the formatting a try, but I'm not completely satisfied:
$$ f(w) = \left\{ \begin{array}{ll} 0 & {\mathrm{a}_{i}} > {\mathrm{x}_{i}}\cdot{}{w} \\ 1 & {\mathrm{a}_{i}} \leq{} {\mathrm{x}_{i}}\cdot{}{w} \end{array}\right. $$
Where;
$$ \sum_{n}\left({f(w)}\right) = l $$
Is it possible to write this as a (linear?) matrix product in order to find $w$?
And what kind of technique should I apply to actually find it?