I trying to minimize this objective function.
$$J(x) = \frac{1}{2}x^THx + c^Tx$$
First I thought I could use Newtown's Method, but later I found Gradient Descent, which is more suitable for this type of problem.
I first turn $J(x)$ into the deritivate.
$$\Delta J(x) = x^TH + c^T$$
And I want to find $x$ when $\Delta J(x)$ is small as possible. I could use gradient descent for that.
$$x_{n+1} = x_n - \gamma \Delta J(x_n)$$
Where $\gamma$ is a small number (tuning factor in an applied engineering world). Also $x_n$ is known.
But how about constraints? Can I juse an if-statement on $x_{n+1}$ to check if $x$ is reach its limits?
Example. Assume that $x \in \Re^2$. Then I can take two if statements.
If x(0) < 0, then x(0) = 0. If x(1) < 0, then x(0) = 0.
If x(0) > 10, then x(0) = 10. If x(1) > 10, then x(0) = 10.
Or what do you think about this?