算法环境中的长算法拆分到多个页面

算法环境中的长算法拆分到多个页面

我的算法环境中的伪代码不适合放在一个页面上,而且我不想在算法环境中重写所有内容。有没有简单的方法可以将其拆分到多个页面上?这是我的代码:

\begin{algorithm}
    \KwData{$\varepsilon$, $k$, $P_1$, $P_2$, $\overline{Ct}$, $LB$, $UB$, $C_e$, $C_f$, $\epsilon$, and the set of distances $d_{ijh} \forall (ijh) \in D_1$ and $D_2$ }
    \KwResult{The optimal speed values ($v_{ijh}^{*}$) and the optimal objective function (OPT)}
    OPT $\leftarrow 0$\;
    Check the feasiblity of the $S_1$ constraint by substituting all of the variables by $UB$\;
    \eIf{$6\varepsilon+P_1+P_2+\dfrac{\sum_{(ijh)\in D_1} d_{ijh}}{UB}\leq\overline{Ct}$}{
        Find $\mu_1$\;
        \eIf{$\mu_1>0$}{
            Find $v_{ijh} \forall (ijh) \in D_1$\;
            \eIf{any of the speeds is $>UB$}{
                Consider the bounded speed case for $S_1$ and solve the problem\;
                Find $\mu_1$\;
                \eIf{$\mu_1>0$}{
                    Find $v_{ijh} \forall (ijh) \in D_1$\;
                    $v_{ijh}\leftarrow v_{ijh}^{*} \forall (ijh) \in D_1$\;
                    Calculate the obj. func.\;
                    OPT $\leftarrow$ obj. func.\;
                }{
                $S_1$ is inf.\;
            }       
            }{
            $v_{ijh}\leftarrow v_{ijh}^{*} \forall (ijh) \in D_1$\;
            Calculate the obj. func.\;
            OPT $\leftarrow$ obj. func.\;
        }
        }{
        $S_1$ is inf.\;
    }
    }{
    $S_1$ is inf.\;
}
Check the feasiblity of the $S_2$ constraints by substituting all of the variables by $UB$\;
\eIf{equations \eqref{cons32}, \eqref{cons33}, and \eqref{cons34} hold}{
        Find $\mu_1$ for Sit. 1\;
        \eIf{$\mu_1>0$}{
            Find $v_{ijh} \forall (ijh) \in D_2$\;
            \eIf{any of the speeds is $>UB$}{
                Consider the bounded speed case for Sit. 1 and solve the problem\;
                Find $\mu_1$\;
                \eIf{$\mu_1>0$}{
                    Find $v_{ijh} \forall (ijh) \in D_2$\;
                    Calculate the obj. func.\;
                        \eIf{obj. func. < OPT}{
                            $v_{ijh}\leftarrow v_{ijh}^{*} \forall (ijh) \in D_2$\;
                            OPT $\leftarrow$ obj. func.\;
                            Stop the algorithm\;
                        }{
                        Stop the algorithm\;
                    }
                }{
                $S_2$ is inf.\;
            }       
        }{
        $v_{ijh}\leftarrow v_{ijh}^{*} \forall (ijh) \in D_2$\;
        Calculate the obj. func.\;
        \eIf{obj. func. < OPT}{
            $v_{ijh}\leftarrow v_{ijh}^{*} \forall (ijh) \in D_2$\;
            OPT $\leftarrow$ obj. func.\;
            Stop the algorithm\;
        }{
        Stop the algorithm\;
    }
    }
}{
$S_2$ is inf.\;
}
}{
$S_1$ is inf.\;
}
\caption{Determining the roots of the function}
\end{algorithm}

相关内容