Skip to content

Commit a9837c2

Browse files
committed
Updated report
1 parent 795fe93 commit a9837c2

File tree

5 files changed

+53
-7
lines changed

5 files changed

+53
-7
lines changed

report/src/figures/mcts.png

60.9 KB
Loading

report/src/main.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
\addbibresource{references.bib}
1212

1313
\title{
14-
\rule{\linewidth}{1pt} \\[6pt]
14+
\rule{\linewidth}{0.5pt} \\[6pt]
1515
\huge Autonomous Software Agents \\ Project Report \\
16-
\rule{\linewidth}{1pt} \\[10pt]
16+
\rule{\linewidth}{2pt} \\[10pt]
1717
}
1818
\author{
1919
\begin{tabular}{c}
@@ -27,6 +27,7 @@
2727
\maketitle
2828

2929
\input{sections/introduction.tex}
30+
\input{sections/background.tex}
3031
\input{sections/method.tex}
3132

3233
\printbibliography

report/src/sections/background.tex

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
\section{Background}
2+
3+
Before we delve into the details of our work, we will provide a brief overview of some of the key concepts that are relevant to our work.
4+
5+
\subsection{Monte Carlo Tree Search}
6+
7+
Monte Carlo Tree Search \parencite{mcts} is a heuristic search algorithm applied to decision processes, that has been successfully used in a variety of games, such as Go and Chess. The algorithm is based on the idea of performing a guided random search that focuses on exploring the more promising moves by expanding the search tree through randomly sampling the search space instead of a brute force approach that completely visits the search space. More in details, the algorithm builds the game tree by iteratively repeating the following four steps (see Figure \ref{fig:mcts} for a visual representation):
8+
9+
\begin{enumerate}
10+
\item \textbf{Selection}: starting from the root $R$, which represent the current game state, traverse the tree until a leaf $L$ is reached. A key aspect for the proper functioning of the algorithm is being able to balance the \textit{exploitation} of already promising paths and the \textit{exploration} of children with fewer simulations. The most used formula to compute such trade-off is the UCT (Upper Confidence Bound 1 applied to Trees)
11+
\begin{align*}
12+
UCT & = \underbrace{\frac {w_{i}}{n_{i}}}_{\text{exploitation term}}+c\underbrace{{\sqrt {\frac {\ln N_{i}}{n_{i}}}}}_{\text{exploration term}}
13+
\end{align*}
14+
where
15+
\begin{itemize}
16+
\item $w_i$ is the number of wins obtained in the subtree of $i$
17+
\item $n_i$ is the number of times node $i$ has been visited
18+
\item $N_i$ is the number of time the parent of node $i$ has been visited
19+
\item $c$ is the exploration parameter, usually equal to $\sqrt{2}$
20+
\end{itemize}
21+
22+
\item \textbf{Expansion}: if $L$ isn't a terminal node (i.e. there are valid moves that can be performed starting from the game state in $L$ ) pick a node $C$ among its children that haven't been yet expanded
23+
24+
\item \textbf{Simulation}: starting from $C$, randomly choose valid moves until a terminal state is reached and the game is decided (i.e. win/loss/draw)
25+
26+
\item \textbf{Backpropagation}: the result of the simulation is used to update the statistics (number of wins and number of visits) for all nodes along the path from $C$ to $R$ that are then used to compute the UCTs for the following iterations
27+
\end{enumerate}
28+
29+
\begin{figure}
30+
\centering
31+
\includegraphics[width=\linewidth]{figures/mcts.png}
32+
\caption{MCTS example for a two player game such as chess.}
33+
\label{fig:mcts}
34+
\end{figure}

report/src/sections/method.tex

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ \section{Method}
2828

2929
Before delving into the details of the implementation, some clarifications need to be made. While for the sake of simplicity we have presented the agent conrol loop as a sequential process, in practice most of the operations are performed concurrently. Indeed, this is a paramount requirement in a highly dynamic environment such as the one of the Deliveroo game, where changings in the environment can happen even while the agent is reasoning, planning and acting. Thus, all perceptions, communications and updates are performed asynchronously and in an event-driven fashion such that updates to the belief base and the desires are performed as soon as new information is available.
3030

31+
3132
\subsection{Team Communication}
3233

3334
As stated in the introduction, not all agents in the environment are adversarial. In fact, agents may form teams and cooperate with each other to better achieve their goals. To allow the formation of teams and the exchange of information among the agents (necessary for an effective and productive cooperation), a communication protocol has been implemented.
@@ -44,6 +45,7 @@ \subsection{Team Communication}
4445

4546
As for the observations, each time an agent updates its desires, it relays the new desires to the other agents in the team. In this way, the agents in the team can coordinate their actions and not interfere with each other (e.g. by not picking up the same parcels) to better achieve their goals. Finally, each time the position of an agent changes, it relays its new position to the other agents in the team.
4647

48+
4749
\subsection{Belief base}
4850
\label{sec:belief-base}
4951

@@ -66,16 +68,25 @@ \subsection{Belief base}
6668
To assess whether an agent is randomly moving, a simple heuristic has been defined. If from the first time the agent was observed to the last time the agent was observed its observed score is below a certain threshold, the agent is considered a random agent. The threshold is defined as the expected reward a greedy agent would have obtained in the same time span. This is computed in the following way:
6769

6870
\begin{equation*}
69-
\mathbb{E}_{\text{greedy}} = \frac{\mathbb{E}_{\texttt{distance}}}{\mu_{\texttt{distance}}} \cdot \frac{\mu_{\texttt{reward}}}{\texttt{numSmartAgents}}
71+
\mathbb{E}_{\text{greedy}}[r] = \frac{\mathbb{E}[dist]}{\mu_{\texttt{dist}}} \cdot \frac{\mu_{\texttt{reward}}}{n_{\texttt{smart}}}
7072
\end{equation*}
7173

72-
where $\mathbb{E}_{\texttt{distance}}$ is the expected distance covered by the agent in the time span, $\mu_{\texttt{distance}}$ is the average distance between parcels in the map, $\mu_{\texttt{reward}}$ is the average reward of the parcels, and \texttt{numSmartAgents} is the number of agents in the environment that are not random agents.
74+
where $\mathbb{E}[dist]$ is the expected distance covered by the agent in the time span, $\mu_{\texttt{dist}}$ is the average distance between parcels in the map, $\mu_{\texttt{reward}}$ is the average reward of the parcels, and $n_{\texttt{smart}}$ is the number of agents in the environment that are not random agents.
7375

7476
Finally, note that here we do not make any assumption about the possible intentions of other agents. Indeed, modelling the behaviour of other agents is a complex and challenging task that may require learning-based approaches. Therefore, we preferred not to implement any partial model of the other agents' intentions, given that wrong assumptions about the actions of the other agents can lead to suboptimal decisions.
7577

76-
\subsection{Search}
7778

78-
This section describes the search algorithm used to update the set of desires of the agent and to select the intention to pursue.
79+
\subsection{Desires}
80+
81+
In the BDI model, the desires represent the goals that the agent wants to achieve. In the context of the Deliveroo game, at each time instant the goals of the agent are to move to a location where there are parcels or to deliver the currently held parcels (if any). Therefore, each time there is a change in the set of available parcels, the agent needs to update its desires accordingly.
82+
83+
Since the long-term objective of the agent is to maximize its reward, not all desires are equally important and worth pursuing. Therefore, it is necessary to assign them a score that should reflect their goodness for the agent's long-term goal. Hence, we deemed not sufficient to assign them a score based on their immediate reward, as this would lead the agent to be short-sighted and not to take into account the future consequences of its actions. To avoid this, we decided to implement a forward-looking scoring function based on Monte Carlo Tree Search. By using the MCTS algorithm, the score of each desire depends not only on the immediate reward, but also on the expected future reward that the agent can obtain after pursuing the desire.
84+
85+
\subsection{Selection}
86+
\label{sec:selection}
87+
88+
The selection phase is the process by which the agent selects the desire to pursue
89+
7990

8091
\subsection{Planning}
8192

@@ -89,7 +100,7 @@ \subsection{Planning}
89100

90101
\begin{figure}
91102
\centering
92-
\includegraphics[width=0.49\textwidth]{sections/figures/path-bottleneck.png}
103+
\includegraphics[width=0.49\textwidth]{figures/path-bottleneck.png}
93104
\caption{An example of path bottleneck. The tiles in yellow belong to the path bottleneck from the start position to the end tile.}
94105
\label{fig:path-bottleneck}
95106
\end{figure}

0 commit comments

Comments
 (0)