如果用LaTeX去寫最佳化問題(Optimization Problem)?
因為之前學長都是把最佳化問題做成一張圖檔,
然後直接貼在paper上,
並且有些圖檔在轉化的時候品質變得很差。
所以整理了一下別人的內容如下:
Constrained optimization problems are almost everywhere in engineering research.
A mathematical description of those problems with a single objective is
to minimize or maximize an objective function
over a set of decision variables under a set of constraints.
There are different ways to format optimization problems;
personally, I follow the format used in the book “Convex Optimization”
by Stephen Boyd and Lieven Vandenberghe.
For example, a general optimization problem has the form
This is generated by the following code:
\begin{equation*}
\begin{aligned}
& \underset{x}{\text{minimize}}
& & f_0(x) \\
& \text{subject to}
& & f_i(x) \leq b_i, \; i = 1, \ldots, m.
\end{aligned}
\end{equation*}
As seen in the code, the formatting is done by the aligned environment,
which is defined in the amsmath package, so you need to include the following line in the preamble:
\usepackage{amsmath} |
Unlike the tabular environment, in which you can specify the alignment of each column,
in the aligned environment, each column (separated by &) has a default alignment,
which alternates between right and left-aligned.
Therefore, all the odd columns are right-aligned and all the even columns are left-aligned.
We conclude with a real example:
The above problem is formulated for completing low-rank positive semidefinite matrices.
It is convex, or more precisely, it is a semidefinite program. The corresponding code is
\begin{equation*}
\begin{aligned}
& \underset{X}{\text{minimize}}
& & \mathrm{trace}(X) \\
& \text{subject to}
& & X_{ij} = M_{ij}, \; (i,j) \in \Omega, \\
&&& X \succeq 0.
\end{aligned}
\end{equation*}