Commit 77b8b2b8 authored by Matthew Hausknecht's avatar Matthew Hausknecht

Updated high level state representation to include ball features.

parent a953144b
No preview for this file type
...@@ -29,14 +29,21 @@ by Barrett et al. pp. 159-160 \cite{THESIS14-Barrett}. Barrett writes ...@@ -29,14 +29,21 @@ by Barrett et al. pp. 159-160 \cite{THESIS14-Barrett}. Barrett writes
``There are many ways to represent the state of a game of half field ``There are many ways to represent the state of a game of half field
offense. Ideally, we want a compact representation that allows the offense. Ideally, we want a compact representation that allows the
agent to learn quickly by generalizing its knowledge about a state to agent to learn quickly by generalizing its knowledge about a state to
similar states without over-constraining the policy.'' The following similar states without over-constraining the policy.'' All features
features are used: are encoded a floating point values and normalized to the range of
[-1,1]. Invalid features are given a value of -2. The features are as
follows:
\subsubsection{High Level State Feature List} \subsubsection{High Level State Feature List}
\begin{itemize} \begin{itemize}
\item{\textbf{X position} - The agent’s x position on the field.} \item{\textbf{X position} - The agent’s x position on the field.}
\item{\textbf{Y position} - The agent’s y position on the field.} \item{\textbf{Y position} - The agent’s y position on the field.}
\item{\textbf{Orientation} - The direction that the agent is facing.} \item{\textbf{Orientation} - The direction that the agent is facing.}
\item{\textbf{Ball Distance} - Distance to the ball.}
\item{\textbf{Ball Angle} - Angle to the ball.}
\item{\textbf{Able to Kick} - Boolean indicating if the agent can kick the ball.}
\item{\textbf{Goal Center Distance} - Distance from the agent to the center of the goal.}
\item{\textbf{Goal Center Angle} - Angle from the agent to the center of the goal.}
\item{\textbf{Goal opening angle} - The size of the largest open angle \item{\textbf{Goal opening angle} - The size of the largest open angle
of the agent to the goal, shown as $\theta_g$ in Figure of the agent to the goal, shown as $\theta_g$ in Figure
\ref{fig:openAngle}.} \ref{fig:openAngle}.}
...@@ -45,12 +52,15 @@ features are used: ...@@ -45,12 +52,15 @@ features are used:
\item{\textbf{Distance to Opponent} - If an opponent is present, \item{\textbf{Distance to Opponent} - If an opponent is present,
distance to the closest opponent. This feature is absent if there distance to the closest opponent. This feature is absent if there
are no opponents.} are no opponents.}
\item{\textbf{Distance from teammate i to opponent} - For each teammate \item{\textbf{Distance from teammate i to opponent} - For each
i: the distance from the teammate to the closest opponent. This teammate i: the distance from the teammate to the closest
feature is absent if there are no opponents.} opponent. This feature is absent if there are no opponents. If
teammates are present but not detected, this feature is considered
invalid and given the value of -2.}
\item{\textbf{Pass opening angle i} - For each teammate i: the open \item{\textbf{Pass opening angle i} - For each teammate i: the open
angle available to pass to teammate i. Shown as $\theta_p$ in Figure angle available to pass to teammate i. Shown as $\theta_p$ in Figure
\ref{fig:openAngle}.} \ref{fig:openAngle}. If teammates are present but not detected, this
feature is considered invalid and given the value of -2.}
\end{itemize} \end{itemize}
\begin{figure}[htp] \begin{figure}[htp]
......
File mode changed from 100644 to 100755
...@@ -37,14 +37,30 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures( ...@@ -37,14 +37,30 @@ const std::vector<float>& HighLevelFeatureExtractor::ExtractFeatures(
const PlayerCont& teammates = wm.teammates(); const PlayerCont& teammates = wm.teammates();
float maxR = sqrtf(SP.pitchHalfLength() * SP.pitchHalfLength() float maxR = sqrtf(SP.pitchHalfLength() * SP.pitchHalfLength()
+ SP.pitchHalfWidth() * SP.pitchHalfWidth()); + SP.pitchHalfWidth() * SP.pitchHalfWidth());
Vector2D goalCenter(SP.pitchHalfLength(), 0);
// features about self pos // features about self pos
// Allow the agent to go 10% over the playfield in any direction
float tolerance_x = .1 * SP.pitchHalfLength();
float tolerance_y = .1 * SP.pitchHalfWidth();
addNormFeature(self_pos.x, -tolerance_x, SP.pitchHalfLength() + tolerance_x);
addNormFeature(self_pos.y, -SP.pitchHalfWidth() - tolerance_y,
SP.pitchHalfWidth() + tolerance_y);
addNormFeature(self_ang, -2*M_PI, 2*M_PI);
float r; float r;
float th; float th;
angleDistToPoint(self_pos, goalCenter, th, r); // features about the ball
Vector2D ball_pos = wm.ball().pos();
angleDistToPoint(self_pos, ball_pos, th, r);
addNormFeature(r, 0, maxR); addNormFeature(r, 0, maxR);
addNormFeature(th, -2*M_PI, 2*M_PI); addNormFeature(th, -2*M_PI, 2*M_PI);
addNormFeature(self_ang, -2*M_PI, 2*M_PI); addNormFeature(self.isKickable(), false, true);
// features about distance to goal center
Vector2D goalCenter(SP.pitchHalfLength(), 0);
angleDistToPoint(self_pos, goalCenter, th, r);
addNormFeature(r, 0, maxR); // Distance to goal center
addNormFeature(th, -2*M_PI, 2*M_PI); // Ang to goal center
// features about our open angle to goal // features about our open angle to goal
addNormFeature(calcLargestGoalAngle(wm, self_pos), 0, M_PI); addNormFeature(calcLargestGoalAngle(wm, self_pos), 0, M_PI);
//std::cout << "goal angle: " << RAD_T_DEG * features[ind-1] << std::endl; //std::cout << "goal angle: " << RAD_T_DEG * features[ind-1] << std::endl;
......
...@@ -22,7 +22,7 @@ public: ...@@ -22,7 +22,7 @@ public:
protected: protected:
// Number of features for non-player objects. // Number of features for non-player objects.
const static int num_basic_features = 4; const static int num_basic_features = 9;
// Number of features for each player or opponent in game. // Number of features for each player or opponent in game.
const static int features_per_teammate = 4; const static int features_per_teammate = 4;
int numTeammates; // Number of teammates in HFO int numTeammates; // Number of teammates in HFO
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment