\section{Mountain\+Car Class Reference}
\label{classmlpack_1_1rl_1_1MountainCar}\index{Mountain\+Car@{Mountain\+Car}}


Implementation of Mountain Car task.  


\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class \textbf{ State}
\begin{DoxyCompactList}\small\item\em Implementation of state of Mountain Car. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ Action} \{ \newline
\textbf{ backward}, 
\newline
\textbf{ stop}, 
\newline
\textbf{ forward}, 
\newline
\textbf{ size}
 \}\begin{DoxyCompactList}\small\item\em Implementation of action of Mountain Car. \end{DoxyCompactList}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Mountain\+Car} (const double position\+Min=-\/1.\+2, const double position\+Max=0.\+6, const double position\+Goal=0.\+5, const double velocity\+Min=-\/0.\+07, const double velocity\+Max=0.\+07, const double done\+Reward=0, const size\+\_\+t max\+Steps=0)
\begin{DoxyCompactList}\small\item\em Construct a Mountain Car instance using the given constant. \end{DoxyCompactList}\item 
\textbf{ State} \textbf{ Initial\+Sample} ()
\begin{DoxyCompactList}\small\item\em Initial position is randomly generated within [-\/0.\+6, -\/0.\+4]. \end{DoxyCompactList}\item 
bool \textbf{ Is\+Terminal} (const \textbf{ State} \&state) const
\begin{DoxyCompactList}\small\item\em This function checks if the car has reached the terminal state. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Max\+Steps} () const
\begin{DoxyCompactList}\small\item\em Get the maximum number of steps allowed. \end{DoxyCompactList}\item 
size\+\_\+t \& \textbf{ Max\+Steps} ()
\begin{DoxyCompactList}\small\item\em Set the maximum number of steps allowed. \end{DoxyCompactList}\item 
double \textbf{ Sample} (const \textbf{ State} \&state, const \textbf{ Action} \&action, \textbf{ State} \&next\+State)
\begin{DoxyCompactList}\small\item\em Dynamics of Mountain Car. \end{DoxyCompactList}\item 
double \textbf{ Sample} (const \textbf{ State} \&state, const \textbf{ Action} \&action)
\begin{DoxyCompactList}\small\item\em Dynamics of Mountain Car. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Steps\+Performed} () const
\begin{DoxyCompactList}\small\item\em Get the number of steps performed. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Implementation of Mountain Car task. 

Definition at line 28 of file mountain\+\_\+car.\+hpp.



\subsection{Member Enumeration Documentation}
\mbox{\label{classmlpack_1_1rl_1_1MountainCar_a8bb1ef53467e4f61410d12822d922498}} 
\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!Action@{Action}}
\index{Action@{Action}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}
\subsubsection{Action}
{\footnotesize\ttfamily enum \textbf{ Action}}



Implementation of action of Mountain Car. 

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{backward@{backward}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!backward@{backward}}}\mbox{\label{classmlpack_1_1rl_1_1MountainCar_a8bb1ef53467e4f61410d12822d922498ab3d7481243d86f5bf31d617c7ba70220}} 
backward&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{stop@{stop}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!stop@{stop}}}\mbox{\label{classmlpack_1_1rl_1_1MountainCar_a8bb1ef53467e4f61410d12822d922498ad82a4ca4dc1f04bf9453ad19f9341028}} 
stop&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{forward@{forward}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!forward@{forward}}}\mbox{\label{classmlpack_1_1rl_1_1MountainCar_a8bb1ef53467e4f61410d12822d922498a726a0af5164861adac8c015a742dcf21}} 
forward&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{size@{size}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!size@{size}}}\mbox{\label{classmlpack_1_1rl_1_1MountainCar_a8bb1ef53467e4f61410d12822d922498a052a2b4924452fb4a73f2cb52b6e9d41}} 
size&Track the size of the action space. \\
\hline

\end{DoxyEnumFields}


