같은 행에 그림이 포함된 알고리즘을 넣는 방법은 무엇입니까?

같은 행에 그림이 포함된 알고리즘을 넣는 방법은 무엇입니까?

알고리즘 코드와 도형이 있는데, 이를 같은 행에 함께 배치하려고 합니다. 코드는 다음과 같습니다.

\centering
\caption{Auto-entrenamiento}
\label{alg_self}
\begin{algorithmic}
\State $m_0 \gets entrenar\_modelo(\mathcal{D}_{l})$
\Repeat
    \State $m \gets entrenar\_modelo(\mathcal{D}_{l})$
    \For {$x \in \mathcal{D}_{u}$}
        \If {max $m(x) > \tau$}
            \State $\mathcal{D}_{l} \gets \mathcal{D}_{l} \cup \{(x, p(x))\}$
        \EndIf
    \EndFor
\Until {las predicciones no sean confiables}
\end{algorithmic}
\end{algorithm}

\begin{figure}[htp]
    \centering
    \includegraphics[scale=0.35]{imagenes/ssl_self2.png} 
    \vspace{0.1cm} 
    \caption{Método semi-supervisado de auto-entrenamiento}
    \label{fig:ssl_self}
\end{figure}

답변1

더 짧은 선을 그리 도록 설득하는 끔찍한 방법입니다 algorithm.

\documentclass{article}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{graphicx}

\begin{document}

\begin{figure}

\begin{minipage}{0.45\textwidth}
\begin{algorithm}[H]
\hsize=\textwidth % <--------- THE HACK!
\caption{Auto-entrenamiento}
\label{alg_self}
\begin{algorithmic}
\State $m_0 \gets \textit{entrenar\_modelo}(\mathcal{D}_{l})$
\Repeat
    \State $m \gets \textit{entrenar\_modelo}(\mathcal{D}_{l})$
    \For {$x \in \mathcal{D}_{u}$}
        \If {max $m(x) > \tau$}
            \State $\mathcal{D}_{l} \gets \mathcal{D}_{l} \cup \{(x, p(x))\}$
        \EndIf
    \EndFor
\Until {las predicciones no sean confiables}
\end{algorithmic}
\end{algorithm}
\end{minipage}\hfill
\begin{minipage}{0.45\textwidth}
    \centering
    \includegraphics[scale=0.35]{example-image}
    \vspace{0.1cm} 
    \caption{Método semi-supervisado de auto-entrenamiento}
    \label{fig:ssl_self}
\end{minipage}
\end{figure}

\end{document}

\textit수학에서 이탤릭체로 된 단어를 원할 경우 사용하세요 .

여기에 이미지 설명을 입력하세요

관련 정보