使用 IEEE Access Class 中的 algorithm2e 包的长算法超过一页

使用 IEEE Access Class 中的 algorithm2e 包的长算法超过一页

我的长算法超出了一页,无法放在这一页上。我正在使用algorithm2e包和 IEEE Access 类。如何将这个长算法放在一页上?

\documentclass{ieeeaccess}
%\usepackage{siunitx}
\usepackage{graphicx
%\usepackage{algorithmic}
\usepackage[lined,boxed,ruled,commentsnumbered]{algorithm2e}
\begin{document}



\begin{algorithm}
\tiny
\color{red}\caption{HGPDO Algorithm steps}
\label{algo:HGPDO Algorithm}
\textbf{A.} \textbf{Algorithm Inputs: } RTP, operation time duration, energy usage pattern, wind speed in \(m/s\), temperature, solar irradiance, efficiency, bio-gas availability, prior-scheduling pattern of appliances, BSS, CHP and EVSS initialization.\newline
\textbf{B. Parameters initialization:} Number of iterations, population size, $P_m$, $P_c$, $N$, $W_i$, $C_1$, $C_2$, $dimMin$, $dimMax$, $V_{min}$, $V_{max}$, $R_t$, $n$, $g$, $a$, maximum and minimum velocity, number of swarms, global and local pulls, initial and final momentum weights, cost per hour, PAR, $T_C$, $V_C$ and emission of CO$_2$.\newline
\For {Time=1:24 }
{
For initial position\newline
\For {hour=1:swarm}
{
\For {i=1:n}
{
\If {rand>0.7}
{
X=1
}
\Else
{
X=0
}
}
}
For initial velocity\newline
\For {vel1=1:10}
{
\For {vel2=1:6}
{
\If {Thour=0}
{
H=0
}
}
}
return $V_{best1}$, return $P_{best1}$\newline
For initial velocity and initial position,
Calculate  $Vel_{best1}$ and  $Pos_{best1}$\newline
 Generate population for WDO\newline
Assign position and velocity\newline
 \Begin
 {
 Based on $1^{st}$ position and velocity do evaluation of fitness  function\newline
        Using equations (\ref{eq:EQ1}) and (\ref{eq:eq2}) update the velocity and position respectively \newline
        $Vel_{best2}$, $Pos_{best2}$\newline
       based on $2_{nd}$ best position and velocity do evaluation of fitness function\newline
       Using equation (\ref{eq:eq3})-(\ref{eq:eq6}) update velocity,   position, check limits and boundaries, respectively \newline
       Evaluate the fitness for WDO \newline
       Check for $T_c$ and $V_c$ feasibility:\newline
      \If  {thermal comfort and visual comfort is less than WDO scheduled comfort}
      {
       Crossover $w_{best}$ and $g_{best}$, $Crossover_{result}$ = $cr_g$\newline
       }
        \Else
      {
        Crossover $Pos_{best1}$ and $Pos_{best2}$, $Crossover_{result}$ = $cr_g$, Mutate $cr_g$, $Mutation_{result}$=$global_{best}$
    }
    }

 returned $global_{best}$\newline
\textbf{C. Compute objectives: EBC, PAR, Carbon emission and UC}\newline
 \Begin
{
 \textbf{ 1. Compute user comfort} \newline
       \For {returned $global_{best}$, to calculate UC}
       {
           \textbf{a.} Usage power schedule=$global_{best}$ \newline
           \textbf{b.} Compute TC using equation (\ref{eq:eq41})\newline
           \textbf{c.} Compute VC using equation (\ref{eq:eq39})\newline
           \textbf{d.} Compute delay comfort using equation (\ref{eq:eq38})\newline
           \textbf{e.} Compute air quality comfort by equation (\ref{eq:eq42})
     }
      \textbf{2. Compute electricity cost} \newline
       \For {returned $global_{best}$, to calculate cost}
       {
        \textbf{a.} Only EG: $L_t=power$*$global_{best}$\newline
        \textbf{b.} EG with RES: Lt(RES)=Load-Energy from RES\newline
        \textbf{c. }EG with RES and BSS: Lt(RES and BSS)=Load-Energy procured from RES-BSS discharge\newline
        \textbf{d.} Compute EBC by Equation (\ref{eq:eq13}) for Case a, b and c
        }
          \textbf{3. Compute CO$_2$ emission}\newline
        \For {returned global-best, to calculate CO$_2$ emission}
        {
       \textbf{ a.} Only EG: average cost excluding RES and BSS\newline
       \textbf{b.} EG with RES: average cost including RES\newline
       \textbf{ c.} EG with RES and BSS: average cost including both RES and BSS\newline
       \textbf{d.} Compute CO$_2$ by Equation (\ref{eq:eq37}) for Case a, b and c
     }
      \textbf{4. Compute PAR}\newline
       \For {Operated returned global best, to calculate PAR}
       {
       \textbf{ a.} Only EG: $L_t=Power$\times$global_{best}$\newline
       \textbf{b.} EG and RES: Lt(RES)=Load- Procured energy by RES\newline
       \textbf{c.} EG, RES and BSS: Lt(RES and BSS)=Load- Procured energy from RES-BSS discharge\newline
       \textbf{d.} Compute PAR by Equation (\ref{eq:eq36}) for Case a, b and c
          }
    }
    }
\end{algorithm}
\end{document} 

答案1

来自 algorithm2e 文档:“警告:算法不能被切割,因此如果在给定位置没有足够的空间放置带有 H 选项的算法,LATEX 将放置一个空白并将算法放在下一页”

因此,我认为最好的选择是将算法嵌入到 minipage 或 resizebox 中。请参阅如何缩放算法以适合一个框架并同时位于框架的中心?

相关内容