How to get the end in algorithm2e

I am using algorithm2e to typeset an algorithm. I like the appearance of the following, but I am not able to get the end to close the 

begin

. Any way to do this?

\documentclass{article}
\usepackage[longend,ruled,vlined]{algorithm2e}

\begin{document}

\begin{algorithm}
\caption{PHORIZONTAL Algorithm}\label{alg:phorizontal}
\KwIn{$R$: relation; $Pr$: set of simple predicates}
\KwOut{$F_{R}$: set of horizontal fragments of $R$}
\Begin{
$Pr' \leftarrow$COM\_MIN($R, Pr$) \;
determine the set $M$ of minterm predicates \;
determine the set $I$ of implications among $p_i \in Pr'$ \;
\ForEach{$m_{i} \in M$}{
\If{ $m_{i}$ is contradictory according to $I$}{$M \leftarrow M - m_{i}$}
}
$F_{R} = \{R_{i} | \sigma_{m_{i}} R, m_{i} \in M\}, \forall m_{i} \in M$ \;
}
\end{algorithm}
\end{document}


• Place \SetAlgoLined at the inception point of your algorithm. – M S Mar 30 '19 at 12:53
• THanks. Will try that as well. – ozsu Mar 30 '19 at 16:29

Referring to the answert by @egreg in End word is hidden in algorithm block , the vlined option suppresses the printing of “end”. Just remove the option:

\documentclass{article}
\usepackage[longend,ruled]{algorithm2e}

\begin{document}

\begin{algorithm}
\caption{PHORIZONTAL Algorithm}\label{alg:phorizontal}
\KwIn{$R$: relation; $Pr$: set of simple predicates}
\KwOut{$F_{R}$: set of horizontal fragments of $R$}
\Begin{
$Pr' \leftarrow$COM\_MIN($R, Pr$) \;
determine the set $M$ of minterm predicates \;
determine the set $I$ of implications among $p_i \in Pr'$ \;
\ForEach{$m_{i} \in M$}{
\If{ $m_{i}$ is contradictory according to $I$}{$M \leftarrow M - m_{i}$}
}
$F_{R} = \{R_{i} | \sigma_{m_{i}} R, m_{i} \in M\}, \forall m_{i} \in M$ \;
}
\end{algorithm}
\end{document}


• Thank you. I was hoping I could keep both, but apparently that is not possible. – ozsu Mar 30 '19 at 16:02