I am trying to maximize the following function
$$f(x)=-x$$
subject to $0 \leq x < c$, where $c > 0$ is a constant.
If I write out the Lagrangian and take the first-order condition, I get a $\lambda = -1$, but this violates the non-negativity of $\lambda \ge 0$ and complementary slackness $\lambda(c-x)=0$. Does this imply the constraint is slack/nonbinding ?
Lastly had the constraint looked like $x > c$, then $\lambda =1$ would have been the case.
But the constraint cannot bind because of strict inequality! Which implies $\lambda = 0$ must be true. Which is a contradiction.
The solution is obvious, I am simply wondering why common optimization techniques are not working with these two constraints for a linear objective function with a boundary solution.
To enforce the non-negativity constraint, let $x =: t^2$. To enforce the strict inequality constraint $x \leq c$, introduce a slack variable $s$ such that $t^2 + s^2 = c$. We then have the following QCQP
$$\begin{array}{ll} \text{maximize} & -t^2\\ \text{subject to} & t^2 + s^2 = c\end{array}$$
which can be rewritten as follows
$$\boxed{\begin{array}{ll} \text{minimize} & t^2\\ \text{subject to} & t^2 + s^2 = c\end{array}}$$
Define the Lagrangian
$$\mathcal L (t, s, \lambda) := t^2 + \lambda (t^2 + s^2 - c)$$
Taking the partial derivatives and finding where they vanish,
$$\begin{array}{rl} (1 + \lambda) t &= 0\\ \lambda s &= 0 \\ t^2 + s^2 &= c\end{array}$$
which produces two solutions
$\color{blue}{(t, s, \lambda) = (0, \pm \sqrt c, 0)}$, which corresponds to $\color{blue}{x = 0}$, where the minimum is attained.
$\color{blue}{(t, s, \lambda) = (\pm \sqrt c, 0,-1)}$, which corresponds to $\color{blue}{x = c}$, where the maximum is attained.