\documentstyle[12pt,eclepsf]{article}
\textheight 260mm
\topmargin -10mm
\textwidth 180mm
\oddsidemargin -7mm
\pagestyle{myheadings}

\markright{(Evolutionary Computatios)}

\begin{document}
\begin{large}

%---------------------------------------------------------------------
\clearpage
\begin{small}
\begin{center}
{\bf Pseudo Code for realization of NN to solve XOR by EC}
\end{center}
\begin{itemize}
\item[step-1:] Create an initial {\it population} of $N$ {\it chromosoms} with 6 {\it genes}
               each of whose values $\in [0,1]$ at random ({\it Initialization}).
\item[step-2:] Evaluate {\it fitness} of each of the $N$ chromosomes
               with the following procedurs ({\it Fitness Evaluation}).
   \begin{itemize}
   \item[(1)] Set $i=1$.
   \item[(2)] Pick up $i$-th chromosome from the population.
   \item[(3)] Create a NN ({\it phenotype}) from the chromsome.
   \item[(4)] Give the NN a pair of inputs $x_1 = 0$ and $x_2 = 0$.
      \begin{itemize}
      \item[$\cdot$] If $y = 0$ then $fitness(i) = fitness(i) + 0.25$
      \end{itemize}
   \item[(5)] Give the NN a pair of inputs $x_1 = 0$ and $x_2 = 1$.
      \begin{itemize}
      \item[$\cdot$] If $y = 1$ then $fitness(i) = fitness(i) + 0.25$
      \end{itemize}
   \item[(6)] Give the NN a pair of inputs $x_1 = 1$ and $x_2 = 0$.
      \begin{itemize}
      \item[$\cdot$] If $y = 1$ then $fitness(i) = fitness(i) + 0.25$
      \end{itemize}
   \item[(7)] Give the NN a pair of inputs $x_1 = 1$ and $x_2 = 1$.
      \begin{itemize}
      \item[$\cdot$] If $y = 0$ then $fitness(i) = fitness(i) + 0.25$
      \end{itemize}
   \item[(8)] Set $i=i+1$ and repeat from (2) to (8) until $i=N$.
   \end{itemize}
\item[step-3:] Sort $N$ chromosomes in the order of fitness value 
               (with the higher one at the top.)
\item[step-4:] Select two chromosomes from the upper half of the population 
               ({\it Truncate Selection}).
\item[step-5:] Create one child chromosome with the following two procedures 
               ({\it Reproduction}).
   \item[$\bullet$] {\it Uniform Cross-over}:
      \begin{itemize}
      \item[(1)]  Set $j = 1$.
      \item[(2)]  Produce a binary random-number $x(j) \in \{0.1 \}$.
      \item[(3)]  As the $j$-th gene of the child chromosome, if x(j) = 0 then
                    pick up the $j$-th genen from the 1st parent 
                    otherwise from the 2nd parent.
      \item[(4)]  Set $j=j+1$ and repeat from (2) to (4) until $j=6$.
      \end{itemize}
  \item[$\bullet$] {\it Mutation}:
      \begin{itemize}
      \item[(1)]  Set $j = 1$
      \item[(2)]  Produce a continuous random-number $y(j) \in [0.1)$.
      \item[(3)]  As the $j$-th gene of the child chromosome, if $y(j) < 0.02$ then
                     flip the gene value, i.e.,
         \begin{itemize}
         \item[$\cdot$]if the gene value is 1 then replace it with 0 and 
                       if the gene is 0 vice versa.
         \end{itemize}
      \item[(4)]  Set $j=j+1$ and repeat from (2) to (4) until $j=6$.
      \end{itemize}
\item[step-6:] Repeat from step-2 to step-6 until chromosome whose fitness is 1.00 appear.
\end{itemize}
\end{small}

\end{large}
\end{document}

