I want to compute the maximum of a function $f(x)$ with an equality constraint, $g(x) = 0$ and an inequality constraint, $h(x)\geq 0 $. I would know what to do with only an equality constraint, or only an inequality constraint, but not both together, and I can't find anything online.
With only an equality, I would formulate the Lagrangian as $L(x,\lambda) = f(x) + \lambda g(x)$. Then I would take the derivative w.r.t. $x$ and w.r.t $\lambda$ and equal both to zero and then compute the optimal x.
With only an inequality, I would formulate the Lagrangian as $L(x, \mu) = f(x) + \mu h(x)$. I then would formulate the KKT conditions as:
$\mu h(x) = 0$
$h(x) \geq 0$
$\mu \geq 0$
Then I would take the derivative w.r.t. $x$ and equal it to zero and try to formulate an optimal $x$ for the case of $\mu = 0, g(x) > 0$ and for the case $\mu > 0, g(x) = 0$.
First of all, is my approach to both cases correct? Second, I don't know how to continue for the case with an inequality and an equality. Should I combine both methods? So formulate $L(x, \mu, \lambda) = f(x) + \lambda g(x) + \mu h(x)$. Do the KKT conditions then remain exactly the same as above or should I also add some inequality with $\lambda$? Should I still take the derivative w.r.t. $\lambda$ and are there also still two cases as above? $(\mu > 0 , \mu = 0)$
Some insights would be greatly appreciated!
The langrangian is indeed $f(x) + \lambda g(x) + \mu h(x)$.
Take derivative with respect to $x$, we have $f'(x) + \lambda g'(x) + \mu h'(x) = 0$.
$\lambda$ corresponds to an inquality constraint, it remains a free variable. The KKT conditions remain the same.
$g(x)=0,\mu h(x) = 0, h(x) \ge 0, \mu \ge 0$