【Latex】Algorithm排版

Navigator

Aglorithm

\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}

\begin{algorithm}[!t]
	\caption{Logic of BL series modeling}
	\label{alg_1}
	\begin{algorithmic}[1]
		\Require
		The variance-covariance matrix $\Sigma$ of sample data;
		The coefficient of uncertainty for sample data moments $\tau$;
		The uncertainty matrix of opinions $\Omega$;
		One of machine learning algorithm $M$;  
		\Ensure
		The optimal portfolio weights $\omega$;
		\State Training machine learning models by $M$ and Setting rules for predicting;
		...
		\State Solve objective function, get portfolio weights $\omega$;
		\label{code:fram:solve}\\
		\Return $\omega$;
	\end{algorithmic}
\end{algorithm}

算法伪代码显示效果如图
【Latex】Algorithm排版

References

Latex伪代码算法排版

上一篇:【周末AI课堂】基于贝叶斯推断的回归模型(代码篇)| 机器学习你会遇到的“坑”


下一篇:特定条件下傅里叶变换的性质