Definition at line 79 of file mountain\+\_\+car.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1rl_1_1MountainCar_a16b12fc6a1449e80664325a2d6f358bb}} 
\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!Mountain\+Car@{Mountain\+Car}}
\index{Mountain\+Car@{Mountain\+Car}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}
\subsubsection{Mountain\+Car()}
{\footnotesize\ttfamily \textbf{ Mountain\+Car} (\begin{DoxyParamCaption}\item[{const double}]{position\+Min = {\ttfamily -\/1.2},  }\item[{const double}]{position\+Max = {\ttfamily 0.6},  }\item[{const double}]{position\+Goal = {\ttfamily 0.5},  }\item[{const double}]{velocity\+Min = {\ttfamily -\/0.07},  }\item[{const double}]{velocity\+Max = {\ttfamily 0.07},  }\item[{const double}]{done\+Reward = {\ttfamily 0},  }\item[{const size\+\_\+t}]{max\+Steps = {\ttfamily 0} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Construct a Mountain Car instance using the given constant. 


\begin{DoxyParams}{Parameters}
{\em position\+Min} & Minimum legal position. \\
\hline
{\em position\+Max} & Maximum legal position. \\
\hline
{\em position\+Goal} & Final target position. \\
\hline
{\em velocity\+Min} & Minimum legal velocity. \\
\hline
{\em velocity\+Max} & Maximum legal velocity. \\
\hline
{\em done\+Reward} & The reward recieved by the agent on success. \\
\hline
{\em max\+Steps} & The number of steps after which the episode terminates. If the value is 0, there is no limit. \\
\hline
\end{DoxyParams}


Definition at line 101 of file mountain\+\_\+car.\+hpp.



\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1rl_1_1MountainCar_aa9f537249fa0c1e62b38197996ab4c6a}} 
\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!Initial\+Sample@{Initial\+Sample}}
\index{Initial\+Sample@{Initial\+Sample}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}
\subsubsection{Initial\+Sample()}
{\footnotesize\ttfamily \textbf{ State} Initial\+Sample (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Initial position is randomly generated within [-\/0.\+6, -\/0.\+4]. 

Initial velocity is 0.

\begin{DoxyReturn}{Returns}
Initial state for each episode. 
\end{DoxyReturn}


Definition at line 181 of file mountain\+\_\+car.\+hpp.



References Mountain\+Car\+::\+State\+::\+Position(), and Mountain\+Car\+::\+State\+::\+Velocity().

\mbox{\label{classmlpack_1_1rl_1_1MountainCar_a7fd056133dfd315e4bf45c408f99326f}} 
\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!Is\+Terminal@{Is\+Terminal}}
\index{Is\+Terminal@{Is\+Terminal}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}
\subsubsection{Is\+Terminal()}
{\footnotesize\ttfamily bool Is\+Terminal (\begin{DoxyParamCaption}\item[{const \textbf{ State} \&}]{state }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



This function checks if the car has reached the terminal state. 


\begin{DoxyParams}{Parameters}
{\em state} & desired state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if state is a terminal state, otherwise false. 
\end{DoxyReturn}


Definition at line 196 of file mountain\+\_\+car.\+hpp.



References Log\+::\+Info, and Mountain\+Car\+::\+State\+::\+Position().



Referenced by Mountain\+Car\+::\+Sample().

\mbox{\label{classmlpack_1_1rl_1_1MountainCar_ad8fd6d8f7581c82e73556491b79a8907}} 
\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!Max\+Steps@{Max\+Steps}}
\index{Max\+Steps@{Max\+Steps}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}
\subsubsection{Max\+Steps()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily size\+\_\+t Max\+Steps (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the maximum number of steps allowed. 



Definition at line 216 of file mountain\+\_\+car.\+hpp.

\mbox{\label{classmlpack_1_1rl_1_1MountainCar_a64c84cebc489c6fdfd7f057e127b0aef}} 
\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!Max\+Steps@{Max\+Steps}}
\index{Max\+Steps@{Max\+Steps}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}
\subsubsection{Max\+Steps()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily size\+\_\+t\& Max\+Steps (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set the maximum number of steps allowed. 



Definition at line 218 of file mountain\+\_\+car.\+hpp.

\mbox{\label{classmlpack_1_1rl_1_1MountainCar_a311ac19edc537dee94f37b7cce93d908}} 
\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!Sample@{Sample}}
\index{Sample@{Sample}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}
\subsubsection{Sample()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily double Sample (\begin{DoxyParamCaption}\item[{const \textbf{ State} \&}]{state,  }\item[{const \textbf{ Action} \&}]{action,  }\item[{\textbf{ State} \&}]{next\+State }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Dynamics of Mountain Car. 

Get reward and next state based on current state and current action.


\begin{DoxyParams}{Parameters}
{\em state} & The current state. \\
\hline
{\em action} & The current action. \\
\hline
{\em next\+State} & The next state. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
reward, it\textquotesingle{}s always -\/1.\+0. 
\end{DoxyReturn}


Definition at line 127 of file mountain\+\_\+car.\+hpp.



References mlpack\+::math\+::\+Clamp\+Range(), Mountain\+Car\+::\+Is\+Terminal(), Mountain\+Car\+::\+State\+::\+Position(), and Mountain\+Car\+::\+State\+::\+Velocity().



Referenced by Mountain\+Car\+::\+Sample().

\mbox{\label{classmlpack_1_1rl_1_1MountainCar_af2bb860eaefeaa62a40f5cf940793704}} 
\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!Sample@{Sample}}
\index{Sample@{Sample}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}
\subsubsection{Sample()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily double Sample (\begin{DoxyParamCaption}\item[{const \textbf{ State} \&}]{state,  }\item[{const \textbf{ Action} \&}]{action }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Dynamics of Mountain Car. 

Get reward based on current state and current action.


\begin{DoxyParams}{Parameters}
{\em state} & The current state. \\
\hline
{\em action} & The current action. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
reward, it\textquotesingle{}s always -\/1.\+0. 
\end{DoxyReturn}


Definition at line 169 of file mountain\+\_\+car.\+hpp.



References Mountain\+Car\+::\+Sample().

\mbox{\label{classmlpack_1_1rl_1_1MountainCar_a5fe06563064ebcee88c593e1673f03d4}} 
\index{mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}!Steps\+Performed@{Steps\+Performed}}
\index{Steps\+Performed@{Steps\+Performed}!mlpack\+::rl\+::\+Mountain\+Car@{mlpack\+::rl\+::\+Mountain\+Car}}
\subsubsection{Steps\+Performed()}
{\footnotesize\ttfamily size\+\_\+t Steps\+Performed (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the number of steps performed. 



Definition at line 213 of file mountain\+\_\+car.\+hpp.



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/var/www/mlpack.\+ratml.\+org/mlpack.\+org/\+\_\+src/mlpack-\/3.\+3.\+1/src/mlpack/methods/reinforcement\+\_\+learning/environment/\textbf{ mountain\+\_\+car.\+hpp}\end{DoxyCompactItemize}
