  We consider the optimization problem of minimizing $\int_{\Omega}|\nabla
u|^{p(x)}+ \lambda \chi_{\{u>0\}} dx$ in the class of functions
$W^{1,p(\cdot)}(\Omega)$ with $u-\phi_0\in W_0^{1,p(\cdot)}(\Omega)$, for a
given $\phi_0\geq 0$ and bounded. $W^{1,p(\cdot)}(\Omega)$ is the class of
weakly differentiable functions with $\int_\Omega |\nabla u|^{p(x)} dx<\infty$.
We prove that every solution $u$ is locally Lipschitz continuous, that it is a
solution to a free boundary problem and that the free boundary,
$\Omega\cap\partial\{u>0\}$, is a regular surface.
