I am an economist with some math background but not strong enough to solve this. I'm trying to solve:
\begin{align} \max_x\ f(x,y(x))=a\cdot y(x)+b\cdot g(x) \end{align} where \begin{align} y(x)=1(h(x)>0). \end{align} $h(x)$ is a linear function of $x$ and $a, b\in \mathbb{R}$ are constants. $x\in X$ and $X$ is a compact and continuous subset of $[0,1]$. $g(x)$ is a concave and differentiable function.
Now, my problem is that the optimal choice of $x$ depends on the value of $y(x)$, which depends on $x$.
I would like to know how to solve for, if possible, a closed-form solution. If it is impossible, what kind of algorithm should I use, and where can I find the essential readings to learn them.
EDIT: Thanks Robert for his great answer. Now I would just like to ask this follow-up question:
Can this method of solving for the maximum be adopted in a dynamic programming version of this problem? Say I want to maximise $V(x_t)=\max_{x_t} f(x_t,y_t(x_t))+\delta V(x_{t+1})$ but the constant $a$ now becomes a function of $x_{t−1}$? $\delta$ is a discount factor.
Essentially there are two separate problems to consider:
and then you take whichever of these solutions has the best objective value. To complicate matters, however, there is no guarantee that a maximum is attained in (2), as $\{x: h(x) > 0\}$ is not closed. If $a > 0$ and the maximum of $a + b g(x)$ on $\{x: h(x) \ge 0\}$ occurs only at a point where $h(x) = 0$, the problem does not have an optimal solution.