[Math] Optimization problem involving step function

optimization

I've got to optimize the following function with respect to $\phi$:

$q(\phi, x) = \frac{1}{n} \sum_{i=1}^{n}{H(y_i)}$

where

$y_i = k – \phi l – x_i$

and $H(.)$ denotes the Heaviside function. $k$ and $l$ are constants, and $x$ follows either (1) a continuous uniform distribution or (2) a normal distribution. This is part of a quite standard programming problem but I'm a little stuck with finding the optimal $\phi$

I'm sure this is a totally simple question but I can't quite figure it out… any help is greatly appreciated…

Best Answer

The step functions all add up in the same direction, since $\phi$ has the same sign in all $y_i$ – thus $q$ is minimal for all $\phi$ such that all step functions are $0$, which occurs for $\phi\lessgtr(k-x)/l$, where the inequality is $\lt$ or $\gt$ and $x$ is the greatest or least of the $x_i$, depending on whether $l$ is negative or positive, respectively.

Related Question