LaTeX,伪代码

%------------------------------------
\begin{algorithm}
	\caption{HHS \cite{Branch1998}}
	\label{hhsa}
	\begin{algorithmic}[1]  %1表示每隔一行编号	
		\Require The original signal $x$.
		\Ensure  The energy-time-frequency distribution of $x$. 
		\Function{EMD}{$x, seg\_len$}
		\State $ N \gets length(x) / seg\_len$;
		\For {$i=1 \to i=N$}
		\State $seg(i) \gets x(1+(i-1)*seg\_len : i*seg\_len)$;
		\EndFor
		\EndFunction
	\end{algorithmic}
\end{algorithm}



\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm

\begin{algorithm}[h]
  \caption{Conjugate Gradient Algorithm with Dynamic Step-Size Control} % 名称
  \label{alg::conjugateGradient}
  \begin{algorithmic}[1]
    \Require
      $x_0$: initial individual, i.e, state;
      $x_0$: initial solution;
      $s$: step size;
    \Ensure
      optimal $x^{*}$
    \State initial $g_0=0$ and $d_0=0$;
    \Repeat
      \State compute gradient directions $g_k=\bigtriangledown f(x_k)$;
      \State compute Polak-Ribiere parameter $\beta_k=\frac{g_k^{T}(g_k-g_{k-1})}{\parallel g_{k-1} \parallel^{2}}$;
      \State compute the conjugate directions $d_k=-g_k+\beta_k d_{k-1}$;
      \State compute the step size $\alpha_k=s/\parallel d_k \parallel_{2}$;
    \Until{($f(x_k)>f(x_{k-1})$)}
  \end{algorithmic}
\end{algorithm}
\IncMargin{1em}
\begin{algorithm}
  \caption{XXXXXX)}\label{algo_disjdecomp}
  \SetKwData{Left}{left}\SetKwData{This}{this}\SetKwData{Up}{up}
  \SetKwFunction{Union}{Union}\SetKwFunction{FindCompress}{FindCompress}
  \SetKwInOut{Input}{input}\SetKwInOut{Output}{output}

  \Input{${d_j^{t_k}}^\ast $, ${S_i}^\ast $, ${RIE_k}$}
  \Output{${d_j^{t_k}}^\ast $, ${S_i}^\ast $, ${RIE_k}$}
  \BlankLine
  %\emph{${d_j^{t_k}}^\ast $ $\leftarrow$ $\emptyset$};  \emph{${S_i}^\ast $ $\leftarrow$ $\emptyset$} \;
 % Calculate the formulation that connects participants \emph{$ u_j $} and task \emph{$t_k$} \;
	\For {$\vee t_{1}, t_{2} \in\left(0, t_{n}\right]$}{
	\If {$T>0$}{
  \For{$k\leftarrow 1$ \KwTo $N_{ub}^t$}{
  \If {the number of subarea index for task {$ k > 1 $}}
  {Choose initial subarea \emph{$ a_i $} satisfying formula ()\;
  \lElse  {Apply right hand to find a set of subareas satisfying formula () based on both the current location of participant \emph{$u_j$} and the location of task \emph{$t_k$}}\;}
  \If {{$acc < 0 $}}
      {
        \If {{$ N_{index}^e > 0 $}}
          {Choose next subarea \;
        \lElse  {${S_i}^\ast $ $\leftarrow$ $a_i$;}}
      \lElse  {Choose next endpoint;}}
 }
  \If {{$ d_j^{t_k}  < D_j $}}
      {
        ${d_j^{t_k}}^\ast $ $\leftarrow$  $ d_j^{t_k} $;
      }
}
}
 return ${d_j^{t_k}}^\ast $, ${S_i}^\ast $

\end{algorithm}\DecMargin{1em}

在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值