
\newpage
\begin{algorithm}[t]
\caption{چارچوب کلی الگوریتم (\lr{Simulated Annealing})}
\label{Algorithm 1}
\begin{latin}
\begin{algorithmic}[1]
      %\begin{flushleft}
          \STATE s ← s0; e ← E(s)                 // Initial state, energy.
\STATE    sbest ← s; ebest ← e             // Initial "best" solution.
\STATE     k ← 0                            // Energy evaluation count.
\STATE   while k < kmax and e > emax      // While time left , not good enought.
\STATE   T ← temperature(k/kmax)        // Temperature calculation.
  \STATE   snew ← neighbour(s)            // Pick some neighbour.
 \STATE    enew ← E(snew)                 // Compute its energy.  
  \STATE     if P(e, enew, T) > random() then  // Should we move to it?   
\STATE    s ← snew; e ← enew           // Yes, change state.   
    \STATE  if enew < ebest then           // Is this a new best?    
   \STATE  sbest ← snew; ebest ← enew   // Save 'new neighbour' to 'best' 
  \STATE   k ← k + 1                      // One more evaluation done.    
\STATE   return sbest                     // Return the best solution found.

\end{algorithmic}
\end{latin}
\end{algorithm}

\textbf{نمودار جریان الگوریتم شبیه سازی تبریدی}
\usepackage{tikz}
\usepackage{verbatim}
\begin{comment}
:Title: Assignment structure
The structure of an assignment illustrated using a flow chart. Labels are in Danish.
\end{comment}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
    decorations.pathreplacing,decorations.pathmorphing,shapes,%
    matrix,shapes.symbols}
\tikzset{
>=stealth',
  punktchain/.style={
    rectangle, 
    rounded corners, 
    draw=black, very thick,
    text width=10em, 
    minimum height=3em, 
    text centered, 
    on chain},
  line/.style={draw, thick, <-----},
  element/.style={
    tape,
    top color=white,
    bottom color=blue!50!black!60!,
    minimum width=8em,
    draw=blue!10!black!90, very thick,
    text width=10em, 
    minimum height=3.5em, 
    text centered, 
    on chain},
  every join/.style={->, thick,shorten >=1pt},
  decoration={brace},
  tuborg/.style={decorate},
  tubnode/.style={midway, right=20pt},
   decision/.style = { diamond, draw=blue, thick, fill=blue!20,
                        text width=5em, text badly centered,
                        inner sep=1pt, rounded corners },
    block/.style    = { rectangle, draw=blue, thick, 
                        fill=blue!20, text width=10em, text centered,
                        rounded corners, minimum height=2em },   
                            line/.style     = { draw, thick, ->, shorten >=2pt },                   
}

\begin{tikzpicture}
  [node distance=1cm,
  start chain=going below,]
     \node[punktchain, join] (intro) {start};
     \node[punktchain, join] (probf)      {Initialize Solution x};
     \node[punktchain, join] (investeringer)      {Create neighborhood solution y};                                
     \node[punktchain, join] (perfekt) {If $\Delta E<0$ then accept y Otherwise,accept it by the probability $exp (-\Delta E/T)$};
   
   \node [punktchain,decision,join] (uiddes1)                         {Thermodynamic balancing ?};                

    \node [punktchain,decision,join] (uiddes)      {Does termination condition met ?};
    \begin{scope}[start branch=hoejre,]
      \node (finans) [punktchain, on chain=going right] {Decreasing T gradually};
    \end{scope}
% \draw[|-,-|,->, thick,] (finans.south) |-+(0,-1em)-| (investeringer.north);
  \node[punktchain, join] (investeringer3)      {Stop};
    \begin{scope} [every path/.style=line]
 \path (uiddes)   --++  (+2,0) node [near start] {no} |-( finans);
    \path (uiddes)   --    node [near start] {yes} (investeringer3);
  \path (uiddes1)    --    node [near start] {yes} (uiddes);
 \path (uiddes1)--++(+5,0) node [near start] {no} |-(investeringer);
 \path (finans)   --++  (+3,0) node [near start] {} |-( investeringer);

  \end{scope}
  \end{tikzpicture}