For better read experience, download or clone this project, and read this file locally
-
GCC version supports at leat C++ standard 11
-
C++ Eigen Library, version 3.3.7,(already included in this project)
In this project, the sample target function is
The image of this problem is as follows.
It is easy to find the answer for the problem with this image. But for algorithm, it needs to search in the valid area.
In this project, interior point method is used with Newton direction. Firstly, we transform the format of this problem into a general one.
Let $c=\left(\begin{matrix} 1\ 1 \end{matrix}\right), A=\left(\begin{matrix} 1 & 2\ 2 & 1\ -1 & 0\ 0 & -1 \end{matrix}\right),b=\left(\begin{matrix} 1\ 1\ 0\ 0 \end{matrix}\right),X=\left(\begin{matrix} x\ y \end{matrix}\right)$.
Then, the problem can be written as
Applying Lagrange, we can get
$$I(x)=\left{\begin{matrix}
x, & x \leq 0\
+\infty,& x > 0
\end{matrix}\right.$$
then the minumum result achieved must be valid. However, this function indifferentiable points, a common method is using
We can then rewrite the target function as:
Then, in order to get the direction in iterations,
For each
Now, all the needed variables are calculated, when using this algorithm, we need to find a start point. In this project we choose
Each point in the above graph is a change of the start point in the algorithm. We can see that the algorithm converges to