\documentclass[11pt,twoside]{article}\makeatletter

\IfFileExists{xcolor.sty}%
  {\RequirePackage{xcolor}}%
  {\RequirePackage{color}}
\usepackage{colortbl}
\usepackage{wrapfig}
\usepackage{ifxetex}
\ifxetex
  \usepackage{fontspec}
  \usepackage{xunicode}
  \catcode`⃥=\active \def⃥{\textbackslash}
  \catcode`❴=\active \def❴{\{}
  \catcode`❵=\active \def❵{\}}
  \def\textJapanese{\fontspec{Noto Sans CJK JP}}
  \def\textChinese{\fontspec{Noto Sans CJK SC}}
  \def\textKorean{\fontspec{Noto Sans CJK KR}}
  \setmonofont{DejaVu Sans Mono}
  
\else
  \IfFileExists{utf8x.def}%
   {\usepackage[utf8x]{inputenc}
      \PrerenderUnicode{–}
    }%
   {\usepackage[utf8]{inputenc}}
  \usepackage[english]{babel}
  \usepackage[T1]{fontenc}
  \usepackage{float}
  \usepackage[]{ucs}
  \uc@dclc{8421}{default}{\textbackslash }
  \uc@dclc{10100}{default}{\{}
  \uc@dclc{10101}{default}{\}}
  \uc@dclc{8491}{default}{\AA{}}
  \uc@dclc{8239}{default}{\,}
  \uc@dclc{20154}{default}{ }
  \uc@dclc{10148}{default}{>}
  \def\textschwa{\rotatebox{-90}{e}}
  \def\textJapanese{}
  \def\textChinese{}
  \IfFileExists{tipa.sty}{\usepackage{tipa}}{}
\fi
\def\exampleFont{\ttfamily\small}
\DeclareTextSymbol{\textpi}{OML}{25}
\usepackage{relsize}
\RequirePackage{array}
\def\@testpach{\@chclass
 \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
  \ifnum \@lastchclass=7 5 \else
   \ifnum \@lastchclass=8 \tw@ \else
    \ifnum \@lastchclass=9 \thr@@
   \else \z@
   \ifnum \@lastchclass = 10 \else
   \edef\@nextchar{\expandafter\string\@nextchar}%
   \@chnum
   \if \@nextchar c\z@ \else
    \if \@nextchar l\@ne \else
     \if \@nextchar r\tw@ \else
   \z@ \@chclass
   \if\@nextchar |\@ne \else
    \if \@nextchar !6 \else
     \if \@nextchar @7 \else
      \if \@nextchar (8 \else
       \if \@nextchar )9 \else
  10
  \@chnum
  \if \@nextchar m\thr@@\else
   \if \@nextchar p4 \else
    \if \@nextchar b5 \else
   \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
   \fi \fi  \fi  \fi  \fi  \fi  \fi \fi \fi \fi \fi \fi}
\gdef\arraybackslash{\let\\=\@arraycr}
\def\@textsubscript#1{{\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
\def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}}
\def\abbr{}
\def\corr{}
\def\expan{}
\def\gap{}
\def\orig{}
\def\reg{}
\def\ref{}
\def\sic{}
\def\persName{}\def\name{}
\def\placeName{}
\def\orgName{}
\def\textcal#1{{\fontspec{Lucida Calligraphy}#1}}
\def\textgothic#1{{\fontspec{Lucida Blackletter}#1}}
\def\textlarge#1{{\large #1}}
\def\textoverbar#1{\ensuremath{\overline{#1}}}
\def\textquoted#1{‘#1’}
\def\textsmall#1{{\small #1}}
\def\textsubscript#1{\@textsubscript{\selectfont#1}}
\def\textxi{\ensuremath{\xi}}
\def\titlem{\itshape}
\newenvironment{biblfree}{}{\ifvmode\par\fi }
\newenvironment{bibl}{}{}
\newenvironment{byline}{\vskip6pt\itshape\fontsize{16pt}{18pt}\selectfont}{\par }
\newenvironment{citbibl}{}{\ifvmode\par\fi }
\newenvironment{docAuthor}{\ifvmode\vskip4pt\fontsize{16pt}{18pt}\selectfont\fi\itshape}{\ifvmode\par\fi }
\newenvironment{docDate}{}{\ifvmode\par\fi }
\newenvironment{docImprint}{\vskip 6pt}{\ifvmode\par\fi }
\newenvironment{docTitle}{\vskip6pt\bfseries\fontsize{22pt}{25pt}\selectfont}{\par }
\newenvironment{msHead}{\vskip 6pt}{\par}
\newenvironment{msItem}{\vskip 6pt}{\par}
\newenvironment{rubric}{}{}
\newenvironment{titlePart}{}{\par }

\newcolumntype{L}[1]{){\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{){\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{){\raggedleft\arraybackslash}p{#1}}
\newcolumntype{P}[1]{){\arraybackslash}p{#1}}
\newcolumntype{B}[1]{){\arraybackslash}b{#1}}
\newcolumntype{M}[1]{){\arraybackslash}m{#1}}
\definecolor{label}{gray}{0.75}
\def\unusedattribute#1{\sout{\textcolor{label}{#1}}}
\DeclareRobustCommand*{\xref}{\hyper@normalise\xref@}
\def\xref@#1#2{\hyper@linkurl{#2}{#1}}
\begingroup
\catcode`\_=\active
\gdef_#1{\ensuremath{\sb{\mathrm{#1}}}}
\endgroup
\mathcode`\_=\string"8000
\catcode`\_=12\relax

\usepackage[a4paper,twoside,lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in,marginparwidth=0.75in]{geometry}
\usepackage{framed}

\definecolor{shadecolor}{gray}{0.95}
\usepackage{longtable}
\usepackage[normalem]{ulem}
\usepackage{fancyvrb}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{marginnote}

\renewcommand{\@cite}[1]{#1}


\renewcommand*{\marginfont}{\itshape\footnotesize}

\def\Gin@extensions{.pdf,.png,.jpg,.mps,.tif}

  \pagestyle{fancy}

\usepackage[pdftitle={Robotic Behavior based on Formal Grammars},
 pdfauthor={}]{hyperref}
\hyperbaseurl{}

	 \paperwidth210mm
	 \paperheight297mm
              
\def\@pnumwidth{1.55em}
\def\@tocrmarg {2.55em}
\def\@dotsep{4.5}
\setcounter{tocdepth}{3}
\clubpenalty=8000
\emergencystretch 3em
\hbadness=4000
\hyphenpenalty=400
\pretolerance=750
\tolerance=2000
\vbadness=4000
\widowpenalty=10000

\renewcommand\section{\@startsection {section}{1}{\z@}%
     {-1.75ex \@plus -0.5ex \@minus -.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
     {-1.75ex\@plus -0.5ex \@minus- .2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\Large}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
     {-1.5ex\@plus -0.35ex \@minus -.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\large}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
     {-1ex \@plus-0.35ex \@minus -0.2ex}%
     {0.5ex \@plus .2ex}%
     {\reset@font\normalsize}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
     {1.5ex \@plus1ex \@minus .2ex}%
     {-1em}%
     {\reset@font\normalsize\bfseries}}


\def\l@section#1#2{\addpenalty{\@secpenalty} \addvspace{1.0em plus 1pt}
 \@tempdima 1.5em \begingroup
 \parindent \z@ \rightskip \@pnumwidth 
 \parfillskip -\@pnumwidth 
 \bfseries \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}\par
 \endgroup}
\def\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
\def\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
\def\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}}
\def\l@subparagraph{\@dottedtocline{5}{10em}{5em}}
\@ifundefined{c@section}{\newcounter{section}}{}
\@ifundefined{c@chapter}{\newcounter{chapter}}{}
\newif\if@mainmatter 
\@mainmattertrue
\def\chaptername{Chapter}
\def\frontmatter{%
  \pagenumbering{roman}
  \def\thechapter{\@roman\c@chapter}
  \def\theHchapter{\roman{chapter}}
  \def\thesection{\@roman\c@section}
  \def\theHsection{\roman{section}}
  \def\@chapapp{}%
}
\def\mainmatter{%
  \cleardoublepage
  \def\thechapter{\@arabic\c@chapter}
  \setcounter{chapter}{0}
  \setcounter{section}{0}
  \pagenumbering{arabic}
  \setcounter{secnumdepth}{6}
  \def\@chapapp{\chaptername}%
  \def\theHchapter{\arabic{chapter}}
  \def\thesection{\@arabic\c@section}
  \def\theHsection{\arabic{section}}
}
\def\backmatter{%
  \cleardoublepage
  \setcounter{chapter}{0}
  \setcounter{section}{0}
  \setcounter{secnumdepth}{2}
  \def\@chapapp{\appendixname}%
  \def\thechapter{\@Alph\c@chapter}
  \def\theHchapter{\Alph{chapter}}
  \appendix
}
\newenvironment{bibitemlist}[1]{%
   \list{\@biblabel{\@arabic\c@enumiv}}%
       {\settowidth\labelwidth{\@biblabel{#1}}%
        \leftmargin\labelwidth
        \advance\leftmargin\labelsep
        \@openbib@code
        \usecounter{enumiv}%
        \let\p@enumiv\@empty
        \renewcommand\theenumiv{\@arabic\c@enumiv}%
	}%
  \sloppy
  \clubpenalty4000
  \@clubpenalty \clubpenalty
  \widowpenalty4000%
  \sfcode`\.\@m}%
  {\def\@noitemerr
    {\@latex@warning{Empty `bibitemlist' environment}}%
    \endlist}

\def\tableofcontents{\section*{\contentsname}\@starttoc{toc}}
\parskip0pt
\parindent1em
\def\Panel#1#2#3#4{\multicolumn{#3}{){\columncolor{#2}}#4}{#1}}
\newenvironment{reflist}{%
  \begin{raggedright}\begin{list}{}
  {%
   \setlength{\topsep}{0pt}%
   \setlength{\rightmargin}{0.25in}%
   \setlength{\itemsep}{0pt}%
   \setlength{\itemindent}{0pt}%
   \setlength{\parskip}{0pt}%
   \setlength{\parsep}{2pt}%
   \def\makelabel##1{\itshape ##1}}%
  }
  {\end{list}\end{raggedright}}
\newenvironment{sansreflist}{%
  \begin{raggedright}\begin{list}{}
  {%
   \setlength{\topsep}{0pt}%
   \setlength{\rightmargin}{0.25in}%
   \setlength{\itemindent}{0pt}%
   \setlength{\parskip}{0pt}%
   \setlength{\itemsep}{0pt}%
   \setlength{\parsep}{2pt}%
   \def\makelabel##1{\upshape ##1}}%
  }
  {\end{list}\end{raggedright}}
\newenvironment{specHead}[2]%
 {\vspace{20pt}\hrule\vspace{10pt}%
  \phantomsection\label{#1}\markright{#2}%

  \pdfbookmark[2]{#2}{#1}%
  \hspace{-0.75in}{\bfseries\fontsize{16pt}{18pt}\selectfont#2}%
  }{}
      \def\TheFullDate{2018-01-15 (revised: 15 January 2018)}
\def\TheID{\makeatother }
\def\TheDate{2018-01-15}
\title{Robotic Behavior based on Formal Grammars}
\author{}\makeatletter 
\makeatletter
\newcommand*{\cleartoleftpage}{%
  \clearpage
    \if@twoside
    \ifodd\c@page
      \hbox{}\newpage
      \if@twocolumn
        \hbox{}\newpage
      \fi
    \fi
  \fi
}
\makeatother
\makeatletter
\thispagestyle{empty}
\markright{\@title}\markboth{\@title}{\@author}
\renewcommand\small{\@setfontsize\small{9pt}{11pt}\abovedisplayskip 8.5\p@ plus3\p@ minus4\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus2\p@
\belowdisplayshortskip 4\p@ plus2\p@ minus2\p@
\def\@listi{\leftmargin\leftmargini
               \topsep 2\p@ plus1\p@ minus1\p@
               \parsep 2\p@ plus\p@ minus\p@
               \itemsep 1pt}
}
\makeatother
\fvset{frame=single,numberblanklines=false,xleftmargin=5mm,xrightmargin=5mm}
\fancyhf{} 
\setlength{\headheight}{14pt}
\fancyhead[LE]{\bfseries\leftmark} 
\fancyhead[RO]{\bfseries\rightmark} 
\fancyfoot[RO]{}
\fancyfoot[CO]{\thepage}
\fancyfoot[LO]{\TheID}
\fancyfoot[LE]{}
\fancyfoot[CE]{\thepage}
\fancyfoot[RE]{\TheID}
\hypersetup{citebordercolor=0.75 0.75 0.75,linkbordercolor=0.75 0.75 0.75,urlbordercolor=0.75 0.75 0.75,bookmarksnumbered=true}
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}

\date{}
\usepackage{authblk}

\providecommand{\keywords}[1]
{
\footnotesize
  \textbf{\textit{Index terms---}} #1
}

\usepackage{graphicx,xcolor}
\definecolor{GJBlue}{HTML}{273B81}
\definecolor{GJLightBlue}{HTML}{0A9DD9}
\definecolor{GJMediumGrey}{HTML}{6D6E70}
\definecolor{GJLightGrey}{HTML}{929497} 

\renewenvironment{abstract}{%
   \setlength{\parindent}{0pt}\raggedright
   \textcolor{GJMediumGrey}{\rule{\textwidth}{2pt}}
   \vskip16pt
   \textcolor{GJBlue}{\large\bfseries\abstractname\space}
}{%   
   \vskip8pt
   \textcolor{GJMediumGrey}{\rule{\textwidth}{2pt}}
   \vskip16pt
}

\usepackage[absolute,overlay]{textpos}

\makeatother 
      \usepackage{lineno}
      \linenumbers
      
\begin{document}

             \author[1]{J.L.  Briseno}

             \affil[1]{  Center for Scientific Research and Higher Education of Ensenada}

\renewcommand\Authands{ and }

\date{\small \em Received: 16 December 2017 Accepted: 1 January 2018 Published: 15 January 2018}

\maketitle


\begin{abstract}
        


Formal grammars, studied by N. Chomsky for the definition of equivalence with languages and models of computing, have been a useful tool in the development of compilers, programming languages, natural language processing, automata theory, etc. The words or symbols of these formal languages can denote deduced actions that correspond to specific behaviors of a robotic entity or agent that interacts with an environment. The primary objective of this paper pretend to represent and generate simple behaviors of artificial agents. Reinforcement learning techniques, grammars, and languages, as defined based on the model of the proposed system were applied to the typical case of the ideal route on the problem of artificial ant. The application of such techniques proofs the viability of building robots that might learn through interaction with the environment.

\end{abstract}


\keywords{context-free grammars, robotic behavior, intelligent agent, machine learning.}

\begin{textblock*}{18cm}(1cm,1cm) % {block width} (coords) 
\textcolor{GJBlue}{\LARGE Global Journals \LaTeX\ JournalKaleidoscope\texttrademark}
\end{textblock*}

\begin{textblock*}{18cm}(1.4cm,1.5cm) % {block width} (coords) 
\textcolor{GJBlue}{\footnotesize \\ Artificial Intelligence formulated this projection for compatibility purposes from the original article published at Global Journals. However, this technology is currently in beta. \emph{Therefore, kindly ignore odd layouts, missed formulae, text, tables, or figures.}}
\end{textblock*}


\let\tabcellsep& 	 	 		 
\section[{Introduction}]{Introduction}\par
dvances in artificial intelligence (AI) have supported to the development of sciences and disciplines whose influence leads to experimentation and application of new techniques that seek an optimal solution or high performance, depending on the problem that has arisen. The problem of emulating human navigation skills in an environment involves the analysis of behaviors of the humans, which are mapped to cases of robots or humanoids to develop in them mechanisms needed to help find solutions to specific problems. Such mechanisms form the structure of models that encompass interactions between the modules involved in the solution of such a problem. In this paper, the proposed model follows the basic structure defined by Russell and Norvig on learning agents \hyperref[b0]{[1]}; then considering modules of events and actions that interact with the environment through sensors and actuators. The functionality of such modules lies in the implementation of context-free grammars as a tool for describing and build robotic behaviors. The purpose of this work is to manage behaviors of agents acting within an environment, based on grammars and formal languages. Some work in this direction will be mentioned briefly in the next section. In section 3 the fundamental principles of regular grammars will be addressed; as they are used to describe knowledge about events and actions, as well as determine the language of valid words that define behavior. Section 4 describes the fundamental concepts of grammars, terminology, and reinforcement learning (RL) used in finding the solution on the Santa Fe Trail problem \hyperref[b1]{[2]}. The last two sections 5 and 6 show the results and conclusions respectively. 
\section[{II.}]{II.} 
\section[{Related Work}]{Related Work}\par
In the recent years, few approaches based on formal grammars have been used to learn behaviors in robot navigation problems. Some of these approaches outline the use of bio-inspired mechanisms to build systems with human-like behavior based on spiking neural networks (SNN) \hyperref[b2]{[3]}; Others that use the RL, Bayesian techniques, and decision trees, rely on human experience and pretend that a robot agent learns to make decisions in generalized models \hyperref[b3]{[4]}, \hyperref[b4]{[5]}. Otherwise, the ART system \hyperref[b5]{[6]} considers learning behaviors as a classification problem, and uses a neural network to increase the learning capacity without losing earlier information of other behaviors when they are learning new ones; also integrated audio, and vision models in the current perception of the behavior are observed. Within the first work on behavior and autonomy of robots, in \hyperref[b6]{[7]} these issues are described based on the representation in nets and using genetic algorithms (GA) as a method to search movements which are learned and generated from the states involved in a net. Regarding the generation of behaviors in \hyperref[b7]{[8]} are proposed architectures that emulate cortical regions of the human brain which relate modules perception declarative memory, and objectives management. Such modules supported in production systems respond to patterns of information stored on the work memory engaged. In \hyperref[b8]{[9]}, behaviors are in software architecture designed to handle reusable components where each of them has a specific role based primarily on finite state machines (FSM). On the other hand, below the context of using of formal languages for generating robotic behaviors, Manikonda, et al., \hyperref[b9]{[10]} propose techniques and models with differential equations based on kinetic state machines. In more recent work, Dantam and Stillman \hyperref[b10]{[11]} formally develop the concept Grammar Movements doing a complete linguistic analysis for robotic control, being very similar some of its specific goals with the particular implementation presented in this article. 
\section[{III. Fundamentals of Languages, Grammars and System Model}]{III. Fundamentals of Languages, Grammars and System Model}\par
The languages described by formal grammars are of great practical importance in the definitions of programming languages, formalization of the rules of the grammars based on the parsing, simplified translations of languages, and applications for preprocessing chains (words). Each language determined by an abstract computing model: finite automaton, pushdown automata, linear bounded automata, and Turing machines, prescribes regular, context-free (CFLs), context-sensitive, and recursively enumerable languages, respectively. 
\section[{a) Context-Free Grammars}]{a) Context-Free Grammars}\par
A context-free grammar (CFG) is a finite set of variables (non-terminals or syntactic categories) where each represents a language. These languages represented by the variables are described recursively each other and regard also primary symbols called terminals. Rules that relate these variables are called productions. Formally a CFG is denoted as G = (V, T, P, S), where V and T are finite sets of variables and terminals respectively. Each production in P is of the form A? ? where A is a variable which can be replaced by a chain (?) of symbols regardless of the context, ? must be not empty, with symbols of the set (V?T)*1, S is a special variable called start symbol. Some common conventions for grammars are a) the capital letters A, B, that can be variables or terminals. d) The lowercase letters u, v, w, and z denote terminals. e) The lowercase Greek letters ?, ?, and ? denote strings of variables and terminals. For further explanation on these issues see Hopcroft and Ullman \hyperref[b11]{[12]}.\par
In this paper, we will define in the next section, Robotic Behavior Grammar (RBG) according to the formal description of the CFG. 
\section[{b) System Model}]{b) System Model}\par
Respect to the system model, this paper follows the general concept of a learning agent according to \hyperref[b0]{[1]} so that the functional mapping defines the relevant modules regarding specific applications addressed by the RBG. The model consists of four main components (Figure \hyperref[fig_0]{1}) linking an agent and an environment. The events module tells the element learning how things are happening about a standard fixed performance, in this case, the target's progress of the agent. In the RBG model, the sensors detect occurrences of events in the environment which may be a valid event, a non-event, and a repeated event. If a valid event occurs in this environment, the events module recognizes it as a variable V corresponding to a fact derivable Ed then defining it as VEd and verifying that belongs to the set of productions to the derivation of events PEd. The learning element will process that information to decide whether the "word" (event or fact) is valid in the language generated by the grammar used. The performance module then looks for the production P, which relates an action a, and a derivate event e in the set of productions of actions to events PEa. Thus, an external operation carried out by the actor in the environment is selected. As the event is null when it was not generated or fired any event; or repeated, when the agent is in the same state as a previous one, the expansion of variables continues without affecting the The process of the agent's behavior ends when its achieved the goal, or that means reaches a predetermined time limit. For a more versatile agent, the problems generator module takes the current knowledge and can formulate new rules to new situations or to find particular areas of behavior that are susceptible to improvement.\par
IV. 
\section[{Terminology and Concepts a) Grammars}]{Terminology and Concepts a) Grammars}\par
A grammar of robotic behavior RBG = (V, ?, P, S) define the components as follows: V is the set of variables V = \{VAc, VEa, VEd, Vaux\} where VAc are variables representing complex actions, VEa are variables representing events or states, VEd is called a derivation variable of facts, and Vaux are auxiliary variables. S is the symbol of the start function, which belongs to the subset VEa. ? contains the terminal symbols for the primary actions of the agent. The symbol P are the productions divided into several subgroups directly related to subsets of V. These productions are: PAc, which are productions of complex actions; PEa, which are productions to select actions for events; PEd indicating outputs to derivation of events; Paux indicating auxiliary productions for operations; PSEenv indicating productions of extension, and PSEnuln productions of suppression. 
\section[{b) Generating behaviors}]{b) Generating behaviors}\par
The RBG can generate behaviors using grammars derivation process, which depends on the different subsets of variables and productions. Those behaviors lead to executing routines that rely on the expansion of production rules. For example, a variable that can be expanded in many different ways, unless there are certain conditions, will always be extended by the same production rule. Whenever is expanded a variable, and a new terminal symbol appears, a corresponding primary action for such a symbol will run. Derivation default will be leftmost derivation, which guarantees a particular order in the process that generates behaviors. 
\section[{c) Learning}]{c) Learning}\par
Reinforcement learning (RL) is the method considered in this work. With this method, the robotic agent learns to select an action from several of them possible involved in a particular state. With reinforcement learning the agent seeks to learn an optimal policy ?, which for some state s, recommend an action a that helps the agent to meet its goal. For this process is performed a mapping between the elements of the grammar of behaviors and RL. The reinforcement learning process was carried out using standard algorithms, once are identified states, actions and a control policy for a grammar of behaviors (in this case the RBG). Note that transitions, utilities, and the learning, tend to vary depending on the problem. In an RBG = \{V, ?, P, S\}, the productions of the subset PEa (member of the set P), have the form Ex ? Ai where Ex is a variable that represents an event, and belongs to the subset VEa, Ai is a variable (where i=1,2,?n) representing an action which belongs to the subgroup VAc. The purpose of the agent is to learn a policy ?:\par
S?A, such that it dictates the next action at to be executed when the agent is in a state st, ie, ?(st)=at. 
\section[{??(st)?????????=0????+??}]{??(st)?????????=0????+??}\par
(1)\par
where rt+i indicates the sequence of generated rewards, which starts at a state st as a result of using a policy ? for selecting actions. The formula \hyperref[b0]{(1)} indicates that starting in state st and then implementing the actions recommended by the policy ?, the sequence of rewards is obtained \hyperref[b12]{[13]}. The parameter ? (gamma) defined by an assignment of values between 0 and 1, is known as the discount factor, and it indicates the preference between immediate rewards on future rewards. The smaller the value of ?, future rewards will be less significant for the agent. In general, it's intended that the agent learns a policy that maximizes V ?(s) for all states s. This procedure is called optimal policy, given by ?? * ?????ð??"ð??"??????????(s), (\par
V. Development and Implementation a) Grammar for the passage of Santa Fe It will describe the design and implementation of the RBG based on the context of the problem of artificial ant in the particular instance Santa Fe Trail \hyperref[b1]{[2]}. The aim of the ant is eating all the food (cells in black), running all the way, in the shortest possible time; the stage in which the artificial ant acts is a 32x32 grid of squares (cells), as shown in Figure \hyperref[fig_2]{2}. Its considered the ant as being the agent that starts in the box at the left upper corner (0,0) facing right and has the following limitations: partially observable environment (only can see the place in which it is) and will have three basic actions:\par
- , . Using that policy to generate the most significant utility it's found one way to specify which strategy to use. An arbitrary policy ? from a random initial state st defined the cumulative value V ?(st) according to the equation: The path is irregular and consists of 89 pieces of food, which can be placed consecutively or separated by jumps. Jumps can vary but follow specific patterns, which are: jumps in a straight line, single and double; jumps corner, individual, double (how a horse moves in chess) and triples. The artificial ant (Agent) will do the corresponding derivations of the RBG after the completion of the algorithm of Figure \hyperref[fig_3]{3}. In this algorithm, the implied grammar will define the events that the agent will receive. Are defined the actions as production rules, and they are explained by a control policy which will select the step to take when an event happens.\par
The Agent can do three necessary actions, which in the grammar through the terminal symbols (f), (r), (l), could represent movement toward the front, turn right 90?, and turn left 90?, respectively. When through the derivation process a new terminal symbol has been adding to the string, the necessary action that corresponds with that terminal symbol will run. From basic movements, are formed complex actions which belong to the subset of productions PAc. When is generated an event, will be selected any of these productions (rules). In the case of agent RBG = (V, ?, P, S), its components are defined as follows:\par
V=\{VAc, VEa, VEd\} P=\{PAc, PEa, PEd, PSEev1\} b) Transitions, frequencies and utilities in the Reinforcement Learning (RL) It will treat a nondeterministic transition function in the implementation of reinforcement learning. That is, when is required to do something to a state, the result will not always be the same, i.e., it hold a probabilistic transition Pr = (s, a, s '), which means the chance of going to the state s' by acting a from the state s. This function is unknown to the agent and, to approximate such function, it will use a table of frequency (TF) defined as:S=\{[START]\} ?= \{(r), (l), (f)\} VA c =\{[ROT RIGHT], [ROT LEFT], [FORWARD]\} VE a =\{[START], [ROT 360], [WALL INFRONT], [FOOD], [NO FOOD]\} VE d =\{[EVENT]\} PA c = \{[ROT RIGHT] ? (r)[EVENT][ROT RIGHT], [ROT LEFT] ? (l)[EVENT][ROT LEFT], [FORWARD] ? (f)[EVENT][FORWARD]\} PE d = \{[EVENT] ? [START] | [ROT 360] | [WALL INFRONT] | [FOOD] | [NO FOOD]\} PE a = \{[START] ? [ROT RIGHT] | [ROT LEFT] | [FORWARD] 
\section[{, [ROT 360] ? [ROT RIGHT] | [ROT LEFT] | [FORWARD], [WALL INFRONT] ? [ROT RIGHT] |[ROT LEFT], [FOOD] ? [ROT RIGHT] | [ROT LEFT] | [FORWARD], [NO FOOD]?[ROT RIGHT] | [ROT LEFT] |}]{, [ROT 360] ? [ROT RIGHT] | [ROT LEFT] | [FORWARD], [WALL INFRONT] ? [ROT RIGHT] |[ROT LEFT], [FOOD] ? [ROT RIGHT] | [ROT LEFT] | [FORWARD], [NO FOOD]?[ROT RIGHT] | [ROT LEFT] |}[FORWARD]\} PSE ev1 = \{[ROT RIGHT] ? ?, [ROT LEFT] ? ?, 
\section[{TF [s, a, s '] = TF [s, a, s'] + 1}]{TF [s, a, s '] = TF [s, a, s'] + 1}\par
That is, for each time it's tried the pass from state s to s' using the action a, it will be adding 1 to the entry table that corresponds to such movement. Just as transitions between states occur, the utility function it presents in a non-deterministic way. Then, it's used a table of utilities (TU) to get updated as does the table of frequencies but, the difference is that it's updated TU only if the agent finds food in the new state s'. That is, TU[st, at, s't+1] ? TU[st, at, s't+1] + Ct+1 iff s't+1 contains food, otherwise TU[st, at, s't+1] ? TU[st, at, s't+1] -0.5\par
Where Ct+1 is the number of boxes with food that the agent found at time t + 1.\par
i. Q-Learning Function Since a strategy (policy) is required to show the best action for each state, a function is then used to recommend the optimal movement for that state when using frequency tables and utilities. It needs to update a Q-table using, Q[s, a] ? updateQValues(s, a), ?(state-action pair (s, a))\par
Where, updateQValues (s, a) is a call to a function in the algorithm of Figure  {\ref 4}. If it's updated the table Q, it is possible to get simply the optimal policy, which, for a state s, is given by the following expression:?? * (s) ? max??[??,??],(?(??),?(??))\par
During the execution of the algorithm, where defined values of 10 for the size of an epoch (times that it's repeated the journey), and values of 400 for the time limit permissible (necessary actions allowed) before concluding such a period.\par
The resulting policy guides the agent to find the 89 pieces of food on the Santa Fe path, and this policy it's represented by a string of integers, where each number represents the index of the optimal action for any state. For example, for a numerical policy 3 3 1 3 1 wherein, the mapping corresponding with each production rule that belonging to subset PE takes the form:[E] ? [A1] | [2] | [A3] | ? [Ax]\par
and knowing that the policy is ?*([E]) = n where n indicates the n-th optimal action to follow for such an event [E], then the resultant learned control policy (3 3 1 3 1) for the agent can be rewritten, as follows:?? * ([START]) = 3 ?? * ([ROT 360]) = 3 ?? * ([WALL INFRONT]) = 1 ?? * ([FOOD]) = 3 ?? * ([NO FOOD]) = 1 VI. 
\section[{Results and Conclusions}]{Results and Conclusions}\par
The software implemented to meet results to the issues raised in this paper can be found in ftp://ftp.cicese.mx/pub/divFA/ciencomp/briseno/ where its possible to download the software, and all the necessary information to verify the algorithmic implementation of the agent's behavior. The Santa Fe Trail problem has also been addressed based on other algorithms applicable to machine learning, such as genetic algorithms (GA). The last option, although not described in this paper, was also considered in the experimental runs for comparative purposes. It's possible to see, in Figure  {\ref 5}, that the reinforcement learning algorithm of the RBG found an effective strategy after the sixth attempt in about 13 seconds to get all the foods. The results showed that formal grammars are a possible method to represent and generate behavior of agents (robots) that interact with an environment. Besides, the techniques of machine learning, as in this case reinforcement learning, can help in the derivation process of the productions involving these grammars, so the agent can optimally meet your goal. In future work, it is considered to include grammars induction techniques to automate the capture of grammars applicable to unforeseen circumstances or in cases of dynamic environments.\begin{figure}[htbp]
\noindent\textbf{1}\includegraphics[]{image-2.png}
\caption{\label{fig_0}Figure 1 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{}\includegraphics[]{image-3.png}
\caption{\label{fig_1}Robotic}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{2}\includegraphics[]{image-4.png}
\caption{\label{fig_2}Figure 2 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{3}\includegraphics[]{image-5.png}
\caption{\label{fig_3}[Figure 3 :}\end{figure}
 \begin{figure}[htbp]
\noindent\textbf{56}\includegraphics[]{image-6.png}
\caption{\label{fig_4}Figure 5 :Figure 6 :}\end{figure}
 			\footnote{The asterisk right here indicates the possible set of relationships between variables and terminals involved.} 			\footnote{( ) D © 2018 Global Journals} 		 		\backmatter  			  				\begin{bibitemlist}{1}
\bibitem[Manikonda et al. ()]{b9}\label{b9} 	 		‘A motion description language and a hybrid architecture for motion planning with nonholonomic robots’.  		 			V Manikonda 		,  		 			P S Krishnaprasad 		,  		 			J Hendler 		.  	 	 		\textit{Proceedings, 1995 IEEE International Conference on. IEEE},  				 (1995 IEEE International Conference on. IEEE)  		1995. 1995. 2 p. .  	 
\bibitem[Gamez et al. ()]{b2}\label{b2} 	 		‘A neuronal controlled computer game avatar with humanlike behavior. Computational Intelligence and AI in Games’.  		 			D Gamez 		,  		 			Z Fountas 		,  		 			A K. ; J L Fidjeland 		,  		 			Briseño 		.  	 	 		\textit{IEEE Transactions on}  		2013. 5  (1)  p. .  	 
\bibitem[Anderson et al. ()]{b7}\label{b7} 	 		‘An integrated theory of the mind’.  		 			J R Anderson 		,  		 			D Bothell 		,  		 			M D Byrne 		,  		 			S Douglass 		,  		 			C Lebiere 		,  		 			Y Qin 		.  	 	 		\textit{Psychological review}  		2004. 111  (4)  p. 1036.  	 
\bibitem[Russell and Norvig ()]{b0}\label{b0} 	 		\textit{Artificial Intelligence: A Modern Approach},  		 			S Russell 		,  		 			P Norvig 		.  		2009. Upper Saddle River, NJ, USA: Prentice Hall Press.  	 	 (3rd ed.) 
\bibitem[Ogura et al. ()]{b6}\label{b6} 	 		‘Behavior network acquisition in multisensory space for whole-body humanoid’.  		 			T Ogura 		,  		 			K Okada 		,  		 			M Inaba 		,  		 			H Inoue 		.  	 	 		\textit{Multisensor Fusion and Integration for Intelligent Systems, MFI2003. Proceedings of IEEE International Conference on. IEEE},  				2003. p. .  	 
\bibitem[Mart?n et al. ()]{b8}\label{b8} 	 		‘Behavior-based iterative component architecture for robotic applications with the NAO humanoid’.  		 			F Mart?n 		,  		 			J M Canas 		,  		 			C Agüero 		,  		 			E Perdices 		.  	 	 		\textit{En: XI Workshop de Agentes F?sicos},  				 (Valencia (Spain)  		2010.  	 
\bibitem[Hester et al. ()]{b4}\label{b4} 	 		‘Generalized model learning for reinforcement learning on a humanoid robot’.  		 			T Hester 		,  		 			M Quinlan 		,  		 			P Stone 		.  	 	 		\textit{Robotics and Automation (ICRA), 2010 IEEE International Conference on. IEEE},  				2010. p. .  	 
\bibitem[Koza ()]{b1}\label{b1} 	 		\textit{Genetic programming: On the programming of computers by means of natural selection},  		 			J R Koza 		.  		1992. MIT Press.  	 
\bibitem[Gu and Su ()]{b5}\label{b5} 	 		‘Humanoid robot behavior learning based on art neural network and crossmodality learning’.  		 			L Gu 		,  		 			J Su 		.  	 	 		\textit{Advances in Natural Computation},  				2006. Springer. p. .  	 
\bibitem[Hopcroft and Ullman ()]{b11}\label{b11} 	 		\textit{Introduction to Automata theory, Languages, and Computation},  		 			J E Hopcroft 		,  		 			J D Ullman 		.  		1979.  	 
\bibitem[Bauckhage et al. ()]{b3}\label{b3} 	 		‘Learning human behavior from analyzing activities in virtual environments’.  		 			C Bauckhage 		,  		 			B Gorman 		,  		 			C Thurau 		,  		 			M Humphrys 		.  	 	 		\textit{MMI-Interaktiv}  		2007. 12 p. .  	 
\bibitem[Mitchell ()]{b12}\label{b12} 	 		\textit{Machine learning},  		 			T M Mitchell 		.  		1997. 1997. Burr Ridge, IL: McGraw Hill. p. 45.  	 
\bibitem[Dantam and Stillman ()]{b10}\label{b10} 	 		‘The motion grammar: Analysis of a linguistic method for robot control. Robotics’.  		 			N Dantam 		,  		 			M Stillman 		.  	 	 		\textit{IEEE Transactions on}  		2013. 29  (3)  p. .  	 
\end{bibitemlist}
 			 		 	 
\end{document}
